Add: Suppressions config for tests
This commit is contained in:
@@ -46,6 +46,10 @@ test {
|
|||||||
|
|
||||||
checkstyle {
|
checkstyle {
|
||||||
toolVersion = '10.21.0'
|
toolVersion = '10.21.0'
|
||||||
|
configFile = file('config/checkstyle/checkstyle.xml')
|
||||||
|
configProperties = [
|
||||||
|
'suppressionFile': file('config/checkstyle/suppressions.xml').absolutePath
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named('jar', Jar) {
|
tasks.named('jar', Jar) {
|
||||||
|
|||||||
@@ -12,6 +12,10 @@
|
|||||||
<!-- https://checkstyle.sourceforge.io/config.html#Properties_1 -->
|
<!-- https://checkstyle.sourceforge.io/config.html#Properties_1 -->
|
||||||
<property name="fileExtensions" value="java"/>
|
<property name="fileExtensions" value="java"/>
|
||||||
|
|
||||||
|
<module name="SuppressionFilter">
|
||||||
|
<property name="file" value="${suppressionFile}"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
<!-- Only allow spaces -->
|
<!-- Only allow spaces -->
|
||||||
<!-- https://checkstyle.sourceforge.io/checks/whitespace/filetabcharacter.html -->
|
<!-- https://checkstyle.sourceforge.io/checks/whitespace/filetabcharacter.html -->
|
||||||
<module name="FileTabCharacter"/>
|
<module name="FileTabCharacter"/>
|
||||||
@@ -141,9 +145,10 @@
|
|||||||
<!-- Disallow System.out.println -->
|
<!-- Disallow System.out.println -->
|
||||||
<!-- https://checkstyle.sourceforge.io/checks/regexp/regexp.html -->
|
<!-- https://checkstyle.sourceforge.io/checks/regexp/regexp.html -->
|
||||||
<module name="Regexp">
|
<module name="Regexp">
|
||||||
|
<property name="id" value="SystemOutErr"/>
|
||||||
<property name="format" value="System\.(out|err)\.print"/>
|
<property name="format" value="System\.(out|err)\.print"/>
|
||||||
<property name="illegalPattern" value="true"/>
|
<property name="illegalPattern" value="true"/>
|
||||||
<property name="message" value="No `System.out.print(err)` in production code — use a logger."/>
|
<property name="message" value="No `System.out.print(err)` allowed — use a logger."/>
|
||||||
</module>
|
</module>
|
||||||
|
|
||||||
<!-- Disallow whitespace before semicolon or bracket -->
|
<!-- Disallow whitespace before semicolon or bracket -->
|
||||||
@@ -159,7 +164,7 @@
|
|||||||
<module name="Regexp">
|
<module name="Regexp">
|
||||||
<property name="format" value=" +$"/>
|
<property name="format" value=" +$"/>
|
||||||
<property name="illegalPattern" value="true"/>
|
<property name="illegalPattern" value="true"/>
|
||||||
<property name="message" value="Kein trailing Whitespace."/>
|
<property name="message" value="No trailing whitespace."/>
|
||||||
</module>
|
</module>
|
||||||
</module>
|
</module>
|
||||||
</module>
|
</module>
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE suppressions PUBLIC
|
||||||
|
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
|
||||||
|
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
|
||||||
|
|
||||||
|
<suppressions>
|
||||||
|
<!-- Allow literal, for example assertEquals(42, life.answer()) -->
|
||||||
|
<suppress checks="MagicNumber" files=".*Test\.java"/>
|
||||||
|
|
||||||
|
<!-- Allow longer method names as the are usually descriptive of the test -->
|
||||||
|
<suppress checks="MethodLength" files=".*Test\.java"/>
|
||||||
|
|
||||||
|
<!-- Allow methods with more parameters -->
|
||||||
|
<suppress checks="ParameterNumber" files=".*Test\.java"/>
|
||||||
|
|
||||||
|
<!-- Allow for System.out.println in tests -->
|
||||||
|
<suppress id="SystemOutErr" files=".*Test\.java"/>
|
||||||
|
|
||||||
|
<!-- Allow wildcard imports (import x.*) -->
|
||||||
|
<suppress checks="AvoidStarImport" files=".*Test\.java"/>
|
||||||
|
|
||||||
|
<!-- Allow for compacter line seperators -->
|
||||||
|
<suppress checks="EmptyLineSeparator" files=".*Test\.java"/>
|
||||||
|
</suppressions>
|
||||||
Reference in New Issue
Block a user