fix: define BEGIN_ATTRIBUTE constant to eliminate string duplication#150
Open
sonarqube-agent[bot] wants to merge 1 commit into
Open
fix: define BEGIN_ATTRIBUTE constant to eliminate string duplication#150sonarqube-agent[bot] wants to merge 1 commit into
sonarqube-agent[bot] wants to merge 1 commit into
Conversation
Fixed issues: - AZl5MuC8GyUqE6OUiTjn for java:S1192 rule Generated by SonarQube Agent (task: d317bef7-fe78-4133-8c6b-7171939e11aa)
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.
Resolves a critical SonarQube issue by extracting the duplicated string literal "begin" into a constant. This improves code maintainability and reduces the risk of inconsistencies if the value needs to be updated in the future.
View Project in SonarCloud
Fixed Issues
java:S1192 - Define a constant instead of duplicating this literal "begin" 3 times. • CRITICAL • View issue
Location:
sonar-ruby-plugin/src/main/java/org/sonarsource/ruby/converter/RubyVisitor.java:163Why is this an issue?
Duplicated string literals make the process of refactoring complex and error-prone, as any change would need to be propagated on all occurrences.
What changed
Defines the constant
BEGIN_ATTRIBUTEwith value "begin" to replace the duplicated string literal "begin" that appears 3 times in the file. This constant declaration enables the other hunks to reference a single constant instead of repeating the literal string.SonarQube Remediation Agent uses AI. Check for mistakes.