Skip to content

Commit

Permalink
Merge 3810767 into a76f459
Browse files Browse the repository at this point in the history
  • Loading branch information
damianszczepanik committed Feb 22, 2015
2 parents a76f459 + 3810767 commit 335445b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
1 change: 0 additions & 1 deletion sevntu-checks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
<regex><pattern>.*.checks.design.NoMainMethodInAbstractClassCheck</pattern><branchRate>92</branchRate><lineRate>98</lineRate></regex>
<regex><pattern>.*.checks.design.PublicReferenceToPrivateTypeCheck</pattern><branchRate>97</branchRate><lineRate>98</lineRate></regex>
<regex><pattern>.*.checks.naming.EnumValueNameCheck</pattern><branchRate>86</branchRate><lineRate>100</lineRate></regex>
<regex><pattern>.*.checks.naming.InterfaceTypeParameterNameCheck</pattern><branchRate>50</branchRate><lineRate>85</lineRate></regex>
<regex><pattern>.*.checks.sizes.LineLengthExtendedCheck</pattern><branchRate>100</branchRate><lineRate>6</lineRate></regex>
<regex><pattern>com.github.sevntu.checkstyle.Utils</pattern><branchRate>0</branchRate><lineRate>0</lineRate></regex>
</regexes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,7 @@ public final int[] getDefaultTokens()
@Override
protected final boolean mustCheckName(DetailAST ast)
{
DetailAST location =
ast.getParent().getParent();

if (location.getType() == TokenTypes.MODIFIERS) {
location = location.getParent();
}
DetailAST location = ast.getParent().getParent();

return location.getType() == TokenTypes.INTERFACE_DEF;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.junit.Test;

import com.github.sevntu.checkstyle.BaseCheckTestSupport;
import com.github.sevntu.checkstyle.checks.naming.InterfaceTypeParameterNameCheck;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;

public class TypeParameterNameTest
Expand All @@ -38,8 +37,10 @@ public void testInterfaceDefault()
createCheckConfig(InterfaceTypeParameterNameCheck.class);

final String[] expected = {
"2:51: " + getCheckMessage(MSG_KEY, "it", "^[A-Z]$"),
"6:27: " + getCheckMessage(MSG_KEY, "foo", "^[A-Z]$"),
"5:51: " + getCheckMessage(MSG_KEY, "it", "^[A-Z]$"),
"9:27: " + getCheckMessage(MSG_KEY, "foo", "^[A-Z]$"),
"18:34: " + getCheckMessage(MSG_KEY, "Taa", "^[A-Z]$"),
"18:52: " + getCheckMessage(MSG_KEY, "Vaa", "^[A-Z]$"),
};
verify(checkConfig, getPath("InputInterfaceTypeParameterName.java"), expected);
}
Expand All @@ -52,8 +53,10 @@ public void testInterfaceFooName()
createCheckConfig(InterfaceTypeParameterNameCheck.class);
checkConfig.addAttribute("format", "^foo$");
final String[] expected = {
"2:51: " + getCheckMessage(MSG_KEY, "it", "^foo$"),
"10:27: " + getCheckMessage(MSG_KEY, "A", "^foo$"),
"5:51: " + getCheckMessage(MSG_KEY, "it", "^foo$"),
"13:27: " + getCheckMessage(MSG_KEY, "A", "^foo$"),
"18:34: " + getCheckMessage(MSG_KEY, "Taa", "^foo$"),
"18:52: " + getCheckMessage(MSG_KEY, "Vaa", "^foo$"),
};
verify(checkConfig, getPath("InputInterfaceTypeParameterName.java"), expected);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
package com.github.sevntu.checkstyle.checks.naming;

import java.util.List;

public interface InputInterfaceTypeParameterName <it> {

}
Expand All @@ -9,4 +12,9 @@ interface OtherInterface <foo>{

interface ThirdInterface <A>{
void action2();
}

class OuterClass <Aaa> {
interface InnerInterface<Taa extends List, Vaa> {
}
}

0 comments on commit 335445b

Please sign in to comment.