Repository navigation
[TEST ONLY][DO NOT MERGE] AP-1498 Exercise ruling diff action - #6551
romainbrenguier wants to merge 2 commits into
Conversation
| private void visitMemberSelectExpression(MemberSelectExpressionTree mset) { | ||
| String name = mset.identifier().name(); | ||
| if ("out".equals(name) && isSystem(mset.expression())) { | ||
| reportIssue(mset, "Replace this use of System.out by a logger."); | ||
| } else if ("err".equals(name) && isSystem(mset.expression())) { | ||
| reportIssue(mset, "Replace this use of System.err by a logger."); | ||
| } else if (isIoPrintFunction(mset)) { | ||
| if (isIoPrintFunction(mset)) { | ||
| reportIssue(mset, "Replace this use of IO." + mset.identifier().name() + " by a logger."); | ||
| } | ||
| } |
There was a problem hiding this comment.
⚠️ Bug: S106 no longer reports System.out/err, breaking downstream SonarLint ITs
visitMemberSelectExpression now reports only when isIoPrintFunction(mset) is true, so every System.out/System.err usage, which is the core of rule S106, goes silent. The sample file and verifyNoIssues() tests were changed to match. The PR says this is a deliberate, do-not-merge regression. Even so, it should not land on romain/ap-1498 or anything downstream. Several SonarLint consumers depend on S106 firing on plain System.out: sonarlint-eclipse connected-mode ITs such as OpenInIdeTest that call getFirstIssue(S106) on SysOut.java; the sonarlint-vscode java diagnostics IT, which expects 'Replace this use of System.out by a logger.'; and sonarlint-intellij StandaloneModeMediumTests.should_analyze_java_file, which expects java:S106 on src/Main.java. All of these would fail once they bump to a sonar-java release that contains this commit. Close this PR, or revert commit 156ca76, once the ruling diff action has been exercised, and keep it out of the #6550 stack before that merges.
Restore the original System.out/System.err reporting branch alongside the IO.print branch:
private void visitMemberSelectExpression(MemberSelectExpressionTree mset) {
if (isIoPrintFunction(mset)) {
reportIssue(mset, "Replace this use of IO." + mset.identifier().name() + " by a logger.");
return;
}
String name = mset.identifier().name();
if (("out".equals(name) || "err".equals(name)) && isSystem(mset.expression())) {
reportIssue(mset, "Replace this use of System." + name + " by a logger.");
}
}
Was this helpful? React with 👍 / 👎
There was a problem hiding this comment.
Agreed that this behavior must not ship. PR #6551 is a draft test branch created solely to produce an S106 ruling diff; the production branch (#6550) retains normal System.out/System.err reporting. I fixed the separate PR-head checkout failure and will close this test PR after the ruling diff action runs.
There was a problem hiding this comment.
Understood. The finding holds on this branch (SystemOutOrErrUsageCheck only reports when isIoPrintFunction(mset) is true), and you've confirmed it's intentional for this throwaway ruling-diff PR. I've recorded it as won't fix and made no code changes. Just make sure #6551 is closed rather than merged, so it doesn't reach #6550 or any SonarLint consumers.
This comment has been minimized.
This comment has been minimized.
CI failed: Ruling-diff tests fail in five projects and the Plugin QA simpleJava test no longer sees java:S106, both attributed to the PR's SystemOutOrErrUsageCheck change which now suppresses System output findings without updated baselines or expectations. The truncated log for template_0000000000000001 shows no explicit error, so its failure cause remains unidentified and it is not attributed to the change.OverviewRuling-diff tests fail in five projects and the Plugin QA simpleJava test no longer sees java:S106, both attributed to the PR's SystemOutOrErrUsageCheck change which now suppresses System output findings without updated baselines or expectations. The truncated log for template_0000000000000001 shows no explicit error, so its failure cause remains unidentified and it is not attributed to the change. FailuresJavaRulingTest ruling diffs in five projects (spring_mall, jboss_ejb3_tutorial, guava, eclipse_jetty_incremental, apache_commons_beanutils)
Plugin QA SonarLintIntegrationTest.simpleJava missing expected java:S106 issue
Summary
Code Review
|
| Auto-apply | Compact | Unblock |
|
|
|
Was this helpful? React with 👍 / 👎 | Gitar
|
|
The test-only S106 regression has served its purpose and must not merge. The PR-head checkout fix is on #6550 and the ruling update job now succeeds. The diff comment remained skipped because this removal-only ruling change produces no actual S106 SARIF files, while the shared artifact sync only copies files that exist; that follow-up belongs in the shared action. |



TEST ONLY — DO NOT MERGE
This draft PR is stacked on #6550 solely to exercise the ruling diff action. The commit intentionally stops rule S106 from reporting
System.outandSystem.errusages, causing a large ruling diff. This behavior is a deliberate test regression and must not be shipped.The
IO.printandIO.printlnbehavior remains active. Unit test expectations were updated so the ruling workflow can run against the intentional S106 change.Verification: targeted
SystemOutOrErrUsageCheckTestpassed; deep Vortex analysis found no issues in the three changed files.Agent workflow
Tool link: https://github.com/SonarSource/languages-experimental-tooling/tree/romain/my-tickets/personal/romain-brenguier
Addressed review comments in pr_report_6551.md using
uv run address_reviews.py pr_report_6551.md