Skip to content
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

dependency: bump pmd.version to 7.1.0 and maven-pmd-plugin to 3.22.0 #14856

Merged
merged 2 commits into from May 12, 2024

Conversation

mahfouz72
Copy link
Member

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:34 min
[INFO] Finished at: 2024-05-04T02:56:07+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-pmd-plugin:3.22.0:pmd (pmd) on project checkstyle: Execution pmd of goal org.apache.maven.plugins:maven-pmd-plugin:3.22.0:pmd failed: org.apache.maven.reporting.MavenReportException: The ruleset could not be loaded: Cannot load ruleset config/pmd.xml: An XML validation error occurred -> [Help 1]  
[ERROR]

I assumed that this is because we using rules that were removed in the latest pmd releases but even after the removal from pmd.xml, the issue is not fixed.
any ideas for why we got this XML validation error?

@mahfouz72 mahfouz72 force-pushed the bumb-pmd-version branch 2 times, most recently from d6a8905 to 3ee17aa Compare May 4, 2024 01:09
@rnveach
Copy link
Member

rnveach commented May 4, 2024

Google is your friend. According to https://stackoverflow.com/a/78330292/1016482 , 6 and 7 are not 1 to 1 compatible and there is a migration guide.

I don't know any other specifics or how to help. You could try setting a breakpoint where the exception occurs and see if you can identify anything in the code.

config/pmd.xml Outdated
Comment on lines 306 to 408
<rule ref="category/java/design.xml/NcssCount">
<properties>
<property name="classReportLevel" value="1000" />
<!-- *TokenTypes are special classes that are big due to a lot of description comments.
RequireThisCheck has to work with and identify many frames.
JavadocMethodCheck is in the process of being rewritten.
SiteUtil provides a lot of functionality to generate documentation. -->
<property name="violationSuppressXPath"
value="//ClassOrInterfaceDeclaration[@SimpleName='JavadocTokenTypes'
or @SimpleName='TokenTypes' or @SimpleName='RequireThisCheck'
or @SimpleName='JavadocMethodCheck' or @SimpleName='JavaAstVisitor'
or @SimpleName='SiteUtil']"/>
</properties>
</rule>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added instead of ExcessiveClassLength rule that was removed

Copy link
Member Author

@mahfouz72 mahfouz72 May 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All properties that accept multiple values now uses ( , ) as a delimiter not ( | )

@mahfouz72
Copy link
Member Author

mahfouz72 commented May 4, 2024

the build started successfully but somehow the violationSuppressXPath is not working as before So, we have 604 pmd failures 💀 . I will look more into that

pmd docs: https://pmd.github.io/pmd/pmd_userdocs_suppressing_warnings.html#the-property-violationsuppressxpath

The XPath version used by those queries is XPath 3.1 since PMD 7. Before then XPath 1.0 was used.

@mahfouz72
Copy link
Member Author

mahfouz72 commented May 4, 2024

@rnveach are we ok to update all violationSuppressXPath queries to match the new version used by pmd? I have no idea about this new version or the amount of modification that should be done yet. waiting for your opinion first before proceeding

@rnveach
Copy link
Member

rnveach commented May 5, 2024

We won't be able to merge a red CI, so how would you get this to a point where it can be merged without updating everything related to the PMD upgrade?

@mahfouz72
Copy link
Member Author

mahfouz72 commented May 5, 2024

  • false positives
    Examples
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControlTest:104 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControlTest:158 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.imports.PkgImportRuleTest:29 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.imports.PkgImportRuleTest:78 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
  • Xpath Suppression is not working properly on some rules
    Examples (This should be suppressed)
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.AbstractAutomaticBean:20 Rule:ExcessiveImports Priority:3 A high number of imports can indicate a high degree of coupling within an object..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.Checker:20 Rule:ExcessiveImports Priority:3 A high number of imports can indicate a high degree of coupling within an object..  

Maybe I'm missing something, but this is based on my findings so far.

@nrmancuso
Copy link
Member

@mahfouz72 Let's do a little more investigation, then open an issue with your findings. We can call it something like "Migrate to PMD 7". Please explain new checks, new AST, etc.

@mahfouz72 mahfouz72 force-pushed the bumb-pmd-version branch 4 times, most recently from 256f277 to c439dc0 Compare May 7, 2024 19:40
@mahfouz72
Copy link
Member Author

