From 04f7a37abda3e7b3bd599b68c5e26c403ecfcfc9 Mon Sep 17 00:00:00 2001 From: Revanshu Paliwal Date: Mon, 16 Jan 2023 15:08:20 +0100 Subject: [PATCH] SONAR-17815 CAYC Wording changes for QG page --- .../branches/CleanAsYouCodeWarning.tsx | 24 +--------------- .../src/main/js/apps/overview/styles.css | 9 ------ .../ConditionReviewAndUpdateModal.tsx | 19 +++++++++++-- .../quality-gates/components/Conditions.tsx | 7 ++--- .../components/__tests__/QualityGate-it.tsx | 5 +++- .../src/main/js/apps/quality-gates/styles.css | 5 ---- .../resources/org/sonar/l10n/core.properties | 28 +++++++++---------- 7 files changed, 39 insertions(+), 58 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/overview/branches/CleanAsYouCodeWarning.tsx b/server/sonar-web/src/main/js/apps/overview/branches/CleanAsYouCodeWarning.tsx index f41c9c11d42..7dd4dc118c2 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/CleanAsYouCodeWarning.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/CleanAsYouCodeWarning.tsx @@ -18,7 +18,6 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { FormattedMessage } from 'react-intl'; import Link from '../../../components/common/Link'; import { Alert } from '../../../components/ui/Alert'; import { translate } from '../../../helpers/l10n'; @@ -32,28 +31,7 @@ interface Props { export default function CleanAsYouCodeWarning({ component }: Props) { return ( <> - - {component.qualityGate ? ( - - - {component.qualityGate.name} - - - ), - }} - /> - ) : ( - translate('overview.quality_gate.conditions.cayc.warning.no_link') - )} - + {translate('overview.quality_gate.conditions.cayc.warning')}

{translate('overview.quality_gate.conditions.cayc.details')} diff --git a/server/sonar-web/src/main/js/apps/overview/styles.css b/server/sonar-web/src/main/js/apps/overview/styles.css index dbe0751d8ec..d06f711df32 100644 --- a/server/sonar-web/src/main/js/apps/overview/styles.css +++ b/server/sonar-web/src/main/js/apps/overview/styles.css @@ -159,15 +159,6 @@ font-size: var(--bigFontSize); } -.overview-quality-gate-alert-inline-link { - display: inline-block; - max-width: 100%; - overflow: hidden; - text-overflow: ellipsis; - padding-bottom: 1px; - margin-bottom: -5px; -} - /* * Animations */ diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionReviewAndUpdateModal.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionReviewAndUpdateModal.tsx index d587a5a298f..328ad0dffc2 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionReviewAndUpdateModal.tsx +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionReviewAndUpdateModal.tsx @@ -19,7 +19,9 @@ */ import { sortBy } from 'lodash'; import * as React from 'react'; +import { FormattedMessage } from 'react-intl'; import { createCondition, deleteCondition, updateCondition } from '../../../api/quality-gates'; +import DocLink from '../../../components/common/DocLink'; import ConfirmModal from '../../../components/controls/ConfirmModal'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { Condition, Dict, Metric, QualityGate } from '../../../types/types'; @@ -110,8 +112,21 @@ export default class CaycReviewUpdateConditionsModal extends React.PureComponent size="medium" >

-

- {translate('quality_gates.cayc.review_update_modal.description')} +

+ + {translate('quality_gates.cayc')} + + ), + }} + /> +

+

+ {translate('quality_gates.cayc.review_update_modal.description2')}

{translate('quality_gates.conditions.new_code', 'long')} diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx index f0615f4406b..707387f074d 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx @@ -315,9 +315,8 @@ export class Conditions extends React.PureComponent { )} {qualityGate.isCaycCompliant && !unlockEditing && canEdit && ( -
-

{translate('quality_gates.cayc_unfollow.title')}

-
+
+

{ ), }} /> -

+

diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx index b011eed4e71..76a1faf300a 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx @@ -315,7 +315,10 @@ it('should show warning banner when CAYC condition is not properly set and shoul }) ).toBeInTheDocument(); expect( - screen.getByText('quality_gates.cayc.review_update_modal.description') + screen.getByText('quality_gates.cayc.review_update_modal.description1') + ).toBeInTheDocument(); + expect( + screen.getByText('quality_gates.cayc.review_update_modal.description2') ).toBeInTheDocument(); expect( screen.getByRole('button', { name: 'quality_gates.cayc.review_update_modal.confirm_text' }) diff --git a/server/sonar-web/src/main/js/apps/quality-gates/styles.css b/server/sonar-web/src/main/js/apps/quality-gates/styles.css index f4703e59887..649182ea7dc 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/styles.css +++ b/server/sonar-web/src/main/js/apps/quality-gates/styles.css @@ -76,8 +76,3 @@ .cayc-warning-description { line-height: 18px; } - -.qg-unfollow-cayc { - border: 1px solid var(--neutral200); - background-color: var(--neutral50); -} 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 eda34a3b660..c6aeb863cfd 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -1839,28 +1839,29 @@ quality_gates.permissions.remove.group=Remove permission from group quality_gates.permissions.remove.group.confirmation=Are you sure you want to remove permission on this quality gate from group {user}? quality_gates.cayc=Clean as You Code quality_gates.cayc.new_code=New Code -quality_gates.cayc_missing.banner.title=This Quality Gate does not comply with Clean as You Code -quality_gates.cayc_missing.banner.description=Six specific conditions on New Code must be included in any Quality Gate to make it compliant with {cayc_link}. They represent the minimum level of quality needed to follow Clean As You Code. We recommend that you update this Quality Gate to benefit from the power of Clean as You Code. -quality_gates.cayc_condition.review_update=Review and update -quality_gates.cayc.review_update_modal.header=Update "{0}" to follow Clean as You Code -quality_gates.cayc.review_update_modal.confirm_text=Update Quality Gate -quality_gates.cayc.review_update_modal.description=This Quality Gate will be updated to match exactly these 6 conditions. Any other condition will be deleted. +quality_gates.cayc_missing.banner.title=This quality gate does not comply with Clean as You Code +quality_gates.cayc_missing.banner.description={cayc_link} is the most efficient approach to delivering Clean Code. This quality gate does not comply with this methodology. We highly recommend that you update this quality gate. +quality_gates.cayc_condition.review_update=Review and Fix Quality Gate +quality_gates.cayc.review_update_modal.header=Fix "{0}" to comply with Clean as You Code +quality_gates.cayc.review_update_modal.confirm_text=Fix Quality Gate +quality_gates.cayc.review_update_modal.description1=This quality gate will be updated to comply with {cayc_link}. Existing conditions on duplication and coverage on new code will be preserved. All non-compliant conditions will be deleted, inlcuding conditions on overall code. +quality_gates.cayc.review_update_modal.description2=Please review the new quality gate conditions below. quality_gates.cayc.new_maintainability_rating.A=Technical debt ratio is less than {0} quality_gates.cayc.new_maintainability_rating=Technical debt ratio is greater than {1} quality_gates.cayc.new_reliability_rating.A=No bugs quality_gates.cayc.new_security_rating.A=No vulnerabilities quality_gates.cayc.unlock_edit=Unlock editing -quality_gates.cayc.tooltip.message=This Quality Gate does not comply with Clean as You Code. +quality_gates.cayc.tooltip.message=This quality gate does not comply with Clean as You Code. quality_gates.cayc.badge.tooltip.learn_more=Learn more: Clean as You Code -quality_gates.cayc.banner.title=This Quality Gate complies with Clean as You Code -quality_gates.cayc.banner.description=This Quality Gate follows the {cayc_link} methodology by enforcing high standards on {new_code_link}: +quality_gates.cayc.banner.title=This quality gate complies with Clean as You Code +quality_gates.cayc.banner.description=This quality gate complies with the {cayc_link} methodology so that you benefit from the most efficient approach to delivering Clean Code. The quality gate ensures that the {new_code_link} you’re working on has: quality_gates.cayc.banner.list_item1=No bugs quality_gates.cayc.banner.list_item2=No vulnerabilities quality_gates.cayc.banner.list_item3=No security hotspots to review -quality_gates.cayc.banner.list_item4=Limited amount of code smells +quality_gates.cayc.banner.list_item4=A limited amount of code smells (i.e. low technical debt ratio) quality_gates.cayc.banner.list_item5=A controlled level of duplication and coverage -quality_gates.cayc_unfollow.title=Don’t want to follow Clean as You Code? -quality_gates.cayc_unfollow.description=Editing is locked on this Quality Gate to prevent you from moving out of the {cayc_link} methodology. If you do not want to follow the Clean as You Code methodology, you may enable editing on this Quality Gate and modify its conditions +quality_gates.cayc_unfollow.description=Are you reconsidering {cayc_link}? We strongly recommend this methodology to achieve a Clean Code state. However, if you still wish to move out of this approach you may edit this quality gate. + #------------------------------------------------------------------------------ # # RULES DOCUMENTATION PAGE @@ -3259,8 +3260,7 @@ overview.you_should_define_quality_gate=You should define a quality gate on this overview.quality_gate.ignored_conditions=Some Quality Gate conditions on New Code were ignored because of the small number of New Lines overview.quality_gate.ignored_conditions.tooltip=At the start of a new code period, if very few lines have been added or modified, it might be difficult to reach the desired level of code coverage or duplications. To prevent Quality Gate failure when there's little that can be done about it, Quality Gate conditions about duplications in new code and coverage on new code are ignored until the number of new lines is at least 20. An administrator can disable this in the general settings. overview.quality_gate.conditions_on_new_code=Only conditions on new code that are defined in the Quality Gate are checked. See the {link} associated to the project for details. -overview.quality_gate.conditions.cayc.warning=Quality gate {link} used by this project does not comply with Clean as You Code. -overview.quality_gate.conditions.cayc.warning.no_link=The quality gate used by this project does not comply with Clean as You Code. +overview.quality_gate.conditions.cayc.warning=The quality gate used by this project does not comply with Clean as You Code. overview.quality_gate.conditions.cayc.details=Fixing this quality gate will help you achieve a Clean Code state. overview.quality_gate.conditions.cayc.review=Review Quality Gate overview.quality_gate.conditions.cayc.link=Learn more: Clean as You Code -- 2.39.5