Remove unnecessary thrown Exception declarations from test methods#414
Open
sonarqube-agent[bot] wants to merge 1 commit into
Open
Remove unnecessary thrown Exception declarations from test methods#414sonarqube-agent[bot] wants to merge 1 commit into
sonarqube-agent[bot] wants to merge 1 commit into
Conversation
Fixed issues: - AZggADGcxdvKFWvLKVB2 for java:S1130 rule - AZggADKmxdvKFWvLKVCO for java:S1130 rule - AZggADKmxdvKFWvLKVCP for java:S1130 rule Generated by SonarQube Agent (task: b37f5bad-7682-4cb1-bfec-d16c0cec2098)
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.
This change fixes three SonarQube code smell violations (java:S1130) by removing superfluous 'throws Exception' declarations from test methods that do not actually throw checked exceptions. Cleaning up these unnecessary exception declarations improves code readability and reduces compiler noise without affecting functionality.
View Project in SonarCloud
Fixed Issues
java:S1130 - Remove the declaration of thrown exception 'java.lang.Exception', as it cannot be thrown from method's body. • MINOR • View issue 1
java:S1130 - Remove the declaration of thrown exception 'java.lang.Exception', as it cannot be thrown from method's body. • MINOR • View issue 2
Location:
its/plugin/src/test/java/com/sonar/it/flex/CoverageTest.java:57Why is this an issue?
Superfluous exceptions within
throwsclauses have negative effects on the readability and maintainability of the code. An exception in athrowsclause is superfluous if it is:What changed
Removes the superfluous 'throws Exception' declaration from the method 'report_paths_can_have_multiple_values()' at line 57 of CoverageTest.java. The method body does not actually throw any checked exception, so the 'throws Exception' clause was unnecessary and negatively impacted code readability. This also addresses the duplicate report of the same superfluous exception declaration issue at the same location.
java:S1130 - Remove the declaration of thrown exception 'java.lang.Exception', as it cannot be thrown from method's body. • MINOR • View issue
Location:
sonar-flex-plugin/src/test/java/org/sonar/plugins/flex/FlexPluginTest.java:32Why is this an issue?
Superfluous exceptions within
throwsclauses have negative effects on the readability and maintainability of the code. An exception in athrowsclause is superfluous if it is:What changed
Removes the superfluous 'throws Exception' declaration from the testGetExtensions() method, since no exception is actually thrown by the method body. This addresses the code smell about declaring thrown exceptions that cannot be thrown from the method's body.
SonarQube Remediation Agent uses AI. Check for mistakes.