summaryrefslogtreecommitdiff
path: root/buildstuffs/src
diff options
context:
space:
mode:
authorGravatar Uko Kokņevičs2025-05-20 05:00:55 +0300
committerGravatar Uko Kokņevičs2025-05-20 05:00:55 +0300
commit6c7f613f505217f94311d2a67bc957ad24620dee (patch)
tree2d33d9e9bbcbeec9e26428afdf13e0dc1684e6f3 /buildstuffs/src
downloadlv.enes:parent-6c7f613f505217f94311d2a67bc957ad24620dee.tar.gz
lv.enes:parent-6c7f613f505217f94311d2a67bc957ad24620dee.tar.xz
lv.enes:parent-6c7f613f505217f94311d2a67bc957ad24620dee.zip
Initial commit
Diffstat (limited to 'buildstuffs/src')
-rw-r--r--buildstuffs/src/main/resources/lv/enes/buildstuffs/checkstyle-suppressions.xml11
-rw-r--r--buildstuffs/src/main/resources/lv/enes/buildstuffs/checkstyle.xml223
-rw-r--r--buildstuffs/src/main/resources/lv/enes/buildstuffs/pmd-rules.xml126
-rw-r--r--buildstuffs/src/main/resources/lv/enes/buildstuffs/spotbugs-exclude.xml46
4 files changed, 406 insertions, 0 deletions
diff --git a/buildstuffs/src/main/resources/lv/enes/buildstuffs/checkstyle-suppressions.xml b/buildstuffs/src/main/resources/lv/enes/buildstuffs/checkstyle-suppressions.xml
new file mode 100644
index 0000000..dbf0b1f
--- /dev/null
+++ b/buildstuffs/src/main/resources/lv/enes/buildstuffs/checkstyle-suppressions.xml
@@ -0,0 +1,11 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 SPDX-License-Identifier: AGPL-3.0-or-later
4 SPDX-FileCopyrightText: 2025 Uko Kokņevičs <perkontevs@gmail.com>
5 -->
6<!DOCTYPE suppressions PUBLIC
7 "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
8 "https://checkstyle.org/dtds/suppressions_1_2.dtd">
9<suppressions>
10 <suppress files="[/\\]target[/\\]generated-sources[/\\]" checks=".*"/>
11</suppressions>
diff --git a/buildstuffs/src/main/resources/lv/enes/buildstuffs/checkstyle.xml b/buildstuffs/src/main/resources/lv/enes/buildstuffs/checkstyle.xml
new file mode 100644
index 0000000..6680d5d
--- /dev/null
+++ b/buildstuffs/src/main/resources/lv/enes/buildstuffs/checkstyle.xml
@@ -0,0 +1,223 @@
1<?xml version="1.0"?>
2<!--
3 SPDX-License-Identifier: AGPL-3.0-or-later
4 SPDX-FileCopyrightText: 2025 Uko Kokņevičs <perkontevs@gmail.com>
5 -->
6<!DOCTYPE module PUBLIC
7 "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
8 "https://checkstyle.org/dtds/configuration_1_3.dtd">
9<module name="Checker">
10 <!-- Last Updated for 10.21.3 -->
11
12 <property name="charset" value="UTF-8"/>
13 <property name="severity" value="error"/>
14
15 <!-- Exclude all 'module-info.java' files -->
16 <module name="BeforeExecutionExclusionFileFilter">
17 <property name="fileNamePattern" value="module\-info\.java$"/>
18 </module>
19
20 <!-- ## Headers ## -->
21 <!-- No Header -->
22 <!-- No RegexpHeader, TODO -->
23
24 <!-- ## Miscellaneous ## -->
25 <module name="NewlineAtEndOfFile" />
26 <module name="OrderedProperties" />
27 <module name="Translation" />
28 <module name="UniqueProperties" />
29
30 <!-- ## Filters ## -->
31 <module name="SuppressWarningsFilter" />
32
33 <module name="TreeWalker">
34 <!-- ## Filters ## -->
35 <module name="SuppressionCommentFilter" />
36
37 <!-- ## Annotations ## -->
38 <module name="AnnotationLocation" />
39 <!-- NO AnnotationOnSameLine -->
40 <module name="AnnotationUseStyle" />
41 <module name="MissingDeprecated" />
42 <module name="MissingOverride" />
43 <module name="PackageAnnotation" />
44 <!-- NO SuppressWarnings -->
45 <module name="SuppressWarningsHolder" />
46
47 <!-- ## Block Checks ## -->
48 <module name="AvoidNestedBlocks">
49 <property name="allowInSwitchCase" value="true" />
50 </module>
51 <module name="EmptyBlock" />
52 <module name="EmptyCatchBlock" />
53 <module name="LeftCurly">
54 <property name="ignoreEnums" value="false" />
55 </module>
56 <module name="NeedBraces" />
57 <module name="RightCurly" />
58
59 <!-- ## Class Design ## -->
60 <!-- No DesignForExtension -->
61 <module name="FinalClass" />
62 <module name="HideUtilityClassConstructor" />
63 <module name="InnerTypeLast" />
64 <module name="InterfaceIsType" />
65 <module name="MutableException" />
66 <module name="OneTopLevelClass" />
67 <!-- No ThrowsCount -->
68 <module name="VisibilityModifier">
69 <property name="allowPublicImmutableFields" value="true" />
70 <property name="immutableClassCanonicalNames"
71 value="java.io.File, java.lang.Boolean, java.lang.Byte, java.lang.Character, java.lang.Double,
72 java.lang.Float, java.lang.Integer, java.lang.Long, java.lang.Short, java.lang.StackTraceElement,
73 java.lang.String, java.math.BigDecimal, java.math.BigInteger, java.net.Inet4Address,
74 java.net.Inet6Address, java.net.InetSocketAddress, java.net.URI, java.net.URL, java.util.Locale,
75 java.util.UUID" />
76 <property name="protectedAllowed" value="true" />
77 </module>
78
79 <!-- ## Coding ## -->
80 <module name="ArrayTrailingComma" />
81 <module name="AvoidDoubleBraceInitialization" />
82 <!-- No AvoidInlineConditionals -->
83 <module name="AvoidNoArgumentSuperConstructorCall" />
84 <module name="ConstructorsDeclarationGrouping" />
85 <module name="CovariantEquals" />
86 <!--
87 NOTE: I personally disagree with the "standard" declaration order of
88 1. static fields
89 2. non-static fields
90 3. constructors
91 4. methods
92
93 I would put public static methods between 1 & 2, but alas. Maybe one day I'll go and change this heh.
94 -->
95 <module name="DeclarationOrder" />
96 <module name="DefaultComesLast" />
97 <module name="EmptyStatement" />
98 <module name="EqualsAvoidNull" />
99 <module name="EqualsHashCode" />
100 <!-- No ExplicitInitialization -->
101 <module name="FallThrough" />
102 <!-- No FinalLocalVariable -->
103 <module name="HiddenField">
104 <property name="ignoreConstructorParameter" value="true" />
105 <property name="ignoreSetter" value="true" />
106 <property name="setterCanReturnItsClass" value="true" />
107 <property name="ignoreAbstractMethods" value="true" />
108 </module>
109 <!-- NO IllegalCatch -->
110 <module name="IllegalInstantiation">
111 <property name="classes"
112 value="java.lang.Boolean, java.lang.Integer" />
113 </module>
114 <module name="IllegalThrows" />
115 <module name="IllegalToken" />
116 <!-- No IllegalTokenText -->
117 <module name="IllegalType" />
118 <module name="InnerAssignment" />
119 <module name="MagicNumber" />
120 <!-- No MatchXPath -->
121 <!-- No MissingCtor -->
122 <module name="MissingSwitchDefault" />
123 <module name="ModifiedControlVariable" />
124 <!-- No MultipleStringLiterals -->
125 <module name="MultipleVariableDeclarations" />
126 <!-- No NestedForDepth -->
127 <!-- No NestedIfDepth -->
128 <!-- No NestedTryDepth -->
129 <!-- No NoArrayTrailingComma -->
130 <module name="NoClone" />
131 <!-- No NoEnumTrailingComma -->
132 <module name="NoFinalizer" />
133 <module name="OneStatementPerLine">
134 <property name="treatTryResourcesAsStatement" value="true" />
135 </module>
136 <module name="OverloadMethodsDeclarationOrder" />
137 <module name="PackageDeclaration" />
138 <module name="ParameterAssignment" />
139 <module name="RequireThis" />
140 <!-- No ReturnCount -->
141 <module name="SimplifyBooleanExpression" />
142 <module name="SimplifyBooleanReturn" />
143 <module name="StringLiteralEquality" />
144 <!-- No SuperClone -->
145 <!-- No SuperFinalize -->
146 <module name="UnnecessaryParentheses" />
147 <module name="UnnecessarySemicolonAfterOuterTypeDeclaration" />
148 <module name="UnnecessarySemicolonAfterTypeMemberDeclaration" />
149 <module name="UnnecessarySemicolonInEnumeration" />
150 <module name="UnnecessarySemicolonInTryWithResources" />
151 <module name="UnusedCatchParameterShouldBeUnnamed" />
152 <module name="UnusedLambdaParameterShouldBeUnnamed" />
153 <module name="UnusedLocalVariable" />
154 <module name="VariableDeclarationUsageDistance" />
155 <module name="WhenShouldBeUsed" />
156
157 <!-- ## Imports ## -->
158 <module name="AvoidStarImport">
159 <property name="allowStaticMemberImports" value="true" />
160 </module>
161 <!-- No AvoidStaticImport -->
162 <!-- No CustomImportOrder -->
163 <module name="IllegalImport" />
164 <!-- No ImportControl -->
165 <module name="ImportOrder">
166 <property name="groups" value="/^java\./,javax,jakarta" />
167 <property name="option" value="bottom" />
168 <property name="separated" value="true" />
169 <property name="sortStaticImportsAlphabetically" value="true" />
170 </module>
171 <module name="RedundantImport" />
172 <module name="UnusedImports">
173 <property name="processJavadoc" value="false" />
174 </module>
175
176 <!-- ## TODO: Javadoc ## -->
177
178 <!-- ## NO Metrics ## -->
179
180 <!-- ## Modifiers ## -->
181 <!-- NO ClassMemberImpliedModifier -->
182 <!-- NO InterfaceMemberImpliedModifier -->
183 <module name="ModifierOrder" />
184 <!-- No RedundantModifier -->
185
186 <!-- ## NO Naming Conventions ## -->
187
188 <!-- ## Regexp ## -->
189 <module name="RegexpSinglelineJava">
190 <property name="format" value="^\t*[ ]+.*\t"/>
191 <property name="message" value="Tabs should only be at the start of the line!"/>
192 </module>
193
194 <!-- ## NO Size Violations ## -->
195
196 <!-- ## TODO: Whitespace ## -->
197
198 <!-- ## Miscellaneous ## -->
199 <module name="ArrayTypeStyle" />
200 <module name="AvoidEscapedUnicodeCharacters" />
201 <module name="CommentsIndentation" />
202 <!-- No DescendantToken -->
203 <!-- No FinalParameters -->
204 <module name="Indentation">
205 <property name="arrayInitIndent" value="8"/>
206 <property name="basicOffset" value="8"/>
207 <property name="braceAdjustment" value="0"/>
208 <property name="caseIndent" value="8"/>
209 <property name="forceStrictCondition" value="false"/>
210 <property name="lineWrappingIndentation" value="4"/>
211 <property name="throwsIndent" value="8"/>
212 </module>
213 <module name="NoCodeInFile" />
214 <module name="OuterTypeFilename" />
215 <!-- No TodoComment -->
216 <!-- No TrailingComment -->
217 <module name="UncommentedMain">
218 <property name="excludedClasses" value="Main$" />
219 </module>
220 <module name="UpperEll" />
221
222 </module>
223</module>
diff --git a/buildstuffs/src/main/resources/lv/enes/buildstuffs/pmd-rules.xml b/buildstuffs/src/main/resources/lv/enes/buildstuffs/pmd-rules.xml
new file mode 100644
index 0000000..796611e
--- /dev/null
+++ b/buildstuffs/src/main/resources/lv/enes/buildstuffs/pmd-rules.xml
@@ -0,0 +1,126 @@
1<?xml version="1.0"?>
2<!--
3 SPDX-License-Identifier: AGPL-3.0-or-later
4 SPDX-FileCopyrightText: 2025 Uko Kokņevičs <perkontevs@gmail.com>
5 -->
6<ruleset name="Custom Rules"
7 xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
8 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9 xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0
10 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
11 <description>
12 My Custom Ruleset.
13 </description>
14
15 <rule ref="category/java/bestpractices.xml">
16 <exclude name="UnitTestAssertionsShouldIncludeMessage" />
17 <exclude name="UnitTestContainsTooManyAsserts" />
18 </rule>
19 <rule ref="category/java/bestpractices.xml/UnitTestContainsTooManyAsserts">
20 <properties>
21 <property name="maximumAsserts" value="3" />
22 </properties>
23 </rule>
24
25 <rule ref="category/java/codestyle.xml">
26 <exclude name="AtLeastOneConstructor" />
27 <exclude name="BooleanGetMethodName" />
28 <exclude name="CallSuperInConstructor" />
29 <exclude name="CommentDefaultAccessModifier" />
30 <exclude name="LinguisticNaming" />
31 <exclude name="LocalVariableCouldBeFinal" />
32 <exclude name="LongVariable" />
33 <exclude name="MethodArgumentCouldBeFinal" />
34 <exclude name="MethodNamingConventions" />
35 <exclude name="OnlyOneReturn" />
36 <exclude name="ShortClassName" />
37 <exclude name="ShortMethodName" />
38 <exclude name="ShortVariable" />
39 <exclude name="TooManyStaticImports" />
40 <exclude name="UnnecessaryFullyQualifiedName" />
41 <exclude name="UseExplicitTypes" />
42 </rule>
43 <rule ref="category/java/codestyle.xml/BooleanGetMethodName">
44 <properties>
45 <property name="checkParameterizedMethods" value="true" />
46 </properties>
47 </rule>
48 <rule ref="category/java/codestyle.xml/CommentDefaultAccessModifier">
49 <properties>
50 <property name="regex" value="\/\*\s*package\s*\*\/" />
51 </properties>
52 </rule>
53 <rule ref="category/java/codestyle.xml/LinguisticNaming">
54 <properties>
55 <!-- It's allowed for setters to return the object itself -->
56 <property name="checkSetters" value="false" />
57 </properties>
58 </rule>
59 <rule ref="category/java/codestyle.xml/MethodNamingConventions">
60 <properties>
61 <property name="nativePattern" value="native[A-Z0-9][a-zA-Z0-9]*" />
62 <property name="junit3TestPattern" value="test[A-Z0-9][a-zA-Z0-9]*" />
63 <property name="junit4TestPattern" value="test[A-Z0-9][a-zA-Z0-9]*" />
64 <property name="junit5TestPattern" value="test[A-Z0-9][a-zA-Z0-9]*" />
65 </properties>
66 </rule>
67 <rule ref="category/java/codestyle.xml/UnnecessaryFullyQualifiedName">
68 <properties>
69 <property name="reportStaticMethods" value="false" />
70 </properties>
71 </rule>
72
73 <rule ref="category/java/design.xml">
74 <!-- TODO: -->
75 <exclude name="AvoidThrowingRawExceptionTypes" />
76 <exclude name="CyclomaticComplexity" />
77 <exclude name="ExcessiveImports" />
78 <exclude name="LawOfDemeter" />
79 <exclude name="LoosePackageCoupling" />
80 <exclude name="NcssCount" />
81 <exclude name="SignatureDeclareThrowsException" />
82 <exclude name="TooManyMethods" />
83 </rule>
84
85 <rule ref="category/java/documentation.xml">
86 <exclude name="CommentContent" />
87 <!-- TODO: Start using javadoc :) -->
88 <exclude name="CommentRequired" />
89 <exclude name="CommentSize" />
90 </rule>
91 <rule ref="category/java/documentation.xml/CommentSize">
92 <properties>
93 <property name="maxLineLength" value="120" />
94 </properties>
95 </rule>
96
97 <rule ref="category/java/errorprone.xml">
98 <exclude name="AvoidLiteralsInIfCondition" />
99 <exclude name="AvoidUsingOctalValues" />
100 <exclude name="CallSuperFirst" />
101 <exclude name="CallSuperLast" />
102 <exclude name="CloseResource" />
103 <exclude name="NonSerializableClass" />
104 </rule>
105 <rule ref="category/java/errorprone.xml/AvoidUsingOctalValues">
106 <properties>
107 <property name="strict" value="true" />
108 </properties>
109 </rule>
110 <rule ref="category/java/errorprone.xml/NonSerializableClass">
111 <properties>
112 <property name="checkAbstractTypes" value="true" />
113 </properties>
114 </rule>
115
116 <rule ref="category/java/multithreading.xml">
117 <exclude name="DoNotUseThreads" />
118 <exclude name="UseConcurrentHashMap" />
119 </rule>
120
121 <rule ref="category/java/performance.xml">
122 <exclude name="RedundantFieldInitializer" />
123 </rule>
124
125 <rule ref="category/java/security.xml" />
126</ruleset>
diff --git a/buildstuffs/src/main/resources/lv/enes/buildstuffs/spotbugs-exclude.xml b/buildstuffs/src/main/resources/lv/enes/buildstuffs/spotbugs-exclude.xml
new file mode 100644
index 0000000..65f2d8d
--- /dev/null
+++ b/buildstuffs/src/main/resources/lv/enes/buildstuffs/spotbugs-exclude.xml
@@ -0,0 +1,46 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 SPDX-License-Identifier: AGPL-3.0-or-later
4 SPDX-FileCopyrightText: 2025 Uko Kokņevičs <perkontevs@gmail.com>
5 -->
6<FindBugsFilter xmlns="https://github.com/spotbugs/filter/4.8.4"
7 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8 xsi:schemaLocation="https://github.com/spotbugs/filter/4.8.4
9 https://raw.githubusercontent.com/spotbugs/spotbugs/4.8.4/spotbugs/etc/findbugsfilter.xsd">
10 <!-- Auto-generated -->
11 <Match>
12 <Source name="HelpMojo.java" />
13 </Match>
14
15 <!-- Finalizer attacks... Don't use finalizers. -->
16 <Match>
17 <Bug pattern="CT_CONSTRUCTOR_THROW" />
18 </Match>
19
20 <!-- Malicious code vulnerabilities. Why are you running untrusted code? -->
21 <Match>
22 <Or>
23 <Bug pattern="EI_EXPOSE_REP" />
24 <Bug pattern="EI_EXPOSE_REP2" />
25 <Bug pattern="MS_EXPOSE_REP" />
26 </Or>
27 </Match>
28
29 <!-- This is a good check but Lombok's @Getter(lazy=true) generates code violating it :/ -->
30 <Match>
31 <Bug pattern="JLM_JSR166_UTILCONCURRENT_MONITORENTER" />
32 </Match>
33
34 <!-- Nullness should get caught by checkerframework. Silencing here because Lombok generates them. -->
35 <Match>
36 <Or>
37 <Bug code="RCN" />
38 <Bug pattern="NP_NONNULL_RETURN_VIOLATION" />
39 </Or>
40 </Match>
41
42 <!-- Catch fallthrough with other tools which allow annotating accepted cases more easily -->
43 <Match>
44 <Bug pattern="SF_SWITCH_FALLTHROUGH" />
45 </Match>
46</FindBugsFilter>