Skip to content

With --auto-gen-config invalid rule references might be generated #124

@adangel

Description

@adangel

See pmd/pmd#4971 for an example:

The changeset contains a change to file pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/AbstractNamingConventionRule.java, which is not a rule by itself but a base class.

The regression tester however generates a ruleset like that:

[ERROR] Error at target/reports/HEAD/checkstyle/config.xml:8:5
  6|     <rule ref="category/apex/design.xml/CognitiveComplexity"/>
  7|     <rule ref="category/apex/design.xml/CyclomaticComplexity"/>
  8|     <rule ref="category/java/codestyle.xml/AbstractNamingConvention"/>
         ^^^^^ Unable to find referenced rule AbstractNamingConvention; perhaps the rule name is misspelled?

  9|     <rule ref="category/java/codestyle.xml/FieldNamingConventions"/>
 10|     <rule ref="category/java/codestyle.xml/IdenticalCatchBranches"/>
[ERROR] Cannot load ruleset target/reports/HEAD/checkstyle/config.xml: An XML validation error occurred

But a rule "AbstractNamingConvention" doesn't exist...

The result is, that PMD is not executed at all and the diff report shows, that all violations are missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions