/
AbbreviationAsWordInNameCheck.xml
69 lines (69 loc) · 3.85 KB
/
AbbreviationAsWordInNameCheck.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle-metadata>
<module>
<check fully-qualified-name="com.puppycrawl.tools.checkstyle.checks.naming.AbbreviationAsWordInNameCheck"
name="AbbreviationAsWordInName"
parent="com.puppycrawl.tools.checkstyle.TreeWalker">
<description><p>
Validates abbreviations (consecutive capital letters) length in
identifier name, it also allows to enforce camel case naming. Please read more at
<a href="https://checkstyle.org/styleguides/google-java-style-20180523/javaguide.html#s5.3-camel-case">
Google Style Guide</a> to get to know how to avoid long abbreviations in names.
</p>
<p>'_' is considered as word separator in identifier name.</p>
<p>
{@code allowedAbbreviationLength} specifies how many consecutive capital letters are
allowed in the identifier.
A value of <i>3</i> indicates that up to 4 consecutive capital letters are allowed,
one after the other, before a violation is printed. The identifier 'MyTEST' would be
allowed, but 'MyTESTS' would not be.
A value of <i>0</i> indicates that only 1 consecutive capital letter is allowed. This
is what should be used to enforce strict camel casing. The identifier 'MyTest' would
be allowed, but 'MyTEst' would not be.
</p>
<p>
{@code ignoreFinal}, {@code ignoreStatic}, and {@code ignoreStaticFinal}
control whether variables with the respective modifiers are to be ignored.
Note that a variable that is both static and final will always be considered under
{@code ignoreStaticFinal} only, regardless of the values of {@code ignoreFinal}
and {@code ignoreStatic}. So for example if {@code ignoreStatic} is true but
{@code ignoreStaticFinal} is false, then static final variables will not be ignored.
</p></description>
<properties>
<property default-value="3" name="allowedAbbreviationLength" type="int">
<description>Indicate the number of consecutive capital
letters allowed in targeted identifiers (abbreviations in the classes, interfaces, variables
and methods names, ... ).</description>
</property>
<property default-value=""
name="allowedAbbreviations"
type="java.lang.String[]">
<description>Specify abbreviations that must be skipped for checking.</description>
</property>
<property default-value="true" name="ignoreFinal" type="boolean">
<description>Allow to skip variables with {@code final} modifier.</description>
</property>
<property default-value="true" name="ignoreStatic" type="boolean">
<description>Allow to skip variables with {@code static} modifier.</description>
</property>
<property default-value="true" name="ignoreStaticFinal" type="boolean">
<description>Allow to skip variables with both {@code static} and
{@code final} modifiers.</description>
</property>
<property default-value="true" name="ignoreOverriddenMethods" type="boolean">
<description>Allow to ignore methods tagged with {@code @Override}
annotation (that usually mean inherited name).</description>
</property>
<property default-value="CLASS_DEF,INTERFACE_DEF,ENUM_DEF,ANNOTATION_DEF,ANNOTATION_FIELD_DEF,PARAMETER_DEF,VARIABLE_DEF,METHOD_DEF,PATTERN_VARIABLE_DEF,RECORD_DEF,RECORD_COMPONENT_DEF"
name="tokens"
type="java.lang.String[]"
validation-type="tokenSet">
<description>tokens to check</description>
</property>
</properties>
<message-keys>
<message-key key="abbreviation.as.word"/>
</message-keys>
</check>
</module>
</checkstyle-metadata>