diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2023-04-27 00:35:26 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2023-04-27 01:34:35 +0530 |
commit | 7b5ded406489a8ee078acdb7dcd4afafe4f96f8b (patch) | |
tree | 572941de539915d0d1d889c7b6bf4d943ee0f62e /build-logic | |
parent | 12714afab752876efc3f3f96d910ece246030280 (diff) |
refactor(build): commonize Lint config
Diffstat (limited to 'build-logic')
-rw-r--r-- | build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt | 9 | ||||
-rw-r--r-- | build-logic/src/main/kotlin/app/passwordstore/gradle/LintConfig.kt | 33 |
2 files changed, 34 insertions, 8 deletions
diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt index ca324ccf..04a2dc7a 100644 --- a/build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt +++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt @@ -1,9 +1,9 @@ package app.passwordstore.gradle +import app.passwordstore.gradle.LintConfig.configureLint import app.passwordstore.gradle.flavors.configureSlimTests import com.android.build.api.dsl.ApplicationExtension import com.android.build.api.dsl.LibraryExtension -import com.android.build.api.dsl.Lint import com.android.build.gradle.TestedExtension import org.gradle.api.JavaVersion import org.gradle.api.Project @@ -58,10 +58,3 @@ object AndroidCommon { project.extensions.findByType<LibraryExtension>()?.run { lint.configureLint(project) } } } - -private fun Lint.configureLint(project: Project) { - abortOnError = false - checkReleaseBuilds = false - warningsAsErrors = false - baseline = project.file("lint-baseline.xml") -} diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/LintConfig.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/LintConfig.kt new file mode 100644 index 00000000..41bb781f --- /dev/null +++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/LintConfig.kt @@ -0,0 +1,33 @@ +package app.passwordstore.gradle + +import com.android.build.api.dsl.Lint +import org.gradle.api.Project + +object LintConfig { + fun Lint.configureLint(project: Project) { + quiet = project.providers.environmentVariable("CI").isPresent + abortOnError = true + checkReleaseBuilds = true + warningsAsErrors = true + ignoreWarnings = false + checkAllWarnings = true + noLines = false + showAll = true + explainIssues = true + textReport = false + xmlReport = false + htmlReport = true + sarifReport = true + // Noisy, not particularly actionable + disable += "DuplicateStrings" + // We deal with dependency upgrades separately + disable += "NewerVersionAvailable" + // Noisy + disable += "SyntheticAccessor" + // Noisy, not particularly actionable + disable += "TypographyQuotes" + // False-positives abound due to use of ViewBinding + disable += "UnusedIds" + baseline = project.file("lint-baseline.xml") + } +} |