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 Nov 29, 2022
1 parent ed42b66 commit 0fa3eed
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
Expand Up @@ -583,7 +583,7 @@ private String getDisallowedAbbreviation(String str) {
else if (abbrStarted) {
abbrStarted = false;

final int endIndex = index - 1;
final int endIndex = Character.isLetterOrDigit(symbol) ? index-1 : index;
result = getAbbreviationIfIllegal(str, beginIndex, endIndex);
if (result != null) {
break;
Expand Down
Expand Up @@ -467,4 +467,13 @@ public void testReceiver() throws Exception {
expected);
}

@Test
public void demoTest() throws Exception {
final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;

verifyWithInlineConfigParser(
getPath("InputAbbreviationAsWordInNameType7.java"),
expected);
}

}
@@ -0,0 +1,28 @@
/*
AbbreviationAsWordInName
allowedAbbreviations = ORDER, OBSERVATION, UNDERSCORE, TEST
*/


package com.puppycrawl.tools.checkstyle.checks.naming.abbreviationaswordinname;

public class InputAbbreviationAsWordInNameType7 {
void getTEST() {
}

void getORDER_OBSERVATION() {}

void getUNDERSCORE() {}

void getTEST_OBSERVATION() {}

void getTEST_UNDERSCORE() {}

void getORDER() {}

void getOBSERVATION() {}

void getORDER_UNDERSCORE() {}
}

0 comments on commit 0fa3eed

Please sign in to comment.