what I have done so far:

  • renamed ClassOrInterfaceDeclaration Token to ClassDeclaration as mentioned in doc
  • used @Name instead of @image doc
  • removal of removedRules doc
    a. ExcessiveClassLength used NcssCount instead
    b. AvoidFinalLocalVariable, AvoidPrefixingMethodParameters, DataflowAnomalyAnalysis. these were just excluded from
    the rules so I just removed <exclude name = "x">

@mahfouz72
Copy link
Member Author

mahfouz72 commented May 7, 2024

is it likely that all of these are false positives?

[INFO] --- pmd:3.22.0:check (default-cli) @ checkstyle ---
[INFO] PMD version: 7.1.0
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.Checker:20 Rule:CouplingBetweenObjects Priority:3 High amount of different objects as members denotes a high coupling.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.JavaAstVisitor:20 Rule:CouplingBetweenObjects Priority:3 High amount of different objects as members denotes a high coupling.   
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.Main:20 Rule:CouplingBetweenObjects Priority:3 High amount of different objects as members denotes a high coupling.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.OutputFormat:550 Rule:CommentDefaultAccessModifier Priority:3 Missing commented default access modifier on nested enum 'OutputFormat'.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.TreeWalker:20 Rule:CouplingBetweenObjects Priority:3 High amount of different objects as members denotes a high coupling.       
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.XMLLogger:293 Rule:ConsecutiveAppendsShouldReuse Priority:3 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.XMLLogger:294 Rule:ConsecutiveAppendsShouldReuse Priority:3 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask:20 Rule:CouplingBetweenObjects Priority:3 High amount of different objects as members denotes a high coupling.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.api.FileText:172 Rule:LooseCoupling Priority:3 Avoid using implementation types like 'ArrayList'; use the interface instead.    
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.TranslationCheck:20 Rule:CouplingBetweenObjects Priority:3 High amount of different objects as members denotes a high coupling.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck:20 Rule:CouplingBetweenObjects Priority:3 High amount of different objects as members denotes a high coupling.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.javadoc.utils.InlineTagUtil:111 Rule:ConsecutiveAppendsShouldReuse Priority:3 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.filters.IntMatchFilterElement:51 Rule:UnnecessaryBoxing Priority:3 Unnecessary explicit boxing.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.gui.MainFrame:78 Rule:ConstructorCallsOverridableMethod Priority:1 This method may call an overridable method during object construction: JFrame.setLayout(LayoutManager) (call stack: [MainFrame.createContent(), JFrame.setLayout(LayoutManager)]).
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.site.DescriptionExtractor:1389 Rule:UseArraysAsList Priority:3 Use asList instead of tight loops.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.utils.FilterUtil:45 Rule:UnusedLocalVariable Priority:3 Avoid unused local variables such as 'stream'..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.ConfigurationLoaderTest:698 Rule:UnusedLocalVariable Priority:3 Avoid unused local variables such as 'mocked'..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.MainTest:1876 Rule:DoNotTerminateVM Priority:3 System.exit() should not be used in J2EE/JEE apps.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.TreeWalkerTest:132 Rule:UnusedLocalVariable Priority:3 Avoid unused local variables such as 'mocked'..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.OrderedPropertiesCheckTest:200 Rule:UnusedLocalVariable Priority:3 Avoid unused local variables such as 'stream'..       
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.UniquePropertiesCheckTest:190 Rule:UnusedLocalVariable Priority:3 Avoid unused local variables such as 'stream'..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.header.HeaderCheckTest:304 Rule:UnusedLocalVariable Priority:3 Avoid unused local variables such as 'mocked'..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.imports.ClassImportRuleTest:29 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.imports.ClassImportRuleTest:55 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.imports.ClassImportRuleTest:81 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheckTest:419 Rule:UnnecessaryVarargsArrayCreation Priority:3 Unnecessary explicit array creation for varargs method call.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheckTest:821 Rule:UselessParentheses Priority:4 Useless parentheses..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControlTest:104 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControlTest:158 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.imports.PkgImportRuleTest:29 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.imports.PkgImportRuleTest:78 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.imports.PkgImportRuleTest:127 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.imports.PkgImportRuleTest:165 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.imports.PkgImportRuleTest:200 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTagInfoTest:412 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.filters.SuppressionFilterTest:245 Rule:DoNotUseThreads Priority:3 To be compliant to J2EE, a webapp should not use any thread.. 
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.filters.SuppressionsLoaderTest:209 Rule:DoNotUseThreads Priority:3 To be compliant to J2EE, a webapp should not use any thread..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.grammar.AstRegressionTest:139 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.gui.CodeSelectorPresentationTest:43 Rule:LooseCoupling Priority:3 Avoid using implementation types like 'ImmutableList'; use the interface instead.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.gui.MainFrameTest:127 Rule:UnusedLocalVariable Priority:3 Avoid unused local variables such as 'mocked'..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.AllChecksTest:368 Rule:JUnitTestsShouldIncludeAssert Priority:3 JUnit tests should include assert() or fail().
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.AllChecksTest:382 Rule:JUnitTestsShouldIncludeAssert Priority:3 JUnit tests should include assert() or fail().
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.AllChecksTest:391 Rule:JUnitTestsShouldIncludeAssert Priority:3 JUnit tests should include assert() or fail().
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.AllChecksTest:492 Rule:JUnitTestsShouldIncludeAssert Priority:3 JUnit tests should include assert() or fail().
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.ArchUnitSuperClassTest:96 Rule:LooseCoupling Priority:3 Avoid using implementation types like 'JavaClasses'; use the interface instead.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.ArchUnitTest:107 Rule:LooseCoupling Priority:3 Avoid using implementation types like 'JavaClasses'; use the interface instead.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.ArchUnitTest:130 Rule:LooseCoupling Priority:3 Avoid using implementation types like 'JavaClasses'; use the interface instead.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.ImmutabilityTest:193 Rule:LooseCoupling Priority:3 Avoid using implementation types like 'JavaClasses'; use the interface instead.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.ImmutabilityTest:230 Rule:LooseCoupling Priority:3 Avoid using implementation types like 'JavaClasses'; use the interface instead.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.XdocsJavaDocsTest:287 Rule:ConsecutiveAppendsShouldReuse Priority:3 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.XdocsJavaDocsTest:288 Rule:ConsecutiveAppendsShouldReuse Priority:3 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.XdocsJavaDocsTest:319 Rule:ConsecutiveAppendsShouldReuse Priority:3 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.XdocsJavaDocsTest:433 Rule:ConsecutiveAppendsShouldReuse Priority:3 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.XdocsJavaDocsTest:434 Rule:ConsecutiveAppendsShouldReuse Priority:3 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.XdocsJavaDocsTest:438 Rule:ConsecutiveAppendsShouldReuse Priority:3 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.XdocsJavaDocsTest:439 Rule:ConsecutiveAppendsShouldReuse Priority:3 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.XdocsJavaDocsTest:440 Rule:ConsecutiveAppendsShouldReuse Priority:3 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.XdocsJavaDocsTest:463 Rule:ConsecutiveAppendsShouldReuse Priority:3 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.XdocsJavaDocsTest:464 Rule:ConsecutiveAppendsShouldReuse Priority:3 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.XdocsJavaDocsTest:527 Rule:ConsecutiveAppendsShouldReuse Priority:3 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.XdocsJavaDocsTest:528 Rule:ConsecutiveAppendsShouldReuse Priority:3 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.XdocsJavaDocsTest:529 Rule:ConsecutiveAppendsShouldReuse Priority:3 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.XdocsPagesTest:1435 Rule:ConsecutiveAppendsShouldReuse Priority:3 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.DummyHandler:183 Rule:LiteralsFirstInComparisons Priority:3 Position literals first in String comparisons.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.DummyHandler:194 Rule:LiteralsFirstInComparisons Priority:3 Position literals first in String comparisons.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.utils.AbstractInvalidClass:224 Rule:ClassWithOnlyPrivateConstructorsShouldBeFinal Priority:1 This class has only private constructors and may be final.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:31 min
[INFO] Finished at: 2024-05-07T21:47:44+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-pmd-plugin:3.22.0:check (default-cli) on project checkstyle: You have 66 PMD violations. For more details see: D:\checkstyle\target\pmd.xml -> [Help 1]

@rnveach
Copy link
Member

rnveach commented May 7, 2024

is it likely that all of these are false positives?

You would have to look at a few and determine if they make no sense, or if they are valid. I would also check before your PR if there was a suppression for it before.

ConfigurationLoaderTest:698 Rule:UnusedLocalVariable Priority:3 Avoid unused local variables such as 'mocked'..

I just picked one and this looks valid to me.

DummyHandler:183 Rule:LiteralsFirstInComparisons Priority:3 Position literals first in String comparisons.

Same with this.

@mahfouz72
Copy link
Member Author

PkgImportControlTest:104 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
.PkgImportControlTest:158 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
PkgImportRuleTest:29 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
PkgImportRuleTest:78 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
PkgImportRuleTest:127 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
PkgImportRuleTest:165 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..
PkgImportRuleTest:200 Rule:JUnitTestContainsTooManyAsserts Priority:3 Unit tests should not contain more than 11 assert(s)..

all are false positives they have no more than 11 assert

@rnveach
Copy link
Member

rnveach commented May 7, 2024

I think JUnitTestContainsTooManyAsserts has always been questionable if they are true violations or false. Report these cases to PMD and I would suppress them.

@romani
Copy link
Member

romani commented May 8, 2024

Keep in mind, we do not have to update to bleeding edge, we can wait for 1 year until everything is calmed down in new version of pmd, to have less problems.

