Skip to content

fix: define constant for duplicated javac log format string - #9

Open
sonarqube-agent[bot] wants to merge 1 commit into
masterfrom
remediate-master-20260331-032525-efe302b9
Open

sonarqube-agent[bot] wants to merge 1 commit into
masterfrom
remediate-master-20260331-032525-efe302b9

Conversation

@sonarqube-agent

Copy link
Copy Markdown

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. • CRITICALView issue

Location: core/src/main/java/com/webcohesion/enunciate/Enunciate.java:664

Why 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_FORMAT with 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.

--- a/core/src/main/java/com/webcohesion/enunciate/Enunciate.java
+++ b/core/src/main/java/com/webcohesion/enunciate/Enunciate.java
@@ -52,0 +53,1 @@ public class Enunciate implements Runnable {
+  private static final String JAVAC_LOG_FORMAT = "[javac] %s";

Have a suggestion or found an issue? Share your feedback here.


SonarQube Remediation Agent uses AI. Check for mistakes.

Fixed issues:
- AZZmtiWq2HDYqP_XyoAj for java:S1192 rule

Generated by SonarQube Agent (task: 8b0d29af-a2db-4cf6-baab-4ebdd265754d)
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant