Files
floci/tools/checkstyle/checkstyle.xml
T
TATSUNO “Taz” Yasuhiro e4278a800c chore(style): Enforce no-FQCN rule on new files, existing bad files later (#5094)
* chore: flag unnecessary fully qualified type names with Checkstyle

Use the built-in UnnecessaryFullyQualifiedType check. It allows a
qualified name when another type with the same simple name is used in
the same file.

The 379 files that have such names today are listed in
suppressions.xml, so only new files are checked for now. Remove an
entry once its file is clean.

* docs: drop the written no-FQCN rule now that Checkstyle checks it

* docs: keep the written no-FQCN rule for files Checkstyle still skips

The baselined files are not checked, and the comment that names a clash
is not something the check can enforce.
2026-10-10 09:22:14 -05:00

42 lines
2.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">
<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>
<!-- A qualified name stays allowed when another type with the same simple name is used in the file. -->
<module name="UnnecessaryFullyQualifiedType">
<property name="id" value="NoFqcn"/>
</module>
</module>
</module>