Skip to content

Commit

Permalink
Issue checkstyle#15456: Specify violation messages for ArrayTrailingC…
Browse files Browse the repository at this point in the history
…omma
  • Loading branch information
AmitKumarDeoghoria authored and romani committed Oct 28, 2024
1 parent 8684faa commit 42cf0ad
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ public final class InlineConfigParser {
"com.puppycrawl.tools.checkstyle.checks.AvoidEscapedUnicodeCharactersCheck",
"com.puppycrawl.tools.checkstyle.checks.blocks.EmptyCatchBlockCheck",
"com.puppycrawl.tools.checkstyle.checks.blocks.NeedBracesCheck",
"com.puppycrawl.tools.checkstyle.checks.coding.ArrayTrailingCommaCheck",
"com.puppycrawl.tools.checkstyle.checks.coding"
+ ".AvoidNoArgumentSuperConstructorCallCheck",
"com.puppycrawl.tools.checkstyle.checks.coding.CovariantEqualsCheck",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ public class Example1 {
boolean[] bools = {
true,
true,
false // violation
false // violation 'Array should contain trailing comma.'
};

String[][] text = {{},{},};

double[][] decimals = {
{0.5, 2.3, 1.1,},
{1.7, 1.9, 0.6},
{0.8, 7.4, 6.5} // violation
{0.8, 7.4, 6.5} // violation 'Array should contain trailing comma.'
};

char[] chars = {'a', 'b', 'c'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@

// xdoc section -- start
public class Example2 {
int[] numbers = {1, 2, 3}; // violation
int[] numbers = {1, 2, 3}; // violation 'Array should contain trailing comma.'
boolean[] bools = {
true,
true,
false // violation
false // violation 'Array should contain trailing comma.'
};

String[][] text = {{},{},};

double[][] decimals = {
{0.5, 2.3, 1.1,},
{1.7, 1.9, 0.6}, // violation
{0.8, 7.4, 6.5,} // violation
{1.7, 1.9, 0.6}, // violation 'Array should contain trailing comma.'
{0.8, 7.4, 6.5,} // violation 'Array should contain trailing comma.'
};

char[] chars = {'a', 'b', 'c' // violation
char[] chars = {'a', 'b', 'c' // violation 'Array should contain trailing comma.'
};

String[] letters = {
"a", "b", "c"}; // violation
"a", "b", "c"}; // violation 'Array should contain trailing comma.'

int[] a1 = new int[]{
1,
Expand Down
16 changes: 8 additions & 8 deletions src/xdocs/checks/coding/arraytrailingcomma.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ public class Example1 {
boolean[] bools = {
true,
true,
false // violation
false // violation 'Array should contain trailing comma.'
};

String[][] text = {{},{},};

double[][] decimals = {
{0.5, 2.3, 1.1,},
{1.7, 1.9, 0.6},
{0.8, 7.4, 6.5} // violation
{0.8, 7.4, 6.5} // violation 'Array should contain trailing comma.'
};

char[] chars = {'a', 'b', 'c'
Expand Down Expand Up @@ -164,26 +164,26 @@ public class Example1 {
<p id="Example2-code">Example:</p>
<source>
public class Example2 {
int[] numbers = {1, 2, 3}; // violation
int[] numbers = {1, 2, 3}; // violation 'Array should contain trailing comma.'
boolean[] bools = {
true,
true,
false // violation
false // violation 'Array should contain trailing comma.'
};

String[][] text = {{},{},};

double[][] decimals = {
{0.5, 2.3, 1.1,},
{1.7, 1.9, 0.6}, // violation
{0.8, 7.4, 6.5,} // violation
{1.7, 1.9, 0.6}, // violation 'Array should contain trailing comma.'
{0.8, 7.4, 6.5,} // violation 'Array should contain trailing comma.'
};

char[] chars = {'a', 'b', 'c' // violation
char[] chars = {'a', 'b', 'c' // violation 'Array should contain trailing comma.'
};

String[] letters = {
&quot;a&quot;, &quot;b&quot;, &quot;c&quot;}; // violation
&quot;a&quot;, &quot;b&quot;, &quot;c&quot;}; // violation 'Array should contain trailing comma.'

int[] a1 = new int[]{
1,
Expand Down

0 comments on commit 42cf0ad

Please sign in to comment.