-
Notifications
You must be signed in to change notification settings - Fork 9
fix: PMD Parameter Value Parsing #126
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
Conversation
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesFootnotes
|
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.
Pull Request Overview
This PR fixes handling of PMD rule parameters by using default values when explicit values are empty and correctly including properties or emitting a simple <rule/> when no parameters remain. It also removes debug logging for production readiness.
- Use
DefaultwhenValueis empty and skip parameters without any value - Update
generateRuleXMLto emit a self-closing tag if no properties - Clean up stray debug prints in tests
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tools/pmdConfigCreator.go | Apply default parameter values, filter out empty/version, and shorten rules without props |
| tools/pmdConfigCreator_test.go | Add tests for empty vs non-empty parameters, but retain debug prints and a skipped default test |
Comments suppressed due to low confidence (2)
tools/pmdConfigCreator_test.go:5
- The import of "fmt" is only used for debug prints in tests; remove it once debug statements are removed.
import (
"encoding/xml"
+ "fmt"
tools/pmdConfigCreator_test.go:382
- Skipping this test leaves default-value handling unverified; either re-enable it or add a new test to cover the default fallback behavior.
t.Skip("Skipping test related to default values")
tools/pmdConfigCreator_test.go
Outdated
| // Debug output | ||
| fmt.Printf("Generated XML:\n%s\n", obtainedConfig) | ||
|
|
Copilot
AI
May 19, 2025
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.
This debug print of the generated XML should be removed to keep test output clean.
| // Debug output | |
| fmt.Printf("Generated XML:\n%s\n", obtainedConfig) | |
| // (No replacement lines; the debug print is removed entirely) |
tools/pmdConfigCreator_test.go
Outdated
| }, | ||
| } | ||
|
|
||
| fmt.Println("Test input:") |
Copilot
AI
May 19, 2025
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.
Debug logging in this test is no longer needed; consider removing these fmt.Println calls.
9f6183b to
dcbc40b
Compare
dcbc40b to
ce79db8
Compare
Fix PMD Parameter Value Parsing
Issue Description
The PMD configuration generator was incorrectly handling parameter values, resulting in empty or missing properties in the generated XML configuration. Rules that should have included property values were being output without their required properties.
Before Fix (incorrect output):
After Fix (correct output with properties):
Fix
The PMD ruleset generator now correctly includes all parameter values in the generated configuration files.