aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/ApplicationNonCaycProjectWarning.tsx34
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/CleanAsYouCodeWarningOverCompliant.tsx64
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanel.tsx27
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/CaycOverCompliantBadgeTooltip.tsx35
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx21
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx23
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/styles.css4
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties10
10 files changed, 9 insertions, 239 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/ApplicationNonCaycProjectWarning.tsx b/server/sonar-web/src/main/js/apps/overview/branches/ApplicationNonCaycProjectWarning.tsx
index 8e7d0139efb..9544aaec21f 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/ApplicationNonCaycProjectWarning.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/ApplicationNonCaycProjectWarning.tsx
@@ -24,34 +24,22 @@ import { useDocUrl } from '../../../helpers/docs';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { getProjectQueryUrl } from '../../../helpers/urls';
import { QualityGateStatus } from '../../../types/quality-gates';
-import { CaycStatus } from '../../../types/types';
interface Props {
projects: QualityGateStatus[];
- caycStatus: CaycStatus;
}
-export default function ApplicationNonCaycProjectWarning({ projects, caycStatus }: Props) {
+export default function ApplicationNonCaycProjectWarning({ projects }: Props) {
const caycUrl = useDocUrl('/user-guide/clean-as-you-code/');
- const caycDrawbacksUrl = useDocUrl('/user-guide/clean-as-you-code/#potential-drawbacks');
return (
<Card className="sw-mt-4 sw-body-sm">
- {caycStatus === CaycStatus.NonCompliant ? (
- <FlagMessage variant="warning">
- {translateWithParameters(
- 'overview.quality_gate.application.non_cayc.projects_x',
- projects.length
- )}
- </FlagMessage>
- ) : (
- <p className="sw-p-2">
- {translateWithParameters(
- 'overview.quality_gate.application.cayc_over_compliant.projects_x',
- projects.length
- )}
- </p>
- )}
+ <FlagMessage variant="warning">
+ {translateWithParameters(
+ 'overview.quality_gate.application.non_cayc.projects_x',
+ projects.length
+ )}
+ </FlagMessage>
<ul className="sw-mt-4 sw-ml-2 sw-mb-2">
{projects.map(({ key, name, branchLike }) => (
@@ -62,13 +50,7 @@ export default function ApplicationNonCaycProjectWarning({ projects, caycStatus
</ul>
<hr className="sw-my-4" />
<div className="sw-m-2 sw-mt-4">
- {caycStatus === CaycStatus.NonCompliant ? (
- <Link to={caycUrl}>{translate('overview.quality_gate.conditions.cayc.link')}</Link>
- ) : (
- <Link to={caycDrawbacksUrl}>
- {translate('overview.quality_gate.conditions.cayc_over_compliant.link')}
- </Link>
- )}
+ <Link to={caycUrl}>{translate('overview.quality_gate.conditions.cayc.link')}</Link>
</div>
</Card>
);
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/CleanAsYouCodeWarningOverCompliant.tsx b/server/sonar-web/src/main/js/apps/overview/branches/CleanAsYouCodeWarningOverCompliant.tsx
deleted file mode 100644
index 38a2b966f99..00000000000
--- a/server/sonar-web/src/main/js/apps/overview/branches/CleanAsYouCodeWarningOverCompliant.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2023 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { DiscreetLink, Link } from 'design-system';
-import * as React from 'react';
-import { FormattedMessage } from 'react-intl';
-import { useDocUrl } from '../../../helpers/docs';
-import { translate } from '../../../helpers/l10n';
-import { getQualityGateUrl } from '../../../helpers/urls';
-import { Component } from '../../../types/types';
-
-interface Props {
- component: Pick<Component, 'key' | 'qualifier' | 'qualityGate'>;
-}
-
-export default function CleanAsYouCodeWarningOverCompliant({ component }: Props) {
- const caycDrawbackUrl = useDocUrl('/user-guide/clean-as-you-code/#potential-drawbacks');
-
- return (
- <>
- {component.qualityGate ? (
- <p className="sw-mb-4">
- <FormattedMessage
- id="overview.quality_gate.conditions.cayc_over_compliant.details_with_link"
- defaultMessage={translate(
- 'overview.quality_gate.conditions.cayc_over_compliant.details_with_link'
- )}
- values={{
- link: (
- <DiscreetLink to={getQualityGateUrl(component.qualityGate.name)}>
- {translate('overview.quality_gate.conditions.cayc_over_compliant.warning.link')}
- </DiscreetLink>
- ),
- }}
- />
- </p>
- ) : (
- <p className="sw-mb-4">
- {translate('overview.quality_gate.conditions.cayc_over_compliant.details')}
- </p>
- )}
-
- <Link to={caycDrawbackUrl}>
- {translate('overview.quality_gate.conditions.cayc_over_compliant.link')}
- </Link>
- </>
- );
-}
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanel.tsx b/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanel.tsx
index 3df69b32c76..a06e88baa3f 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanel.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanel.tsx
@@ -31,7 +31,6 @@ import { QualityGateStatusTitle } from '../components/QualityGateStatusTitle';
import SonarLintPromotion from '../components/SonarLintPromotion';
import ApplicationNonCaycProjectWarning from './ApplicationNonCaycProjectWarning';
import CleanAsYouCodeWarning from './CleanAsYouCodeWarning';
-import CleanAsYouCodeWarningOverCompliant from './CleanAsYouCodeWarningOverCompliant';
import QualityGatePanelSection from './QualityGatePanelSection';
export interface QualityGatePanelProps {
@@ -65,12 +64,6 @@ export function QualityGatePanel(props: QualityGatePanelProps) {
.sort(({ name: a }, { name: b }) => a.localeCompare(b, undefined, { sensitivity: 'base' }))
: [];
- const overCompliantCaycProjectsInApp = isApp
- ? qgStatuses
- .filter(({ caycStatus }) => caycStatus === CaycStatus.OverCompliant)
- .sort(({ name: a }, { name: b }) => a.localeCompare(b, undefined, { sensitivity: 'base' }))
- : [];
-
const showIgnoredConditionWarning =
component.qualifier === ComponentQualifier.Project &&
qgStatuses.some((p) => Boolean(p.ignoredConditions));
@@ -114,17 +107,7 @@ export function QualityGatePanel(props: QualityGatePanelProps) {
</Card>
{nonCaycProjectsInApp.length > 0 && (
- <ApplicationNonCaycProjectWarning
- projects={nonCaycProjectsInApp}
- caycStatus={CaycStatus.NonCompliant}
- />
- )}
-
- {overCompliantCaycProjectsInApp.length > 0 && (
- <ApplicationNonCaycProjectWarning
- projects={overCompliantCaycProjectsInApp}
- caycStatus={CaycStatus.OverCompliant}
- />
+ <ApplicationNonCaycProjectWarning projects={nonCaycProjectsInApp} />
)}
{qgStatuses.length === 1 &&
@@ -135,14 +118,6 @@ export function QualityGatePanel(props: QualityGatePanelProps) {
</Card>
)}
- {qgStatuses.length === 1 &&
- qgStatuses[0].caycStatus === CaycStatus.OverCompliant &&
- !isApp && (
- <Card className="sw-mt-4 sw-body-sm">
- <CleanAsYouCodeWarningOverCompliant component={component} />
- </Card>
- )}
-
<SonarLintPromotion
qgConditions={flatMap(qgStatuses, (qgStatus) => qgStatus.failedConditions)}
/>
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx
index 203aeb5a512..93f8b78d687 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx
@@ -232,21 +232,6 @@ describe('project overview', () => {
expect(screen.getByText('overview.quality_gate.conditions.cayc.warning')).toBeInTheDocument();
});
- it('should show Cayc message when QG is over-compliant', async () => {
- jest
- .mocked(getQualityGateProjectStatus)
- .mockResolvedValueOnce(
- mockQualityGateProjectStatus({ status: 'OK', caycStatus: CaycStatus.OverCompliant })
- );
-
- renderBranchOverview();
-
- expect(await screen.findByText('metric.level.OK')).toBeInTheDocument();
- expect(
- screen.getByText('overview.quality_gate.conditions.cayc_over_compliant.link')
- ).toBeInTheDocument();
- });
-
it('should show a failed QG', async () => {
renderBranchOverview();
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/CaycOverCompliantBadgeTooltip.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/CaycOverCompliantBadgeTooltip.tsx
deleted file mode 100644
index 1ca53aa2ea9..00000000000
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/CaycOverCompliantBadgeTooltip.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2023 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import * as React from 'react';
-import DocLink from '../../../components/common/DocLink';
-import { translate } from '../../../helpers/l10n';
-
-export default function CaycOverCompliantBadgeTooltip() {
- return (
- <div>
- <p className="spacer-bottom padded-bottom bordered-bottom-cayc">
- {translate('quality_gates.cayc_over_compliant.tooltip.message')}
- </p>
- <DocLink to="/user-guide/clean-as-you-code/#potential-drawbacks">
- {translate('quality_gates.cayc_over_compliant.badge.tooltip.learn_more')}
- </DocLink>
- </div>
- );
-}
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx
index ea476fca3f1..39debe2a694 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx
@@ -21,11 +21,8 @@ import classNames from 'classnames';
import * as React from 'react';
import { deleteCondition } from '../../../api/quality-gates';
import withMetricsContext from '../../../app/components/metrics/withMetricsContext';
-import { colors } from '../../../app/theme';
import { DeleteButton, EditButton } from '../../../components/controls/buttons';
import ConfirmModal from '../../../components/controls/ConfirmModal';
-import Tooltip from '../../../components/controls/Tooltip';
-import InfoIcon from '../../../components/icons/InfoIcon';
import { getLocalizedMetricName, translate, translateWithParameters } from '../../../helpers/l10n';
import {
CaycStatus,
@@ -39,7 +36,6 @@ import {
getLocalizedMetricNameNoDiffMetric,
isCaycCondition,
} from '../utils';
-import CaycOverCompliantBadgeTooltip from './CaycOverCompliantBadgeTooltip';
import ConditionModal from './ConditionModal';
import ConditionValue from './ConditionValue';
@@ -61,7 +57,6 @@ interface State {
modal: boolean;
}
-const TOOLTIP_MOUSE_LEAVE_DELAY = 0.3;
export class ConditionComponent extends React.PureComponent<Props, State> {
constructor(props: Props) {
super(props);
@@ -140,16 +135,6 @@ export class ConditionComponent extends React.PureComponent<Props, State> {
/>
</td>
<td className="text-middle nowrap display-flex-justify-end">
- {!isCaycCondition(condition) && isCaycCompliantAndOverCompliant && (
- <span className="display-flex-center spacer-right">
- <Tooltip
- overlay={<CaycOverCompliantBadgeTooltip />}
- mouseLeaveDelay={TOOLTIP_MOUSE_LEAVE_DELAY}
- >
- <InfoIcon fill={colors.alertIconInfo} />
- </Tooltip>
- </span>
- )}
{!isCaycModal && canEdit && (
<>
{(!isCaycCompliantAndOverCompliant ||
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 10885d4f923..2bc8876a107 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
@@ -194,27 +194,6 @@ export class Conditions extends React.PureComponent<Props, State> {
</Alert>
)}
- {qualityGate.caycStatus === CaycStatus.OverCompliant && (
- <Alert className="big-spacer-top big-spacer-bottom cayc-success-banner" variant="info">
- <h4 className="spacer-bottom cayc-over-compliant-header">
- {translate('quality_gates.cayc_over_compliant.banner.title')}
- </h4>
- <div className="cayc-warning-description spacer-top">
- <FormattedMessage
- id="quality_gates.cayc_over_compliant.banner.description"
- defaultMessage={translate('quality_gates.cayc_over_compliant.banner.description')}
- values={{
- link: (
- <DocLink to="/user-guide/clean-as-you-code/#potential-drawbacks">
- {translate('quality_gates.cayc_over_compliant.banner.link')}
- </DocLink>
- ),
- }}
- />
- </div>
- </Alert>
- )}
-
{qualityGate.caycStatus === CaycStatus.NonCompliant && (
<Alert className="big-spacer-top big-spacer-bottom" variant="warning">
<h4 className="spacer-bottom cayc-warning-header">
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 e1e0b8dfcd4..cea9b441406 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
@@ -376,29 +376,6 @@ it('should show success banner when quality gate is CAYC compliant', async () =>
expect(await conditionsWrapper.findByText('Duplicated Lines (%)')).toBeInTheDocument();
});
-it('should show info banner when quality gate is CAYC over-compliant', async () => {
- const user = userEvent.setup();
- handler.setIsAdmin(true);
- renderQualityGateApp();
-
- const qualityGate = await screen.findByText('Over Compliant CAYC QG');
-
- await user.click(qualityGate);
-
- expect(screen.getByText('quality_gates.cayc.banner.title')).toBeInTheDocument();
- expect(
- screen.getByText('quality_gates.cayc.banner.description1', { exact: false })
- ).toBeInTheDocument();
- expect(screen.getByText('quality_gates.cayc_over_compliant.banner.title')).toBeInTheDocument();
- expect(
- screen.queryByText('quality_gates.cayc_condition.missing_warning.title')
- ).not.toBeInTheDocument();
- expect(
- screen.queryByRole('button', { name: 'quality_gates.cayc_condition.review_update' })
- ).not.toBeInTheDocument();
- expect(screen.getByText('quality_gates.cayc.unlock_edit')).toBeInTheDocument();
-});
-
it('should unlock editing option for CAYC conditions', async () => {
const user = userEvent.setup();
handler.setIsAdmin(true);
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 20597091444..966eec709dc 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
@@ -73,10 +73,6 @@
color: var(--alertTextSuccess);
}
-.cayc-over-compliant-header {
- color: var(--veryDarkBlue);
-}
-
.cayc-warning-description {
line-height: 18px;
}
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 8680995447c..db00e9dd67e 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -2161,8 +2161,6 @@ 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.badge.tooltip.learn_more=Learn more: Clean as You Code
-quality_gates.cayc_over_compliant.tooltip.message=You added extra conditions to the "Clean as You Code" quality gate, which is something we do not recommend.
-quality_gates.cayc_over_compliant.badge.tooltip.learn_more=Learn why
quality_gates.cayc.banner.title=This quality gate complies with Clean as You Code
quality_gates.cayc.banner.description1=This quality gate complies with the {cayc_link} methodology, so that you benefit from the most efficient approach to delivering Clean Code.
quality_gates.cayc.banner.description2=It ensures that:
@@ -2172,9 +2170,6 @@ quality_gates.cayc.banner.list_item3=All new security hotspots are reviewed
quality_gates.cayc.banner.list_item4=New code has limited technical debt
quality_gates.cayc.banner.list_item5=New code has limited duplication
quality_gates.cayc.banner.list_item6=New code is properly covered by tests
-quality_gates.cayc_over_compliant.banner.title=Extra conditions are not recommended
-quality_gates.cayc_over_compliant.banner.description=You added extra conditions to the "Clean as You Code" quality gate, which is something we do not recommend. Learn {link}
-quality_gates.cayc_over_compliant.banner.link=why
quality_gates.cayc_unfollow.description=You may click unlock to edit this quality gate. Adding extra conditions to a compliant quality gate can result in drawbacks. Are you reconsidering {cayc_link}? We strongly recommend this methodology to achieve a Clean Code status.
quality_gates.cayc.review_update_modal.add_condition.header= {0} condition(s) on New Code will be added
quality_gates.cayc.review_update_modal.modify_condition.header= {0} condition(s) on New Code will be modified
@@ -3673,13 +3668,8 @@ overview.quality_gate.conditions.cayc.warning=The quality gate used by this proj
overview.quality_gate.conditions.cayc.details=Fixing this quality gate will help you achieve a Clean Code state.
overview.quality_gate.conditions.cayc.details_with_link=Fixing {link} will help you achieve a Clean Code state.
overview.quality_gate.conditions.non_cayc.warning.link=this quality gate
-overview.quality_gate.conditions.cayc_over_compliant.warning.link=quality gate
-overview.quality_gate.conditions.cayc_over_compliant.details=You added extra conditions to the "Clean as You Code" quality gate, which is something we do not recommend.
-overview.quality_gate.conditions.cayc_over_compliant.details_with_link=You added extra conditions to the "Clean as You Code" quality gate, which is something we do not recommend. Review your {link}.
overview.quality_gate.conditions.cayc.link=Learn why
-overview.quality_gate.conditions.cayc_over_compliant.link=Learn why
overview.quality_gate.application.non_cayc.projects_x={0} project(s) in this application use a Quality Gate that does not comply with Clean as You Code
-overview.quality_gate.application.cayc_over_compliant.projects_x=You added extra conditions to the "Clean as You Code" quality gate for {0} project(s) in this application, which is something we do not recommend.
overview.quality_gate.show_project_conditions_x=Show failed conditions for project {0}
overview.quality_gate.hide_project_conditions_x=Hide failed conditions for project {0}
overview.quality_profiles=Quality Profiles used