-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
rules.xml
221 lines (194 loc) · 9.69 KB
/
rules.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
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
Checkstyle configuration that checks if a bundle is matching the Coding Guidelines in the openHAB project.
For more information about the guidelines see - https://www.openhab.org/docs/developer/guidelines.html.
Note that some of the required checks may be provided by some of the other plugins used in the Static Code Analysis tool.
-->
<module name="Checker">
<!-- Allow to skip parsing of files, see https://github.com/checkstyle/checkstyle/issues/5629#issuecomment-375126473 -->
<!-- Add default to skip unhandled Java 9 sources -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="${checkstyle.beforeExecutionExclusionFileFilter.fileNamePattern}"
default="module\-info\.java$"/>
</module>
<!-- Rules for Code Formatting -->
<module name="FileTabCharacter">
<property name="severity" value="error"/>
<property name="fileExtensions" value="java"/>
</module>
<!--See http://checkstyle.sourceforge.net/config_header.html#Header -->
<module name="org.openhab.tools.analysis.checkstyle.ParameterizedRegexpHeaderCheck">
<!-- This property represents the severity level of a check violation. The valid options are:
-ignore
-info
-warning
-error -->
<!-- The default level of a check is "error". -->
<!-- See http://checkstyle.sourceforge.net/config.html#Severity -->
<property name="severity" value="error"/>
<property name="fileExtensions" value="java"/>
<property name="values" value="${checkstyle.headerCheck.values}" default="2010,2019"/>
<property name="header" value="${checkstyle.headerCheck.content}"
default="^/\*\*$\n^ \* Copyright \(c\) {0}-{1} by the respective copyright holders\.$\n^ \*$\n^ \* All rights reserved\. This program and the accompanying materials$\n^ \* are made available under the terms of the Eclipse Public License v1\.0$\n^ \* which accompanies this distribution, and is available at$\n^ \* http://www.eclipse.org/legal/epl\-v10\.html$"/>
</module>
<module name="NewlineAtEndOfFile">
<property name="severity" value="error"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.readme.MarkdownCheck">
<property name="severity" value="warning"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.OverridingParentPomConfigurationCheck">
<property name="severity" value="warning"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.OnlyTabIndentationCheck">
<property name="severity" value="error"/>
<property name="onlyShowFirstWarning" value="true"/>
<property name="fileTypes" value="${checkstyle.onlyTabIndentationCheck.fileTypes}" default="xml,json"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.RequiredFilesCheck">
<property name="severity" value="error"/>
<property name="extensions" value="${checkstyle.requiredFilesCheck.extensions}" default="xml"/>
<!-- Relative path to the root directory of the module -->
<property name="requiredFiles" value="${checkstyle.requiredFilesCheck.files}" default="pom.xml"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.OhInfXmlLabelCheck">
<property name="severity" value="warning"/>
<property name="maxLabelLength" value="20"/>
<property name="maxLabelLengthError" value="25"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.OhInfXmlValidationCheck">
<property name="severity" value="error"/>
<property name="thingSchema" value="https://openhab.org/schemas/thing-description-1.0.0.xsd"/>
<property name="addonSchema" value="https://openhab.org/schemas/addon-1.0.0.xsd"/>
<property name="configSchema" value="https://openhab.org/schemas/config-description-1.0.0.xsd"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.OhInfXmlUsageCheck">
<property name="severity" value="warning"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.PomXmlCheck">
<property name="severity" value="error"/>
<property name="checkPomVersion" value="${checkstyle.pomXmlCheck.checkPomVersion}" default="true"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.KarafFeatureCheck">
<property name="severity" value="${checkstyle.karafFeatureCheck.severity}" default="ignore"/>
<property name="featureXmlPath" value="${checkstyle.karafFeatureCheck.featureXmlPath}"
default="features/karaf/openhab-addons/src/main/feature/feature.xml"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.KarafAddonFeatureCheck">
<property name="severity" value="${checkstyle.karafAddonFeatureCheck.severity}" default="error"/>
<property name="featureNameMappings" value="${checkstyle.karafAddonFeatureCheck.featureNameMappings}"
default=""/>
<property name="excludeAddonPatterns" value="${checkstyle.karafAddonFeatureCheck.excludeAddonPatterns}"
default=""/>
</module>
<module name="TreeWalker">
<!-- See http://checkstyle.sourceforge.net/config_coding.html#IllegalThrows -->
<module name="IllegalThrows">
<property name="severity" value="warning"/>
</module>
<!-- See http://checkstyle.sourceforge.net/config_coding.html#OneStatementPerLine -->
<module name="OneStatementPerLine">
<property name="severity" value="info"/>
</module>
<!-- See https://checkstyle.sourceforge.io/config_blocks.html#NeedBraces -->
<module name="NeedBraces">
<property name="severity" value="info"/>
</module>
<!-- See http://checkstyle.sourceforge.net/config_misc.html#TodoComment -->
<module name="TodoComment">
<property name="format" value="(TODO)|(FIXME)"/>
<property name="severity" value="info"/>
</module>
<!-- See http://checkstyle.sourceforge.net/config_modifier.html#ModifierOrder -->
<module name="ModifierOrder">
<property name="severity" value="info"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.MissingJavadocFilterCheck">
<property name="severity" value="warning"/>
<property name="scope" value="public"/>
<property name="checkInnerUnits" value="false"/>
<property name="tokens" value="INTERFACE_DEF,CLASS_DEF,ENUM_DEF"/>
<message key="javadoc.missing" value="Missing Javadoc comment."/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.DeclarativeServicesDependencyInjectionCheck">
<property name="severity" value="warning"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.InheritDocCheck">
<property name="severity" value="warning"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.ForbiddenPackageUsageCheck">
<property name="severity" value="warning"/>
<property name="forbiddenPackages" value="${checkstyle.forbiddenPackageUsageCheck.forbiddenPackages}"/>
<property name="exceptions" value="${checkstyle.forbiddenPackageUsageCheck.exceptions}"/>
</module>
<module name="UnusedImports">
<property name="processJavadoc" value="true"/>
<property name="severity" value="info"/>
</module>
<!-- See https://checkstyle.sourceforge.io/config_imports.html#AvoidStarImport -->
<module name="AvoidStarImport">
<property name="allowStaticMemberImports" value="true"/>
<property name="severity" value="warning"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.AuthorTagCheck">
<property name="tag" value="@author"/>
<property name="tagFormat" value="\S"/> <!-- the tag can be anything but whitespace -->
<property name="checkInnerUnits" value="false"/>
<property name="severity" value="error"/> <!-- A property defining what should be done if the author is missing. In our case we want the build to fail. -->
<property name="tagSeverity" value="ignore"/> <!-- A property defining what should be done when the author tag is found. In our case we want to ignore it. -->
<message key="type.missingTag" value="An author tag is missing"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.NoEmptyLineSeparatorCheck">
<property name="severity" value="info"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.AvoidScheduleAtFixedRateCheck">
<property name="severity" value="warning"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.JavadocMethodStyleCheck">
<property name="severity" value="info"/>
<property name="allowMissingPropertyJavadoc" value="true"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.AuthorContributionDescriptionCheck">
<property name="severity" value="warning"/>
<property name="requiredContributionDescriptions" value="Initial contribution"/>
<property name="checkInnerUnits" value="false"/>
</module>
<module name="org.openhab.tools.analysis.checkstyle.NullAnnotationsCheck">
<property name="severity" value="warning"/>
<property name="checkInnerUnits" value="false"/>
</module>
<!-- Rules for Java Naming Convention -->
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
<property name="severity" value="info"/>
</module>
<module name="TypeName">
<property name="tokens" value="INTERFACE_DEF,CLASS_DEF,ENUM_DEF"/>
<property name="severity" value="info"/>
</module>
<module name="MethodName">
<property name="severity" value="info"/>
</module>
<module name="ConstantName">
<property name="severity" value="info"/>
</module>
<module name="LocalFinalVariableName">
<property name="severity" value="info"/>
</module>
<module name="LocalVariableName">
<property name="severity" value="info"/>
</module>
<module name="StaticVariableName">
<property name="severity" value="info"/>
</module>
<module name="MemberName">
<property name="severity" value="info"/>
</module>
<module name="EqualsAvoidNull">
<property name="severity" value="warning"/>
</module>
</module>
</module>