forked from zhukunpenglinyutong/jetbrains-cc-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckstyle.xml
More file actions
163 lines (133 loc) · 7.84 KB
/
Copy pathcheckstyle.xml
File metadata and controls
163 lines (133 loc) · 7.84 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="error"/>
<!-- File-level: enforce newline at end of file -->
<module name="NewlineAtEndOfFile">
<property name="lineSeparator" value="lf"/>
</module>
<!-- File-level: enforce max line length -->
<module name="LineLength">
<property name="max" value="200"/>
<property name="fileExtensions" value="java"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="TreeWalker">
<!-- ===== Project-specific: IntelliJ Platform API Usage ===== -->
<!-- Prohibit use of System.out, System.err, and e.printStackTrace -->
<module name="RegexpSinglelineJava">
<property name="format" value="System\.(out|err)\.print|e\.printStackTrace"/>
<property name="message" value="Do not use System.out/err, use com.intellij.openapi.diagnostic.Logger instead"/>
<property name="ignoreComments" value="true"/>
</module>
<!-- Require ApplicationManager.getApplication().invokeLater instead of SwingUtilities.invokeLater for EDT operations -->
<module name="RegexpSinglelineJava">
<property name="format" value="SwingUtilities\.invokeLater"/>
<property name="message" value="Use ApplicationManager.getApplication().invokeLater instead of SwingUtilities.invokeLater"/>
<property name="ignoreComments" value="true"/>
</module>
<!-- Prohibit System.getProperty("user.home") - use PlatformUtils.getHomeDirectory() instead -->
<module name="RegexpSinglelineJava">
<property name="id" value="NoUserHomeProperty"/>
<property name="format" value="System\.getProperty\(\s*"user\.home""/>
<property name="message" value="Do not use System.getProperty("user.home"), use PlatformUtils.getHomeDirectory() instead (IDEA may override user.home)"/>
<property name="ignoreComments" value="true"/>
</module>
<!-- Allow PlatformUtils.java to use System.getProperty("user.home") as fallback -->
<module name="SuppressionXpathSingleFilter">
<property name="id" value="NoUserHomeProperty"/>
<property name="files" value="PlatformUtils\.java"/>
</module>
<!-- ===== Annotations ===== -->
<!-- Enforce @Override when overriding methods -->
<module name="MissingOverride"/>
<!-- ===== Imports ===== -->
<!-- No illegal imports (e.g. sun.*) -->
<module name="IllegalImport"/>
<!-- No duplicate imports or imports of classes in java.lang -->
<module name="RedundantImport"/>
<!-- No unused imports -->
<module name="UnusedImports">
<property name="processJavadoc" value="true"/>
</module>
<!-- ===== Coding (real bug-catchers) ===== -->
<!-- equals(Object) and equals(SameType) must be consistent -->
<module name="CovariantEquals"/>
<!-- Disallow empty statements (lone semicolons) -->
<module name="EmptyStatement"/>
<!-- equals() and hashCode() must be overridden together -->
<module name="EqualsHashCode"/>
<!-- Simplify boolean expressions such as "x == true" -->
<module name="SimplifyBooleanExpression"/>
<!-- Simplify "if (x) return true; else return false;" -->
<module name="SimplifyBooleanReturn"/>
<!-- Use .equals() for String comparison, not == -->
<module name="StringLiteralEquality"/>
<!-- Declare one variable per declaration statement -->
<module name="MultipleVariableDeclarations"/>
<!-- One statement per line -->
<module name="OneStatementPerLine"/>
<!-- ===== Miscellaneous ===== -->
<!-- Use uppercase L for long literals (1000L not 1000l) -->
<module name="UpperEll"/>
<!-- Array brackets belong to the type, not the variable (String[] args not String args[]) -->
<module name="ArrayTypeStyle"/>
<!-- File name must match the public type name -->
<module name="OuterTypeFilename"/>
<!-- ===== Modifiers ===== -->
<!-- Remove redundant modifiers (e.g. public on interface methods) -->
<module name="RedundantModifier"/>
<!-- ===== Block Style ===== -->
<!-- Require braces around all if/else/while/for/do bodies. Guards against
goto-fail-style bugs where a future edit silently slips outside the
conditional. The 197 pre-existing single-line violations were fixed
in the preceding commit. -->
<module name="NeedBraces"/>
<!-- ===== Regexp ===== -->
<!--
Forbid single-element array hack used to smuggle mutable state into lambdas / anonymous
classes, e.g.: final boolean[] flag = {false}; final int[] count = {0};
Prefer AtomicBoolean / AtomicInteger / AtomicLong / AtomicReference.
-->
<module name="RegexpSinglelineJava">
<property name="format"
value="^\s*(?:final\s+)?[A-Za-z_][\w<>,?\s]*\s*\[\]\s+[a-z]\w*\s*=\s*\{\s*[^,{}]+\s*\}"/>
<property name="message"
value="Do not use a single-element array to capture mutable state in a lambda or anonymous class. Use AtomicBoolean / AtomicInteger / AtomicLong / AtomicReference instead."/>
<property name="ignoreComments" value="true"/>
</module>
<module name="RegexpSinglelineJava">
<property name="format"
value="^\s*(?:final\s+)?[A-Za-z_][\w<>,?\s]*\s*\[\]\s+[a-z]\w*\s*=\s*\{\s*new\s+[A-Za-z_][\w<>,?\s]*\s*\[\]\s*\{\s*[^,{}]+\s*\}"/>
<property name="message"
value="Do not use a single-element array to capture mutable state in a lambda or anonymous class. Use AtomicBoolean / AtomicInteger / AtomicLong / AtomicReference instead."/>
<property name="ignoreComments" value="true"/>
</module>
<!--
===== Disabled Rules (kept here for future adoption) =====
The following rules from checkstyle-new.xml are intentionally left out
for now because they would create a large backlog of fixes. Enable them
in a future cleanup pass when the team is ready.
- JavadocMethod / JavadocVariable / JavadocStyle / NonEmptyAtclauseDescription (~1216 violations)
Reason: requires writing Javadoc for every public method/field. High effort, low return for
this project where method names are self-documenting.
- InnerTypeLastCheck (~628 violations)
Reason: pure code-ordering preference, no functional benefit.
- NestedIfDepth / NestedTryDepth (~26 violations)
Reason: real refactoring required, schedule separately.
- HideUtilityClassConstructor (~23 violations)
Reason: needs adding private constructors to all utility classes.
- LeftCurly / RightCurly / WhitespaceAround / WhitespaceAfter / NoWhitespaceBefore /
NoWhitespaceAfter / ParenPad / MethodParamPad / GenericWhitespace / AnnotationLocation /
AvoidNestedBlocks / EmptyBlock (collectively ~70 violations)
Reason: stylistic, IDE-fixable. Worth a one-shot reformat in a separate commit.
- InterfaceIsType / InnerAssignment / OneTopLevelClass
Reason: project-specific exceptions exist; review case by case before enabling.
- Trailing whitespace
Reason: easy to enable after a one-time reformat of all files.
-->
</module>
</module>