aboutsummaryrefslogtreecommitdiffstats
path: root/build-logic/src/main/kotlin/app/passwordstore/gradle/LintConfig.kt
blob: d6c58a7a52b0da916d7a87e13e2adf798be11423 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package app.passwordstore.gradle

import com.android.build.api.dsl.Lint
import org.gradle.api.Project

object LintConfig {
  fun Lint.configureLint(project: Project, isJVM: Boolean = false) {
    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 += "AndroidGradlePluginVersion"
    disable += "GradleDependency"
    disable += "NewerVersionAvailable"
    // Noisy
    disable += "SyntheticAccessor"
    // Noisy, not particularly actionable
    disable += "TypographyQuotes"
    // False-positives abound due to use of ViewBinding
    disable += "UnusedIds"
    // False-positive, not relevant on the API levels we support
    disable += "TrulyRandom"
    if (!isJVM) {
      // Enable compose-lint-checks' Material 2 detector
      enable += "ComposeM2Api"
      error += "ComposeM2Api"
      // slack-lint-checks' checker for deprecations is useless to me
      disable += "DeprecatedCall"
      // Hilt only does field injection for fragments
      disable += "FragmentFieldInjection"
      // Too pedantic
      disable += "ArgInFormattedQuantityStringRes"
      // Biometric strings are temporarily unused due to issue 2802
      disable += "UnusedResources"
    }
    baseline = project.file("lint-baseline.xml")
  }
}