NIFI-14073 Add PMD Plugin to contrib-check Profile#9581
NIFI-14073 Add PMD Plugin to contrib-check Profile#9581exceptionfactory wants to merge 1 commit intoapache:mainfrom
Conversation
- Added standard PMD rules scoped to current project conventions - Updated multiple classes to meet UseDiamondOperator rule requirements - Applied selected SuppressWarnings to selected classes - Streamlined ci-workflow build to avoid unnecessary exclusions - Refactored assembly module phases to align with standard lifecycle behavior
|
@dan-s1 Thanks for your recent working on standardizing use of the diamond operator for generic types. I included the UseDiamondOperator rule in the list of PMD rules, which enforces standardized usage. Adding the PMD plugin to the set of tools for evaluation will avoid regressions in this and other areas. |
pvillard31
left a comment
There was a problem hiding this comment.
Thanks for the changes @exceptionfactory, great addition for maintaining good code quality.
@exceptionfactory Thank you for the including this and thank you for contributing this PR to introduce the enforcement of these standard rules. It certainly brings an increased rigor to the code. |
|
@dan-s1 For reference, here is the default ruleset configuration for the Maven PMD plugin: Most of the removed rulesets relate to unused elements and unnecessary syntax. Removing unused values involves code changes in cases that may impact behavior, so that was the reason for removing some of those rules. Removing unnecessary syntax should be safer in general, but touches more files. Now that the PMD check is part of the main branch, we can certainly consider adding some of these rulesets on a case-by-case basis. |
Summary
NIFI-14073 Adds the Maven PMD Plugin to the set of plugins run as part of the
contrib-checkprofile for verifying correctness and style of code changes.The PMD project augments existing code style evaluation from Checkstyle and introduces tuned analysis rules for catching common problems.
Thanks to recent efforts to cleanup and standardize code across the repository, the changes in this pull request are limited to bringing a handful of classes in line with common rules. Most of these changes involve removing or annotating unused private fields, and bringing consistency to the use of generic types.
The plugin configuration uses the
pmd-ruleset.xml, which is based on the default set of rules, but removes some that would have involved too many changes to existing code. The PMD configuration excludes code generated from ANTLR and JAXB plugins from evaluation.Additional changes include simplifying the Maven options for the GitHub
ci-workflow, removing the need for selective exclusion of certain modules. These adjustments make it easier to run thepmd:checkgoal without a large number of module exclusions.Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000NIFI-00000Pull Request Formatting
mainbranchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
mvn clean install -P contrib-checkLicensing
LICENSEandNOTICEfilesDocumentation