Add explanatory comments to empty test stub methods#719
Open
sonarqube-agent[bot] wants to merge 1 commit into
Open
Add explanatory comments to empty test stub methods#719sonarqube-agent[bot] wants to merge 1 commit into
sonarqube-agent[bot] wants to merge 1 commit into
Conversation
Fixed issues: - AZjRjd2C592amupb0FPg for java:S1186 rule - AZjRjd2C592amupb0FPe for java:S1186 rule - AZjRjd2C592amupb0FPh for java:S1186 rule - AZjRjd2C592amupb0FPf for java:S1186 rule - AZjRjd2C592amupb0FPd for java:S1186 rule Generated by SonarQube Agent (task: 1efd7c88-8b38-472b-ad40-ec9f4b8365bd)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed 5 SonarQube S1186 critical issues by adding explanatory comments to intentionally empty methods in the test fake client class. Empty methods in test code now clearly document why they are no-op stubs, satisfying code quality standards.
View Project in SonarCloud
Fixed Issues
java:S1186 - Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation. • CRITICAL • View issue
Location:
sonarlint-language-server:src/test/java/org/sonarsource/sonarlint/ls/mediumtests/AbstractLanguageServerMediumTests.java:602Why is this an issue?
An empty method is generally considered bad practice and can lead to confusion, readability, and maintenance issues. Empty methods bring no functionality and are misleading to others as they might think the method implementation fulfills a specific and identified requirement.
What changed
Adds a nested comment inside the empty
showHotspot()method at line 602, explaining that it is intentionally empty because it is not needed for tests using this fake client. This satisfies the rule requiring empty methods to have a comment explaining why they are empty.java:S1186 - Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation. • CRITICAL • View issue
Location:
sonarlint-language-server:src/test/java/org/sonarsource/sonarlint/ls/mediumtests/AbstractLanguageServerMediumTests.java:620Why is this an issue?
An empty method is generally considered bad practice and can lead to confusion, readability, and maintenance issues. Empty methods bring no functionality and are misleading to others as they might think the method implementation fulfills a specific and identified requirement.
What changed
Adds a nested comment inside the empty
maybeShowWiderLanguageSupportNotification()method at line 620, explaining that it is intentionally empty because it is not needed for tests using this fake client. This satisfies the rule requiring empty methods to have a comment explaining why they are empty.java:S1186 - Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation. • CRITICAL • View issue
Location:
sonarlint-language-server:src/test/java/org/sonarsource/sonarlint/ls/mediumtests/AbstractLanguageServerMediumTests.java:571Why is this an issue?
An empty method is generally considered bad practice and can lead to confusion, readability, and maintenance issues. Empty methods bring no functionality and are misleading to others as they might think the method implementation fulfills a specific and identified requirement.
What changed
Adds a nested comment inside the empty
doNotShowMissingRequirementsMessageAgain()method at line 571, explaining that it is intentionally empty as a no-op stub for tests. This satisfies the rule requiring empty methods to have a comment explaining why they are empty.java:S1186 - Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation. • CRITICAL • View issue
Location:
sonarlint-language-server:src/test/java/org/sonarsource/sonarlint/ls/mediumtests/AbstractLanguageServerMediumTests.java:611Why is this an issue?
An empty method is generally considered bad practice and can lead to confusion, readability, and maintenance issues. Empty methods bring no functionality and are misleading to others as they might think the method implementation fulfills a specific and identified requirement.
What changed
Adds a nested comment inside the empty
showIssueOrHotspot()method at line 611, explaining that it is a no-op in the fake client used for tests. This satisfies the rule requiring empty methods to have a comment explaining why they are empty.java:S1186 - Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation. • CRITICAL • View issue
Location:
sonarlint-language-server:src/test/java/org/sonarsource/sonarlint/ls/mediumtests/AbstractLanguageServerMediumTests.java:625Why is this an issue?
An empty method is generally considered bad practice and can lead to confusion, readability, and maintenance issues. Empty methods bring no functionality and are misleading to others as they might think the method implementation fulfills a specific and identified requirement.
What changed
Adds a nested comment inside the empty
showFirstSecretDetectionNotification()method at line 625, explaining that it is a no-op in the fake client used for testing. This satisfies the rule requiring empty methods to have a comment explaining why they are empty.SonarQube Remediation Agent uses AI. Check for mistakes.