Skip to content

[core] Backport to PMD6 changes to accomodate PicoCli in PMD7#4161

Merged
jsotuyod merged 8 commits into
pmd:masterfrom
jsotuyod:prep-4059
Nov 10, 2022
Merged

[core] Backport to PMD6 changes to accomodate PicoCli in PMD7#4161
jsotuyod merged 8 commits into
pmd:masterfrom
jsotuyod:prep-4059

Conversation

@jsotuyod

@jsotuyod jsotuyod commented Oct 15, 2022

Copy link
Copy Markdown
Member

Describe the PR

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)

 - Companion PR for pmd#4059
 - Add deprecations and path the way for the upcoming changes to the CLI in PMD7
@ghost

ghost commented Oct 15, 2022

Copy link
Copy Markdown
1 Message
📖 No regression tested rules have been changed.
Compared to master:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report

Generated by 🚫 Danger

@adangel adangel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

I noticed recently, we use "-stress" in PMDCoverageTest, but I think it's really not needed.

"-benchmark" is used in the same test class. But it is also used in maven-pmd-plugin. Do we need to change anything on this side? (probably not for pmd6, but for pmd7?)

Comment thread pmd-core/src/main/java/net/sourceforge/pmd/PMD.java
Comment thread pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDParameters.java
m.put("-no-cache", "--no-cache");
m.put("-v", "--use-version"); // In PMD 7, -v will enable verbose mode
m.put("-V", "--verbose"); // In PMD 7, -V will show the tool version
m.put("-min", "--minimum-priority");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I was just wondering about deprecating "-min", but it actually fixes #3426 👍

readonly CLASSNAME="net.sourceforge.pmd.util.viewer.Viewer"
;;
"cpdgui")
echo "'cpdgui' is deprecated and will be removed in PMD 7.0.0, use 'cpd-gui' instead."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@VishV-Android VishV-Android Apr 3, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pmd cpd-gui
This command is not working in Command Prompt. It just open window for a moment then automatically close.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@VishV-Android please, open a new issue with full details.

@VishV-Android VishV-Android Apr 3, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@jsotuyod #4913 (comment)
New issue created with details.

@jsotuyod

jsotuyod commented Oct 17, 2022

Copy link
Copy Markdown
Member Author

I noticed recently, we use "-stress" in PMDCoverageTest, but I think it's really not needed.

It's not. The PMDConfiguration.isStressTest() method is never called within PMD7, it's been a noop for some time. In PMD6 the behavior is moot (shuffle input files). The whole test however is to be removed from PMD7 once we remove the old CLI code (as it would fail to run).

"-benchmark" is used in the same test class. But it is also used in maven-pmd-plugin. Do we need to change anything on this side? (probably not for pmd6, but for pmd7?)

Benchmark is useful (does print timing report to stderr), but it's now implemented fully at pmd-cli in PMD7… I did so because:

  • it's not structured output, so it's intended for a human reading it
  • STDERR is pretty much a CLI concern

I didn't think about Maven honestly… Maven would not be able to pass the flag (it can call the rendering itself though), but does it make sense? is there really a case for this flag existing on Maven? Is this flag useful to anyone else beyond ourselves to measure the impact of changes we do to PMD?

@adangel

adangel commented Oct 18, 2022

Copy link
Copy Markdown
Member

I noticed recently, we use "-stress" in PMDCoverageTest, but I think it's really not needed.

It's not. The PMDConfiguration.isStressTest() method is never called within PMD7, it's been a noop for some time. In PMD6 the behavior is moot (shuffle input files). The whole test however is to be removed from PMD7 once we remove the old CLI code (as it would fail to run).

👍

"-benchmark" is used in the same test class. But it is also used in maven-pmd-plugin. Do we need to change anything on this side? (probably not for pmd6, but for pmd7?)

Benchmark is useful (does print timing report to stderr), but it's now implemented fully at pmd-cli in PMD7… I did so because:

* it's not structured output, so it's intended for a human reading it

* STDERR is pretty much a CLI concern

I didn't think about Maven honestly… Maven would not be able to pass the flag (it can call the rendering itself though), but does it make sense? is there really a case for this flag existing on Maven? Is this flag useful to anyone else beyond ourselves to measure the impact of changes we do to PMD?

I found the original feature request here: https://issues.apache.org/jira/browse/MPMD-181
So, it seems to be useful for analyzing slow builds.
I think, we should consider this again later and not now - once pmd7 is closer to release. We have a separate pmd7 branch for the maven-pmd-plugin (https://github.com/apache/maven-pmd-plugin/tree/pmd7) where we can adjust the plugin to be compatible with pmd7.

@adangel

adangel commented Oct 27, 2022

Copy link
Copy Markdown
Member

@jsotuyod This PR looks ready - except for the refactoring around CPD / CpdAnalysis. Maybe it's better to do this in a separate PR, that way we can bring in this PR already with 6.51.0 and continue with #4059 in pmd7. Wdyt?

@adangel adangel modified the milestones: 6.51.0, 6.52.0 Oct 27, 2022

@oowekyala oowekyala left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks ready to me as well. I agree implementing this CpdAnalysis would be a better fit for another PR. If we merge this as is, we can also move forward with #4059.

Comment thread docs/pages/pmd/userdocs/cli_reference.md Outdated
Co-authored-by: Clément Fournier <clement.fournier@tu-dresden.de>
@jsotuyod jsotuyod marked this pull request as ready for review November 10, 2022 15:28

@jsotuyod jsotuyod left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Typo

Comment thread docs/pages/release_notes.md Outdated
@jsotuyod jsotuyod merged commit 79e294b into pmd:master Nov 10, 2022
@jsotuyod jsotuyod deleted the prep-4059 branch November 10, 2022 15:34

@oowekyala oowekyala left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A couple of comments that came to me when using PMDConfiguration in PMD 7. I will submit a PR for PMD 6.52.0

*
* @return URI
*/
public URI getUri() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this name is too vague and we should at least rename it (eg to getSourceDbUri or so)... Maybe it's also the right time to deprecate this feature altogether. It's untested, and it's completely unclear how to use it at all.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is/was actually a PMD 7 misc task (in #2524). I've created a separate issue for this for pmd 7 -> #4216

Since this feature exists already, we should document how to use it in any case.
Remaining question is: Should we remove it with pmd 7?

return inputFilePath == null ? null : inputFilePath.toString();
}

public Path getInputFile() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Similarly, this is very vague and confusing given we have getInputPathList and other similar methods. I would name this getInputFileListPath maybe

return ignoreFilePath == null ? null : ignoreFilePath.toString();
}

public Path getIgnoreFile() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

getIgnoreFileListPath

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[core] Deprecate -language, -version, -min options

4 participants