Skip to content

fix: eliminate string literal duplications in PlantUML mapping#33

Open
sonarqube-agent[bot] wants to merge 1 commit into
mainfrom
remediate-main-20260511-090209-36148f25
Open

fix: eliminate string literal duplications in PlantUML mapping#33
sonarqube-agent[bot] wants to merge 1 commit into
mainfrom
remediate-main-20260511-090209-36148f25

Conversation

@sonarqube-agent
Copy link
Copy Markdown

Resolves two SonarQube critical issues by extracting repeated string literals into constants. Defines EXTENSION_EXTENSION_PREFIX and PLANTUML_AS constants to replace 4 and 9 duplicate occurrences respectively, improving code maintainability and reducing the risk of inconsistent string values.

View Project in SonarCloud


Fixed Issues

python:S1192 - Define a constant instead of duplicating this literal 'Extension.extension:' 4 times. • CRITICALView issue

Location: PlantUML/construct_mappings.py:109

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 the constant EXTENSION_EXTENSION_PREFIX = 'Extension.extension:' to replace the duplicated string literal 'Extension.extension:' that appeared 4 times throughout the code. This constant is then used by other hunks to eliminate the duplication.

--- a/PlantUML/construct_mappings.py
+++ b/PlantUML/construct_mappings.py
@@ -12,0 +13,2 @@ output_path = sys.argv[2]
+EXTENSION_EXTENSION_PREFIX = 'Extension.extension:'
+
python:S1192 - Define a constant instead of duplicating this literal '" as ' 9 times. • CRITICALView issue

Location: PlantUML/construct_mappings.py:313

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 the constant PLANTUML_AS = '" as ' to replace the duplicated string literal '" as ' that appeared 9 times in the PlantUML generation code. This constant is then used by subsequent hunks to eliminate the duplication.

--- a/PlantUML/construct_mappings.py
+++ b/PlantUML/construct_mappings.py
@@ -278,0 +281,2 @@ def structure_data(extracted_data):
+PLANTUML_AS = '" as '
+

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


SonarQube Remediation Agent uses AI. Check for mistakes.

Fixed issues:
- AZZjJgtKOPkSvG45yHzz for python:S1192 rule
- AZZjJgtKOPkSvG45yHzy for python:S1192 rule

Generated by SonarQube Agent (task: d6a18938-c725-4590-b619-be401fd2d201)
@sonarqube-agent
Copy link
Copy Markdown
Author

⚠️ This repository does not have a CODEOWNERS file. The PR has been created but has not been automatically assigned to any reviewer. To ensure PRs are reviewed promptly, consider adding a CODEOWNERS file to your repository.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 11, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

⚠️ Remediation Agent monthly limit reached

Your organization has used all 200 agent fixes. This limit resets at the start of next month. Contact your SonarQube organization admin to upgrade.

  • Retry Remediation Agent
    Select the checkbox above to enable this action.

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

0 participants