refactor(build): commonize Lint config

This commit is contained in:
Harsh Shandilya 2023-04-27 00:35:26 +05:30
parent 12714afab7
commit 7b5ded4064
No known key found for this signature in database
2 changed files with 34 additions and 8 deletions

View file

@ -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")
}

View file

@ -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")
}
}