Skip to content

fix: resolve 5 SonarQube issues (5 minor)#1945

Open
sonarqube-agent[bot] wants to merge 1 commit intomasterfrom
remediate-master-20260325-000050-f086308c
Open

fix: resolve 5 SonarQube issues (5 minor)#1945
sonarqube-agent[bot] wants to merge 1 commit intomasterfrom
remediate-master-20260325-000050-f086308c

Conversation

@sonarqube-agent
Copy link
Copy Markdown
Contributor

This PR includes automated code changes to address 5 SonarQube issues: MINOR (5).

View Project in SonarCloud


Fixed Issues

java:S1874 - Remove this use of "AnalyzeFilesAndTrackParams"; it is deprecated. • MINORView issue

Location: sonarlint-core-parent:medium-tests/src/test/java/mediumtest/issues/CheckResolutionStatusChangePermittedMediumTests.java:267

Why is this an issue?

Code is sometimes annotated as deprecated by developers maintaining libraries or APIs to indicate that the method, class, or other programming element is no longer recommended for use. This is typically due to the introduction of a newer or more effective alternative. For example, when a better solution has been identified, or when the existing code presents potential errors or security risks.

What changed

The deprecated usage of AnalyzeFilesAndTrackParams at line 320 is caused by calling a deprecated constructor overload that accepts an extra integer parameter. By removing the , 0 argument, this hunk switches the call to the non-deprecated constructor overload of AnalyzeFilesAndTrackParams.

--- a/medium-tests/src/test/java/mediumtest/issues/CheckResolutionStatusChangePermittedMediumTests.java
+++ b/medium-tests/src/test/java/mediumtest/issues/CheckResolutionStatusChangePermittedMediumTests.java
@@ -321,1 +321,1 @@ class CheckResolutionStatusChangePermittedMediumTests {
-      List.of(fileUri), Map.of(), false, 0)).join();
+      List.of(fileUri), Map.of(), false)).join();
java:S1874 - Remove this use of "AnalyzeFilesAndTrackParams"; it is deprecated. • MINORView issue

Location: sonarlint-core-parent:medium-tests/src/test/java/mediumtest/issues/CheckResolutionStatusChangePermittedMediumTests.java:320

Why is this an issue?

Code is sometimes annotated as deprecated by developers maintaining libraries or APIs to indicate that the method, class, or other programming element is no longer recommended for use. This is typically due to the introduction of a newer or more effective alternative. For example, when a better solution has been identified, or when the existing code presents potential errors or security risks.

What changed

The deprecated usage of AnalyzeFilesAndTrackParams at line 381 is caused by calling a deprecated constructor overload that accepts an extra integer parameter. By removing the , 0 argument, this hunk switches the call to the non-deprecated constructor overload of AnalyzeFilesAndTrackParams.

--- a/medium-tests/src/test/java/mediumtest/issues/CheckResolutionStatusChangePermittedMediumTests.java
+++ b/medium-tests/src/test/java/mediumtest/issues/CheckResolutionStatusChangePermittedMediumTests.java
@@ -382,1 +382,1 @@ class CheckResolutionStatusChangePermittedMediumTests {
-      List.of(fileUri), Map.of(), false, 0)).join();
+      List.of(fileUri), Map.of(), false)).join();
java:S1874 - Remove this use of "AnalyzeFilesAndTrackParams"; it is deprecated. • MINORView issue

Location: sonarlint-core-parent:medium-tests/src/test/java/mediumtest/issues/CheckResolutionStatusChangePermittedMediumTests.java:381

Why is this an issue?

Code is sometimes annotated as deprecated by developers maintaining libraries or APIs to indicate that the method, class, or other programming element is no longer recommended for use. This is typically due to the introduction of a newer or more effective alternative. For example, when a better solution has been identified, or when the existing code presents potential errors or security risks.

What changed

The deprecated usage of AnalyzeFilesAndTrackParams at line 435 is caused by calling a deprecated constructor overload that accepts an extra integer parameter. By removing the , 0 argument, this hunk switches the call to the non-deprecated constructor overload of AnalyzeFilesAndTrackParams, resolving the deprecation warning about using the old constructor signature. This also addresses any additional deprecated usage warnings related to the same deprecated constructor pattern in this area of the file.

--- a/medium-tests/src/test/java/mediumtest/issues/CheckResolutionStatusChangePermittedMediumTests.java
+++ b/medium-tests/src/test/java/mediumtest/issues/CheckResolutionStatusChangePermittedMediumTests.java
@@ -436,1 +436,1 @@ class CheckResolutionStatusChangePermittedMediumTests {
-      List.of(fileUri), Map.of(), false, 0)).join();
+      List.of(fileUri), Map.of(), false)).join();
java:S1874 - Remove this use of "AnalyzeFilesAndTrackParams"; it is deprecated. • MINORView issue

