Skip to content

Commit

Permalink
Updated DetailsTableModel.java to display '-' for issues with blank c…
Browse files Browse the repository at this point in the history
…ategories
  • Loading branch information
debayangg committed Dec 29, 2023
1 parent 018c572 commit 9a5e6fd
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ protected String formatSeverity(final Severity severity) {
}

/**
* Formats the text of the specified property column. T he text actually is a link to the UI representation of
* Formats the text of the specified property column. The text actually is a link to the UI representation of
* the property.
*
* @param property
Expand All @@ -258,7 +258,11 @@ protected String formatSeverity(final Severity severity) {
* @return the formatted column
*/
protected String formatProperty(final String property, final String value) {
return String.format("<a href=\"%s.%d/\">%s</a>", property, value.hashCode(), render(value));
String renderedValue = render(value);
if (StringUtils.isBlank(value)) {
renderedValue="-";

Check warning on line 263 in plugin/src/main/java/io/jenkins/plugins/analysis/core/model/DetailsTableModel.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAroundCheck

NORMAL: '=' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is surrounded by whitespace. Empty constructor, method, class, enum, interface, loop bodies (blocks), lambdas of the form </p><pre><code>public MyClass() {} // empty constructor public void func() {} // empty method public interface Foo {} // empty interface public class Foo {} // empty class public enum Foo {} // empty enum MyClass c = new MyClass() {}; // empty anonymous class while (i = 1) {} // empty while loop for (int i = 1; i &gt; 1; i++) {} // empty for loop do {} while (i = 1); // empty do-while loop Runnable noop = () -&gt; {}; // empty lambda public @interface Beta {} // empty annotation type </code></pre><p> may optionally be exempted from the policy using the <code> allowEmptyMethods</code>, <code>allowEmptyConstructors </code>, <code>allowEmptyTypes</code>, <code>allowEmptyLoops</code><code>allowEmptyLambdas</code> and <code>allowEmptyCatches</code> properties. </p><p>This check does not flag as violation double brace initialization like:</p><pre><code> new Properties() {{ setProperty("key", "value"); }}; </code></pre><p>Parameter allowEmptyCatches allows to suppress violations when token list contains SLIST to check if beginning of block is surrounded by whitespace and catch block is empty, for example:</p><pre><code> try { k = 5 / i; } catch (ArithmeticException ex) {} </code></pre> With this property turned off, this raises violation because the beginning of the catch block (left curly bracket) is not separated from the end of the catch block (right curly bracket).

Check warning on line 263 in plugin/src/main/java/io/jenkins/plugins/analysis/core/model/DetailsTableModel.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAroundCheck

NORMAL: '=' is not preceded with whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is surrounded by whitespace. Empty constructor, method, class, enum, interface, loop bodies (blocks), lambdas of the form </p><pre><code>public MyClass() {} // empty constructor public void func() {} // empty method public interface Foo {} // empty interface public class Foo {} // empty class public enum Foo {} // empty enum MyClass c = new MyClass() {}; // empty anonymous class while (i = 1) {} // empty while loop for (int i = 1; i &gt; 1; i++) {} // empty for loop do {} while (i = 1); // empty do-while loop Runnable noop = () -&gt; {}; // empty lambda public @interface Beta {} // empty annotation type </code></pre><p> may optionally be exempted from the policy using the <code> allowEmptyMethods</code>, <code>allowEmptyConstructors </code>, <code>allowEmptyTypes</code>, <code>allowEmptyLoops</code><code>allowEmptyLambdas</code> and <code>allowEmptyCatches</code> properties. </p><p>This check does not flag as violation double brace initialization like:</p><pre><code> new Properties() {{ setProperty("key", "value"); }}; </code></pre><p>Parameter allowEmptyCatches allows to suppress violations when token list contains SLIST to check if beginning of block is surrounded by whitespace and catch block is empty, for example:</p><pre><code> try { k = 5 / i; } catch (ArithmeticException ex) {} </code></pre> With this property turned off, this raises violation because the beginning of the catch block (left curly bracket) is not separated from the end of the catch block (right curly bracket).
}
return String.format("<a href=\"%s.%d/\">%s</a>", property, value.hashCode(), renderedValue);
}

/**
Expand Down

0 comments on commit 9a5e6fd

Please sign in to comment.