Skip to content

Commit c94b13e

Browse files
committed
Clean up code quality tool excludes
1 parent 9730677 commit c94b13e

File tree

3 files changed

+36
-98
lines changed

3 files changed

+36
-98
lines changed

config/codenarc/codenarc.groovy

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ ruleset {
3737
'net.kautler.command.api.parameter.ParameterParseExceptionTest',
3838
'net.kautler.command.api.restriction.RestrictionChainElementTest',
3939
'net.kautler.command.parameter.ParametersImplTest',
40-
'net.kautler.command.restriction.RestrictionLookupTest',
4140
'net.kautler.command.util.lazy.LazyReferenceByFunctionTest',
4241
'net.kautler.command.util.lazy.LazyReferenceBySupplierTest',
4342
'net.kautler.command.util.lazy.LazyReferenceTest'
@@ -314,7 +313,6 @@ ruleset {
314313
'net.kautler.command.api.parameter.ParameterParseExceptionTest',
315314
'net.kautler.command.api.restriction.RestrictionChainElementTest',
316315
'net.kautler.command.parameter.ParametersImplTest',
317-
'net.kautler.command.restriction.RestrictionLookupTest',
318316
'net.kautler.command.util.lazy.LazyReferenceByFunctionTest',
319317
'net.kautler.command.util.lazy.LazyReferenceBySupplierTest',
320318
'net.kautler.command.util.lazy.LazyReferenceTest'
@@ -325,9 +323,7 @@ ruleset {
325323
ExplicitCallToMinusMethod
326324
ExplicitCallToModMethod
327325
ExplicitCallToMultiplyMethod
328-
ExplicitCallToOrMethod {
329-
doNotApplyToClassNames = 'net.kautler.command.api.restriction.RestrictionChainElementTest'
330-
}
326+
ExplicitCallToOrMethod
331327
ExplicitCallToPlusMethod
332328
ExplicitCallToPowerMethod
333329
ExplicitCallToPutAtMethod
@@ -518,12 +514,7 @@ ruleset {
518514
}
519515
UnusedObject
520516
UnusedPrivateField
521-
UnusedPrivateMethod {
522-
doNotApplyToClassNames = [
523-
'net.kautler.command.integ.test.spock.AddBeansExtension',
524-
'net.kautler.command.integ.test.spock.VetoBeansExtension'
525-
].join(', ')
526-
}
517+
UnusedPrivateMethod
527518
UnusedPrivateMethodParameter
528519
UnusedVariable
529520
}

config/pmd/pmd.xml

Lines changed: 33 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -26,36 +26,7 @@
2626
<rule ref="category/java/bestpractices.xml">
2727
<exclude name="GuardLogStatement"/>
2828
</rule>
29-
<rule ref="category/java/bestpractices.xml/UnusedFormalParameter">
30-
<properties>
31-
<property name="violationSuppressXPath">
32-
<value>
33-
.[
34-
(ancestor::MethodDeclaration/@MethodName = 'ensureInitializationAtStartup') and ancestor-or-self::FormalParameter[
35-
Annotation[typeIsExactly('javax.enterprise.event.Observes')]
36-
and Annotation[typeIsExactly('javax.enterprise.context.Initialized')]]
37-
]
38-
</value>
39-
</property>
40-
</properties>
41-
</rule>
42-
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod">
43-
<properties>
44-
<property name="ignoredAnnotations" value="
45-
javax.annotation.PostConstruct |
46-
javax.annotation.PreDestroy |
47-
javax.enterprise.inject.Produces |
48-
javax.inject.Inject
49-
"/>
50-
<property name="violationSuppressXPath">
51-
<value>
52-
.[
53-
descendant::FormalParameter/Annotation[typeIsExactly('javax.enterprise.event.Observes')]
54-
]
55-
</value>
56-
</property>
57-
</properties>
58-
</rule>
29+
5930
<rule ref="category/java/codestyle.xml">
6031
<exclude name="AtLeastOneConstructor"/>
6132
<exclude name="CallSuperInConstructor"/>
@@ -66,7 +37,7 @@
6637
<exclude name="TooManyStaticImports"/>
6738
<exclude name="UselessParentheses"/>
6839
</rule>
69-
<rule ref="category/java/codestyle.xml/ClassNamingConventions"/>
40+
7041
<rule ref="category/java/codestyle.xml/DefaultPackage">
7142
<properties>
7243
<property name="violationSuppressXPath">
@@ -75,15 +46,16 @@
7546
((MethodDeclaration/@MethodName = 'ensureInitializationAtStartup') and descendant::FormalParameter[
7647
Annotation[typeIsExactly('javax.enterprise.event.Observes')]
7748
and Annotation[typeIsExactly('javax.enterprise.context.Initialized')]])
78-
or (Annotation[typeIsExactly('javax.enterprise.inject.Produces')]
79-
or Annotation[typeIsExactly('javax.inject.Inject')]
80-
or Annotation[typeIsExactly('javax.annotation.PostConstruct')]
81-
or Annotation[typeIsExactly('javax.annotation.PreDestroy')])
49+
or Annotation[typeIsExactly('javax.enterprise.inject.Produces')]
50+
or Annotation[typeIsExactly('javax.inject.Inject')]
51+
or Annotation[typeIsExactly('javax.annotation.PostConstruct')]
52+
or Annotation[typeIsExactly('javax.annotation.PreDestroy')]
8253
]
8354
</value>
8455
</property>
8556
</properties>
8657
</rule>
58+
8759
<rule ref="category/java/codestyle.xml/EmptyMethodInAbstractClassShouldBeAbstract">
8860
<properties>
8961
<property name="violationSuppressXPath">
@@ -93,28 +65,31 @@
9365
Annotation[typeIsExactly('javax.enterprise.event.Observes')]
9466
and Annotation[typeIsExactly('javax.enterprise.context.Initialized')]])
9567
or (((@MethodName = 'expression')
96-
or (@MethodName = 'optional')
97-
or (@MethodName = 'placeholder')
98-
or (@MethodName = 'placeholderWithWhitespace')
99-
or (@MethodName = 'alternatives')
100-
or (@MethodName = 'literal'))
68+
or (@MethodName = 'optional')
69+
or (@MethodName = 'placeholder')
70+
or (@MethodName = 'placeholderWithWhitespace')
71+
or (@MethodName = 'alternatives')
72+
or (@MethodName = 'literal'))
10173
and ancestor::ClassOrInterfaceDeclaration[typeIsExactly('net.kautler.command.usage.UsageParserRuleContext')])
10274
]
10375
</value>
10476
</property>
10577
</properties>
10678
</rule>
79+
10780
<rule ref="category/java/codestyle.xml/FieldNamingConventions">
10881
<properties>
10982
<property name="publicConstantPattern" value="[a-z][a-zA-Z0-9]*|[A-Z][A-Z_0-9]*"/>
11083
<property name="constantPattern" value="[a-z][a-zA-Z0-9]*|[A-Z][A-Z_0-9]*"/>
11184
</properties>
11285
</rule>
86+
11387
<rule ref="category/java/codestyle.xml/FormalParameterNamingConventions">
11488
<properties>
11589
<property name="lambdaParameterPattern" value="[a-z][a-zA-Z0-9]*|__+" />
11690
</properties>
11791
</rule>
92+
11893
<rule ref="category/java/codestyle.xml/LinguisticNaming">
11994
<properties>
12095
<property name="violationSuppressXPath">
@@ -127,11 +102,13 @@
127102
</property>
128103
</properties>
129104
</rule>
105+
130106
<rule ref="category/java/codestyle.xml/LongVariable">
131107
<properties>
132108
<property name="minimum" value="45"/>
133109
</properties>
134110
</rule>
111+
135112
<rule ref="category/java/codestyle.xml/ShortMethodName">
136113
<properties>
137114
<property name="violationSuppressXPath">
@@ -143,39 +120,28 @@
143120
</property>
144121
</properties>
145122
</rule>
123+
146124
<rule ref="category/java/design.xml">
147125
<exclude name="AvoidCatchingGenericException"/>
148126
<exclude name="ExcessiveImports"/>
149127
<exclude name="LawOfDemeter"/>
150128
<exclude name="LoosePackageCoupling"/>
151129
</rule>
152-
<rule ref="category/java/design.xml/ClassWithOnlyPrivateConstructorsShouldBeFinal">
153-
<properties>
154-
<property name="violationSuppressXPath">
155-
<value>
156-
.[
157-
ancestor::TypeDeclaration/Annotation[
158-
typeIsExactly('javax.enterprise.context.ApplicationScoped')
159-
or typeIsExactly('javax.enterprise.context.Dependent')]
160-
]
161-
</value>
162-
</property>
163-
</properties>
164-
</rule>
130+
165131
<rule ref="category/java/design.xml/DataClass">
166132
<properties>
167133
<property name="violationSuppressXPath">
168134
<value>
169135
<!-- typeIs('java.lang.Exception') is a work-around for https://github.com/pmd/pmd/issues/2246 -->
170136
.[
171137
typeIsExactly('net.kautler.command.api.Version')
172-
or typeIsExactly('net.kautler.test.pitest.ExplicitMutationFilterDetails')
173138
or typeIs('java.lang.Exception')
174139
]
175140
</value>
176141
</property>
177142
</properties>
178143
</rule>
144+
179145
<rule ref="category/java/design.xml/SignatureDeclareThrowsException">
180146
<properties>
181147
<property name="violationSuppressXPath">
@@ -188,21 +154,26 @@
188154
</property>
189155
</properties>
190156
</rule>
157+
191158
<rule ref="category/java/design.xml/TooManyMethods">
192159
<properties>
193160
<property name="maxmethods" value="15"/>
194161
</properties>
195162
</rule>
163+
196164
<rule ref="category/java/documentation.xml"/>
165+
197166
<rule ref="category/java/documentation.xml/CommentSize">
198167
<properties>
199168
<property name="maxLines" value="99999"/>
200169
<property name="maxLineLength" value="120"/>
201170
</properties>
202171
</rule>
172+
203173
<rule ref="category/java/errorprone.xml">
204174
<exclude name="BeanMembersShouldSerialize"/>
205175
</rule>
176+
206177
<rule ref="category/java/errorprone.xml/AvoidDuplicateLiterals">
207178
<properties>
208179
<property name="violationSuppressXPath">
@@ -215,6 +186,7 @@
215186
</property>
216187
</properties>
217188
</rule>
189+
218190
<rule ref="category/java/errorprone.xml/AvoidFieldNameMatchingTypeName">
219191
<properties>
220192
<property name="violationSuppressXPath">
@@ -226,6 +198,7 @@
226198
</property>
227199
</properties>
228200
</rule>
201+
229202
<rule ref="category/java/errorprone.xml/AvoidLiteralsInIfCondition">
230203
<properties>
231204
<property name="ignoreMagicNumbers" value="-1, 0, 1"/>
@@ -239,6 +212,7 @@
239212
</property>
240213
</properties>
241214
</rule>
215+
242216
<rule ref="category/java/errorprone.xml/AvoidLosingExceptionInformation">
243217
<properties>
244218
<property name="violationSuppressXPath">
@@ -251,23 +225,17 @@
251225
</property>
252226
</properties>
253227
</rule>
228+
254229
<rule ref="category/java/errorprone.xml/DataflowAnomalyAnalysis">
255230
<properties>
256231
<!-- false positives -->
257232
<property name="violationSuppressRegex">
258233
<value>(?x)
259234
\QFound 'UR'-anomaly for variable \E.* |
260-
\QFound 'DU'-anomaly for variable 'first' (lines '\E.* |
261235
\QFound 'DD'-anomaly for variable 'groupName' (lines '\E.* |
262-
\QFound 'DU'-anomaly for variable 'leftHasWhitespace' (lines '\E.* |
263-
\QFound 'DU'-anomaly for variable 'leftOptional' (lines '\E.* |
264-
\QFound 'DU'-anomaly for variable 'noneOf' (lines '\E.* |
265-
\QFound 'DU'-anomaly for variable 'outer' (lines '\E.* |
266236
\QFound 'DU'-anomaly for variable 'restrictionPolicy' (lines '\E.* |
267-
\QFound 'DU'-anomaly for variable 'result' (lines '\E.* |
268237
\QFound 'DU'-anomaly for variable 'usageTree' (lines '\E.* |
269238
\QFound 'DU'-anomaly for variable 'seen' (lines '\E.* |
270-
\QFound 'DD'-anomaly for variable 'distance' (lines '\E.* |
271239
\QFound 'DU'-anomaly for variable 'channelId' (lines '\E.* |
272240
\QFound 'DU'-anomaly for variable 'roleId' (lines '\E.* |
273241
\QFound 'DU'-anomaly for variable 'userId' (lines '\E.* |
@@ -277,7 +245,7 @@
277245
</property>
278246
</properties>
279247
</rule>
280-
<rule ref="category/java/errorprone.xml/MissingStaticMethodInNonInstantiatableClass"/>
248+
281249
<rule ref="category/java/errorprone.xml/NullAssignment">
282250
<properties>
283251
<property name="violationSuppressXPath">
@@ -291,10 +259,13 @@
291259
</property>
292260
</properties>
293261
</rule>
262+
294263
<rule ref="category/java/multithreading.xml">
295264
<exclude name="DoNotUseThreads"/>
296265
<exclude name="UseConcurrentHashMap"/>
297266
</rule>
267+
298268
<rule ref="category/java/performance.xml"/>
269+
299270
<rule ref="category/java/security.xml"/>
300271
</ruleset>

config/spotbugs/spotbugs-exclude.xml

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@
2626
<Match>
2727
<Class name="net.kautler.command.api.CommandHandler"/>
2828
<Method name="ensureInitializationAtStartup" params="java.lang.Object" returns="void"/>
29-
<Or>
30-
<Bug pattern="ACEM_ABSTRACT_CLASS_EMPTY_METHODS"/>
31-
<Bug pattern="UP_UNUSED_PARAMETER"/>
32-
</Or>
29+
<Bug pattern="ACEM_ABSTRACT_CLASS_EMPTY_METHODS"/>
3330
</Match>
3431

3532
<Match>
@@ -38,13 +35,6 @@
3835
<Bug pattern="VA_FORMAT_STRING_USES_NEWLINE"/>
3936
</Match>
4037

41-
<Match>
42-
<Class name="net.kautler.command.usage.UsagePatternBuilder"/>
43-
<Method name="getUsageContext" params="net.kautler.command.usage.UsageParserRuleContext" returns="net.kautler.command.usage.UsageParser$UsageContext"/>
44-
<Local name="current"/>
45-
<Bug pattern="BC_UNCONFIRMED_CAST"/>
46-
</Match>
47-
4838
<Match>
4939
<Or>
5040
<Class name="net.kautler.command.api.restriction.javacord.ChannelJavacord"/>
@@ -112,13 +102,6 @@
112102
<Bug pattern="CRLF_INJECTION_LOGS"/>
113103
</Match>
114104

115-
<!-- work-around for https://github.com/mebigfatguy/fb-contrib/issues/372 -->
116-
<Match>
117-
<Class name="net.kautler.command.handler.CommandHandlerJda"/>
118-
<Method name="onEvent" params="net.dv8tion.jda.api.events.GenericEvent" returns="void"/>
119-
<Bug pattern="ITC_INHERITANCE_TYPE_CHECKING"/>
120-
</Match>
121-
122105
<!-- work-around for https://github.com/mebigfatguy/fb-contrib/issues/384 -->
123106
<Match>
124107
<Or>
@@ -134,13 +117,6 @@
134117
<Bug pattern="OI_OPTIONAL_ISSUES_USES_ORELSEGET_WITH_NULL"/>
135118
</Match>
136119

137-
<!-- work-around for https://github.com/mebigfatguy/fb-contrib/issues/385 -->
138-
<Match>
139-
<Class name="net.kautler.command.parameter.converter.javacord.UserMentionConverterJavacord"/>
140-
<Method name="convert" params="java.lang.String, java.lang.String, net.kautler.command.api.CommandContext" returns="org.javacord.api.entity.user.User"/>
141-
<Bug pattern="AI_ANNOTATION_ISSUES_NEEDS_NULLABLE"/>
142-
</Match>
143-
144120
<Match>
145121
<Class name="net.kautler.test.spock.EagerExceptionRenderer"/>
146122
<Method name="~lambda\$(?:visitSpec|null)\$\d++" params="org.spockframework.runtime.extension.IMethodInvocation" returns="void"/>

0 commit comments

Comments
 (0)