Ability to list all failing files with spotlessCheck
Hello
Today running spotlessCheck allows the display of maximum 10 files as stated in : https://github.com/diffplug/spotless/blob/5a5db69db6254de76c2b33ca4c1f76d3da5d62b3/lib-extra/src/main/java/com/diffplug/spotless/extra/integration/DiffMessageFormatter.java#L161
Example of logged error today :
Violations also present in 41 other files.
Run 'gradlew.bat :spotlessApply' to fix these violations.
\* Try:`
\> Run with \-\-stacktrace option to get the stack trace.
\> Run with --info or \-\-debug option to get more log output.
\* Get more help at https://help.gradle.org`
BUILD FAILED in 6s
3 actionable tasks: 1 executed, 1 from cache, 1 up-to-date
For our projects, we need be able to see all files that are breaking the formatting. Could we remove this limit or raise it ?
Thank you
Would you like to see just the filenames or their contents, too?
@jbduncan The filenames should be enough 👍 like what is displayed today when we have less than 10 files
@AchrafBelkahla Great, thanks for clarifying.
I don't contribute to this repo as much as I used to, but I'm sure @nedtwigg wouldn't mind if you wanted to raise a PR.
Having said that, we'll need to agree on an API for this. I only know the Gradle plugin, but I imagine we'd want something like:
spotless {
maxFilesToReport(9999)
}
We can always skip the Maven plugin until someone asks for this option there, too.
What do you think, both?
This would be perfect of course if approved by @nedtwigg
Sorry for the long delay.
- I don't think a configurable max makes sense. It should either be a brief summary or it should be complete. The default should be brief.
- Adding a complete mode is fine with me, I lean towards it should be a CLI flag rather than DSL. Maybe
--show-all-failures? I'm okay with a DSL change too, but I think it should be boolean rather than an integer max.
I'm fine with it being either a DSL change or a CLI flag (like Ned's suggestion for --show-all-failures or an API change like below), and I agree with hindsight that it should be an on/off switch that's off by default.
spotless {
showAllFailures()
}
@AchrafBelkahla It seems that neither Ned nor I will have enough time to implement this, so feel free to raise a PR and to ask for help if you get stuck. :)