Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for marking violations with high enough priority as errors #2

Open
eclipse-pmd opened this issue Mar 29, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@eclipse-pmd
Copy link
Owner

From eclipse-pmd created by ddekany: acanda#19

Starting from a workspace scope configurable PMD rule priority, the Eclipse marker should be error instead of warning. (Use case: At my current employer SVN will block commits with violations with priority <= 2. Hence, developers should see them as errors in Eclipse. I guess this isn't an uncommon practice, and right now this is why they still stick with the other messy PMD plugin.)

@eclipse-pmd eclipse-pmd added the enhancement New feature or request label Mar 29, 2020
@eclipse-pmd
Copy link
Owner Author

Any updates here? I see this hasn't been addressed in a couple years and wondering if there was any idea to move forward on this. I personally don't have the eclipse-plugin experience to do so which is why I ask.

@sratz @acanda any thoughts?

@eclipse-pmd
Copy link
Owner Author

In my opinion PMD issues are warnings not errors. Errors prevent an application from working correctly, e.g. compile errors or bugs. PMD finds design issues which make the code more complicated than necessary or harder to extend in the future. Even if you do not fix the PMD issues right away your application will most likely run and work correctly.

This is my opinion of course and is the reason why I have not addressed this issue yet. However, I am not opposed to include this feature if someone were to send a pull request. Unfortunately I have very limited time to work on eclipse-pmd and this simply is not a high priority.

@eclipse-pmd
Copy link
Owner Author

Since eclipse-pmd supports multiple rulesets, and we use this feature, a simple idea is to set the priority at the ruleset level in eclipse-pmd when adding a ruleset to eclipse-pmd.

Not everyone splits the rulesets accordingly, but hopefully this is an easy first implementation (it's "good enough" for us! :-) (we have "build fail" rules and "the rest", so the "build fail" rules need to have error priority)

@eclipse-pmd
Copy link
Owner Author

I finally finished fixing all of the PMD warnings in a project I am working on. I would like to never merge a code change that leaves a PMD warning. Hence, I would like to have the PMD warnings be marked as errors. If a PMD warning/error shows up in a file I am editing, then I will fix the problem. If a PMD warning/error shows up in another file due to code changes in a file I am editing, then I might miss it. At least, an error will cause Eclipse to prompt me before running the project. Warnings may go unnoticed.

@eclipse-pmd
Copy link
Owner Author

The PMD page on the severity levels indicates that level 1 is to be used to indicate critical broken / buggy code so it wouldn't be unusual, I think, to flag these at the error level instead of warning. In terms of a pull request, I would think we'd need to retain current behavior but add a maximum severity level that should be treated as an error - defaulted to 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant