Skip to content

Commit

Permalink
注解不进行小写驼峰命名校验
Browse files Browse the repository at this point in the history
  • Loading branch information
昶乐 committed Nov 6, 2018
1 parent 3cd68ff commit 4d8a8a0
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,10 @@ public Object visit(ASTMethodDeclarator node, Object data) {
}
return super.visit(node, data);
}

@Override
public Object visit(ASTAnnotationTypeDeclaration node, Object data) {
//对所有注解内的内容不做检查
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,60 @@ public interface BizConstants {
<expected-problems>0</expected-problems>
<code-ref id="LowerCamelCaseVariableNamingRuleTest8" />
</test-code>

<code-fragment id="LowerCamelCaseVariableNamingRuleTest8">
<![CDATA[
public @interface TYPE {
int DO_NO_THING = 0;
int DO_ONE_START_TO_END_ROUTE = 1;
int DO_ONE_CAR_TO_START_ROUTE = 2;
int DO_TWO_ROUTE = 3;
}
]]>
</code-fragment>
<test-code>
<description>Variable name should be lowerCamelCase8</description>
<expected-problems>0</expected-problems>
<code-ref id="LowerCamelCaseVariableNamingRuleTest8" />
</test-code>

<code-fragment id="LowerCamelCaseVariableNamingRuleTest9">
<![CDATA[
@Document
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface TYPE {
int DO_NO_THING = 0;
int DO_ONE_START_TO_END_ROUTE = 1;
int DO_ONE_CAR_TO_START_ROUTE = 2;
int DO_TWO_ROUTE = 3;
}
]]>
</code-fragment>
<test-code>
<description>Variable name should be lowerCamelCase9</description>
<expected-problems>0</expected-problems>
<code-ref id="LowerCamelCaseVariableNamingRuleTest9" />
</test-code>

<code-fragment id="LowerCamelCaseVariableNamingRuleTest10">
<![CDATA[
@Document
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public class Type {
int DO_NO_THING = 0;
int DO_ONE_START_TO_END_ROUTE = 1;
int DO_ONE_CAR_TO_START_ROUTE = 2;
int DO_TWO_ROUTE = 3;
}
]]>
</code-fragment>
<test-code>
<description>Variable name should be lowerCamelCase10</description>
<expected-problems>4</expected-problems>
<code-ref id="LowerCamelCaseVariableNamingRuleTest10" />
</test-code>
</test-data>


0 comments on commit 4d8a8a0

Please sign in to comment.