pmd / pmd/pmd-eclipse-plugin

Error activating / deactivating rules with the same name

Open
#170 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
99
Forks
42
Avg merge
20h 19m
Merged PRs (30d)
19

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Eclipse's PMD Rule Configuration and inspect the Eclipse preference files where activated rules are stored. Reproduce the Java/Ecmascript same-name rule case, then verify that language-specific activation and deactivation persist after applying settings and rebuilding, without reporting violations for the deactivated rule.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.