ankidroid / Anki-Android

AnkiDroid: Anki flashcards on Android. Your secret trick to achieve superhuman information retention.
GNU General Public License v3.0
8.71k stars 2.24k forks source link

[Bug] Lint is not run on `androidTest` #10322

Closed viciousAegis closed 2 years ago

viciousAegis commented 2 years ago
Reproduction Steps
  1. On the latest master, or a branch off the latest master (I am using 0184435 as my latest pull)
  2. run a lint check

Not sure if this is a problem with my local repo, or the remote one; so posting here

Expected Result

Check gets completed with no building errors, and all the lint issues are displayed

Actual Result

While lint issues are displayed (not sure if all of them are), the following error arises in the Terminal for me:

> Task :AnkiDroid:lintAmazonDebug FAILED
/*
Lint issues listed
*/
27 errors, 0 warnings

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':AnkiDroid:lintAmazonDebug'.
> Lint found errors in the project; aborting build.

  Fix the issues identified by lint, or create a baseline to see only new errors:

android { lint { baseline = file("lint-baseline.xml") } }


  For more details, see https://developer.android.com/studio/write/lint#snapshot

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1s
60 actionable tasks: 3 executed, 1 from cache, 56 up-to-date

On checking the Inspect Code Output for lint errors: image

Debug info
MacOs 12.0.1
Android Studio Bumblebee | 2021.1.1
Build #AI-211.7628.21.2111.8092744, built on January 19, 2022
Runtime version: 11.0.11+0-b60-7772763 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.0.1
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: cn.haojiyou.CodeGlance3 (2.1.0), org.jetbrains.kotlin (211-1.6.10-release-923-AS7442.40), org.intellij.plugins.markdown (211.7142.37)
Research

Enter an [x] character to confirm the points below:

mikehardy commented 2 years ago

I don't reproduce this, fully up to date with master as I type this comment, this was the test:

./gradlew --stop && ./gradlew clean jacocoTestReport :api:lintRelease :AnkiDroid:lintPlayRelease ktlintCheck

(that's what we run in CI)

viciousAegis commented 2 years ago

Oh okay, I see. I was running ./gradlew lint as I had read that up on the Android Studio docs. Maybe this info could be added to the development guide?

mikehardy commented 2 years ago

Sure - I would put a reference in there to the .github/workflows directory with an indication that is the "source of truth" for how we actually expect to run things, but then provide the actual command as that's helpful in the moment

david-allison commented 2 years ago

Underlying issue: Our current lint run doesn't apply lint over androidTest