Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structured report of compliance failures #811

Closed
roxspring opened this issue Mar 4, 2021 · 3 comments
Closed

Structured report of compliance failures #811

roxspring opened this issue Mar 4, 2021 · 3 comments

Comments

@roxspring
Copy link

My team have requested better integration into our CI than simply failing a maven build, at a minimum they'd like to see a PR comment summarising the state of compliance failures. To my mind this would be best accomplished by:

  • Spotless Core gains a mechanism to output a structure (JSON?) report indicating which files and lines need attention
  • Spotless Maven/Gradle plugins gain a third mode of operation: to check fails and build a spotless-report.json on their status without failing the build.
  • I do some integration work to turn the JSON report into a markdown comment or code review (suspect this would be too niche for a Spotless feature)

Is there a better / simpler option I should be looking into? Would a structured report like this be welcome for Spotless?

@jbduncan
Copy link
Member

jbduncan commented Mar 4, 2021

I'm aware of another Gradle plugin, specifically ben-manes/gradle-versions-plugin, which I think allows a custom output format e.g. JSON, so that part of your feature request sounds sensible to me.

I'm not entirely sure I understand your suggestion for the plugins' proposed third mode. Are you suggesting that even if the check reports that some code is not formatted, then it doesn't "fail" in the associated build tool? If so, that sounds rather unusual to me. I'm tempted to just expose the option to change the output format of the existing check mode.

Just my 2 cents as an ex-contributor. I don't know for sure how this would even look like in Spotless yet. :)

@roxspring
Copy link
Author

I'm not entirely sure I understand your suggestion for the plugins' proposed third mode. Are you suggesting that even if the check reports that some code is not formatted, then it doesn't "fail" in the associated build tool? If so, that sounds rather unusual to me.

(Happy to be corrected on any of this but...) in a multi-module maven project running mvn spotless:check tells you of all non-compliant files within the first failing module, but then halts the build immediately without checking files in subsequent modules. Even if I use mavens' --fail-at-end mode then modules which depend on non-compliant modules won't be checked. If I'm going to post PR comments about non-compliant failures then I need to be able to tell people about all non-compliant files, not just the first batch. Consequently I need to be able to run a flavour of the mvn spotless:check logic across all modules without failing (or only failing at the last module). I'm happy to take advice on whether this is a fully-fledged "third mode" or just a variant of the existing check mode.

If it helps though, I'm happy to leave all that for a future issue and focus this one on the structured report.

@nedtwigg
Copy link
Member

nedtwigg commented Mar 4, 2021

I'm going to closet this as a dupe of #655. A PR for adding a structured report is indeed welcome, but it would be best to leverage the existing reviewdog diagnostic format.

@nedtwigg nedtwigg closed this as completed Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants