Add lint baseline, enable linting on CI, fix some reported errors #3291

Merged
arjan5 merged 9 commits from lint-fixes into master 2023-09-11 09:17:06 +00:00
Collaborator

This PR:

  • fixes some errors reported by gradlew lint and the Android Studio "Code Inspection" tool
  • adds a snapshot file lint-baseline.xml of the remaining lint errors and warnings to be used by the linter as baseline
  • adds a job for CI to run gradlew lint on every build

Some things to consider:

  • do we want linting on the nightly build?
  • do we want a separate automatic lint job run from cron?
This PR: - fixes some errors reported by `gradlew lint` and the Android Studio "Code Inspection" tool - adds a snapshot file `lint-baseline.xml` of the remaining lint errors and warnings to be used by the linter as baseline - adds a job for CI to run `gradlew lint` on every build Some things to consider: - do we want linting on the nightly build? - do we want a separate automatic lint job run from cron?
arjan5 added 7 commits 2023-09-05 11:24:36 +00:00
ci/woodpecker/push/can_master_build Pipeline is pending Details
ci/woodpecker/push/run_tests Pipeline is pending Details
0a04afc673
Update lint snapshot
ci/woodpecker/push/can_master_build Pipeline was successful Details
ci/woodpecker/push/run_tests Pipeline was successful Details
ci/woodpecker/push/run_lint Pipeline was successful Details
f73f4283cb
Run lint in woodpecker
ci/woodpecker/push/can_master_build Pipeline was successful Details
ci/woodpecker/push/run_tests Pipeline was successful Details
ci/woodpecker/push/run_lint Pipeline was successful Details
ci/woodpecker/pr/can_master_build Pipeline was successful Details
ci/woodpecker/pr/run_tests Pipeline was successful Details
ci/woodpecker/pr/run_lint Pipeline was successful Details
ab03250927
Abort linter when errors are found
joserebelo reviewed 2023-09-05 21:37:37 +00:00
@ -216,10 +216,13 @@ android {
lintOptions {
abortOnError ABORT_ON_CHECK_FAILURE
Collaborator

Maybe set it to true here instead of setting it twice?

Maybe set it to true here instead of setting it twice?
Poster
Collaborator

Whoops, I was too quick setting that... The ABORT_ON_CHECK_FAILURE variable is used in other places too, in task pmd() and spotbugs {}. I'm thinking the better fix would be to set the variable to true instead of hardcoding it in lintOptions {}. Agree?

Whoops, I was too quick setting that... The `ABORT_ON_CHECK_FAILURE` variable is used in other places too, in `task pmd()` and `spotbugs {}`. I'm thinking the better fix would be to set the variable to `true` instead of hardcoding it in `lintOptions {}`. Agree?
arjan5 marked this conversation as resolved
joserebelo reviewed 2023-09-06 21:05:09 +00:00
@ -0,0 +1,16 @@
steps:
tests:
Collaborator

can you rename this to lint?

can you rename this to lint?
arjan5 marked this conversation as resolved
joserebelo reviewed 2023-09-06 21:05:10 +00:00
@ -0,0 +1,16 @@
steps:
tests:
Collaborator

can you rename this to lint?

can you rename this to lint?
arjan5 marked this conversation as resolved
joserebelo approved these changes 2023-09-06 21:05:20 +00:00
joserebelo left a comment
Collaborator

Aside from the 2 minor comments, lgtm. The updated activities look to be unchanged and work as expected.

Aside from the 2 minor comments, lgtm. The updated activities look to be unchanged and work as expected.
arjan5 force-pushed lint-fixes from 08232cd445 to 3415236a4c 2023-09-07 11:50:47 +00:00 Compare
joserebelo reviewed 2023-09-07 12:12:39 +00:00
@ -0,0 +13,4 @@
when:
event:
exclude: cron
Collaborator

You should update this to exclude: ['cron', 'deployment'] following ec9b423785

You should update this to `exclude: ['cron', 'deployment']` following ec9b423785ba65bd5880d1b6c4db3e900db7a92a
arjan5 marked this conversation as resolved
arjan5 force-pushed lint-fixes from 3415236a4c to db20f51bcc 2023-09-07 12:32:03 +00:00 Compare
arjan5 force-pushed lint-fixes from db20f51bcc to 17ecea226b 2023-09-11 09:03:42 +00:00 Compare
arjan5 merged commit 557bfea35c into master 2023-09-11 09:17:06 +00:00
arjan5 deleted branch lint-fixes 2023-09-11 09:17:07 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Freeyourgadget/Gadgetbridge#3291
There is no content yet.