Skip to content

Clean up code smells: remove empty statements and commented code#377

Open
sonarqube-agent[bot] wants to merge 1 commit into
masterfrom
remediate-master-20260611-050222-b37cd6fd
Open

Clean up code smells: remove empty statements and commented code#377
sonarqube-agent[bot] wants to merge 1 commit into
masterfrom
remediate-master-20260611-050222-b37cd6fd

Conversation

@sonarqube-agent

Copy link
Copy Markdown
Contributor

This PR was automatically created by the Remediation Agent's Scheduled backlog remediation feature.

Why these issues? These issues were selected for their well-defined, mechanical fix patterns with minimal risk. Removing empty statements and commented-out code are straightforward automated tasks that follow clear rules and have high confidence in correctness.

This PR resolves 2 SonarQube code smells by removing an unnecessary empty statement (double semicolon) and deleting commented-out code that adds no value. These cleanup changes improve code clarity and reduce noise in the codebase.

View Project in SonarCloud


Fixed Issues

java:S1116 - Remove this empty statement. • MINORView issue

Location: flex-checks/src/test/java/org/sonar/flex/checks/FunctionNameCheckTest.java:28

Why is this an issue?

Empty statements represented by a semicolon ; are statements that do not perform any operation. They are often the result of a typo or a misunderstanding of the language syntax. It is a good practice to remove empty statements since they don’t add value and lead to confusion and errors.

What changed

This hunk removes the extra semicolon (empty statement) at the end of the FlexVerifier.verify() call on line 28. The original code had a double semicolon ';;' which constitutes an empty statement after the method call. By changing it to a single semicolon, the empty statement is eliminated, resolving the code smell.

--- a/flex-checks/src/test/java/org/sonar/flex/checks/FunctionNameCheckTest.java
+++ b/flex-checks/src/test/java/org/sonar/flex/checks/FunctionNameCheckTest.java
@@ -28,1 +28,1 @@ public class FunctionNameCheckTest {
-    FlexVerifier.verify(new File("src/test/resources/checks/FunctionName.as"), check);;
+    FlexVerifier.verify(new File("src/test/resources/checks/FunctionName.as"), check);
java:S125 - This block of commented-out lines of code should be removed. • MAJORView issue

Location: its/plugin/src/test/java/com/sonar/it/flex/FlexSimpleProjectTest.java:65

Why is this an issue?

Commented-out code distracts the focus from the actual executed code. It creates a noise that increases maintenance code. And because it is never executed, it quickly becomes out of date and invalid.

What changed

This hunk removes the commented-out line of code assertThat(getFileMeasure(PROJECT + ":same_name/XMLUtil.mxml", "ncloc").getIntValue(), is(12)); and replaces it with a blank comment. This addresses the code smell about commented-out code that should be removed, as it creates noise and distracts from actual executed code. The commented-out assertion is deleted, leaving only a blank comment placeholder.

--- a/its/plugin/src/test/java/com/sonar/it/flex/FlexSimpleProjectTest.java
+++ b/its/plugin/src/test/java/com/sonar/it/flex/FlexSimpleProjectTest.java
@@ -65,1 +65,1 @@ public class FlexSimpleProjectTest {
-    // assertThat(getFileMeasure(PROJECT + ":same_name/XMLUtil.mxml", "ncloc").getIntValue(), is(12));
+    //

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


SonarQube Remediation Agent uses AI. Check for mistakes.

Fixed issues:
- AZggACkKxdvKFWvLKU7K for java:S1116 rule
- AZggADLvxdvKFWvLKVCQ for java:S125 rule

Generated by SonarQube Agent (task: 51fe1438-4214-4d81-89b3-a43645e95afe)

@zglicz zglicz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Auto-approved: SonarQube automated remediation.

@zglicz zglicz enabled auto-merge (squash) June 12, 2026 07:21
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.

2 participants