Repository navigation
[TEST ONLY][DO NOT MERGE] AP-1498 Exercise ruling diff action - #6551
romainbrenguier wants to merge 1 commit into
Conversation
CI failed: Two test failures are attributed to this PR, which suppresses System.out/System.err findings: JavaRulingTest shows ruling differences and the Plugin QA test no longer finds java:S106. The ruling update job failed separately on a checkout SHA mismatch that the analyzer did not link to the PR, and the diff-generation job's log shows no failing step.OverviewTwo test failures are attributed to this PR, which suppresses System.out/System.err findings: JavaRulingTest shows ruling differences and the Plugin QA test no longer finds java:S106. The ruling update job failed separately on a checkout SHA mismatch that the analyzer did not link to the PR, and the diff-generation job's log shows no failing step. FailuresJavaRulingTest fails with issue differences in five ruling projects
Plugin QA SonarLintIntegrationTest.simpleJava no longer finds java:S106
Ruling update job fails on PR head SHA checkout mismatch
Summary
Code Review
|
| Auto-apply | Compact | Unblock |
|
|
|
Was this helpful? React with 👍 / 👎 | Gitar
| 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.");
}
}
- Apply fix
Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎
|
|



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.