forked from checkstyle/checkstyle
-
Notifications
You must be signed in to change notification settings - Fork 2
/
ImportOrderCheck.xml
102 lines (102 loc) · 5.26 KB
/
ImportOrderCheck.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle-metadata>
<module>
<check fully-qualified-name="com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck"
name="ImportOrder"
parent="com.puppycrawl.tools.checkstyle.TreeWalker">
<description><p>
Checks the ordering/grouping of imports. Features are:
</p>
<ul>
<li>
groups type/static imports: ensures that groups of imports come in a specific order
(e.g., java. comes first, javax. comes second, then everything else)
</li>
<li>
adds a separation between type import groups : ensures that a blank line sit between each group
</li>
<li>
type/static import groups aren't separated internally: ensures that each group aren't separated
internally by blank line or comment
</li>
<li>
sorts type/static imports inside each group: ensures that imports within each group are in
lexicographic order
</li>
<li>
sorts according to case: ensures that the comparison between imports is case-sensitive, in
<a href="https://en.wikipedia.org/wiki/ASCII#Order">ASCII sort order</a>
</li>
<li>
arrange static imports: ensures the relative order between type imports and static imports
(see
<a href="https://checkstyle.org/property_types.html#ImportOrderOption">ImportOrderOption</a>)
</li>
</ul></description>
<properties>
<property default-value="under"
name="option"
type="com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderOption">
<description>specify policy on the relative order between type imports and static
imports.</description>
</property>
<property default-value="" name="groups" type="java.util.regex.Pattern[]">
<description>specify list of <b>type import</b> groups. Every group identified
either by a common prefix string, or by a regular expression enclosed in forward slashes
(e.g. {@code /regexp/}). All type imports, which does not match any group, falls into an
additional group, located at the end.
Thus, the empty list of type groups (the default value) means one group for all type imports.</description>
</property>
<property default-value="true" name="ordered" type="boolean">
<description>control whether type imports within each group should be
sorted.
It doesn't affect sorting for static imports.</description>
</property>
<property default-value="false" name="separated" type="boolean">
<description>control whether type import groups should be separated
by, at least, one blank line or comment and aren't separated internally.
It doesn't affect separations for static imports.</description>
</property>
<property default-value="false" name="separatedStaticGroups" type="boolean">
<description>control whether static import groups should
be separated by, at least, one blank line or comment and aren't separated internally.
This property has effect only when the property {@code option} is set to {@code top}
or {@code bottom} and when property {@code staticGroups} is enabled.</description>
</property>
<property default-value="true" name="caseSensitive" type="boolean">
<description>control whether string comparison should be
case-sensitive or not. Case-sensitive sorting is in
<a href="https://en.wikipedia.org/wiki/ASCII#Order">ASCII sort order</a>.
It affects both type imports and static imports.</description>
</property>
<property default-value=""
name="staticGroups"
type="java.util.regex.Pattern[]">
<description>specify list of <b>static</b> import groups. Every group
identified either by a common prefix string, or by a regular expression enclosed in forward
slashes (e.g. {@code /regexp/}). All static imports, which does not match any group, fall into
an additional group, located at the end. Thus, the empty list of static groups (the default
value) means one group for all static imports. This property has effect only when the property
{@code option} is set to {@code top} or {@code bottom}.</description>
</property>
<property default-value="false"
name="sortStaticImportsAlphabetically"
type="boolean">
<description>control whether
<b>static imports</b> located at <b>top</b> or <b>bottom</b> are sorted within the group.</description>
</property>
<property default-value="false"
name="useContainerOrderingForStatic"
type="boolean">
<description>control whether to use container
ordering (Eclipse IDE term) for static imports or not.</description>
</property>
</properties>
<message-keys>
<message-key key="import.groups.separated.internally"/>
<message-key key="import.ordering"/>
<message-key key="import.separation"/>
</message-keys>
</check>
</module>
</checkstyle-metadata>