GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [cli] Print PMD analysis summary by DragonFSKY · Pull Request #6823 · pmd/pmd

Conversation

@DragonFSKY

@DragonFSKY DragonFSKY commented Jun 28, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

Fixes #1995.

This adds a final PMD CLI summary after analysis using the existing ReportStats counts, for example:

  • Found no violations.
  • Found 1 violation.
  • Found no violations. There was 1 processing error.

The summary is emitted through the CLI reporter, not stdout, so report output remains unchanged whether reports are rendered to stdout or written with --report-file. Exit-code behavior is unchanged.

Tests

  • ./mvnw -pl pmd-cli -am -DskipTests package
  • ./mvnw -pl pmd-cli -am -Dtest=PmdCliTest -Dsurefire.failIfNoSpecifiedTests=false test

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pmd-actions-helper

pmd-actions-helper Bot commented Jun 28, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Documentation Preview

Compared to main:
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.
There are 0 changed duplications, 0 new duplications and 0 removed duplications.
There are 0 changed CPD errors, 0 new CPD errors and 0 removed CPD errors.

Regression Tester Report

(comment created at 2026-07-05 19:06:05+00:00 for 8a4a1ce)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

UncleOwen
UncleOwen requested changes Jul 2, 2026
View reviewed changes

@UncleOwen UncleOwen left a comment

Copy link
Copy Markdown
Member

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 just tried this.

$ ./pmd check --dir=/data/code/pmd/pmd/main/pmd-java/src/main/java -R rulesets/java/quickstart.xml
[WARN] Progressbar rendering conflicts with reporting to STDOUT. No progressbar will be shown. Try running with argument -r <file> to output the report to a file instead.
[WARN] This analysis could be faster, please consider using Incremental Analysis: https://docs.pmd-code.org/latest/pmd_userdocs_incremental_analysis.html
/data/code/pmd/pmd/main/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTAmbiguousName.java:74:      CompareObjectsWithEquals:       Use equals() to compare object references.
[...]
/data/code/pmd/pmd/main/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ResolutionFailedException.java:102:   LocalVariableNamingConventions: The final local variable name 'PRETTY_PRINTER_CONFIG' doesn't match '[a-z][a-zA-Z0-9]*'
[INFO] Found 101 violations.
$

Works as expected.

$ ./pmd check --dir=/data/code/pmd/pmd/main/pmd-java/src/main/java -R rulesets/java/quickstart.xml --format=text -r out.txt
[WARN] This analysis could be faster, please consider using Incremental Analysis: https://docs.pmd-code.org/latest/pmd_userdocs_incremental_analysis.html
                                                                                                                                                                                                                  
                                                                                                                                                                                                                  
$

Uh... where is the summary?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pmd-cli/src/main/java/net/sourceforge/pmd/cli/commands/internal/PmdCommand.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@DragonFSKY
[cli] Print PMD analysis summary
1e17172
@DragonFSKY
DragonFSKY force-pushed the fix-cli-summary-counts branch from 7d1adbb to 1e17172 Compare July 4, 2026 12:59
@DragonFSKY

DragonFSKY commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for checking. I moved the summary logging after PMD finishes closing its listeners, so the progress bar cleanup no longer hides it when --report-file is used. I also applied the wording suggestion and added a regression test for this case.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@DragonFSKY

DragonFSKY commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

@UncleOwen I updated this PR to match the requested wording and to fix the summary visibility issue: summary logging is now after PMD listener cleanup and I added regression coverage for the progress-bar/report-file path.

I also updated the PR description example from Found no violations. And there was 1 processing error. to Found no violations. There was 1 processing error.. Could you please re-check when you have a chance?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

UncleOwen added 3 commits July 5, 2026 20:41
@UncleOwen
Convert telescoping calls to builder pattern.
af9437a
@UncleOwen
Merge branch 'main' into fork/DragonFSKY/fix-cli-summary-counts
e2314ed
@UncleOwen
[docs] Update release notes
8a4a1ce
UncleOwen
UncleOwen approved these changes Jul 5, 2026
View reviewed changes

@UncleOwen UncleOwen left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

Thanks. I'm not a fan of all those telescoping runCli() calls (those tend to grow and become unmanageable over time), that's why I replaced them with a builder pattern.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@UncleOwen UncleOwen added this to the 7.27.0 milestone Jul 5, 2026
@UncleOwen
UncleOwen merged commit 1562570 into pmd:main Jul 5, 2026
13 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@adangel adangel mentioned this pull request Nov 13, 2026
[cli] Fix hanging PmdCliTest under Windows with git bash #7344
Merged
2 of 4 tasks
UncleOwen pushed a commit that referenced this pull request Nov 13, 2026
@adangel @claude
[cli] Fix hanging PmdCliTest under Windows with git bash (#7344)
f835461
The progressbar uses JLine to determine the terminal width. Under
Windows in git bash (PWD and MSYSTEM are set), JLine uses the exec
terminal provider, which runs "tty.exe" with the inherited stdin of
the forked surefire JVM. As surefire is reading from stdin (command
channel) at the same time, tty.exe doesn't start until that read
completes. This made PmdCliTest hang (locally) or take about 9.5
minutes (in the Windows CI build).

This happened before and was worked around in d1d10d1 by adding
"--no-progress" to the standard arguments of PmdCliTest. The test
reportsSummaryAfterProgressBarWithReportFile (added with #6823)
needs the progress bar and doesn't use these standard arguments, so
the problem came back.

The tests don't need a real terminal, so disable the exec provider
for all pmd-cli tests instead.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@UncleOwen UncleOwen UncleOwen approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

7.27.0

Development

Successfully merging this pull request may close these issues.

[core] PMD should display number of rules violated or errors found

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@DragonFSKY @UncleOwen
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.