SONARPHP-1836 fix: Remove unnecessary 'throws Exception' declarations from test methods#1714
Open
sonarqube-agent[bot] wants to merge 1 commit into
Open
SONARPHP-1836 fix: Remove unnecessary 'throws Exception' declarations from test methods#1714sonarqube-agent[bot] wants to merge 1 commit into
sonarqube-agent[bot] wants to merge 1 commit into
Conversation
Fixed issues: - AZkoU_egIsbR56mqmhIa for java:S1130 rule - AZkoU_dzIsbR56mqmhIW for java:S1130 rule - AZkoU_EIIsbR56mqmhG5 for java:S1130 rule - AZkoU_e-IsbR56mqmhIc for java:S1130 rule - AZkoU_E1IsbR56mqmhG8 for java:S1130 rule Generated by SonarQube Agent (task: e824f901-7cb1-411d-8479-8503bec541ed)
Contributor
|
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.





Removed 5 superfluous 'throws Exception' declarations from test methods in the PHP checks module that were flagged by SonarQube. These methods do not actually throw any checked exceptions, so the throws clauses were inaccurate and cluttered the code; removing them improves code clarity and resolves minor code smells.
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
Location:
php:php-checks/src/test/java/org/sonar/php/checks/CharacterBeforeOpeningPHPTagCheckTest.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 'ok()' method, since no exception is actually thrown from the method's body. This addresses the code smell where a throws clause declares an exception that cannot be thrown by any execution path of the method.
java:S1130 - Remove the declaration of thrown exception 'java.lang.Exception', as it cannot be thrown from method's body. • MINOR • View issue
Location:
php:php-checks/src/test/java/org/sonar/php/checks/NoPaddingRsaCheckTest.java:25Why 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 test method 'test()' in NoPaddingRsaCheckTest.java. The method body does not actually throw any checked exception, so declaring 'throws Exception' was unnecessary and flagged as a code smell. By removing the throws clause, the method signature accurately reflects that no checked exceptions are thrown.
java:S1130 - Remove the declaration of thrown exception 'java.lang.Exception', as it cannot be thrown from method's body. • MINOR • View issue
Location:
php:php-checks/src/test/java/org/sonar/php/checks/WrongAssignmentOperatorCheckTest.java:25Why 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 test method 'test()' in WrongAssignmentOperatorCheckTest.java. The method body does not actually throw any checked exception, so the 'throws Exception' clause was unnecessary. This directly addresses the code smell about declaring a thrown exception that cannot be thrown from the method's body.
java:S1130 - Remove the declaration of thrown exception 'java.lang.Exception', as it cannot be thrown from method's body. • MINOR • View issue
Location:
php:php-checks/src/test/java/org/sonar/php/checks/regex/EmptyStringRepetitionCheckTest.java:25Why 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 test method 'test()' in EmptyStringRepetitionCheckTest.java. The method body does not actually throw any checked exception, so the 'throws Exception' clause was unnecessary and flagged as a code smell. By removing it, the method signature accurately reflects that no checked exceptions are thrown.
java:S1130 - Remove the declaration of thrown exception 'java.lang.Exception', as it cannot be thrown from method's body. • MINOR • View issue
Location:
php:php-checks/src/test/java/org/sonar/php/checks/regex/RegexLookaheadCheckTest.java:25Why 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 test method 'test()' in RegexLookaheadCheckTest.java. The method body does not actually throw any checked exception, so the 'throws Exception' clause was unnecessary. This directly 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.