-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[POC-FIX-PMD] maven-pmd-plugin
: reactivate PMD
- Best Practices
#2331
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
maven-pmd-plugin
: Reintroduce PMDmaven-pmd-plugin
: reactivate PMD
maven-pmd-plugin
: reactivate PMD
maven-pmd-plugin
: reactivate PMD
as recall from past to fullfill Disabled until projects have been made to comply
maven-pmd-plugin
: reactivate PMD
as recall from past to fullfill Disabled until projects have been made to comply
maven-pmd-plugin
: reactivate PMD
fullfill Disabled until projects have been made to comply
maven-pmd-plugin
: reactivate PMD
fullfill Disabled until projects have been made to comply
maven-pmd-plugin
: reactivate PMD
fullfill Disabled until projects have been made to comply
maven-pmd-plugin
: reactivate PMD
fullfill Disabled until projects have been made to comply
maven-pmd-plugin
: reactivate PMD
fullfill Disabled until projects have been made to comply
maven-pmd-plugin
: reactivate PMD
fullfill Disabled until projects have been made to comply
maven-pmd-plugin
: reactivate PMD
maven-pmd-plugin
: reactivate PMD
maven-pmd-plugin
: reactivate PMD - minimumPriority 1
maven-pmd-plugin
: reactivate PMD - minimumPriority 1
maven-pmd-plugin
: reactivate PMD
- minimumPriority 1
maven-pmd-plugin
: reactivate PMD
- minimumPriority 1maven-pmd-plugin
: reactivate PMD
- **minimumPriority 1**
maven-pmd-plugin
: reactivate PMD
- **minimumPriority 1**maven-pmd-plugin
: reactivate PMD
- minimumPriority 1
693b6f1
to
1c7544d
Compare
pom.xml
Outdated
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
<plugins> | ||
<!-- why profile not working? --> |
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.
please why is it only applied when declared here?
maven-pmd-plugin
: reactivate PMD
- minimumPriority 1maven-pmd-plugin
: reactivate PMD
- minimumPriority 2
maven-pmd-plugin
: reactivate PMD
- minimumPriority 2maven-pmd-plugin
: reactivate PMD
- minimumPriority 1
1c7544d
to
2d8b9ef
Compare
2d8b9ef
to
c6c4134
Compare
.pmd/exclude.properties
Outdated
org.apache.maven.project.MavenProject=UnusedFormalParameter,CollapsibleIfStatements | ||
org.apache.maven.slf4j.DefaultLogLevelRecorder=CollapsibleIfStatements,AvoidBranchingStatementAsLastInLoop | ||
org.apache.maven.toolchain.building.DefaultToolchainsBuilder=UnusedFormalParameter | ||
org.apache.maven.internal.xml.DefaultXmlService=UnusedPrivateMethod |
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.
UnusedPrivateMethod
this is why check
and spot
not enough.
maven-pmd-plugin
: reactivate PMD
- minimumPriority 1maven-pmd-plugin
: reactivate PMD
c6c4134
to
9e7e613
Compare
maven-pmd-plugin
: reactivate PMD
maven-pmd-plugin
: reactivate PMD - Best Practices
9e7e613
to
a4fb59d
Compare
How was the excludes file generated? |
AI/custom generated script, this feature is requested feature by PMD. See here: |
org.apache.maven.toolchain.building.DefaultToolchainsBuilder=UnusedFormalParameter,AvoidReassigningParameters | ||
org.apache.maven.toolchain.java.JavaToolchainFactory=MissingOverride | ||
org.apache.maven.toolchain.java.JavaToolchainImpl=MissingOverride | ||
org.eclipse.sisu.plexus.PlexusXmlBeanConverter=MissingOverride,GuardLogStatement,PreserveStackTrace |
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.
not in the codebase
org.apache.maven.toolchain.java.JavaToolchainFactory=MissingOverride | ||
org.apache.maven.toolchain.java.JavaToolchainImpl=MissingOverride | ||
org.eclipse.sisu.plexus.PlexusXmlBeanConverter=MissingOverride,GuardLogStatement,PreserveStackTrace | ||
org.fusesource.jansi.Ansi=AvoidStringBufferField,LooseCoupling,UseVarargs |
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.
not in the code base
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.
why can PMD find it then?
@@ -0,0 +1,483 @@ | |||
org.apache.maven.AbstractMavenLifecycleParticipant=AbstractClassWithoutAbstractMethod |
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.
I am not sure that all of those (or even the majority) are actually in the code base.
If you want to add supressions, add `@SuppressWarnings("PMD.") statements at the places where the problems occur. That way, an IDE can pick them up and point out when a suppression is no longer needed.
Having a big central file is a sure recipe for this to fall into disrepair and things never getting fixed. Which is counter to what you are trying to accomplish.
Suppressions need to be applied surgically in the right place where a violation exist. Not as a blanked "We cover the whole class"
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.
place where a violation exist
is only possible doing it here. Other wise we have 500 operations inside the code thats impossible.
/*.svg | ||
/**/.cache |
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.
Where is that needed and why would we ignore any .cache
subfolder at any level of the tree?
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.
yes should be specific, but there is not collision so its not an big deal actually.
<excludeFromFailureFile>.pmd/exclude.properties</excludeFromFailureFile> | ||
<printFailingErrors>true</printFailingErrors> | ||
<rulesets> | ||
<ruleset>category/java/bestpractices.xml</ruleset> |
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.
why would we not apply all java rulesets but only one?
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.
we can not pass even this one, so it might be overkill.
This is not the right way to engage with this project. If you want to improve the code quality, we would be willing to review small, specific changes that solve an issue that exists. Not blanket, AI generated "here are large changes that are hard to verify" PRs without any context. I will close this PR; feel free to resubmit smaller, better documented changes. |
at to silly for this simple task. |
will have issues (blindspots), not making it possible to activate the plugin. We have blind spots or ignore 1o1 the errors. This solution is very exact, as it only addresses existing issues not ignoring rules globally. |
please tell me, how can we stop further violations? Freezing existing depth, not able to commit any more rubbish. @hgschmie |
@cescoffier @geoand Would you like to adhere to Best Practices? With this way we can prevent any new corruption from entering the code base. |
@Pankraz76 we don't use Maven in our projects, so I'm not sure why I'm being pinged here. I guess the answer is "no", then. |
its about PMD. Can be used via gradle too. https://docs.gradle.org/current/userguide/pmd_plugin.html As its Best Practices having to find large acceptance for comprehending minds. |
@Pankraz76 I am not sure what you expect from us here. |
If Maven does not care about norms, standardization, and following common sense, maybe Quarkus and Spring will. It's about avoiding overhead, reducing effort spent on avoidable issues, and focusing attention on the real business logic. We should not waste time on unused imports but on real progress being made. So with this example given I would like to offer doing the same as its done by script now, giving ability to freeze technical dept. I will shoot demo PR providing the same for Spring and Quarkus. Thus you can see the current situations and choose if you want more violations. |
@Pankraz76 I suggest taking a step and back and trying to ascertain how your changes and communication of said changes appears to project maintainers. |
yes, i see this type of change is not simple to integrate. Thanks for feedback. |
👍🏽 |
@Pankraz76 This type of "you need to adhere to some imaginary standards or norms that I defined" comments don't work here. You need to ask yourself if that is a reasonable way to engage with any community, given the amount of pushback to your style of engagement that you have seen. |
Of course, my direct approach isn't very charming. I can only convince those who in favor of rules and reason—not those prioritize individual opinion or embrace the freedom of chaos (what some might call the broken window effect). Some thrive in disorder, finding creativity in the absence of boundaries. For others, order is essential; they need structure to keep the marathon going. P.S. This is the essence of law. There is no law without enforcement. These best practices serve the common good—they belong to no one, being defined by the community itself, in sync with Java Coding Conventions (JCC). Debating them in generell seems kind of goofy. I didn't create, nor do I particularly care about these rules, even though they seem legitimate and reasonable. They seem the only valid foundation, making it obvious to integrate. Java coding conventions come from Java itself, not from me. The same applies to PMD best practices—we can assure significant effort went into balancing these rules. Thus ends our endless debates about which rules are good or bad (though we've all participated eagerly). That's the power of norms and standards. They're like syntax, but operating on a higher semantic plane. You all grasp this intuitively—while I remain, as ever, the least enlightened among us. |
Using ChatGPT (or friends) also doesn't do you any favors when trying to convince people... |
Its my language given form and correction. Please stop horsing around. I spend 30 mins to create the post, yes im very special, taking my time. Not everyone is so smart like you @geoand please excuse. |
The point I'm trying to make is very simple: you are putting effort into doing work but not taking feedback into account at all and continuing on a course that almost certainly leads to your work not having the impact you hope it has. |
Facing real bugs, we could activate
PMD
again as mention in comments to prevent violations:(suppress existing
483
issues)References:
outputStream
destination;request
instead ofpath
inDefaultPluginXmlFactory#write
#2312legacy
automateexcludeFromFailureFile
pmd/pmd#5735legacy
automateexcludeFromFailureFile
maven-pmd-plugin#202maven/impl/maven-core/src/test/resources/apiv4-repo/org/apache/maven/maven-parent/4/maven-parent-4.pom
Line 227 in ffd30a3
checkstyle: