From 7b5ded406489a8ee078acdb7dcd4afafe4f96f8b Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Thu, 27 Apr 2023 00:35:26 +0530 Subject: refactor(build): commonize Lint config --- .../app/passwordstore/gradle/AndroidCommon.kt | 9 +----- .../kotlin/app/passwordstore/gradle/LintConfig.kt | 33 ++++++++++++++++++++++ 2 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 build-logic/src/main/kotlin/app/passwordstore/gradle/LintConfig.kt (limited to 'build-logic') 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()?.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") + } +} -- cgit v1.2.3