ci.jenkins.io / CheckStyle
failed
Dec 18, 2023 in 0s
1 new issue
Total | New | Outstanding | Fixed | Trend |
---|---|---|---|---|
1 | 1 | 0 | 0 | 👎 |
Reference build: Core » jenkins » master #5641
Details
Severity distribution of new issues
Error | Warning High | Warning Normal | Warning Low |
---|---|---|---|
1 | 0 | 0 | 0 |
Annotations
Check warning on line 52 in core/src/main/java/jenkins/telemetry/impl/JavaSystemProperties.java
ci-jenkins-io / CheckStyle
ArrayTrailingCommaCheck
ERROR:
Array should contain trailing comma.
Raw output
<p>Since Checkstyle 3.2</p><p> Checks that array initialization contains a trailing comma. </p><pre><code> int[] a = new int[] { 1, 2, 3, }; </code></pre><p> The check demands a comma at the end if neither left nor right curly braces are on the same line as the last element of the array. </p><pre><code> return new int[] { 0 }; return new int[] { 0 }; return new int[] { 0 }; </code></pre><p> Rationale: Putting this comma in makes it easier to change the order of the elements or add new elements on the end. Main benefit of a trailing comma is that when you add new entry to an array, no surrounding lines are changed. </p><pre><code> { 100000000000000000000, 200000000000000000000, // OK } { 100000000000000000000, 200000000000000000000, 300000000000000000000, // Just this line added, no other changes } </code></pre><p> If closing brace is on the same line as training comma, this benefit is gone (as the Check does not demand a certain location of curly braces the following two cases will not produce a violation): </p><pre><code> {100000000000000000000, 200000000000000000000,} // Trailing comma not needed, line needs to be modified anyway {100000000000000000000, 200000000000000000000, // Modified line 300000000000000000000,} // Added line </code></pre><p> If opening brace is on the same line as training comma there's also (more arguable) problem: </p><pre><code> {100000000000000000000, // Line cannot be just duplicated to slightly modify entry } {100000000000000000000, 100000000000000000001, // More work needed to duplicate } </code></pre>
Loading