Repository navigation
feat: report Java deep nesting from PMD - #161
Closed
renanfranca wants to merge 1 commit into
Closed
renanfranca wants to merge 1 commit into
renanfranca wants to merge 1 commit into
Conversation
Collaborator
|
PR merged! Thanks for making the review easy :) |
Contributor
Author
I am glad that you enjoyed, I'll keep that way. Thank you 😀👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this changes
Java projects can now report the existing
deep-nestingsmell through PMD'sAvoidDeeplyNestedIfStmtsrule.
Projects without their own PMD ruleset receive the rule from the bundled
fallback. A project-owned ruleset remains authoritative and is never combined
with the bundled one.
Why
problemDepth=3The bundled ruleset pins
problemDepth=3: the first and second nestedifstatements are accepted, and the third is reported.
Although
3is currently PMD's default, keeping it explicit prevents a futurePMD release from silently changing Habit Hooks behavior.
This deliberately does not try to match TypeScript's
max-depth: 4numerically. PMD counts nested
ifstatements specifically;for,while,try, and other blocks do not increase this depth. The two plugins thereforekeep deterministic contracts that reflect what their underlying tools measure.
Why the documentation and tests changed
The smell vocabulary previously described
deep-nestingas TypeScript-only.It now records Java support and the PMD rule-to-smell mapping.
The Java plugin specification is also executable documentation: its examples
run the real
habit-sensors→ Java sensor → PMD path. It now demonstrates thedepth boundary and confirms that project-owned rulesets still take precedence.
Finally, the installed-plugin test includes a nested Java fixture so the built
wheel proves that the bundled ruleset is packaged, active, and able to produce
the canonical finding without access to the source tree.
Verification
Any feedback is very welcome, especially on the
problemDepth=3choice and howthis Java-specific boundary is described.
Closes #160