Issue #1288: 'AbbreviationAsWordInNameCheck' was refactored, UT coverage improved

This commit is contained in:
Ruslan Diachenko 2015-07-06 22:51:45 +01:00 committed by Roman Ivanov
parent 8d32a7d800
commit b8ca9f9765
4 changed files with 7 additions and 8 deletions

View File

@ -867,7 +867,6 @@
<regex><pattern>.*.checks.metrics.NPathComplexityCheck</pattern><branchRate>100</branchRate><lineRate>90</lineRate></regex>
<regex><pattern>.*.checks.naming.AbbreviationAsWordInNameCheck</pattern><branchRate>93</branchRate><lineRate>100</lineRate></regex>
<regex><pattern>.*.checks.naming.AbstractAccessControlNameCheck</pattern><branchRate>95</branchRate><lineRate>80</lineRate></regex>
<regex><pattern>.*.checks.naming.AbstractClassNameCheck</pattern><branchRate>100</branchRate><lineRate>90</lineRate></regex>
<regex><pattern>.*.checks.naming.AbstractNameCheck</pattern><branchRate>100</branchRate><lineRate>87</lineRate></regex>

View File

@ -245,12 +245,10 @@ public class AbbreviationAsWordInNameCheck extends Check {
private static boolean isInterfaceDeclaration(DetailAST variableDefAst) {
boolean result = false;
final DetailAST astBlock = variableDefAst.getParent();
if (astBlock != null) {
final DetailAST astParent2 = astBlock.getParent();
if (astParent2 != null
&& astParent2.getType() == TokenTypes.INTERFACE_DEF) {
result = true;
}
final DetailAST astParent2 = astBlock.getParent();
if (astParent2.getType() == TokenTypes.INTERFACE_DEF) {
result = true;
}
return result;
}
@ -267,6 +265,7 @@ public class AbbreviationAsWordInNameCheck extends Check {
for (DetailAST child : getChildren(methodModifiersAST)) {
if (child.getType() == TokenTypes.ANNOTATION) {
final DetailAST annotationIdent = child.findFirstToken(TokenTypes.IDENT);
if (annotationIdent != null && "Override".equals(annotationIdent.getText())) {
result = true;
break;

View File

@ -296,6 +296,7 @@ public class AbbreviationAsWordInNameCheckTest extends BaseCheckTestSupport {
warningMessage = getCheckMessage(MSG_KEY, expectedCapitalCount);
checkConfig.addAttribute("allowedAbbreviationLength", String.valueOf(expectedCapitalCount));
checkConfig.addAttribute("ignoreFinal", "false");
checkConfig.addAttribute("allowedAbbreviations", null);
final String[] expected = {
};

View File

@ -18,7 +18,7 @@ abstract class NonAAAAbstractClassName1 extends Class1 {
}
class Class1 {
@SuppressWarnings(value = { "" })
protected void oveRRRRRrriddenMethod(){
int a = 0;
// blah-blah