tomasbjerre / violations-gradle-plugin

Gradle plugin that will find report files from static code analysis, present and optionally fail the build.
https://plugins.gradle.org/plugin/se.bjurr.violations.violations-gradle-plugin
Other
18 stars 9 forks source link

Disabling columns in the output #11

Open perlun opened 5 years ago

perlun commented 5 years ago

Hi, thanks again for a nice plugin. :smile:

The README.md for this repo states that you can set the maxReporterColumnWidth to 0 to "disable" it. I got the impression from this that you could disable an individual column altogether (which would be useful, especially to give room for "more important" columns - the maxRuleColumnWidth is what I'm after more specifically, since the rule names can be very long with Checkstyle).

task violations(type: se.bjurr.violations.gradle.plugin.ViolationsTask) {
 //
 // Optional config
 //
 maxReporterColumnWidth = 0 // 0 is disabled

However, when looking more closely at the code, I realize that this is not what you mean with "disabled" here - rather, you mean that the max width feature is disabled, not the column altogether.

  private String addNewlines(final String message, final int maxLineLength) {
    if (message == null) {
      return "";
    }
    if (maxLineLength <= 0) {
      return message;
}

It would be useful to be able to drop a column completely. Our typical use case is when running Checkstyle and Spotbugs on our CI server; I would like the Message and the affected file/line to be shown, as well as the Reporter, but not so much more.

Since 0 is already used for "disable limit", how about letting -1 indicate that "column should be dropped"? I might be able to put together a PR if you are fine with the idea, but I want to check first what you think about it.

If you want to do it yourself, feel free - you know the code base much better than me.

tomasbjerre commented 5 years ago

PR:s are very welcome! And using -1 as you describe sounds good!

perlun commented 5 years ago

OK, I might give it a try. :smile: What is the suggested workflow with the "multiple package" approach that this project uses, just to clone everything locally and set up local dependency overrides or what's the typical way you tend to work with this?

tomasbjerre commented 5 years ago

Yes clone this and violations-git-lib.

You can probably test it by observing the output of tests in violations-git-lib: https://github.com/tomasbjerre/violations-git-lib/blob/master/src/test/java/se/bjurr/violations/git/ViolationsReporterApiTest.java

perlun commented 4 years ago

Sorry, I never got around to doing this. We are currently moving away from the violations plugin, so it's unlikely that I will fix this.

@tomasbjerre Feel free to close this issue if you like, or keep it if you think it would make sense to put time into it. All in all, thanks for a nice plugin. :+1: