-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Description
Checkstyle allows configuring the same check multiple times with different IDs and configurations. For example:
<module name="TreeWalker">
<!-- Strict check for production code -->
<module name="FinalLocalVariableCheck">
<property name="id" value="strict"/>
<property name="validateEnhancedForLoopVariable" value="true"/>
</module>
<!-- Lenient check for test code -->
<module name="FinalLocalVariableCheck">
<property name="id" value="lenient"/>
<property name="validateEnhancedForLoopVariable" value="false"/>
</module>
</module>Current Behavior
- Maps checks by their
CheckstyleCheckenum value (class name only), ignoring theidattribute - Overwrites previous configurations when multiple instances of the same check exist
- Groups all violations from the same check type together, regardless of which check instance reported them
This means violations from strict and lenient are:
- Treated as the same check
- Fixed using only the last loaded configuration
- Cannot be distinguished or fixed differently
Expected Behavior
- Preserve the
idattribute for each check instance - Store multiple configurations for the same check type (keyed by ID)
- Match violations to their specific check instance using the
idfrom the report - Apply the correct configuration when fixing violations from each instance
Starting Point
- Change
CheckstyleCheckenum or create a new identity class that includes both check type and ID - Update
ConfigurationLoaderto preserve multiple instances with their IDs - Update parsers (XML/SARIF) to extract the check ID from violation reports
- Update
CheckstyleRecipeRegistryto match violations to the correct check instance
Metadata
Metadata
Assignees
Labels
No labels