violations-gradle-plugin icon indicating copy to clipboard operation
violations-gradle-plugin copied to clipboard

Disabling columns in the output

Open perlun opened this issue 6 years ago • 4 comments

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.

perlun avatar Jan 22 '19 13:01 perlun

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

tomasbjerre avatar Jan 22 '19 13:01 tomasbjerre

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?

perlun avatar Jan 22 '19 13:01 perlun

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

tomasbjerre avatar Jan 22 '19 13:01 tomasbjerre

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:

perlun avatar Oct 13 '20 07:10 perlun