From 934629d829f29a636d9fc66bffc5f94ff394da0c Mon Sep 17 00:00:00 2001 From: FooIbar <118464521+FooIbar@users.noreply.github.com> Date: Sun, 15 Oct 2023 17:16:50 +0800 Subject: [PATCH] Add lint check for marshmallow (#58) * Add lint check for marshmallow * Treat some warnings as errors * Fix attribute unused on older versions --- .github/workflows/ci.yml | 3 + app/build.gradle.kts | 5 + app/lint-baseline.xml | 147 ++++++++++++++++++ .../main/res/{xml => xml-v25}/shortcuts.xml | 0 4 files changed, 155 insertions(+) create mode 100644 app/lint-baseline.xml rename app/src/main/res/{xml => xml-v25}/shortcuts.xml (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c433a636..0ce261d38 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,9 @@ jobs: - name: Spotless Check run: ./gradlew spotlessCheck + - name: Lint Check + run: ./gradlew lintMarshmallowRelease + - name: CMake Cache uses: actions/cache@v3 with: diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 224f3003e..c6a0a353a 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -105,6 +105,11 @@ android { compileOptions { isCoreLibraryDesugaringEnabled = true } + lint { + baseline = file("lint-baseline.xml") + checkOnly += setOf("InlinedApi", "NewApi", "UnusedAttribute") + error += setOf("InlinedApi", "UnusedAttribute") + } } } diff --git a/app/lint-baseline.xml b/app/lint-baseline.xml new file mode 100644 index 000000000..5607d110a --- /dev/null +++ b/app/lint-baseline.xml @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/xml/shortcuts.xml b/app/src/main/res/xml-v25/shortcuts.xml similarity index 100% rename from app/src/main/res/xml/shortcuts.xml rename to app/src/main/res/xml-v25/shortcuts.xml