Fix two lint configuration traps - #3121
Draft
StylianosGakis wants to merge 2 commits into
Draft
Conversation
This was referenced Sep 3, 2026
Lint aborts the build whenever it has to create a baseline, and it does so even when it found nothing to put in one. Every module the lint convention plugin touches was therefore required to carry a checked-in baseline, so adding any new module failed `./gradlew lint` with a message that names neither the module nor the reason. Worse, the baseline lint leaves behind on that first run records whatever it found, so a re-run passes and any real error in the new module is suppressed from then on. Pointing `baseline` at the file only when it exists removes both problems. Modules that suppress findings today keep their baseline and behave exactly as before, and a module without one simply reports its findings.
Renovate owns dependency freshness in this repo, so lint's GradleDependency and NewerVersionAvailable notices are duplicate signal that nobody acts on. They resolve against the shared root gradle/libs.versions.toml rather than the module being linted, so they report identically regardless of which module runs lint, and :hedvig-ktlint surfaced 77 of them for dependencies it does not declare.
StylianosGakis
force-pushed
the
chore/lint-config-fixes
branch
from
September 3, 2026 08:31
dd3a0e8 to
350e422
Compare
StylianosGakis
changed the base branch from
develop
to
chore/fix-ktlint-formatting
September 3, 2026 08:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bottom-but-one of stack #3125, on top of #3111 (which fixes develop's pre-existing ktlint failures). Two independent lint configuration fixes. Both surfaced while adding a new Gradle module, but neither is specific to it, so they are split out ahead of that work.
1. Only set the baseline when the module has one
HedvigLintConventionPluginpointedbaselineathedvig-lint/lint-baseline/lint-baseline-<module>.xmlunconditionally. Lint aborts the build whenever it has to create a baseline, so every module the plugin touched was implicitly required to carry a checked-in file, and adding any new module failed./gradlew lintwith a message that names neither the module nor the reason:It does this even when lint found nothing to put in the baseline. Verified: with all findings suppressed, lint printed "Lint found no errors or warnings", wrote a 188-byte baseline, and failed anyway.
The second problem is worse. The baseline lint leaves behind records whatever it found, so the re-run it tells you to do passes, and any real error in the new module is suppressed from then on. Verified end to end on
:cross-sells:NamespaceImportviolation, empty baselineLint found 1 error, build failsupdateLintBaseline, then lint again, violation still in the sourceLint found no new issues (and 1 error filtered by baseline), build succeedsSetting
baselineonly when the file exists removes both. Modules that suppress findings today keep their baseline and behave exactly as before, and a module without one simply reports its findings. Verified by removing:apollo-test's baseline: lint no longer aborts, and no baseline is written.This also makes the 104 empty baselines vestigial rather than load-bearing. Deleting them is deliberately left out of this PR.
2. Stop lint reporting version catalog staleness
GradleDependencyandNewerVersionAvailableresolve against the shared rootgradle/libs.versions.toml, not against the module being linted, so they report the same thing no matter which module runs lint. Only a module whose directory is a direct child of the repo root actually surfaces them, which is why they have never been visible: the only such included modules arehedvig-lint, which the plugin opts out of lint entirely, and a new one.renovate.jsonalready owns dependency freshness repo-wide, on a daily schedule, so these are duplicate signal that nobody acts on. Both are nowseverity="ignore"in the sharedlint.xml, which is where this repo keeps issue configuration.For scale, a single root-level module reported 77 of these: 19
GradleDependencyand 58NewerVersionAvailable, every one of them pointing at the root catalog rather than at the module.Verification
./gradlew lintacross the repo: passes.