You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Specify that ./gradlew spotlessApply will fix all issues in error messageΒ #2592
When running ./gradlew spotlessCheck, and there's a styling error in several modules, we get an error and a suggested resolution of Run './gradlew :feature:foo:spotlessApply' to fix these violations.
If you are proficient in Gradle, you may correctly deduce that running ./gradlew spotlessApply will fix the violations in all modules. You may also correctly deduce this if you've read the docs.
Otherwise, you will:
Run ./gradlew :feature:foo:spotlessApply
Rerun ./gradlew spotlessCheck (perhaps because it's part of a git pre-commit hook)
Get an error in another module, with the suggested resolution of Run './gradlew :feature:bar:spotlessApply' to fix these violations.
Run ./gradlew :feature:bar:spotlessApply
Repeat steps 2 to 4 a few times with different modules
And eventually rerunning ./gradlew spotlessCheck will pass
As a mobile platform engineer, I've seen these exact steps play out with several people already. Given they are all heeding the advice of the error message already, and other developers outside of our team could be facing the same issue, could it be worth updating the error message to something like the following?
Run './gradlew :feature:foo:spotlessApply' to fix these violations. Alternatively, run './gradlew spotlessApply' to fix all violations.
The only reason I can think of to keep the exact path around is to help with very large projects, but I'm not sure how we would detect which subprojects need spotlessApplying, so no strong feelings on the final solution.
The only reason I can think of to keep the exact path around is to help with very large projects
That is a good point, but ideally we would just be so fast and good at up-to-date checking that they don't care. But big slow projects do still exist, but people in those projects are more likely to have the habit of :subproject:task anyway and don't need us to call it out for them. The anecdote is pretty persuasive to me.
@nedtwigg That's true, Spotless is pretty darn fast due to its incremental processing and Git ratchet support, so I'm persuaded by this anecdote, too. π
Activity
nedtwigg commentedon Aug 8, 2025
Thanks for sharing this anecdote!
I can't see any reason why we're bothering to specify the exact path. If we just say
gradlew spotlessApplythat seems better.Happy to take a PR which makes this change, if anyone has a strong reason why the exact path should stay, chime in.
jbduncan commentedon Aug 8, 2025
The only reason I can think of to keep the exact path around is to help with very large projects, but I'm not sure how we would detect which subprojects need
spotlessApplying, so no strong feelings on the final solution.nedtwigg commentedon Aug 8, 2025
That is a good point, but ideally we would just be so fast and good at up-to-date checking that they don't care. But big slow projects do still exist, but people in those projects are more likely to have the habit of
:subproject:taskanyway and don't need us to call it out for them. The anecdote is pretty persuasive to me.jbduncan commentedon Aug 8, 2025
@nedtwigg That's true, Spotless is pretty darn fast due to its incremental processing and Git ratchet support, so I'm persuaded by this anecdote, too. π
State `./gradlew spotlessApply` fixes all issues in error message (#2593
nedtwigg commentedon Sep 24, 2025
Published in
plugin-gradle 8.0.0.fix: suggest build-tree path for spotlessApply in composite builds