From 77ec19255b9b42f10450e7e99277cd73861f13c8 Mon Sep 17 00:00:00 2001 From: 7PH Date: Tue, 28 Nov 2023 17:39:03 +0100 Subject: [PATCH] SONAR-21112 Drop 'issue' and 'rule' word repetition in CCT badges --- .../src/main/js/apps/coding-rules/utils-tests.tsx | 2 +- .../src/main/js/apps/issues/__tests__/IssueHeader-it.tsx | 2 +- .../changelog/__tests__/ChangelogContainer-it.tsx | 4 ++-- .../main/js/components/shared/CleanCodeAttributePill.tsx | 9 ++------- .../src/main/resources/org/sonar/l10n/core.properties | 8 -------- 5 files changed, 6 insertions(+), 19 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/coding-rules/utils-tests.tsx b/server/sonar-web/src/main/js/apps/coding-rules/utils-tests.tsx index b2bb9d64002..b668e0fab23 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/utils-tests.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/utils-tests.tsx @@ -114,7 +114,7 @@ const selectors = { cancelButton: byRole('button', { name: 'cancel' }), removeButton: byRole('button', { name: 'remove' }), ruleCleanCodeAttributeCategory: (category: CleanCodeAttributeCategory) => - byText(`rule.clean_code_attribute_category.${category}.title_short`), + byText(`rule.clean_code_attribute_category.${category}`), ruleCleanCodeAttribute: (attribute: CleanCodeAttribute) => byText(new RegExp(`rule\\.clean_code_attribute\\.${attribute}$`)), ruleSoftwareQuality: (quality: SoftwareQuality) => byText(`software_quality.${quality}`), diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueHeader-it.tsx b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueHeader-it.tsx index 23d7d74101e..e15e23d3223 100644 --- a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueHeader-it.tsx +++ b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueHeader-it.tsx @@ -52,7 +52,7 @@ it('renders correctly', async () => { // CCT attribute const cctBadge = byText( - `issue.clean_code_attribute_category.${issue.cleanCodeAttributeCategory}.title_short`, + `issue.clean_code_attribute_category.${issue.cleanCodeAttributeCategory}`, ).get(); expect(cctBadge).toBeInTheDocument(); await expect(cctBadge).toHaveATooltipWithContent( diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogContainer-it.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogContainer-it.tsx index b2e05bc57ec..7a9fa5131f1 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogContainer-it.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogContainer-it.tsx @@ -92,7 +92,7 @@ it('should see the changelog', async () => { 'April 23, 2019', 'System', 'quality_profiles.changelog.DEACTIVATED', - 'Rule 0issue.clean_code_attribute_category.RESPONSIBLE.title_shortsoftware_quality.SECURITYsoftware_quality.MAINTAINABILITY', + 'Rule 0issue.clean_code_attribute_category.RESPONSIBLEsoftware_quality.SECURITYsoftware_quality.MAINTAINABILITY', [/quality_profiles.deprecated_severity_set_to severity.MAJOR/], ); ui.checkRow( @@ -100,7 +100,7 @@ it('should see the changelog', async () => { '', '', '', - 'Rule 1issue.clean_code_attribute_category.RESPONSIBLE.title_shortsoftware_quality.SECURITYsoftware_quality.MAINTAINABILITY', + 'Rule 1issue.clean_code_attribute_category.RESPONSIBLEsoftware_quality.SECURITYsoftware_quality.MAINTAINABILITY', [ /quality_profiles.deprecated_severity_set_to severity.CRITICAL/, /quality_profiles.changelog.cca_and_category_changed.*COMPLETE.*INTENTIONAL.*LAWFUL.*RESPONSIBLE/, diff --git a/server/sonar-web/src/main/js/components/shared/CleanCodeAttributePill.tsx b/server/sonar-web/src/main/js/components/shared/CleanCodeAttributePill.tsx index c1c7883a8ad..95c7d81dc86 100644 --- a/server/sonar-web/src/main/js/components/shared/CleanCodeAttributePill.tsx +++ b/server/sonar-web/src/main/js/components/shared/CleanCodeAttributePill.tsx @@ -31,7 +31,7 @@ export interface Props { cleanCodeAttribute?: CleanCodeAttribute; } -export function CleanCodeAttributePill(props: Props) { +export function CleanCodeAttributePill(props: Readonly) { const { className, cleanCodeAttributeCategory, cleanCodeAttribute, type = 'issue' } = props; return ( @@ -65,12 +65,7 @@ export function CleanCodeAttributePill(props: Props) { > - {translate( - type, - 'clean_code_attribute_category', - cleanCodeAttributeCategory, - 'title_short', - )} + {translate(type, 'clean_code_attribute_category', cleanCodeAttributeCategory)} {cleanCodeAttribute && ( | {translate(type, 'clean_code_attribute', cleanCodeAttribute)} diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 8a2ae88b08b..b3d5b50819f 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -995,19 +995,15 @@ issue.impact.severity.tooltip=This issue has a {severity} impact on the {quality issue.clean_code_attribute_category.CONSISTENT=Consistency issue.clean_code_attribute_category.CONSISTENT.title=This is a consistency issue. issue.clean_code_attribute_category.CONSISTENT.advice=To be consistent, the code needs to be written in a uniform and conventional way. -issue.clean_code_attribute_category.CONSISTENT.title_short=Consistency issue issue.clean_code_attribute_category.INTENTIONAL=Intentionality issue.clean_code_attribute_category.INTENTIONAL.title=This is an intentionality issue. issue.clean_code_attribute_category.INTENTIONAL.advice=To be intentional, the code content needs to be precise and purposeful. -issue.clean_code_attribute_category.INTENTIONAL.title_short=Intentionality issue issue.clean_code_attribute_category.ADAPTABLE=Adaptability issue.clean_code_attribute_category.ADAPTABLE.title=This is an adaptability issue. issue.clean_code_attribute_category.ADAPTABLE.advice=To be adaptable, the code needs to be structured to be easy to evolve and develop with confidence. -issue.clean_code_attribute_category.ADAPTABLE.title_short=Adaptability issue issue.clean_code_attribute_category.RESPONSIBLE=Responsibility issue.clean_code_attribute_category.RESPONSIBLE.title=This is a responsibility issue. issue.clean_code_attribute_category.RESPONSIBLE.advice=To be responsible, the code must take into account its ethical obligations on data and potential impact of societal norms. -issue.clean_code_attribute_category.RESPONSIBLE.title_short=Responsibility issue issue.clean_code_attribute=Clean Code Attribute issue.clean_code_attribute.CLEAR=Not clear @@ -2475,16 +2471,12 @@ rule.impact.severity.tooltip=Issues found for this rule will have a {severity} i rule.clean_code_attribute_category.CONSISTENT=Consistency rule.clean_code_attribute_category.CONSISTENT.title=This is a consistency rule. -rule.clean_code_attribute_category.CONSISTENT.title_short=Consistency rule rule.clean_code_attribute_category.INTENTIONAL=Intentionality rule.clean_code_attribute_category.INTENTIONAL.title=This is an intentionality rule. -rule.clean_code_attribute_category.INTENTIONAL.title_short=Intentionality rule rule.clean_code_attribute_category.ADAPTABLE=Adaptability rule.clean_code_attribute_category.ADAPTABLE.title=This is an adaptability rule. -rule.clean_code_attribute_category.ADAPTABLE.title_short=Adaptability rule rule.clean_code_attribute_category.RESPONSIBLE=Responsibility rule.clean_code_attribute_category.RESPONSIBLE.title=This is a responsibility rule. -rule.clean_code_attribute_category.RESPONSIBLE.title_short=Responsibility rule rule.clean_code_attribute.CLEAR=Clear rule.clean_code_attribute.CLEAR.title=This is an intentionality rule, the code should be clear. -- 2.39.5