Skip to content

Commit 8a10693

Browse files
committedJul 27, 2022
#1111 check removed
1 parent 26b7e7c commit 8a10693

File tree

1 file changed

+64
-63
lines changed
  • qulice-pmd/src/main/resources/com/qulice/pmd

1 file changed

+64
-63
lines changed
 

‎qulice-pmd/src/main/resources/com/qulice/pmd/ruleset.xml

+64-63
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
3030
-->
3131
<ruleset xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Qulice Ruleset" xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
3232
<description>
33-
This ruleset checks code for potential mess
34-
</description>
33+
This ruleset checks code for potential mess
34+
</description>
3535
<rule ref="category/java/bestpractices.xml">
3636
<exclude name="JUnitTestsShouldIncludeAssert"/>
3737
<exclude name="PositionLiteralsFirstInComparisons"/>
@@ -54,6 +54,7 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
5454
<exclude name="LawOfDemeter"/>
5555
<exclude name="SignatureDeclareThrowsException"/>
5656
<exclude name="ExcessiveImports"/>
57+
<exclude name="CyclomaticComplexity"/>
5758
</rule>
5859
<rule ref="category/java/documentation.xml">
5960
<exclude name="CommentRequired"/>
@@ -85,135 +86,135 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
8586
</rule>
8687
<rule name="ProhibitPlainJunitAssertionsRule" message="Avoid using Plain JUnit assertions" class="com.qulice.pmd.rules.ProhibitPlainJunitAssertionsRule">
8788
<description>
88-
Instead of using plain JUnit assertions like org.junit.Assert.assert*
89-
junit.framework.Assert.assert* - use Matchers from package org.hamcrest
90-
</description>
89+
Instead of using plain JUnit assertions like org.junit.Assert.assert*
90+
junit.framework.Assert.assert* - use Matchers from package org.hamcrest
91+
</description>
9192
</rule>
9293
<rule name="UseStringIsEmptyRule" message="Use String.isEmpty() when checking for empty string" class="com.qulice.pmd.rules.UseStringIsEmptyRule">
9394
<description>
94-
Method String.isEmpty() should be used when testing for empty string, rather than using
95-
String.length() compared to 0
96-
</description>
95+
Method String.isEmpty() should be used when testing for empty string, rather than using
96+
String.length() compared to 0
97+
</description>
9798
</rule>
9899
<rule name="UnnecessaryLocalRule" message="Avoid creating unnecessary local variables like ''{0}''" class="com.qulice.pmd.rules.UnnecessaryLocalRule">
99100
</rule>
100101
<rule name="ConstructorShouldDoInitialization" message="Avoid doing field initialization outside constructor." language="java" class="net.sourceforge.pmd.lang.rule.XPathRule">
101102
<description>
102-
Avoid doing field initialization outside class constructor.
103-
Such initialization is allowed only when there is no constructor.
104-
</description>
103+
Avoid doing field initialization outside class constructor.
104+
Such initialization is allowed only when there is no constructor.
105+
</description>
105106
<priority>3</priority>
106107
<properties>
107108
<property name="xpath">
108109
<value><![CDATA[
109-
//ClassOrInterfaceBody
110-
[count(ClassOrInterfaceBodyDeclaration/ConstructorDeclaration)>0]
111-
[count(ClassOrInterfaceBodyDeclaration/FieldDeclaration[@Static='false']/VariableDeclarator/VariableInitializer)>0]
112-
]]></value>
110+
//ClassOrInterfaceBody
111+
[count(ClassOrInterfaceBodyDeclaration/ConstructorDeclaration)>0]
112+
[count(ClassOrInterfaceBodyDeclaration/FieldDeclaration[@Static='false']/VariableDeclarator/VariableInitializer)>0]
113+
]]></value>
113114
</property>
114115
</properties>
115116
</rule>
116117
<rule name="OnlyOneConstructorShouldDoInitialization" message="Avoid field initialization in several constructors." language="java" class="net.sourceforge.pmd.lang.rule.XPathRule">
117118
<description>
118-
Avoid doing field initialization in several constructors.
119-
Only one main constructor should do real work.
120-
Other constructors should delegate initialization to it.
121-
</description>
119+
Avoid doing field initialization in several constructors.
120+
Only one main constructor should do real work.
121+
Other constructors should delegate initialization to it.
122+
</description>
122123
<priority>3</priority>
123124
<properties>
124125
<property name="xpath">
125126
<value><![CDATA[
126-
//ClassOrInterfaceBody[count(ClassOrInterfaceBodyDeclaration/ConstructorDeclaration)>1]
127-
[count(ClassOrInterfaceBodyDeclaration/ConstructorDeclaration[BlockStatement])>1]
128-
]]></value>
127+
//ClassOrInterfaceBody[count(ClassOrInterfaceBodyDeclaration/ConstructorDeclaration)>1]
128+
[count(ClassOrInterfaceBodyDeclaration/ConstructorDeclaration[BlockStatement])>1]
129+
]]></value>
129130
</property>
130131
</properties>
131132
</rule>
132133
<rule name="ConstructorOnlyInitializesOrCallOtherConstructors" message="Only field initialization or call to other constructors in a constructor." language="java" class="net.sourceforge.pmd.lang.rule.XPathRule">
133134
<description>
134-
Avoid putting anything other than field assignments into constructors.
135-
The only exception should be calling other constructors
136-
or calling super class constructor.
137-
</description>
135+
Avoid putting anything other than field assignments into constructors.
136+
The only exception should be calling other constructors
137+
or calling super class constructor.
138+
</description>
138139
<priority>3</priority>
139140
<properties>
140141
<property name="xpath">
141142
<value><![CDATA[
142-
//ConstructorDeclaration/BlockStatement[count(Statement/StatementExpression/PrimaryExpression[count(following-sibling::AssignmentOperator[1])>0]/PrimaryPrefix[@ThisModifier="true"])!=count(*)]
143-
]]></value>
143+
//ConstructorDeclaration/BlockStatement[count(Statement/StatementExpression/PrimaryExpression[count(following-sibling::AssignmentOperator[1])>0]/PrimaryPrefix[@ThisModifier="true"])!=count(*)]
144+
]]></value>
144145
</property>
145146
</properties>
146147
</rule>
147148
<rule name="StaticAccessToStaticFields" message="Static fields should be accessed in a static way [CLASS_NAME.FIELD_NAME]." language="java" class="net.sourceforge.pmd.lang.rule.XPathRule">
148149
<description>
149-
Avoid accessing static fields directly.
150-
</description>
150+
Avoid accessing static fields directly.
151+
</description>
151152
<priority>3</priority>
152153
<properties>
153154
<property name="xpath">
154155
<value><![CDATA[
155-
//Name[@Image = //FieldDeclaration[@Static='true']/@VariableName]
156-
]]></value>
156+
//Name[@Image = //FieldDeclaration[@Static='true']/@VariableName]
157+
]]></value>
157158
</property>
158159
</properties>
159160
</rule>
160161
<rule name="ProhibitPublicStaticMethods" message="Public static methods are prohibited." language="java" class="net.sourceforge.pmd.lang.rule.XPathRule">
161162
<description>
162-
Public static methods are prohibited.
163-
</description>
163+
Public static methods are prohibited.
164+
</description>
164165
<priority>3</priority>
165166
<properties>
166167
<property name="xpath">
167168
<value><![CDATA[
168-
//ClassOrInterfaceBodyDeclaration[
169-
MethodDeclaration[@Static='true' and @Public='true'
170-
and not (
171-
MethodDeclarator[
172-
count(FormalParameters/FormalParameter)=1
173-
and @Image='main'
174-
and FormalParameters/FormalParameter[1]/Type/ReferenceType/ClassOrInterfaceType[@Image='String']
175-
and FormalParameters/FormalParameter[@Varargs='true']
176-
] and not(ResultType/Type)
177-
)
178-
] and (
179-
Annotation/MarkerAnnotation/Name[@Image!='BeforeClass' and @Image!='AfterClass'
180-
and @Image!='Parameterized.Parameters']
181-
or not (Annotation)
182-
)
183-
]
184-
]]></value>
169+
//ClassOrInterfaceBodyDeclaration[
170+
MethodDeclaration[@Static='true' and @Public='true'
171+
and not (
172+
MethodDeclarator[
173+
count(FormalParameters/FormalParameter)=1
174+
and @Image='main'
175+
and FormalParameters/FormalParameter[1]/Type/ReferenceType/ClassOrInterfaceType[@Image='String']
176+
and FormalParameters/FormalParameter[@Varargs='true']
177+
] and not(ResultType/Type)
178+
)
179+
] and (
180+
Annotation/MarkerAnnotation/Name[@Image!='BeforeClass' and @Image!='AfterClass'
181+
and @Image!='Parameterized.Parameters']
182+
or not (Annotation)
183+
)
184+
]
185+
]]></value>
185186
</property>
186187
</properties>
187188
</rule>
188189
<rule name="ProhibitFilesCreateFileInTests" message="Files.createFile should not be used in tests, replace them with @Rule TemporaryFolder" language="java" class="net.sourceforge.pmd.lang.rule.XPathRule">
189190
<description>
190-
Files.createFile shouldn't be used in tests.
191-
</description>
191+
Files.createFile shouldn't be used in tests.
192+
</description>
192193
<priority>3</priority>
193194
<properties>
194195
<property name="xpath">
195196
<value><![CDATA[
196-
//ClassOrInterfaceDeclaration[ends-with(@Image, 'Test')]//PrimaryPrefix/Name[@Image='Files.createFile']
197-
]]></value>
197+
//ClassOrInterfaceDeclaration[ends-with(@Image, 'Test')]//PrimaryPrefix/Name[@Image='Files.createFile']
198+
]]></value>
198199
</property>
199200
</properties>
200201
</rule>
201202
<rule name="ReturnEmptyCollectionRatherThanNull" language="java" class="net.sourceforge.pmd.lang.rule.XPathRule" message="Returned null collection was found (NullCollection).">
202203
<description>
203-
Any method that returns an collection (i.e. an array or a List), it is better to return
204-
an empty one rather than a null reference.
205-
</description>
204+
Any method that returns an collection (i.e. an array or a List), it is better to return
205+
an empty one rather than a null reference.
206+
</description>
206207
<priority>1</priority>
207208
<properties>
208209
<property name="version" value="2.0"/>
209210
<!--Solve priority confict-->
210211
<property name="xpath">
211212
<value><![CDATA[
212-
//MethodDeclaration[
213-
(./ResultType/Type[pmd-java:typeIs('java.util.Collection')
214-
or pmd-java:typeIs('java.util.Map') or @ArrayType=true()]) and
215-
(./Block/BlockStatement/Statement/ReturnStatement/Expression/PrimaryExpression/PrimaryPrefix/Literal/NullLiteral)
216-
]]]></value>
213+
//MethodDeclaration[
214+
(./ResultType/Type[pmd-java:typeIs('java.util.Collection')
215+
or pmd-java:typeIs('java.util.Map') or @ArrayType=true()]) and
216+
(./Block/BlockStatement/Statement/ReturnStatement/Expression/PrimaryExpression/PrimaryPrefix/Literal/NullLiteral)
217+
]]]></value>
217218
</property>
218219
</properties>
219220
</rule>

0 commit comments

Comments
 (0)
Please sign in to comment.