Skip to content

#2123: configure Checkstyle suppression for legitimate System.out usages#2128

Merged
hohwille merged 4 commits into
devonfw:mainfrom
maybeec:feature/2123-checkstyle-system-out-suppression
Jul 16, 2026
Merged

#2123: configure Checkstyle suppression for legitimate System.out usages#2128
hohwille merged 4 commits into
devonfw:mainfrom
maybeec:feature/2123-checkstyle-system-out-suppression

Conversation

@maybeec

@maybeec maybeec commented Jul 7, 2026

Copy link
Copy Markdown
Member

This PR fixes #2123

Internal enhancement (developers only) — preparation for the linting harness, scoped to the
System.out / System.err Checkstyle rule. Labelled internal, so no CHANGELOG entry.

Implemented changes:

  • checkstyle.xml: gave the System.out/System.err rule the id SystemOut and added two
    suppression mechanisms so legitimate usages no longer block the build:
    • SuppressWithNearbyCommentFilter — inline, single-line: a trailing // checkstyle:ignore SystemOut - reason on the offending line (limited to that line only).
    • SuppressionSingleFilter — whole-file, scoped to the log package (the logging implementation
      legitimately writes to System.out/System.err); only the SystemOut rule is suppressed there.
  • Marked the legitimate usages with inline markers: AbstractIdeContext (log just failed, point to
    logfile), GraalVmHelper (native-image bootstrap before logging), CompleteCommandlet (bash
    completion must reach stdout), Ideasy (option parsing before logger init), OperatingSystem
    (static OS detection, no context).
  • Cleaned up the accidental usages: UrlSecurityFile now logs via the SLF4J/jline logger; removed
    leftover debug prints from PycharmTest, IntellijTest, FileAccessImplTest.
  • EclipseWorkspaceLockChecker (+ its test): adopted the exact java.io.Filejava.nio.file.Path
    and System.out → SLF4J-logger change from #2118: replace java.io.File usages with java.nio.file.Path #2120 so both branches merge without conflict.

Out of scope and intentionally left as-is: the printStackTrace violation in
IdeLogExceptionDetails (a different rule), and three further System.out sites already handled by
#2120 / to be addressed with their respective rules.

Testing instructions

  1. In cli/, run mvn checkstyle:check — the System.out/System.err sites listed above no longer
    produce violations (the remaining printStackTrace in IdeLogExceptionDetails is a different
    rule and out of scope).
  2. In cli/, run mvn -Dtest=PycharmTest,IntellijTest,FileAccessImplTest,EclipseWorkspaceLockCheckerTest test
    — all pass.
  3. Run mvn clean test — build is green.

Checklist for this PR

  • When running mvn clean test locally all tests pass and build is successful
  • PR title is of the form #«issue-id»: «brief summary» (e.g. #921: fixed setup.bat). If no issue ID exists, title only.
  • PR top-level comment summarizes what has been done and contains link to addressed issue(s)
  • PR and issue(s) have suitable labels
  • Issue is set to In Progress and assigned to you or there is no issue (might happen for very small PRs)
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc unless issue is labeled with internallabelled internal, no CHANGELOG entry needed
  • You have formulated clear instructions on how to test your contribution under "Testing instructions"

@github-project-automation github-project-automation Bot moved this to 🆕 New in IDEasy board Jul 7, 2026
@maybeec maybeec added the internal Nothing to be added to CHANGELOG, only internal story label Jul 7, 2026
@maybeec
maybeec requested a review from hohwille July 7, 2026 13:21
@coveralls

coveralls commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 29487708149

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage increased (+0.02%) to 72.229%

Details

  • Coverage increased (+0.02%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 74 coverage regressions across 4 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

74 previously-covered lines in 4 files lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/context/AbstractIdeContext.java 43 68.99%
com/devonfw/tools/ide/url/model/file/UrlSecurityFile.java 19 11.11%
com/devonfw/tools/ide/locking/EclipseWorkspaceLockChecker.java 8 39.29%
com/devonfw/tools/ide/cli/GraalVmHelper.java 4 0.0%

Coverage Stats

Coverage Status
Relevant Lines: 16734
Covered Lines: 12592
Line Coverage: 75.25%
Relevant Branches: 7464
Covered Branches: 4886
Branch Coverage: 65.46%
Branches in Coverage %: Yes
Coverage Strength: 3.18 hits per line

💛 - Coveralls

@maybeec maybeec moved this from 🆕 New to Team Review in IDEasy board Jul 7, 2026
@maybeec maybeec added this to the release:2026.07.002 milestone Jul 7, 2026

@hohwille hohwille 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.

@maybeec thanks for pushing this forward. 👍

Comment thread cli/src/main/java/com/devonfw/tools/ide/context/AbstractIdeContext.java Outdated
@github-project-automation github-project-automation Bot moved this from Team Review to 👀 In review in IDEasy board Jul 16, 2026
@hohwille
hohwille merged commit 00ff05b into devonfw:main Jul 16, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in IDEasy board Jul 16, 2026
@hohwille hohwille added the QA approved Label a PR that has been re-testet via nightly SNAPSHOT after merge and commented. label Jul 20, 2026
@hohwille

Copy link
Copy Markdown
Member

QA retest:
This is just an internal refactoring so no explicit feature to test in end-to-end test. I tested some basic stuff with the latest nightly SNAPSHOT release on Windows and verified that System.out is only used in few places that have commented with checkstyle:ignore.
I found that we also have a groovy script full of System.out statements without annotations but I verified that our commit hook is only checking *.java and *.groovy currently does not have linting.
Therefore, I set QA approved label.

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

Labels

internal Nothing to be added to CHANGELOG, only internal story QA approved Label a PR that has been re-testet via nightly SNAPSHOT after merge and commented.

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Add linting harness to ensure code-quality

3 participants