Skip to content

Commit

Permalink
Issue checkstyle#12409: Inconsistent allowedAbbreviations
Browse files Browse the repository at this point in the history
  • Loading branch information
arinmodi committed Dec 1, 2022
1 parent facfdf4 commit 781dd1a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
Expand Up @@ -299,7 +299,7 @@
* <p>
* To configure to check variables, enforce
* no abbreviations (essentially camel case) except for
* words like 'ORDERS', 'OBSERVATION', 'UNDERSCORE', 'TEST'.
* words like 'ORDERS', 'TEST'.
* </p>
* <p>Configuration:</p>
* <pre>
Expand All @@ -310,7 +310,7 @@
* <p>Example:</p>
* <pre>
* public class Test {
* void getORDER_OBSERVATION() {} // violation, at most 4 consecutive capital letters allowed
* void getORDER_TEST() {} // OK, ignored
* }
* </pre>
* <p>
Expand Down
Expand Up @@ -470,10 +470,10 @@ public void testReceiver() throws Exception {
@Test
public void testInputAbbreviationAsWordInNameTypeWithUnderScore() throws Exception {
final String[] expected = {
"12:17: " + getWarningMessage("HBCK_LOCK_PATH", 4),
"14:15: " + getWarningMessage("BOOL_VALS", 4),
"21:10: " + getWarningMessage("getNONE_Test", 4),
"38:13: " + getWarningMessage("LINE_SEP", 4),
"13:17: " + getWarningMessage("HBCK_LOCK_PATH", 4),
"16:15: " + getWarningMessage("BOOL_VALS", 4),
"24:10: " + getWarningMessage("getNONE_Test", 4),
"42:13: " + getWarningMessage("LINE_SEP", 4),
};

verifyWithInlineConfigParser(
Expand Down
Expand Up @@ -9,16 +9,19 @@
package com.puppycrawl.tools.checkstyle.checks.naming.abbreviationaswordinname;

public class InputAbbreviationAsWordInNameType7 {
private int HBCK_LOCK_PATH; // violation
// violation below 'Abb.* in name '.*' must contain no more than '4' consecutive cap.* let.*.'
private int HBCK_LOCK_PATH;

Boolean[] BOOL_VALS = { false, true }; // violation
// violation below 'Abb.* in name '.*' must contain no more than '4' consecutive cap.* let.*.'
Boolean[] BOOL_VALS = { false, true };

void getTEST() {
} // ok

void getORDER_OBSERVATION() {} // ok

void getNONE_Test() {} // violation
// violation below 'Abb.* in name '.*' must contain no more than '4' consecutive cap.* let.*.'
void getNONE_Test() {}

void getCLR_Test() {} // ok

Expand All @@ -35,7 +38,8 @@ void getOBSERVATION() {} // ok
void getORDER_UNDERSCORE() {} // ok

int getCLRTest() { // ok
int LINE_SEP = 1; // violation
// violation below 'Abb.* in name '.*' must contain no more than '4' conse.* cap.* let.*.'
int LINE_SEP = 1;
return LINE_SEP;
}
}
4 changes: 2 additions & 2 deletions src/xdocs/config_naming.xml
Expand Up @@ -349,7 +349,7 @@ public class MyClass {
<p>
To configure to check variables, enforce
no abbreviations (essentially camel case) except for
words like 'ORDERS', 'OBSERVATION', 'UNDERSCORE', 'TEST'.
words like 'ORDERS', 'TEST'.
</p>
<p>Configuration:</p>
<source>
Expand All @@ -360,7 +360,7 @@ public class MyClass {
<p>Example:</p>
<source>
public class Test {
void getORDER_OBSERVATION() {} // violation, at most 4 consecutive capital letters allowed
void getORDER_TEST() {} // OK, ignored
}
</source>
</subsection>
Expand Down

0 comments on commit 781dd1a

Please sign in to comment.