Remove unnecessary String.raw usage from shell fragments#521
Open
sonarqube-agent[bot] wants to merge 1 commit into
Open
Remove unnecessary String.raw usage from shell fragments#521sonarqube-agent[bot] wants to merge 1 commit into
sonarqube-agent[bot] wants to merge 1 commit into
Conversation
Fixed issues: - AZ7wF1S9I9TVtwnJfdRg for typescript:S7780 rule - AZ7wF1UnI9TVtwnJfdRh for typescript:S7780 rule Generated by SonarQube Agent (task: c3035933-50ce-45be-89bf-50d2c834f6ef)
✅ Deploy Preview for sonarqube-cli canceled.
|
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 removes redundant String.raw tags from two shell-fragment files where the template strings contain no backslash characters. String.raw is only necessary when a string contains backslashes that need to be preserved literally; removing it from these strings eliminates unnecessary code and resolves SonarQube code smell warnings.
View Project in SonarCloud
Fixed Issues
typescript:S7780 - Using `String.raw` is unnecessary as the string does not contain any `\`. • MINOR • View issue
Location:
src/cli/commands/integrate/git/tools/husky/shell-fragments.ts:44Why is this an issue?
String literals with escaped backslashes can be difficult to read and maintain. Each backslash character must be escaped with another backslash, creating sequences like
\\that are hard to interpret at a glance.What changed
This hunk replaces
String.rawtemplate literal usage with a plain string literal. The static analysis warning flagged thatString.rawwas unnecessary on line 44 because the string 'SONAR_BIN=$(PATH=$CLEAN_PATH command -v sonar 2>/dev/null || :)' does not contain any backslash characters, making theString.rawtag redundant. By converting it to a simple quoted string, the unnecessaryString.rawusage is removed.typescript:S7780 - Using `String.raw` is unnecessary as the string does not contain any `\`. • MINOR • View issue
Location:
src/cli/commands/integrate/git/tools/native/shell-fragments.ts:47Why is this an issue?
String literals with escaped backslashes can be difficult to read and maintain. Each backslash character must be escaped with another backslash, creating sequences like
\\that are hard to interpret at a glance.What changed
This hunk removes the unnecessary
String.rawtag from a template literal that does not contain any backslash characters. The stringSONAR_BIN=$(command -v sonar 2>/dev/null || :)has no backslashes, so wrapping it inString.rawserves no purpose and triggers a code smell warning. By converting it fromString.raw...`` to a plain template literal (backtick string), the unnecessary usage ofString.rawis eliminated, making the code cleaner and resolving the static analysis warning.SonarQube Remediation Agent uses AI. Check for mistakes.