fix: remove redundant isValid assignment in mime-type validator#19
Open
sonarqube-agent[bot] wants to merge 1 commit intomasterfrom
Open
fix: remove redundant isValid assignment in mime-type validator#19sonarqube-agent[bot] wants to merge 1 commit intomasterfrom
sonarqube-agent[bot] wants to merge 1 commit intomasterfrom
Conversation
Fixed issues: - AZWU-tLOYJSZqVQVbSb6 for typescript:S4165 rule Generated by SonarQube Agent (task: 376f8526-1f17-4ff0-9600-e7f1cb5c0eab)
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.
Removes an unnecessary reassignment of the isValid variable that was flagged by SonarQube as redundant. The variable already held the value false along all execution paths at that point, making this assignment unreachable and improving code clarity.
View Project in SonarCloud
Fixed Issues
typescript:S4165 - Review this redundant assignment: "isValid" already holds the assigned value along all execution paths. • MAJOR • View issue
Location:
frontend/src/app/photo-wall/mime-type.validator.ts:38Why is this an issue?
The transitive property says that if
a == bandb == c, thena == c. In such cases, there’s no point in assigningatocor vice versa because they’re already equivalent.What changed
Removes the redundant assignment
isValid = falseon line 38 of mime-type.validator.ts. The static analysis detected thatisValidalready holds the valuefalsealong all execution paths at that point, making this assignment unnecessary. By deleting this line, the code smell about a useless reassignment is resolved.SonarQube Remediation Agent uses AI. Check for mistakes.