pmd/pmd-eclipse-plugin

Error activating / deactivating rules with the same name

sfieux opened this issue · 0 comments

Hi, I think I spotted a bug when I try to activate a rule in Java and deactivate the rule with the same name in all other languages.

Tested with Eclipse 4.25.0 (2022-09) and PMD plugin 4.40.0.v20221029

Steps to reproduce:

  • Install PMD Eclipse plugin
  • Import project with Java and Javascript. In my case, the Java is the code I actually want to check, and the Javascript is automatically generated in target directory (Jacoco report in HTML/JS format), I don't want to see violations for
  • Go to Window -> Preferences -> PMD Rule Configuration
  • Activate rules manually: choose to activate AssignmentInOperand for Java and deactivate it for Ecmascript
  • Apply & close, click Yes when it asks for a full rebuild
  • The project sees violations in the Javascript that we just deactivated :'(
  • Reopen Window -> Preferences -> PMD Rule Configuration
  • The Ecmascript rule we just deactivated is now activate again :'(

I played around with Eclipse preference files, it seems that the activated rules are stored just with their names without mentioning the language and without storing the rules properties. This would break when several rules have the same name.

I worked around this bug by ignoring the target folder in the File Filters preference.