-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Add Detekt static analysis #7209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
a64e858
928eac7
ffdc923
02ab916
395b532
715ec52
76c13f1
d06ff1d
80f4021
0346ad3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| import dev.detekt.gradle.Detekt | ||
| import org.jlleitschuh.gradle.ktlint.reporter.ReporterType | ||
|
|
||
| val kotlinVersion = libs.versions.kotlin.get() | ||
|
|
||
| plugins { | ||
| alias(libs.plugins.detekt) | ||
| alias(libs.plugins.ktlint) | ||
|
|
||
| alias(libs.plugins.aboutlibraries).apply(false) | ||
|
|
@@ -20,8 +22,11 @@ plugins { | |
| } | ||
|
|
||
| allprojects { | ||
| apply(plugin = rootProject.libs.plugins.detekt.get().pluginId) | ||
| apply(plugin = rootProject.libs.plugins.ktlint.get().pluginId) | ||
|
|
||
| val detektBaselineName = if (path == ":") "root" else path.removePrefix(":").replace(':', '-') | ||
|
jpelgrom marked this conversation as resolved.
Outdated
|
||
|
|
||
| // TODO this has been added until https://youtrack.jetbrains.com/issue/KT-87220/Kotlin-Gradle-plugin-resolves-kotlinAbiValidationCompatClasspath-to-newer-beta-Kotlin-artifacts-during-dependency-locking is addressed | ||
| configurations.matching { it.name == "kotlinAbiValidationCompatClasspath" }.configureEach { | ||
| resolutionStrategy.eachDependency { | ||
|
|
@@ -54,6 +59,17 @@ allprojects { | |
| } | ||
| } | ||
|
|
||
| detekt { | ||
| baseline = rootProject.file("config/detekt/baseline-$detektBaselineName.xml") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the initial PR I did I added basic rule file https://github.com/home-assistant/android/pull/5312/changes#diff-ea29de1180303564fca0c4eddb30f7da4b596754f2c139fc252ae290e3d201e2 to match Ktlint line length constraint. Having the file is important to override some rules that we don't want to apply to the project and I think setting up this file should be part of this PR.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After comparing the actual findings with ktlint and current project conventions, the shared configuration now disables |
||
| } | ||
|
|
||
| tasks.withType<Detekt>().configureEach { | ||
| reports { | ||
| html.required.set(true) | ||
| sarif.required.set(true) | ||
| } | ||
| } | ||
|
|
||
| dependencyLocking { | ||
| lockAllConfigurations() | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.