• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pmd / pmd / 727
79%

Build:
DEFAULT BRANCH: main
Ran 14 Aug 2026 07:08PM UTC
Jobs 1
Files 2194
Run time 4min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

14 Aug 2026 06:44PM UTC coverage: 79.31% (+0.005%) from 79.305%
727

push

github

web-flow
[java] Fix #1287: GuardLogStatement false positive with a guard clause (#6920)

* [java] Fix #1287: GuardLogStatement false positive with a guard clause

hasGuard only looked for the guard among the ancestors of the log call, so the early-return style guard - a preceding sibling that leaves the block - was not recognized.

Signed-off-by: Eljees <3.14hell@gmail.com>

* [java] GuardLogStatement: let a guard clause cover nested log statements

Addresses the review on #6920.

- hasEarlyExitGuard now walks up the statement ancestors instead of looking
  only at the immediate siblings of the log statement, so an early-exit guard
  also covers log statements nested deeper than the guard itself - for example
  inside a loop that follows it. This is the case reported in review.
- alwaysExits uses children(...).last() and lets the recursive instanceof
  handle the null case, as suggested.

Test cases added:

- log inside a loop after the guard (the reported case)
- log nested several blocks deep after the guard
- a continue guard inside a loop does not guard a log after the loop
- a guard in a sibling if-block does not guard a later log statement

The last two are negative cases: they pin that walking up the ancestors does
not start swallowing real violations. Both already passed before this change,
so they fail if the walk is ever made too permissive.

* review

* [doc] Update release notes (#1287)

---------

Signed-off-by: Eljees <3.14hell@gmail.com>
Co-authored-by: Lukas Gräf <48957581+lukasgraef@users.noreply.github.com>
Co-authored-by: Lukas Gräf <lukas-graef@web.de>

19543 of 25614 branches covered (76.3%)

Branch coverage included in aggregate %.

20 of 21 new or added lines in 1 file covered. (95.24%)

42308 of 52372 relevant lines covered (80.78%)

0.82 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
92.83
-1.8% pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/GuardLogStatementRule.java
Jobs
ID Job ID Ran Files Coverage
1 727.1 14 Aug 2026 07:08PM UTC 2194
79.31
GitHub Action Run
Source Files on build 727
  • Tree
  • List 2194
  • Changed 2
  • Source Changed 1
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #727
  • 2789d743 on github
  • Prev Build on main (#726)
  • Next Build on main (#728)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc