GeezerVison is showing github.com — [apex] Fix for #3568 - Added new configuration properties reportEmptyPrivateNoArgConstructor and reportEmptyVirtualMethod to EmptyStatementBlock by SCWells72 · Pull Request #3573 · pmd/pmd
Conversation
SCWells72
commented
Oct 20, 2021
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Describe the PR
Added two new configuration properties to the Apex EmptyStatementBlock rule:
reportEmptyPrivateNoArgConstructor that when set to false ignores empty private no-arg constructors that are commonly used in singleton pattern implementations and utility classes in support of prescribed best practices.
reportEmptyVirtualMethod that when set to false ignores empty virtual methods that are commonly used in abstract base classes as default no-op implementations when derived classes typically only override a subset of virtual methods.
Note that I had to add ASTModifierNode#isVirtual to expose usage of the virtual modifier for use in XPath-based rules, and I had to update the SafeNavigationOperator.txt snapshot to include @Virtual = false in all ModifierNode tree nodes.
Related issues
Ready?
- Added unit tests for fixed bug/feature
- Passing all unit tests
- Complete build
./mvnw clean verify passes (checked automatically by github actions)
- Added (in-code) documentation (if needed)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…oArgConstructor', that if set to false (default is true if unspecified) doesn't report an issue for empty private no-arg constructors that are commonly used in singleton and utility class implementations according to respective best practices.
…ethod', that if set to false (default is true if unspecified) doesn't report an issue for empty virtual methods that are commonly used in abstract base classes as default no-op implementations when partial override/specialization is typical in derived classes.
SCWells72
changed the title
[apex] Fix for #3558 - Added new configuration properties reportEmptyPrivateNoArgConstructor and reportEmptyVirtualMethod to EmptyStatementBlock
[apex] Fix for #3568 - Added new configuration properties reportEmptyPrivateNoArgConstructor and reportEmptyVirtualMethod to EmptyStatementBlock
Oct 20, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You rock @SCWells72. Thanks for adding all those pragmatic, less-effort, and backward-compatible changes to PMD Apex. I looked at all of them and can wholeheartedly approve them BUT as approving is merging and kicking of a few processes I want to wait for feedback from @oowekyala / @adangel.
- How should we proceed here and the other PRs by Scott?
- Merge and plan in for the next Minor?
- Should @SCWells72 add a PR to describe the changes in the Documentation repo as well?
- Or 7.0 as we add params to existing rules? I would hope to get all those changes out sooner than 7.0.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
rsoesemann
left a comment
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
1 Message
|
| 📖 |
No java rules are changed! |
Generated by 🚫 Danger
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SCWells72 can you also add documentation changes to the same PR?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
SCWells72
commented
Oct 22, 2021
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
@rsoesemann Based on the discussions in other PRs, it seems like this one is already whole as it contains the following in the actual rule definition XML:
<property name="reportEmptyPrivateNoArgConstructor" type="Boolean" value="true" description="If false, empty private no-arg constructors are not flagged. This supports a common idiom used by singleton pattern implementations, utility classes, etc."/>
<property name="reportEmptyVirtualMethod" type="Boolean" value="true" description="If false, empty virtual methods are not flagged. This supports abstract base classes with default no-op implementations."/>
That should be used in the auto-generated documentation, correct? Or is there something else I need to add for documentation?
|
rsoesemann reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
adangel
adangel approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|