This repository has been archived on 2026-05-29. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Programmierprojekt/config/checkstyle/checkstyle.xml
T
Lars Simon Winzer e1500845eb Remove: Indentation module, as Checkstyle can not match Spotless
Explanation: Spotless uses the context to calculate the required indentation
2026-03-18 17:41:38 +01:00

171 lines
7.2 KiB
XML

<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<!-- Fail build if checkstyle finds violations -->
<!-- https://checkstyle.sourceforge.io/config.html#Properties_1 -->
<property name="severity" value="error"/>
<!-- Only check java files -->
<!-- https://checkstyle.sourceforge.io/config.html#Properties_1 -->
<property name="fileExtensions" value="java"/>
<module name="SuppressionFilter">
<property name="file" value="${suppressionFile}"/>
</module>
<!-- Only allow spaces -->
<!-- https://checkstyle.sourceforge.io/checks/whitespace/filetabcharacter.html -->
<module name="FileTabCharacter"/>
<!-- Maximale Zeilenlänge (AOSP enforces 100 lines, the Google Java Style Guide 80)-->
<!-- https://checkstyle.sourceforge.io/checks/sizes/linelength.html -->
<module name="LineLength">
<property name="max" value="100"/>
</module>
<module name="TreeWalker">
<!-- Allows for emptylines BETWEEN methods and classes but DISALLOWS newlines after an opening bracket -->
<!-- https://checkstyle.sourceforge.io/checks/whitespace/emptylineseparator.html -->
<module name="EmptyLineSeparator">
<property name="allowNoEmptyLineBetweenFields" value="true"/>
<property name="tokens" value="
METHOD_DEF,
CTOR_DEF,
STATIC_INIT,
INSTANCE_INIT,
CLASS_DEF,
INTERFACE_DEF,
ENUM_DEF
"/>
</module>
<!-- No wildcard imports (import x.*) -->
<!-- https://checkstyle.sourceforge.io/checks/imports/avoidstarimport.html -->
<module name="AvoidStarImport"/>
<!-- No unused imports -->
<!-- https://checkstyle.sourceforge.io/checks/imports/unusedimports.html -->
<module name="UnusedImports"/>
<!-- No unordered / ungrouped imports -->
<!-- https://checkstyle.sourceforge.io/checks/imports/importorder.html -->
<module name="ImportOrder">
<property name="option" value="top"/>
<property name="groups" value="/^import static\..+/,*"/>
<property name="separated" value="true"/>
<property name="separatedStaticGroups" value="true"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
</module>
<!-- Classes, enums, records, ... as PascalCase -->
<!-- https://checkstyle.sourceforge.io/checks/naming/typename.html -->
<module name="TypeName"/>
<!-- Method names as camelCase -->
<!-- https://checkstyle.sourceforge.io/checks/naming/methodname.html -->
<module name="MethodName"/>
<!-- Parameter names as camelCase -->
<!-- https://checkstyle.sourceforge.io/checks/naming/parametername.html -->
<module name="ParameterName"/>
<!-- Lokal variables as camelCase -->
<!-- https://checkstyle.sourceforge.io/checks/naming/localvariablename.html -->
<module name="LocalVariableName"/>
<!-- Constants as UPPER_SNAKE_CASE -->
<!-- https://checkstyle.sourceforge.io/checks/naming/constantname.html -->
<module name="ConstantName"/>
<!-- Field names as camelCase -->
<!-- https://checkstyle.sourceforge.io/checks/naming/membername.html -->
<module name="MemberName">
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
</module>
<!-- Restrict length of method name -->
<!-- https://checkstyle.sourceforge.io/checks/sizes/methodlength.html -->
<module name="MethodLength">
<property name="max" value="60"/>
<property name="countEmpty" value="false"/>
</module>
<!-- Restrict number of parameters -->
<!-- https://checkstyle.sourceforge.io/checks/sizes/parameternumber.html -->
<module name="ParameterNumber">
<property name="max" value="5"/>
</module>
<!-- Modifier-Reihenfolge: public static final ... -->
<!-- https://checkstyle.sourceforge.io/checks/modifier/modifierorder.html -->
<module name="ModifierOrder"/>
<!-- Require braces arround code block (no single instruction after if/else/while/...)-->
<!-- https://checkstyle.sourceforge.io/checks/blocks/needbraces.html -->
<module name="NeedBraces"/>
<!-- Require the left curly braces at the same line -->
<!-- https://checkstyle.sourceforge.io/checks/blocks/leftcurly.html -->
<module name="LeftCurly"/>
<!-- Require right curly braces at the same line as following instructions -->
<!-- https://checkstyle.sourceforge.io/checks/blocks/rightcurly.html -->
<module name="RightCurly"/>
<!-- Disallow empty code blocks -->
<!-- https://checkstyle.sourceforge.io/checks/blocks/emptyblock.html -->
<module name="EmptyBlock">
<property name="option" value="text"/>
</module>
<!-- Disallow empty code blocks after catch -->
<!-- https://checkstyle.sourceforge.io/checks/blocks/emptycatchblock.html -->
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="expected|ignored"/>
</module>
<!-- Require string literals to be compared with .equals and not == -->
<!-- https://checkstyle.sourceforge.io/checks/coding/stringliteralequality.html -->
<module name="StringLiteralEquality"/>
<!-- Disallow standalone numbers in code -->
<!-- https://checkstyle.sourceforge.io/checks/coding/magicnumber.html -->
<module name="MagicNumber">
<property name="ignoreNumbers" value="-1, 0, 1, 2"/>
<property name="ignoreAnnotation" value="true"/>
</module>
<!-- Disallow nested code blocks dangling in code -->
<!-- https://checkstyle.sourceforge.io/checks/blocks/avoidnestedblocks.html -->
<module name="AvoidNestedBlocks"/>
<!-- Disallow System.out.println -->
<!-- https://checkstyle.sourceforge.io/checks/regexp/regexp.html -->
<module name="Regexp">
<property name="id" value="SystemOutErr"/>
<property name="format" value="System\.(out|err)\.print"/>
<property name="illegalPattern" value="true"/>
<property name="message" value="No `System.out.print(err)` allowed — use a logger."/>
</module>
<!-- Disallow whitespace before semicolon or bracket -->
<!-- https://checkstyle.sourceforge.io/checks/whitespace/nowhitespacebefore.html -->
<module name="NoWhitespaceBefore"/>
<!-- Disallow whitespace after code -->
<!-- https://checkstyle.sourceforge.io/checks/whitespace/whitespaceafter.html -->
<module name="WhitespaceAfter"/>
<!-- No trailing whitespace at line ending -->
<!-- https://checkstyle.sourceforge.io/checks/regexp/regexp.html -->
<module name="Regexp">
<property name="format" value=" +$"/>
<property name="illegalPattern" value="true"/>
<property name="message" value="No trailing whitespace."/>
</module>
</module>
</module>