Files
floci/tools/checkstyle/checkstyle.xml
T
David Phillips da6a7dd085 build: enforce Java import order with Checkstyle (#5326)
* style: align Java imports with project guidelines

* build: enforce consistent Java import order

* style: follow IntelliJ import order
2026-10-08 20:50:53 -04:00

38 lines
2.0 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">
<property name="charset" value="UTF-8"/>
<property name="severity" value="error"/>
<!-- config_loc is the directory of this file in IDE plugins. Maven sets it in pom.xml. -->
<module name="SuppressionFilter">
<property name="file" value="${config_loc}/suppressions.xml"/>
</module>
<module name="TreeWalker">
<!-- IntelliJ layout: other imports, javax, java, then static imports. -->
<module name="ImportOrder">
<property name="groups" value="*,javax,java"/>
<property name="ordered" value="true"/>
<property name="separated" value="true"/>
<property name="option" value="bottom"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
</module>
<!-- ImportOrder otherwise requires a blank line between javax and java.
Exempt only that boundary, retaining ordering and other separation checks. -->
<module name="SuppressionXpathSingleFilter">
<property name="checks" value="ImportOrder"/>
<property name="message" value="^'java\..*' should be separated from previous imports\.$"/>
<property name="query"
value="//IMPORT[preceding-sibling::IMPORT[1]//IDENT[@text='javax' and not(preceding-sibling::*)]]"/>
</module>
<!-- Reviewers need the concrete type, such as LinkedHashMap versus Map.
Record pattern components (case Node(var left, var right)) are allowed. -->
<module name="MatchXpath">
<property name="id" value="NoVar"/>
<property name="query" value="//TYPE[IDENT[@text='var']][not(parent::PATTERN_VARIABLE_DEF)]"/>
<message key="matchxpath.match" value="Do not use var. Write the explicit type."/>
</module>
</module>
</module>