Location: sonarlint-core-parent:medium-tests/src/test/java/mediumtest/issues/CheckResolutionStatusChangePermittedMediumTests.java:435

Why is this an issue?

Code is sometimes annotated as deprecated by developers maintaining libraries or APIs to indicate that the method, class, or other programming element is no longer recommended for use. This is typically due to the introduction of a newer or more effective alternative. For example, when a better solution has been identified, or when the existing code presents potential errors or security risks.

What changed

The deprecated usage of AnalyzeFilesAndTrackParams at line 435 is caused by calling a deprecated constructor overload that accepts an extra integer parameter. By removing the , 0 argument, this hunk switches the call to the non-deprecated constructor overload of AnalyzeFilesAndTrackParams, resolving the deprecation warning about using the old constructor signature. This also addresses any additional deprecated usage warnings related to the same deprecated constructor pattern in this area of the file.

--- a/medium-tests/src/test/java/mediumtest/issues/CheckResolutionStatusChangePermittedMediumTests.java
+++ b/medium-tests/src/test/java/mediumtest/issues/CheckResolutionStatusChangePermittedMediumTests.java
@@ -436,1 +436,1 @@ class CheckResolutionStatusChangePermittedMediumTests {
-      List.of(fileUri), Map.of(), false, 0)).join();
+      List.of(fileUri), Map.of(), false)).join();
java:S1874 - Remove this use of "setSeverity"; it is deprecated. • MINORView issue

Location: sonarlint-core-parent:medium-tests/src/test/java/mediumtest/http/ProxyMediumTests.java:115

Why is this an issue?

Code is sometimes annotated as deprecated by developers maintaining libraries or APIs to indicate that the method, class, or other programming element is no longer recommended for use. This is typically due to the introduction of a newer or more effective alternative. For example, when a better solution has been identified, or when the existing code presents potential errors or security risks.

What changed

This hunk directly fixes the deprecated 'setSeverity' usage at line 115 by replacing the deprecated '.setSeverity("INFO").setType(Common.RuleType.BUG)' calls with the modern alternatives '.setCleanCodeAttribute(Common.CleanCodeAttribute.CONVENTIONAL).setImpacts(Rules.Rule.Impacts.newBuilder().build())'. This eliminates the use of the deprecated API method as flagged by the static analysis tool.

--- a/medium-tests/src/test/java/mediumtest/http/ProxyMediumTests.java
+++ b/medium-tests/src/test/java/mediumtest/http/ProxyMediumTests.java
@@ -115,1 +115,1 @@ class ProxyMediumTests {
-        .setRule(Rules.Rule.newBuilder().setName("newName").setSeverity("INFO").setType(Common.RuleType.BUG).setLang("py").setHtmlNote("extendedDesc from server").build())
+        .setRule(Rules.Rule.newBuilder().setName("newName").setCleanCodeAttribute(Common.CleanCodeAttribute.CONVENTIONAL).setImpacts(Rules.Rule.Impacts.newBuilder().build()).setLang("py").setHtmlNote("extendedDesc from server").build())

Have a suggestion or found an issue? Share your feedback here.


SonarQube Remediation Agent uses AI. Check for mistakes.

Fixed issues:
- AZv9xbSbClKDVB-iUu2x for java:S1874 rule
- AZv9xbRYClKDVB-iUu2c for java:S1874 rule
- AZv9xbRYClKDVB-iUu2d for java:S1874 rule
- AZv9xbRYClKDVB-iUu2e for java:S1874 rule
- AZv9xbRYClKDVB-iUu2f for java:S1874 rule

Generated by SonarQube Agent (task: 36a79da5-0805-4518-8768-2b8d08814e0c)
@sonar-review-alpha
Copy link
Copy Markdown

Summary

Addresses 5 SonarQube deprecation warnings by removing use of deprecated APIs in test code. Two categories of changes: (1) removes unused integer parameter from 4 AnalyzeFilesAndTrackParams constructor calls in CheckResolutionStatusChangePermittedMediumTests.java, and (2) replaces deprecated setSeverity/setType calls with modern setCleanCodeAttribute/setImpacts in 6 rule builder instances within ProxyMediumTests.java test mocks. All changes are in test setup code with no impact to production behavior.

What reviewers should know

Changes are straightforward API deprecation cleanups. The test code itself is unchanged—only the test setup/mock construction differs. In ProxyMediumTests, the API migration from severity/type to clean code attributes/impacts reflects SonarQube's newer rule modeling; verify the test assertions still pass if you're unfamiliar with the impacts-based model. All line-by-line changes are mechanical (removing a parameter or swapping deprecated calls for modern equivalents), so scanning the diff is sufficient for review.


  • Generate Walkthrough
  • Generate Diagram

🗣️ Give feedback

Copy link
Copy Markdown

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conclusion: Clean, mechanical deprecation cleanup confined entirely to test code. All changes are correct and the quality gate passes.

🗣️ Give feedback

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants