mirror of
https://github.com/alibaba/p3c.git
synced 2026-01-13 07:01:01 +08:00
注解不进行小写驼峰命名校验
This commit is contained in:
@@ -73,4 +73,10 @@ public class LowerCamelCaseVariableNamingRule extends AbstractAliRule {
|
||||
}
|
||||
return super.visit(node, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object visit(ASTAnnotationTypeDeclaration node, Object data) {
|
||||
//对所有注解内的内容不做检查
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user