@rnveach
Copy link
Member

rnveach commented May 8, 2024

@mahfouz72 This seems like an all or nothing PR. If we delay this for year(s), it could become even harder to work with (or come back to ) when GSoC is over.

I think we should consider this PR carefully if we can finish it before we start working on the project, and if we can't, then we should probably close it or mark it as abandoned. You still have other PRs on your plate that need to be wrapped up before starting the project.

@mahfouz72
Copy link
Member Author

I think it will be difficult to look at all 66 violations before GSoC. and also I am not sure what exactly needs to be done to finish this PR.
look at each violation to see if it is valid or a false positive, if it is valid try to fix this violation if not suppress it?

@rnveach
Copy link
Member

rnveach commented May 8, 2024

look at each violation to see if it is valid or a false positive, if it is valid try to fix this violation if not suppress it?

I would move any valid ones to a new issue where the list can be broken up easier so its not all on this single PR. But otherwise yes, false ones should be reported.

I am also ok to suppress everything and have everything be in the new issue to confirm if it is valid or not and how to fix them.

@mahfouz72
Copy link
Member Author

I am also ok to suppress everything and have everything be in the new issue to confirm if it is valid or not and how to fix them.

@romani @nrmancuso what do you think? are we ok to suppress all violations from #14856 (comment) to make PMD happy then merge this PR and open a new issue to take our time to investigate the list and take the appropriate action for each violation

@romani
Copy link
Member

romani commented May 9, 2024

Yes, we always migrate tools like this, all new stuff goes to suppression until some ticket.

At least new violations will not leak to our codebase.

@mahfouz72
Copy link
Member Author

mahfouz72 commented May 9, 2024

suppressions for all violations are added in a separate commit
we can now open a new issue with the suppression list and take time to investigate it and fix violations if it is valid ( I fixed 1 violation in this commit)

we should put https://gist.github.com/mahfouz72/d199fca33ce2c9e8d84be3882403093c and 8da7fc0 in the issue

@romani
Copy link
Member

romani commented May 9, 2024

@mahfouz72 ,

we can now open a new issue with the suppression list

please open issue.

Copy link
Member

@romani romani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

items:

Comment on lines 547 to 552
* @noinspection PackageVisibleInnerClass
* @noinspectionreason PackageVisibleInnerClass - we keep this enum package visible for tests
*/
enum OutputFormat {
/* package */ enum OutputFormat {
/** XML output format. */
XML,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets put this to new issue to review, kind of strange that not making it public, we usually do not use package-private just for tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config/pmd-test.xml Show resolved Hide resolved
@mahfouz72 mahfouz72 force-pushed the bumb-pmd-version branch 2 times, most recently from 656bada to 5a1f41e Compare May 9, 2024 14:08
Copy link
Member

@romani romani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last:

config/pmd-test.xml Outdated Show resolved Hide resolved
Copy link
Member

@romani romani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok to merge

@nrmancuso nrmancuso assigned rnveach and unassigned nrmancuso May 10, 2024
@mahfouz72
Copy link
Member Author

@romani @nrmancuso we can close #14832 and #14835

@nrmancuso
Copy link
Member

@romani @nrmancuso we can close #14832 and #14835

Done, thanks for the reminder

@@ -818,7 +818,7 @@ public void testClearState() throws Exception {
assertWithMessage("State is not cleared on beginTree")
.that(TestUtil.isStatefulFieldClearedDuringBeginTree(check,
staticImport.orElseThrow(), "lastImportStatic",
lastImportStatic -> !((boolean) lastImportStatic)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mahfouz72 @nrmancuso @romani If this parenthesis is unnecessary, then why didn't our check ping it?
https://checkstyle.org/checks/coding/unnecessaryparentheses.html#UnnecessaryParentheses

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we need to create issue on this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rnveach rnveach assigned romani and unassigned rnveach May 12, 2024
@romani romani merged commit 4a1e34e into checkstyle:master May 12, 2024
114 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants