fix: define constant for duplicated javac log format string - #9
Open
sonarqube-agent[bot] wants to merge 1 commit into
Open
sonarqube-agent[bot] wants to merge 1 commit into
sonarqube-agent[bot] wants to merge 1 commit into
Conversation
Fixed issues: - AZZmtiWq2HDYqP_XyoAj for java:S1192 rule Generated by SonarQube Agent (task: 8b0d29af-a2db-4cf6-baab-4ebdd265754d)
SonarQube reviewer guide
|
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.




Extracted the duplicated literal "[javac] %s" into a class-level constant JAVAC_LOG_FORMAT to eliminate code duplication and provide a single source of truth. This resolves a critical SonarQube code smell issue and improves maintainability by centralizing the string definition.
View Project in SonarCloud
Fixed Issues
java:S1192 - Define a constant instead of duplicating this literal "[javac] %s" 4 times. • CRITICAL • View issue
Location:
core/src/main/java/com/webcohesion/enunciate/Enunciate.java:664Why 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 a new constant
JAVAC_LOG_FORMATwith the value "[javac] %s" at the class level. This provides the single source of truth for the duplicated string literal, enabling the other hunks to reference this constant instead of repeating the literal. This is the foundational change for eliminating the duplicated string literal code smell.SonarQube Remediation Agent uses AI. Check for mistakes.