{"id":13427906,"url":"https://github.com/detekt/detekt","last_synced_at":"2025-05-14T08:05:19.945Z","repository":{"id":36973385,"uuid":"71729669","full_name":"detekt/detekt","owner":"detekt","description":"Static code analysis for Kotlin","archived":false,"fork":false,"pushed_at":"2025-05-07T03:29:22.000Z","size":155590,"stargazers_count":6488,"open_issues_count":213,"forks_count":796,"subscribers_count":60,"default_branch":"main","last_synced_at":"2025-05-07T07:19:10.981Z","etag":null,"topics":["analysis","code-quality","codesmells","gradle-plugin","hacktoberfest","kotlin","lint","linter","static","static-analysis"],"latest_commit_sha":null,"homepage":"https://detekt.dev","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/detekt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"detekt"}},"created_at":"2016-10-23T21:04:45.000Z","updated_at":"2025-05-07T03:29:25.000Z","dependencies_parsed_at":"2023-01-17T10:16:09.081Z","dependency_job_id":"e7063393-3e5b-42ea-9702-0cf35fdf9047","html_url":"https://github.com/detekt/detekt","commit_stats":{"total_commits":6089,"total_committers":303,"mean_commits":"20.095709570957094","dds":0.7935621612744292,"last_synced_commit":"f3b0ade67ea7ee318f2277fe7022f0ec8e66e783"},"previous_names":["arturbosch/detekt"],"tags_count":129,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/detekt%2Fdetekt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/detekt%2Fdetekt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/detekt%2Fdetekt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/detekt%2Fdetekt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/detekt","download_url":"https://codeload.github.com/detekt/detekt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253618924,"owners_count":21937073,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analysis","code-quality","codesmells","gradle-plugin","hacktoberfest","kotlin","lint","linter","static","static-analysis"],"created_at":"2024-07-31T01:00:42.294Z","updated_at":"2025-05-14T08:05:19.924Z","avatar_url":"https://github.com/detekt.png","language":"Kotlin","funding_links":["https://github.com/sponsors/detekt"],"categories":["Libraries","Kotlin","Android","Linters and Static Code Analysis","静态分析","Recently Updated","code-quality","Tools","必备开发库"],"sub_categories":["Android view libraries","[Jul 27, 2025](/content/2025/07/27/README.md)","Static Analysis Tools","Kotlin 基础"],"readme":"# detekt\n\n[![Join the chat at #detekt on KotlinLang](https://img.shields.io/badge/%23detekt-on_slack-red.svg?logo=slack)](https://kotlinlang.slack.com/archives/C88E12QH4)\n[![Visit the website at detekt.dev/](https://img.shields.io/badge/visit-website-red.svg?logo=firefox)](https://detekt.dev/)\n[![Maven Central](https://img.shields.io/maven-central/v/io.gitlab.arturbosch.detekt/detekt-cli?label=MavenCentral\u0026logo=apache-maven)](https://search.maven.org/artifact/io.gitlab.arturbosch.detekt/detekt-cli)\n[![Gradle Plugin](https://img.shields.io/maven-central/v/io.gitlab.arturbosch.detekt/detekt-gradle-plugin?label=Gradle\u0026logo=gradle)](https://plugins.gradle.org/plugin/io.gitlab.arturbosch.detekt)\n[![Revved up by Develocity](https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle\u0026labelColor=02303A)](https://ge.detekt.dev/scans)\n[![License](https://img.shields.io/github/license/detekt/detekt.svg)](LICENSE)\n\n![Pre Merge Checks](https://github.com/detekt/detekt/workflows/Pre%20Merge%20Checks/badge.svg?branch=main)\n[![Codecov](https://codecov.io/gh/detekt/detekt/branch/main/graph/badge.svg)](https://codecov.io/gh/detekt/detekt)\n[![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin)\n[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B25591%2Fgithub.com%2Fdetekt%2Fdetekt.svg?type=small)](https://app.fossa.com/projects/custom%2B25591%2Fgithub.com%2Fdetekt%2Fdetekt?ref=badge_small)\n\nMeet _detekt_, a static code analysis tool for the [_Kotlin_ programming language](https://kotlinlang.org/).\nVisit [the project website](https://detekt.dev/) for installation guides, rule descriptions, configuration options and more.\n\n![detekt in action](website/static/img/tutorial/detekt_in_action.png \"detekt in action\")\n\n### Features\n\n- Code smell analysis for your [Kotlin](https://kotlinlang.org/) projects.\n- Highly configurable rule sets.\n- Generate baselines to suppress existing issues for legacy projects while making sure no new issues are introduced.\n- Suppress issues in source files using `@Suppress` annotations.\n- Support for different report formats: HTML, Markdown, [SARIF](https://sarifweb.azurewebsites.net/), XML (Checkstyle) and custom reports.\n- [Extend detekt](https://detekt.dev/docs/introduction/extensions) with custom rule sets and reports.\n- Complexity reports based on lines of code, cyclomatic complexity and number of code smells.\n- First party integration with Gradle with our [Gradle plugin](#with-gradle).\n- A community of [third party plugins](https://github.com/topics/detekt-plugin) that adds more rules and features to detekt.\n\n#### Quick-Links\n\n- [Changelog and migration guides](https://detekt.dev/changelog.html)\n- [Available CLI options](https://detekt.dev/cli.html)\n- [Rule set and rule descriptions](https://detekt.dev/complexity.html)\n- [Writing custom rules and extending detekt](https://detekt.dev/docs/introduction/extensions/)\n- [Suppressing issues in code](https://detekt.dev/suppressing-rules.html)\n- [Suppressing issues via baseline file](https://detekt.dev/baseline.html)\n- [Configuring detekt](https://detekt.dev/configurations.html)\n- Sample Gradle integrations examples:\n    - [multi project (Kotlin DSL)](https://github.com/detekt/detekt/blob/main/build.gradle.kts)\n    - [single project (Groovy DSL)](https://github.com/arturbosch/kutils/blob/master/build.gradle)\n    - [single project (Unofficial Maven plugin)](https://github.com/detekt/sonar-kotlin/blob/main/pom.xml)\n\n### Quick Start ...\n\n#### with the command-line interface\n\n```sh\ncurl -sSLO https://github.com/detekt/detekt/releases/download/v[version]/detekt-cli-[version]-all.jar\njava -jar detekt-cli-[version]-all.jar --help\n```\n\nYou can find [other ways to install detekt here](https://detekt.dev/cli.html)\n\n#### with Gradle\n\n```kotlin\nplugins {\n    id(\"io.gitlab.arturbosch.detekt\") version \"[version]\"\n}\n\nrepositories {\n    mavenCentral()\n}\n\ndetekt {\n    buildUponDefaultConfig = true // preconfigure defaults\n    allRules = false // activate all available (even unstable) rules.\n    config.setFrom(\"$projectDir/config/detekt.yml\") // point to your custom config defining rules to run, overwriting default behavior\n    baseline = file(\"$projectDir/config/baseline.xml\") // a way of suppressing issues before introducing detekt\n}\n\ntasks.withType\u003cDetekt\u003e().configureEach {\n    reports {\n        html.required.set(true) // observe findings in your browser with structure and code snippets\n        xml.required.set(true) // checkstyle like format mainly for integrations like Jenkins\n        sarif.required.set(true) // standardized SARIF format (https://sarifweb.azurewebsites.net/) to support integrations with GitHub Code Scanning\n        md.required.set(true) // simple Markdown format\n    }\n}\n\n// Groovy DSL\ntasks.withType(Detekt).configureEach {\n    jvmTarget = \"1.8\"\n}\ntasks.withType(DetektCreateBaselineTask).configureEach {\n    jvmTarget = \"1.8\"\n}\n\n// or\n\n// Kotlin DSL\ntasks.withType\u003cDetekt\u003e().configureEach {\n    jvmTarget = \"1.8\"\n}\ntasks.withType\u003cDetektCreateBaselineTask\u003e().configureEach {\n    jvmTarget = \"1.8\"\n}\n```\n\nSee [maven central](https://search.maven.org/artifact/io.gitlab.arturbosch.detekt/detekt-cli) for releases and [sonatype](https://oss.sonatype.org/#view-repositories;snapshots~browsestorage~io/gitlab/arturbosch/detekt) for snapshots.\n\nIf you want to use a SNAPSHOT version, you can find more info on [this documentation page](https://detekt.dev/snapshots.html).\n\n#### Requirements\n\nGradle 6.8.3+ is the minimum requirement. However, the recommended versions together with the other tools recommended versions are:\n\n| Detekt Version | Gradle   | Kotlin   | AGP     | Java Target Level | JDK Max Version |\n|----------------|----------|----------|---------|-------------------|-----------------|\n| `1.23.8`       | `8.12.1` | `2.0.21` | `8.8.1` | `1.8`             | `21`            |\n\nThe list of [recommended versions for previous detekt version is listed here](https://detekt.dev/compatibility.html).\n\n### Adding more rule sets\n\ndetekt itself provides a wrapper over [ktlint](https://github.com/pinterest/ktlint) as the `formatting` rule set\nwhich can be easily added to the Gradle configuration:\n\n```kotlin\ndependencies {\n    detektPlugins(\"io.gitlab.arturbosch.detekt:detekt-formatting:[version]\")\n}\n```\n\nSimilarly, there are extra rule sets available for detekt from detekt:\n```kotlin\ndependencies {\n    detektPlugins(\"io.gitlab.arturbosch.detekt:detekt-rules-libraries:[version]\")\n    detektPlugins(\"io.gitlab.arturbosch.detekt:detekt-rules-ruleauthors:[version]\")\n}\n```\nFor more info visit the [Detekt Marketplace](https://detekt.dev/marketplace).\n\nLikewise custom [extensions](https://detekt.dev/docs/introduction/extensions/) can be added to detekt.\n\n### Contributing\n\nSee [CONTRIBUTING](.github/CONTRIBUTING.md)\n\nThanks to all the people who contributed to detekt!\n\n[![Profile images of all the contributors](https://contrib.rocks/image?repo=detekt/detekt)](https://github.com/detekt/detekt/graphs/contributors)\n\n### Mentions\n\n[![androidweekly](https://img.shields.io/badge/androidweekly.net-259-orange.svg?style=flat-square)](http://androidweekly.net/issues/issue-259)\n[![androidweekly](https://img.shields.io/badge/androidweekly.cn-154-orange.svg?style=flat-square)](http://androidweekly.cn/android-dev-wekly-issue-154/)\n\nAs mentioned in...\n\n- [To Detekt 2.0, and beyond!](https://www.youtube.com/watch?v=6EQd_SDR6n0)\n- [droidcon London 2021 - Detekt - State of the Union](https://www.droidcon.com/2021/11/17/detekt-state-of-the-union-2/)\n- [KotlinConf 2018 - Safe(r) Kotlin Code - Static Analysis Tools for Kotlin by Marvin Ramin](https://www.youtube.com/watch?v=yjhQiP0329M)\n- [droidcon NYC 2018 - Static Code Analysis For Kotlin](https://www.youtube.com/watch?v=LT6m5_LO2DQ)\n- Kotlin on Code Quality Tools - by @vanniktech [Slides](https://docs.google.com/presentation/d/1sUoQCRHTR01JfaS67Qkd7K1rdRLOhO6QGCelZZwxOKs/edit) [Presentation](https://www.youtube.com/watch?v=FKDNE6PPTTE)\n- [Integrating detekt in the Workflow](https://www.raywenderlich.com/24470020-integrating-detekt-in-the-workflow)\n- [Check the quality of Kotlin code](https://blog.frankel.ch/check-quality-kotlin-code/)\n- [Kotlin Static Analysis Tools](http://smyachenkov.com/posts/kotlin-static-analysis-tools/)\n- [Are you still smelling it?: A comparative study between Java and Kotlin language](https://doi.org/10.1145/3267183.3267186) by [Flauzino et al.](https://github.com/matheusflauzino/smells-experiment-Kotlin-and-Java)\n- [Preventing software antipatterns with Detekt](https://galler.dev/preventing-software-antipatterns-with-detekt/)\n\nIntegrations:\n\n- [IntelliJ integration](https://github.com/detekt/detekt-intellij-plugin)\n- [SonarQube integration](https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/importing-external-issues/external-analyzer-reports/)\n- [TCA(Tencent CodeAnalysis) integration](https://github.com/Tencent/CodeAnalysis/blob/main/client/tool/detekt.py)\n- [Codacy](https://www.codacy.com)\n- [Gradle plugin that configures Error Prone, Checkstyle, PMD, CPD, Lint, Detekt \u0026 Ktlint](https://github.com/vanniktech/gradle-code-quality-tools-plugin)\n- [Violations Lib](https://github.com/tomasbjerre/violations-lib) is a Java library for parsing report files like static code analysis.\n- [sputnik](https://github.com/TouK/sputnik) is a free tool for static code review and provides support for detekt\n- [Detekt Maven plugin](https://github.com/Ozsie/detekt-maven-plugin) that wraps the Detekt CLI\n- [Detekt Bazel plugin](https://github.com/buildfoundation/bazel_rules_detekt) that wraps the Detekt CLI\n- [Gradle plugin that helps facilitate GitHub PR checking and automatic commenting of violations](https://github.com/btkelly/gnag)\n- [Codefactor](http://codefactor.io/)\n- [GitHub Action: Detekt All](https://github.com/marketplace/actions/detekt-all)\n- [GitHub Action: Setup detekt](https://github.com/marketplace/actions/setup-detekt)\n\nCustom rules and reports from 3rd parties can be found on our [**Detekt Marketplace**](https://detekt.dev/marketplace).\n\n#### Credits\n\n- [JetBrains](https://github.com/jetbrains/) - Creating IntelliJ + Kotlin\n- [PMD](https://github.com/pmd/pmd) \u0026 [Checkstyle](https://github.com/checkstyle/checkstyle) \u0026 [ktlint](https://github.com/pinterest/ktlint) - Ideas for threshold values and style rules\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdetekt%2Fdetekt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdetekt%2Fdetekt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdetekt%2Fdetekt/lists"}