Skip to content

fix(lint): register new modules for lint, and auto-register all in CI#21064

Open
david-allison wants to merge 3 commits into
ankidroid:mainfrom
david-allison:lint-checks
Open

fix(lint): register new modules for lint, and auto-register all in CI#21064
david-allison wants to merge 3 commits into
ankidroid:mainfrom
david-allison:lint-checks

Conversation

@david-allison
Copy link
Copy Markdown
Member

@david-allison david-allison commented May 17, 2026

Note

Assisted-by: Claude Opus 4.7 - most of the code

Purpose / Description

A number of modules weren't using lint-rules, fix them. Some are excluded, see commit 1 for details

Fixes

Approach

  • Move to a convention plugin, so this is applied automatically
  • Update CI so new modules do not manually need to be registered there
  • Optimize the CI script

How Has This Been Tested?

./gradlew lintAll ktLintCheck lintVitalFullRelease lint-rules:test --daemon

Learning (optional, can help others)

I was surprised it was so easy to apply lint-rules to a java-library

But there's no in-IDE support it seems for those files... only CI

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

Using convention plugins.

Updated:
:anki-common:lint :common:android:lint :compat:lint

* lint-rules is ignored due to a potential circular dependency
* AnkiDroid is ignored as the convention plugin is pending
* vbpd is ignored as it is vendored

Fixes 21063

Assisted-by: Claude Opus 4.7
By defining a 'lintAll' gradle task

Related to issue 21063

Assisted-by: Claude Opus 4.7 - all but comments
@david-allison david-allison changed the title fix(lint): register all modules for lint, and auto-register all in CI fix(lint): register new modules for lint, and auto-register all in CI May 17, 2026
if (path != ":lint-rules") {
pluginManager.apply("com.android.lint")
dependencies {
"lintChecks"(project(":lint-rules"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: JVM modules don’t use lint.gradle because it depends on the android {} DSL. Custom rules are still FATAL, so builds will fail if they trigger, but checkTestSources won’t be applied. Probably fine for now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems OK for now, I'm surprised it worked at all

Comment thread .github/workflows/lint.yml Outdated
`lintVitalFullRelease` was copied from the publish script,
`lintFullDebug` will find the same issues, so just call it

Assisted-by: Claude Opus 4.7 - confirmation of correctness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lintChecks(project(":lint-rules")) is not applied to all modules

2 participants