Bukama commented on issue #608:
URL: 
https://github.com/apache/maven-checkstyle-plugin/issues/608#issuecomment-7349009100

   I analysed this with AI and the following comment was generated by it:
   
   ---
   
   I could reproduce this with the current master, and it is indeed a plugin 
issue, not a Checkstyle one.
   
   ### Cause
   
   To fill the *Rules* section, the report counts the violations of every 
configured module by comparing the module name from the configuration with the 
rule name derived from the violation's source (`RuleUtil.getName()`). That rule 
name is always the **simple class name without the `Check` suffix**, e.g. 
`ForbiddenWord`.
   
   Custom checks are usually configured by their **fully qualified class 
name**, e.g.
   
   ```xml
   <module name="com.example.checks.ForbiddenWordCheck"/>
   ```
   
   so the two names never match. The module ends up with 0 violations, and 
since rules without violations are intentionally not listed, it disappears from 
the Rules section, while its violations still show up in the Details section.
   
   The same happens for built-in checks configured with the Check suffix (e.g. 
`FileTabCharacterCheck`). For those, the link to the Checkstyle documentation 
was also broken (`filetabcharactercheck.html`).
   
   **Fix**
   
   The configured name is now normalized the same way as the violation's source 
before comparing them, and the documentation link is built from the normalized 
name. The rule is still displayed with the name as written in the 
configuration, so the reader can see how the check was configured, together 
with its properties.
   
   A new report scenario test configures a custom check (twice, with different 
properties and severities) by its fully qualified class name, plus a built-in 
check with the Check suffix, and asserts that all of them are listed in the 
Rules section with their properties, violation counts and correct documentation 
link. The test fails without the fix.
   
   **Not changed**
   
   - Rules without violations are still not listed in the Rules section. This 
is the existing, intended behavior and not specific to custom checks.
   - If the same check is configured several times and one configuration has no 
explicit severity, that row also counts the violations of the other 
configurations. This is the known limitation mentioned in 
[MCHECKSTYLE-365](https://github.com/apache/maven-checkstyle-plugin/issues/277) 
and is not addressed here.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to