]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-23298 Deprecate quality_issues in favor of software_quality_issues
authorIsmail Cherri <ismail.cherri@sonarsource.com>
Thu, 31 Oct 2024 15:38:10 +0000 (16:38 +0100)
committersonartech <sonartech@sonarsource.com>
Tue, 5 Nov 2024 20:03:03 +0000 (20:03 +0000)
30 files changed:
server/sonar-web/src/main/js/api/mocks/data/measures.ts
server/sonar-web/src/main/js/apps/code/__tests__/Code-it.ts
server/sonar-web/src/main/js/apps/code/__tests__/__snapshots__/utils-test.tsx.snap
server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx
server/sonar-web/src/main/js/apps/component-measures/__tests__/ComponentMeasures-it.tsx
server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx
server/sonar-web/src/main/js/apps/component-measures/config/bubbles.ts
server/sonar-web/src/main/js/apps/component-measures/config/domains.ts
server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChartView.tsx
server/sonar-web/src/main/js/apps/component-measures/drilldown/MeasureCell.tsx
server/sonar-web/src/main/js/apps/component-measures/routes.tsx
server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx
server/sonar-web/src/main/js/apps/component-measures/utils.ts
server/sonar-web/src/main/js/apps/overview/branches/SoftwareImpactMeasureCard.tsx
server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx
server/sonar-web/src/main/js/apps/overview/utils.tsx
server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-it.tsx
server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx
server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasures.tsx
server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCard-test.tsx
server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCardMeasures-test.tsx
server/sonar-web/src/main/js/apps/projects/utils.ts
server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx
server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx
server/sonar-web/src/main/js/components/activity-graph/__tests__/ActivityGraph-it.tsx
server/sonar-web/src/main/js/components/activity-graph/utils.ts
server/sonar-web/src/main/js/helpers/constants.ts
server/sonar-web/src/main/js/helpers/issues.ts
server/sonar-web/src/main/js/helpers/measures.ts
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 593f2eb22f5ec14f7e51be2eb29499e3a69356dc..aafef6c4635a3cc2af6128a19f00168c89953935 100644 (file)
@@ -22,7 +22,6 @@ import { keyBy } from 'lodash';
 import { MetricKey, MetricType } from '~sonar-aligned/types/metrics';
 import { isDiffMetric } from '../../../helpers/measures';
 import { mockMeasure } from '../../../helpers/testMocks';
-import { SoftwareImpactSeverity } from '../../../types/clean-code-taxonomy';
 import { IssueDeprecatedStatus, IssueType, RawIssue } from '../../../types/issues';
 import { Measure } from '../../../types/types';
 import { ComponentTree } from './components';
@@ -59,80 +58,50 @@ function mockComponentMeasure(tree: ComponentTree, issueList: IssueData[], metri
         value: 'java=10000;javascript=5000;css=1000',
       });
 
-    case MetricKey.security_issues:
+    case MetricKey.software_quality_security_issues:
       return mockMeasure({
         metric: metricKey,
-        value: JSON.stringify({
-          total: 1,
-          [SoftwareImpactSeverity.High]: 0,
-          [SoftwareImpactSeverity.Medium]: 1,
-          [SoftwareImpactSeverity.Low]: 0,
-        }),
+        value: '1',
       });
 
-    case MetricKey.new_security_issues:
+    case MetricKey.new_software_quality_security_issues:
       return mockMeasure({
         metric: metricKey,
         period: {
           index: 1,
-          value: JSON.stringify({
-            total: 3,
-            [SoftwareImpactSeverity.High]: 2,
-            [SoftwareImpactSeverity.Medium]: 0,
-            [SoftwareImpactSeverity.Low]: 1,
-          }),
+          value: '3',
         },
         value: undefined,
       });
 
-    case MetricKey.reliability_issues:
+    case MetricKey.software_quality_reliability_issues:
       return mockMeasure({
         metric: metricKey,
-        value: JSON.stringify({
-          total: 3,
-          [SoftwareImpactSeverity.High]: 0,
-          [SoftwareImpactSeverity.Medium]: 2,
-          [SoftwareImpactSeverity.Low]: 1,
-        }),
+        value: '3',
       });
 
-    case MetricKey.new_reliability_issues:
+    case MetricKey.new_software_quality_reliability_issues:
       return mockMeasure({
         metric: metricKey,
         period: {
           index: 1,
-          value: JSON.stringify({
-            total: 2,
-            [SoftwareImpactSeverity.High]: 0,
-            [SoftwareImpactSeverity.Medium]: 1,
-            [SoftwareImpactSeverity.Low]: 1,
-          }),
+          value: '2',
         },
         value: undefined,
       });
 
-    case MetricKey.maintainability_issues:
+    case MetricKey.software_quality_maintainability_issues:
       return mockMeasure({
         metric: metricKey,
-        value: JSON.stringify({
-          total: 2,
-          [SoftwareImpactSeverity.High]: 0,
-          [SoftwareImpactSeverity.Medium]: 0,
-          [SoftwareImpactSeverity.Low]: 1,
-        }),
+        value: '2',
       });
 
-    case MetricKey.new_maintainability_issues:
+    case MetricKey.new_software_quality_maintainability_issues:
       return mockMeasure({
         metric: metricKey,
         period: {
           index: 1,
-          value: JSON.stringify({
-            total: 5,
-            [SoftwareImpactSeverity.High]: 2,
-            [SoftwareImpactSeverity.Medium]: 2,
-            [SoftwareImpactSeverity.Low]: 1,
-          }),
+          value: '5',
         },
         value: undefined,
       });
@@ -364,17 +333,6 @@ export function getMetricTypeFromKey(metricKey: string) {
     return MetricType.Percent;
   } else if (metricKey.includes('_rating')) {
     return MetricType.Rating;
-  } else if (
-    [
-      MetricKey.reliability_issues,
-      MetricKey.new_reliability_issues,
-      MetricKey.security_issues,
-      MetricKey.new_security_issues,
-      MetricKey.maintainability_issues,
-      MetricKey.new_maintainability_issues,
-    ].includes(metricKey as MetricKey)
-  ) {
-    return MetricType.Data;
   }
   return MetricType.Integer;
 }
index 4b319d332405a73c60c39312db0cde532c8f20d9..c620624df310dbec8c6d7ffea4e39b73c8f510f2 100644 (file)
@@ -296,9 +296,9 @@ it('should correctly show measures for a project', async () => {
   const folderRow = ui.measureRow(/folderA/);
   [
     [MetricKey.ncloc, '2'],
-    [MetricKey.security_issues, '4'],
-    [MetricKey.reliability_issues, '4'],
-    [MetricKey.maintainability_issues, '4'],
+    [MetricKey.software_quality_security_issues, '4'],
+    [MetricKey.software_quality_reliability_issues, '4'],
+    [MetricKey.software_quality_maintainability_issues, '4'],
     [MetricKey.security_hotspots, '2'],
     [MetricKey.coverage, '2.0%'],
     [MetricKey.duplicated_lines_density, '2.0%'],
@@ -310,9 +310,9 @@ it('should correctly show measures for a project', async () => {
   const fileRow = ui.measureRow(/index\.tsx/);
   [
     [MetricKey.ncloc, '—'],
-    [MetricKey.security_issues, '—'],
-    [MetricKey.reliability_issues, '—'],
-    [MetricKey.maintainability_issues, '—'],
+    [MetricKey.software_quality_security_issues, '—'],
+    [MetricKey.software_quality_reliability_issues, '—'],
+    [MetricKey.software_quality_maintainability_issues, '—'],
     [MetricKey.security_hotspots, '—'],
     [MetricKey.coverage, '—'],
     [MetricKey.duplicated_lines_density, '—'],
@@ -360,9 +360,9 @@ it('should correctly show measures for a project when relying on old taxonomy',
   const folderRow = ui.measureRow(/folderA/);
   [
     [MetricKey.ncloc, '2'],
-    [MetricKey.security_issues, '2'],
-    [MetricKey.reliability_issues, '2'],
-    [MetricKey.maintainability_issues, '2'],
+    [MetricKey.software_quality_security_issues, '2'],
+    [MetricKey.software_quality_reliability_issues, '2'],
+    [MetricKey.software_quality_maintainability_issues, '2'],
     [MetricKey.security_hotspots, '2'],
     [MetricKey.coverage, '2.0%'],
     [MetricKey.duplicated_lines_density, '2.0%'],
@@ -374,9 +374,9 @@ it('should correctly show measures for a project when relying on old taxonomy',
   const fileRow = ui.measureRow(/index\.tsx/);
   [
     [MetricKey.ncloc, '—'],
-    [MetricKey.security_issues, '—'],
-    [MetricKey.reliability_issues, '—'],
-    [MetricKey.maintainability_issues, '—'],
+    [MetricKey.software_quality_security_issues, '—'],
+    [MetricKey.software_quality_reliability_issues, '—'],
+    [MetricKey.software_quality_maintainability_issues, '—'],
     [MetricKey.security_hotspots, '—'],
     [MetricKey.coverage, '—'],
     [MetricKey.duplicated_lines_density, '—'],
@@ -649,12 +649,10 @@ function generateMeasures(overallValue = '1.0', newValue = '2.0') {
   return keyBy(
     [
       ...[
-        MetricKey.security_issues,
-        MetricKey.reliability_issues,
-        MetricKey.maintainability_issues,
-      ].map((metric) =>
-        mockMeasure({ metric, value: JSON.stringify({ total: 4 }), period: undefined }),
-      ),
+        MetricKey.software_quality_security_issues,
+        MetricKey.software_quality_reliability_issues,
+        MetricKey.software_quality_maintainability_issues,
+      ].map((metric) => mockMeasure({ metric, value: '4', period: undefined })),
       ...[
         MetricKey.ncloc,
         MetricKey.new_lines,
index 2ba88be1e1d65659c6efb61f63e815bce2652613..f71657b17db4f6185b603c82c8ea8fdfaacf5c65 100644 (file)
@@ -4,9 +4,9 @@ exports[`getCodeMetrics should return the right metrics for apps 1`] = `
 [
   "alert_status",
   "ncloc",
-  "security_issues",
-  "reliability_issues",
-  "maintainability_issues",
+  "software_quality_security_issues",
+  "software_quality_reliability_issues",
+  "software_quality_maintainability_issues",
   "vulnerabilities",
   "bugs",
   "code_smells",
@@ -96,9 +96,9 @@ exports[`getCodeMetrics should return the right metrics for portfolios 4`] = `
 exports[`getCodeMetrics should return the right metrics for projects 1`] = `
 [
   "ncloc",
-  "security_issues",
-  "reliability_issues",
-  "maintainability_issues",
+  "software_quality_security_issues",
+  "software_quality_reliability_issues",
+  "software_quality_maintainability_issues",
   "vulnerabilities",
   "bugs",
   "code_smells",
@@ -111,9 +111,9 @@ exports[`getCodeMetrics should return the right metrics for projects 1`] = `
 exports[`getCodeMetrics should return the right metrics for projects 2`] = `
 [
   "new_lines",
-  "security_issues",
-  "reliability_issues",
-  "maintainability_issues",
+  "software_quality_security_issues",
+  "software_quality_reliability_issues",
+  "software_quality_maintainability_issues",
   "vulnerabilities",
   "bugs",
   "code_smells",
index 08085326415474cec64e888f2a01fe5383365323..6d9c826ab4b5ffc8ac3d39d1550c57c6d0c87afd 100644 (file)
@@ -25,10 +25,7 @@ import { Status } from '~sonar-aligned/types/common';
 import { MetricKey, MetricType } from '~sonar-aligned/types/metrics';
 import RatingComponent from '../../../app/components/metrics/RatingComponent';
 import { getLeakValue } from '../../../components/measure/utils';
-import {
-  CCT_SOFTWARE_QUALITY_METRICS,
-  OLD_TO_NEW_TAXONOMY_METRICS_MAP,
-} from '../../../helpers/constants';
+import { OLD_TO_NEW_TAXONOMY_METRICS_MAP } from '../../../helpers/constants';
 import {
   areCCTMeasuresComputed as areCCTMeasuresComputedFn,
   isDiffMetric,
@@ -44,7 +41,7 @@ interface Props {
   metric: Metric;
 }
 
-export default function ComponentMeasure(props: Props) {
+export default function ComponentMeasure(props: Readonly<Props>) {
   const { component, metric, branchLike } = props;
   const isProjectLike = isProject(component.qualifier) || isApplication(component.qualifier);
   const { data: isStandardMode } = useStandardExperienceMode();
@@ -62,15 +59,7 @@ export default function ComponentMeasure(props: Props) {
     ? component.measures.find((measure) => measure.metric === finalMetricKey)
     : undefined;
 
-  let value;
-  if (
-    measure?.value !== undefined &&
-    CCT_SOFTWARE_QUALITY_METRICS.includes(measure.metric as MetricKey)
-  ) {
-    value = JSON.parse(measure.value).total;
-  } else {
-    value = isDiffMetric(metric.key) ? getLeakValue(measure) : measure?.value;
-  }
+  const value = isDiffMetric(metric.key) ? getLeakValue(measure) : measure?.value;
 
   switch (finalMetricType) {
     case MetricType.Level: {
index 6e7255c6f673744f312fdd985066a661b82eeecc..fa486575cff8101d21e259b333c3057f8076a3fc 100644 (file)
@@ -93,11 +93,11 @@ describe('rendering', () => {
     // Check one of the domains.
     await user.click(ui.maintainabilityDomainBtn.get());
     [
-      'component_measures.metric.new_maintainability_issues.name 5',
+      'component_measures.metric.new_software_quality_maintainability_issues.name 5',
       'Added Technical Debt work_duration.x_minutes.1',
       'Technical Debt Ratio on New Code 1.0%',
       'Maintainability Rating on New Code metric.has_rating_X.D metric.software_quality_maintainability_rating.tooltip.D.0.0%',
-      'component_measures.metric.maintainability_issues.name 2',
+      'component_measures.metric.software_quality_maintainability_issues.name 2',
       'Technical Debt work_duration.x_minutes.1',
       'Technical Debt Ratio 1.0%',
       'Maintainability Rating metric.has_rating_X.D metric.software_quality_maintainability_rating.tooltip.D.0.0%',
@@ -148,8 +148,14 @@ describe('rendering', () => {
   });
 
   it('should correctly revert to old measures when analysis is missing', async () => {
-    measuresHandler.deleteComponentMeasure('foo', MetricKey.maintainability_issues);
-    measuresHandler.deleteComponentMeasure('foo', MetricKey.new_maintainability_issues);
+    measuresHandler.deleteComponentMeasure(
+      'foo',
+      MetricKey.software_quality_maintainability_issues,
+    );
+    measuresHandler.deleteComponentMeasure(
+      'foo',
+      MetricKey.new_software_quality_maintainability_issues,
+    );
     measuresHandler.deleteComponentMeasure(
       'foo',
       MetricKey.software_quality_maintainability_rating,
@@ -198,11 +204,11 @@ describe('rendering', () => {
     // Check one of the domains.
     await user.click(ui.maintainabilityDomainBtn.get());
     [
-      'component_measures.metric.new_maintainability_issues.name 5',
+      'component_measures.metric.new_software_quality_maintainability_issues.name 5',
       'Added Technical Debt work_duration.x_minutes.1',
       'Technical Debt Ratio on New Code 1.0%',
       'Maintainability Rating on New Code metric.has_rating_X.E metric.sqale_rating.tooltip.E.0.0%',
-      'component_measures.metric.maintainability_issues.name 2',
+      'component_measures.metric.software_quality_maintainability_issues.name 2',
       'Technical Debt work_duration.x_minutes.1',
       'Technical Debt Ratio 1.0%',
       'Maintainability Rating metric.has_rating_X.E metric.sqale_rating.tooltip.E.0.0%',
@@ -438,16 +444,20 @@ describe('rendering', () => {
 
   it('should correctly render a link to the activity page', async () => {
     const { ui, user } = getPageObject();
-    renderMeasuresApp('component_measures?id=foo&metric=new_maintainability_issues');
+    renderMeasuresApp(
+      'component_measures?id=foo&metric=new_software_quality_maintainability_issues',
+    );
     await ui.appLoaded();
 
     expect(ui.goToActivityLink.query()).not.toBeInTheDocument();
     await user.click(
-      ui.measureLink('component_measures.metric.maintainability_issues.name 2').get(),
+      ui
+        .measureLink('component_measures.metric.software_quality_maintainability_issues.name 2')
+        .get(),
     );
     expect(ui.goToActivityLink.get()).toHaveAttribute(
       'href',
-      '/project/activity?id=foo&graph=custom&custom_metrics=maintainability_issues',
+      '/project/activity?id=foo&graph=custom&custom_metrics=software_quality_maintainability_issues',
     );
   });
 
@@ -479,7 +489,9 @@ describe('navigation', () => {
     await user.click(ui.maintainabilityDomainBtn.get());
 
     await user.click(
-      ui.measureLink('component_measures.metric.maintainability_issues.name 2').get(),
+      ui
+        .measureLink('component_measures.metric.software_quality_maintainability_issues.name 2')
+        .get(),
     );
     expect(
       within(ui.measuresRow('folderA').get()).getByRole('cell', { name: '2' }),
@@ -512,7 +524,9 @@ describe('navigation', () => {
 
     await user.click(ui.maintainabilityDomainBtn.get());
     await user.click(
-      ui.measureLink('component_measures.metric.maintainability_issues.name 2').get(),
+      ui
+        .measureLink('component_measures.metric.software_quality_maintainability_issues.name 2')
+        .get(),
     );
 
     // Click list option in view select
@@ -568,7 +582,9 @@ describe('navigation', () => {
     // Drilldown to the file level.
     await user.click(ui.maintainabilityDomainBtn.get());
     await user.click(
-      ui.measureLink('component_measures.metric.maintainability_issues.name 2').get(),
+      ui
+        .measureLink('component_measures.metric.software_quality_maintainability_issues.name 2')
+        .get(),
     );
 
     await ui.arrowDown(); // Select the 1st element ("folderA")
@@ -608,8 +624,14 @@ describe('redirects', () => {
   });
 
   it('should redirect old metric route', async () => {
-    measuresHandler.deleteComponentMeasure('foo', MetricKey.maintainability_issues);
-    measuresHandler.deleteComponentMeasure('foo', MetricKey.new_maintainability_issues);
+    measuresHandler.deleteComponentMeasure(
+      'foo',
+      MetricKey.software_quality_maintainability_issues,
+    );
+    measuresHandler.deleteComponentMeasure(
+      'foo',
+      MetricKey.new_software_quality_maintainability_issues,
+    );
 
     const { ui } = getPageObject();
     renderMeasuresApp('component_measures/metric/bugs?id=foo');
@@ -625,13 +647,19 @@ describe('redirects', () => {
     renderMeasuresApp('component_measures/metric/security_issues?id=foo');
     await ui.appLoaded();
     expect(
-      ui.measureLink('component_measures.metric.security_issues.name 1').get(),
+      ui.measureLink('component_measures.metric.software_quality_security_issues.name 1').get(),
     ).toHaveAttribute('aria-current', 'true');
   });
 
   it('should redirect old domain route', async () => {
-    measuresHandler.deleteComponentMeasure('foo', MetricKey.maintainability_issues);
-    measuresHandler.deleteComponentMeasure('foo', MetricKey.new_maintainability_issues);
+    measuresHandler.deleteComponentMeasure(
+      'foo',
+      MetricKey.software_quality_maintainability_issues,
+    );
+    measuresHandler.deleteComponentMeasure(
+      'foo',
+      MetricKey.new_software_quality_maintainability_issues,
+    );
 
     const { ui } = getPageObject();
     renderMeasuresApp('component_measures/domain/bugs?id=foo');
index 70980a390ddae3cbd0bd37b1f7c511c9474c7a0c..9ebb24a2e5ad6dcbd96c6061f706afb6d9b6d664 100644 (file)
@@ -31,7 +31,7 @@ import { getComponentMeasureUniqueKey } from '../../../helpers/component';
 import { SOFTWARE_QUALITY_RATING_METRICS_MAP } from '../../../helpers/constants';
 import { KeyboardKeys } from '../../../helpers/keycodes';
 import { translate } from '../../../helpers/l10n';
-import { getCCTMeasureValue, isDiffMetric } from '../../../helpers/measures';
+import { isDiffMetric } from '../../../helpers/measures';
 import { RequestData } from '../../../helpers/request';
 import { isDefined } from '../../../helpers/types';
 import { getProjectUrl } from '../../../helpers/urls';
@@ -134,9 +134,8 @@ export default function MeasureContent(props: Readonly<Props>) {
   const measures = measuresData?.component.measures ?? [];
   const measure = measures.find((m) => m.metric === requestedMetric.key);
   const secondaryMeasure = measures.find((m) => m.metric !== requestedMetric.key);
-  const rawMeasureValue =
+  const measureValue =
     measure && (isDiffMetric(measure.metric) ? measure.period?.value : measure.value);
-  const measureValue = getCCTMeasureValue(metric.key, rawMeasureValue);
   const isFileComponent = isFile(baseComponent.qualifier);
 
   const paging = treeData?.pages[treeData?.pages.length - 1].paging;
index a63963f7b094c0e4bcdafbf1cfd13d0e1765dd09..703b6003f12a3af69461766c714a6deca93e0d3e 100644 (file)
@@ -35,19 +35,19 @@ export const newTaxonomyBubbles: BubblesByDomain = {
   Reliability: {
     x: MetricKey.ncloc,
     y: MetricKey.software_quality_reliability_remediation_effort,
-    size: MetricKey.reliability_issues,
+    size: MetricKey.software_quality_reliability_issues,
     colors: [MetricKey.software_quality_reliability_rating],
   },
   Security: {
     x: MetricKey.ncloc,
     y: MetricKey.software_quality_security_remediation_effort,
-    size: MetricKey.security_issues,
+    size: MetricKey.software_quality_security_issues,
     colors: [MetricKey.software_quality_security_rating],
   },
   Maintainability: {
     x: MetricKey.ncloc,
     y: MetricKey.software_quality_maintainability_remediation_effort,
-    size: MetricKey.maintainability_issues,
+    size: MetricKey.software_quality_maintainability_issues,
     colors: [MetricKey.software_quality_maintainability_rating],
   },
   Coverage: {
@@ -77,19 +77,19 @@ export const newTaxonomyWithoutRatingsBubbles: BubblesByDomain = {
   Reliability: {
     x: MetricKey.ncloc,
     y: MetricKey.reliability_remediation_effort,
-    size: MetricKey.reliability_issues,
+    size: MetricKey.software_quality_reliability_issues,
     colors: [MetricKey.reliability_rating],
   },
   Security: {
     x: MetricKey.ncloc,
     y: MetricKey.security_remediation_effort,
-    size: MetricKey.security_issues,
+    size: MetricKey.software_quality_security_issues,
     colors: [MetricKey.security_rating],
   },
   Maintainability: {
     x: MetricKey.ncloc,
     y: MetricKey.sqale_index,
-    size: MetricKey.maintainability_issues,
+    size: MetricKey.software_quality_maintainability_issues,
     colors: [MetricKey.sqale_rating],
   },
   Coverage: {
index 93db7f74622a408ba2ed9c78b53fad921848f09e..aebad3521f4e1ea78ee0efa4c13c0038331cbc33 100644 (file)
@@ -33,7 +33,7 @@ export const domains: Domains = {
     categories: [NEW_CODE_CATEGORY, OVERALL_CATEGORY],
     order: [
       NEW_CODE_CATEGORY,
-      MetricKey.new_reliability_issues,
+      MetricKey.new_software_quality_reliability_issues,
       MetricKey.new_bugs,
       MetricKey.new_reliability_rating,
       SOFTWARE_QUALITY_RATING_METRICS_MAP[MetricKey.new_reliability_rating],
@@ -41,7 +41,7 @@ export const domains: Domains = {
       SOFTWARE_QUALITY_RATING_METRICS_MAP[MetricKey.new_reliability_remediation_effort],
 
       OVERALL_CATEGORY,
-      MetricKey.reliability_issues,
+      MetricKey.software_quality_reliability_issues,
       MetricKey.bugs,
       MetricKey.reliability_rating,
       SOFTWARE_QUALITY_RATING_METRICS_MAP[MetricKey.reliability_rating],
@@ -54,7 +54,7 @@ export const domains: Domains = {
     categories: [NEW_CODE_CATEGORY, OVERALL_CATEGORY],
     order: [
       NEW_CODE_CATEGORY,
-      MetricKey.new_security_issues,
+      MetricKey.new_software_quality_security_issues,
       MetricKey.new_vulnerabilities,
       MetricKey.new_security_rating,
       SOFTWARE_QUALITY_RATING_METRICS_MAP[MetricKey.new_security_rating],
@@ -62,7 +62,7 @@ export const domains: Domains = {
       SOFTWARE_QUALITY_RATING_METRICS_MAP[MetricKey.new_security_remediation_effort],
 
       OVERALL_CATEGORY,
-      MetricKey.security_issues,
+      MetricKey.software_quality_security_issues,
       MetricKey.vulnerabilities,
       MetricKey.security_rating,
       SOFTWARE_QUALITY_RATING_METRICS_MAP[MetricKey.security_rating],
@@ -92,7 +92,7 @@ export const domains: Domains = {
     categories: [NEW_CODE_CATEGORY, OVERALL_CATEGORY],
     order: [
       NEW_CODE_CATEGORY,
-      MetricKey.new_maintainability_issues,
+      MetricKey.new_software_quality_maintainability_issues,
       MetricKey.new_code_smells,
       MetricKey.new_technical_debt,
       SOFTWARE_QUALITY_RATING_METRICS_MAP[MetricKey.new_technical_debt],
@@ -102,7 +102,7 @@ export const domains: Domains = {
       SOFTWARE_QUALITY_RATING_METRICS_MAP[MetricKey.new_maintainability_rating],
 
       OVERALL_CATEGORY,
-      MetricKey.maintainability_issues,
+      MetricKey.software_quality_maintainability_issues,
       MetricKey.code_smells,
       MetricKey.sqale_index,
       SOFTWARE_QUALITY_RATING_METRICS_MAP[MetricKey.sqale_index],
@@ -177,11 +177,16 @@ export const domains: Domains = {
   },
 
   Complexity: {
-    order: ['complexity', 'function_complexity', 'file_complexity', 'class_complexity'],
+    order: [
+      MetricKey.complexity,
+      MetricKey.function_complexity,
+      MetricKey.file_complexity,
+      MetricKey.class_complexity,
+    ],
   },
 
   Releasability: {
-    order: ['releasability_rating', 'releasability_effort', 'alert_status'],
+    order: [MetricKey.releasability_rating, MetricKey.releasability_effort, MetricKey.alert_status],
   },
 
   Issues: {
index 1107b0a116a996ddc9b241332e1f54be0334c8a7..7751fc840a4eb0e00732b1123f19503c27c953b6 100644 (file)
@@ -39,7 +39,7 @@ import {
   translate,
   translateWithParameters,
 } from '../../../helpers/l10n';
-import { getCCTMeasureValue, isDiffMetric } from '../../../helpers/measures';
+import { isDiffMetric } from '../../../helpers/measures';
 import { isDefined } from '../../../helpers/types';
 import { getComponentDrilldownUrl } from '../../../helpers/urls';
 import { BranchLike } from '../../../types/branch-like';
@@ -257,9 +257,7 @@ const getMeasureVal = (component: ComponentMeasureEnhanced, metric: Metric) => {
   if (!measure) {
     return undefined;
   }
-  return Number(
-    getCCTMeasureValue(metric.key, isDiffMetric(metric.key) ? measure.leak : measure.value),
-  );
+  return Number(isDiffMetric(metric.key) ? measure.leak : measure.value);
 };
 
 const getTooltip = (
index e4661f2acb2790a08e1ef411bc4b2c9d9e35729f..b34c2e24004bd206deadf8a780f252a3d8f89951 100644 (file)
@@ -20,7 +20,7 @@
 
 import { NumericalCell } from '~design-system';
 import Measure from '~sonar-aligned/components/measure/Measure';
-import { getCCTMeasureValue, isDiffMetric } from '../../../helpers/measures';
+import { isDiffMetric } from '../../../helpers/measures';
 import { BranchLike } from '../../../types/branch-like';
 import { ComponentMeasureEnhanced, MeasureEnhanced, Metric } from '../../../types/types';
 
@@ -35,8 +35,7 @@ export default function MeasureCell({ component, measure, metric, branchLike }:
   const getValue = (item: { leak?: string; value?: string }) =>
     isDiffMetric(metric.key) ? item.leak : item.value;
 
-  const rawValue = getValue(measure || component);
-  const value = getCCTMeasureValue(metric.key, rawValue);
+  const value = getValue(measure || component);
 
   return (
     <NumericalCell className="sw-py-3">
index bd5fc98bf99b3497c7fe3aa394159f9573af3d86..7b640397127bf93d93ee51684f9e34f6def0a0f4 100644 (file)
@@ -21,7 +21,9 @@
 import { Navigate, Route, useParams, useSearchParams } from 'react-router-dom';
 import { lazyLoadComponent } from '~sonar-aligned/helpers/lazyLoadComponent';
 import { searchParamsToQuery } from '~sonar-aligned/helpers/router';
+import { MetricKey } from '~sonar-aligned/types/metrics';
 import NavigateWithParams from '../../app/utils/NavigateWithParams';
+import { SOFTWARE_QUALITIES_ISSUES_KEYS_MAP } from '../../helpers/constants';
 import { omitNil } from '../../helpers/request';
 
 const ComponentMeasuresApp = lazyLoadComponent(() => import('./components/ComponentMeasuresApp'));
@@ -36,7 +38,9 @@ const routes = () => (
           pathname="/component_measures"
           transformParams={(params) =>
             omitNil({
-              metric: params['domainName'],
+              metric:
+                SOFTWARE_QUALITIES_ISSUES_KEYS_MAP[params['domainName'] as MetricKey] ??
+                params['domainName'],
             })
           }
         />
@@ -70,7 +74,8 @@ function MetricRedirect() {
     search: new URLSearchParams(
       omitNil({
         ...searchParamsToQuery(searchParams),
-        metric: params.metricKey,
+        metric:
+          SOFTWARE_QUALITIES_ISSUES_KEYS_MAP[params.metricKey as MetricKey] ?? params.metricKey,
         view: params.view,
       }),
     ).toString(),
index a2c7f0a950fa0f14077e730377766b0001106b6d..b38402ae671f76296a95984e0f3a95e297d3b8a9 100644 (file)
@@ -36,7 +36,7 @@ import useFollowScroll from '../../../hooks/useFollowScroll';
 import { useStandardExperienceMode } from '../../../queries/settings';
 import { Domain } from '../../../types/measures';
 import { MeasureEnhanced } from '../../../types/types';
-import { PROJECT_OVERVEW, Query, isProjectOverview, populateDomainsFromMeasures } from '../utils';
+import { PROJECT_OVERVIEW, Query, isProjectOverview, populateDomainsFromMeasures } from '../utils';
 import DomainSubnavigation from './DomainSubnavigation';
 
 interface Props {
@@ -61,7 +61,7 @@ export default function Sidebar(props: Readonly<Props>) {
   );
 
   const handleProjectOverviewClick = () => {
-    handleChangeMetric(PROJECT_OVERVEW);
+    handleChangeMetric(PROJECT_OVERVIEW);
   };
 
   const distanceFromBottom = topScroll + window.innerHeight - document.body.scrollHeight;
@@ -97,7 +97,7 @@ export default function Sidebar(props: Readonly<Props>) {
             ariaCurrent={isProjectOverview(selectedMetric)}
             onClick={handleProjectOverviewClick}
           >
-            {translate('component_measures.overview', PROJECT_OVERVEW, 'subnavigation')}
+            {translate('component_measures.overview', PROJECT_OVERVIEW, 'subnavigation')}
           </SubnavigationItem>
         </SubnavigationGroup>
 
index c4defaf8727553903ce5bf009ad8dd2cac7fd9cc..037d0b454f0f864c8a2285b2a6803c37f519fb99 100644 (file)
@@ -39,7 +39,6 @@ import {
   areCCTMeasuresComputed,
   areLeakCCTMeasuresComputed,
   areSoftwareQualityRatingsComputed,
-  getCCTMeasureValue,
   getDisplayMetrics,
   isDiffMetric,
   MEASURES_REDIRECTION,
@@ -64,9 +63,9 @@ import { BubblesByDomain } from './config/bubbles';
 import { domains } from './config/domains';
 
 export const BUBBLES_FETCH_LIMIT = 500;
-export const PROJECT_OVERVEW = 'project_overview';
+export const PROJECT_OVERVIEW = 'project_overview';
 export const DEFAULT_VIEW = MeasurePageView.tree;
-export const DEFAULT_METRIC = PROJECT_OVERVEW;
+export const DEFAULT_METRIC = PROJECT_OVERVIEW;
 export const KNOWN_DOMAINS = [
   'Releasability',
   'Security',
@@ -108,10 +107,7 @@ export const populateDomainsFromMeasures = memoize(
       .filter((measure) => !DEPRECATED_METRICS.includes(measure.metric.key as MetricKey))
       .map((measure) => {
         const isDiff = isDiffMetric(measure.metric.key);
-        const calculatedValue = getCCTMeasureValue(
-          measure.metric.key,
-          isDiff ? measure.leak : measure.value,
-        );
+        const calculatedValue = isDiff ? measure.leak : measure.value;
 
         return {
           ...measure,
@@ -328,7 +324,7 @@ export function getBubbleYDomain(bubblesByDomain: BubblesByDomain, domain: strin
 }
 
 export function isProjectOverview(metric: string) {
-  return metric === PROJECT_OVERVEW;
+  return metric === PROJECT_OVERVIEW;
 }
 
 function parseView(metric: MetricKey, rawView?: string): MeasurePageView {
index 694dd594eaa75efe0cfea3ab812bd8a63de15f69..33cea6fd02bf2b0b3c202f9f82454c8f2a3bfd3a 100644 (file)
@@ -33,7 +33,7 @@ import {
 import { isDefined } from '../../../helpers/types';
 import { useStandardExperienceMode } from '../../../queries/settings';
 import { Branch } from '../../../types/branch-like';
-import { SoftwareImpactMeasureData, SoftwareQuality } from '../../../types/clean-code-taxonomy';
+import { SoftwareQuality } from '../../../types/clean-code-taxonomy';
 import { QualityGateStatusConditionEnhanced } from '../../../types/quality-gates';
 import { Component, MeasureEnhanced } from '../../../types/types';
 import { Status, softwareQualityToMeasure } from '../utils';
@@ -56,15 +56,11 @@ export function SoftwareImpactMeasureCard(props: Readonly<SoftwareImpactBreakdow
 
   // Find measure for this software quality
   const metricKey = softwareQualityToMeasure(softwareQuality);
-  const measureRaw = measures.find((m) => m.metric.key === metricKey);
-  const measure = isStandardMode
-    ? undefined
-    : (JSON.parse(measureRaw?.value ?? 'null') as SoftwareImpactMeasureData);
+  const measure = isStandardMode ? undefined : measures.find((m) => m.metric.key === metricKey);
   const alternativeMeasure = measures.find(
     (m) => m.metric.key === SOFTWARE_QUALITIES_METRIC_KEYS_MAP[softwareQuality].deprecatedMetric,
   );
-
-  const count = formatMeasure(measure?.total ?? alternativeMeasure?.value, MetricType.ShortInteger);
+  const count = formatMeasure(measure?.value ?? alternativeMeasure?.value, MetricType.ShortInteger);
 
   const totalLinkHref = getComponentIssuesUrl(component.key, {
     ...DEFAULT_ISSUES_QUERY,
index 8fe0b15c627ce307a296c03618aab5772f928479..1f0cdf03650d6dfe9e22665d1e936ef52bf98b5c 100644 (file)
@@ -351,14 +351,17 @@ describe('project overview', () => {
 
   it('should render old measures if software impact are missing', async () => {
     // Make as if new analysis after upgrade is missing
-    measuresHandler.deleteComponentMeasure('foo', MetricKey.maintainability_issues);
+    measuresHandler.deleteComponentMeasure(
+      'foo',
+      MetricKey.software_quality_maintainability_issues,
+    );
     measuresHandler.deleteComponentMeasure(
       'foo',
       MetricKey.software_quality_maintainability_rating,
     );
-    measuresHandler.deleteComponentMeasure('foo', MetricKey.security_issues);
+    measuresHandler.deleteComponentMeasure('foo', MetricKey.software_quality_security_issues);
     measuresHandler.deleteComponentMeasure('foo', MetricKey.software_quality_security_rating);
-    measuresHandler.deleteComponentMeasure('foo', MetricKey.reliability_issues);
+    measuresHandler.deleteComponentMeasure('foo', MetricKey.software_quality_reliability_issues);
     measuresHandler.deleteComponentMeasure('foo', MetricKey.software_quality_reliability_rating);
 
     const { user, ui } = getPageObjects();
@@ -390,18 +393,21 @@ describe('project overview', () => {
 
   it('should render missing software impact measure cards if both software qualities and old measures are missing', async () => {
     // Make as if no measures at all
-    measuresHandler.deleteComponentMeasure('foo', MetricKey.maintainability_issues);
+    measuresHandler.deleteComponentMeasure(
+      'foo',
+      MetricKey.software_quality_maintainability_issues,
+    );
     measuresHandler.deleteComponentMeasure('foo', MetricKey.code_smells);
     measuresHandler.deleteComponentMeasure(
       'foo',
       MetricKey.software_quality_maintainability_rating,
     );
 
-    measuresHandler.deleteComponentMeasure('foo', MetricKey.security_issues);
+    measuresHandler.deleteComponentMeasure('foo', MetricKey.software_quality_security_issues);
     measuresHandler.deleteComponentMeasure('foo', MetricKey.vulnerabilities);
     measuresHandler.deleteComponentMeasure('foo', MetricKey.software_quality_security_rating);
 
-    measuresHandler.deleteComponentMeasure('foo', MetricKey.reliability_issues);
+    measuresHandler.deleteComponentMeasure('foo', MetricKey.software_quality_reliability_issues);
     measuresHandler.deleteComponentMeasure('foo', MetricKey.bugs);
     measuresHandler.deleteComponentMeasure('foo', MetricKey.software_quality_reliability_rating);
 
@@ -431,13 +437,13 @@ describe('project overview', () => {
   });
 
   it.each([
-    ['security_issues', MetricKey.security_issues],
-    ['reliability_issues', MetricKey.reliability_issues],
-    ['maintainability_issues', MetricKey.maintainability_issues],
+    [MetricKey.software_quality_security_issues],
+    [MetricKey.software_quality_reliability_issues],
+    [MetricKey.software_quality_maintainability_issues],
   ])(
     'should display info about missing analysis if a project is not computed for %s',
     async (missingMetricKey) => {
-      measuresHandler.deleteComponentMeasure('foo', missingMetricKey as MetricKey);
+      measuresHandler.deleteComponentMeasure('foo', missingMetricKey);
       const { user, ui } = getPageObjects();
       renderBranchOverview();
 
@@ -723,9 +729,9 @@ describe('application overview', () => {
   });
 
   it.each([
-    ['security_issues', MetricKey.security_issues],
-    ['reliability_issues', MetricKey.reliability_issues],
-    ['maintainability_issues', MetricKey.maintainability_issues],
+    [MetricKey.software_quality_security_issues],
+    [MetricKey.software_quality_reliability_issues],
+    [MetricKey.software_quality_maintainability_issues],
   ])(
     'should ask to reanalyze all projects if a project is not computed for %s',
     async (missingMetricKey) => {
index 6ddb82ea2c14044659869f168ee818354a1c5c72..4fb159fbfb6a5fb80f5ec2e92cf5562c63560a3d 100644 (file)
@@ -42,9 +42,9 @@ export const BRANCH_OVERVIEW_METRICS: string[] = [
   MetricKey.accepted_issues,
   MetricKey.new_accepted_issues,
   MetricKey.high_impact_accepted_issues,
-  MetricKey.maintainability_issues,
-  MetricKey.reliability_issues,
-  MetricKey.security_issues,
+  MetricKey.software_quality_maintainability_issues,
+  MetricKey.software_quality_reliability_issues,
+  MetricKey.software_quality_security_issues,
 
   // bugs
   MetricKey.bugs,
@@ -190,7 +190,7 @@ export const METRICS_REPORTED_IN_OVERVIEW_CARDS = [
 ];
 
 export function softwareQualityToMeasure(softwareQuality: SoftwareQuality): MetricKey {
-  return (softwareQuality.toLowerCase() + '_issues') as MetricKey;
+  return `software_quality_${softwareQuality.toLowerCase()}_issues` as MetricKey;
 }
 
 export function getIssueRatingName(type: IssueType) {
index b74a5f34e9627d5ff65038248d3c449aecb02493..380572a181c919ecb6ec77aae7314f25136afd26 100644 (file)
@@ -90,7 +90,7 @@ beforeEach(() => {
       MetricKey.sqale_rating,
       MetricKey.security_hotspots_reviewed,
       MetricKey.security_review_rating,
-      MetricKey.maintainability_issues,
+      MetricKey.software_quality_maintainability_issues,
     ].map((metric) =>
       mockMeasureHistory({
         metric,
index 7aeadbb197f8d674dbd4ec1d8c9c5558aa01cb38..9ea67fc27748ab1be4db97d00de62fa9c488fa12 100644 (file)
@@ -68,9 +68,9 @@ function renderFirstLine(
 ) {
   const { analysisDate, isFavorite, key, measures, name, qualifier, tags, visibility } = project;
   const noSoftwareQualityMetrics = [
-    MetricKey.reliability_issues,
-    MetricKey.maintainability_issues,
-    MetricKey.security_issues,
+    MetricKey.software_quality_reliability_issues,
+    MetricKey.software_quality_maintainability_issues,
+    MetricKey.software_quality_security_issues,
   ].every((key) => measures[key] === undefined);
   const noRatingMetrics = [
     MetricKey.software_quality_reliability_rating,
index 07822ead3ffdc666e757cffc68772efc1302c1d9..c5d0250515024fc9397092756dd6ede1659f77bb 100644 (file)
@@ -125,35 +125,36 @@ function renderRatings(props: ProjectCardMeasuresProps, isStandardMode: boolean)
     : [
         {
           iconLabel: translate(
-            `metric.${isStandardMode ? MetricKey.vulnerabilities : MetricKey.security_issues}.short_name`,
+            `metric.${isStandardMode ? MetricKey.vulnerabilities : MetricKey.software_quality_security_issues}.short_name`,
           ),
           noShrink: true,
           metricKey:
-            isStandardMode || measures[MetricKey.security_issues] === undefined
+            isStandardMode || measures[MetricKey.software_quality_security_issues] === undefined
               ? MetricKey.vulnerabilities
-              : MetricKey.security_issues,
+              : MetricKey.software_quality_security_issues,
           metricRatingKey: MetricKey.security_rating,
           metricType: MetricType.ShortInteger,
         },
         {
           iconLabel: translate(
-            `metric.${isStandardMode ? MetricKey.bugs : MetricKey.reliability_issues}.short_name`,
+            `metric.${isStandardMode ? MetricKey.bugs : MetricKey.software_quality_reliability_issues}.short_name`,
           ),
           metricKey:
-            isStandardMode || measures[MetricKey.reliability_issues] === undefined
+            isStandardMode || measures[MetricKey.software_quality_reliability_issues] === undefined
               ? MetricKey.bugs
-              : MetricKey.reliability_issues,
+              : MetricKey.software_quality_reliability_issues,
           metricRatingKey: MetricKey.reliability_rating,
           metricType: MetricType.ShortInteger,
         },
         {
           iconLabel: translate(
-            `metric.${isStandardMode ? MetricKey.code_smells : MetricKey.maintainability_issues}.short_name`,
+            `metric.${isStandardMode ? MetricKey.code_smells : MetricKey.software_quality_maintainability_issues}.short_name`,
           ),
           metricKey:
-            isStandardMode || measures[MetricKey.maintainability_issues] === undefined
+            isStandardMode ||
+            measures[MetricKey.software_quality_maintainability_issues] === undefined
               ? MetricKey.code_smells
-              : MetricKey.maintainability_issues,
+              : MetricKey.software_quality_maintainability_issues,
           metricRatingKey: MetricKey.sqale_rating,
           metricType: MetricType.ShortInteger,
         },
@@ -162,7 +163,7 @@ function renderRatings(props: ProjectCardMeasuresProps, isStandardMode: boolean)
   const measureList = [
     ...measuresByCodeLeak,
     {
-      iconKey: 'security_hotspots',
+      iconKey: MetricKey.security_hotspots,
       iconLabel: translate('projects.security_hotspots_reviewed'),
       metricKey: isNewCode
         ? MetricKey.new_security_hotspots_reviewed
@@ -177,15 +178,6 @@ function renderRatings(props: ProjectCardMeasuresProps, isStandardMode: boolean)
   return measureList.map((measure) => {
     const { iconLabel, metricKey, metricRatingKey, metricType } = measure;
 
-    const measureValue =
-      [
-        MetricKey.security_issues,
-        MetricKey.reliability_issues,
-        MetricKey.maintainability_issues,
-      ].includes(metricKey) && measures[metricKey]
-        ? JSON.parse(measures[metricKey] as string)?.total
-        : measures[metricKey];
-
     return (
       <ProjectCardMeasure key={metricKey} metricKey={metricKey} label={iconLabel}>
         <RatingComponent ratingMetric={metricRatingKey} componentKey={componentKey} />
@@ -193,7 +185,7 @@ function renderRatings(props: ProjectCardMeasuresProps, isStandardMode: boolean)
           componentKey={componentKey}
           metricKey={metricKey}
           metricType={metricType}
-          value={measureValue}
+          value={measures[metricKey]}
           className="sw-ml-2 sw-typo-lg-semibold"
         />
       </ProjectCardMeasure>
index 0927cc2a5670360c394689549c99e5be8cb66658..93ae42ebbd2cd288bcbb5e008037c11c80c1c500 100644 (file)
@@ -188,14 +188,9 @@ describe('upgrade scenario (awaiting scan)', () => {
       ...PROJECT,
       measures: {
         ...MEASURES,
-        [MetricKey.security_issues]: JSON.stringify({ LOW: 0, MEDIUM: 0, HIGH: 1, total: 1 }),
-        [MetricKey.reliability_issues]: JSON.stringify({ LOW: 0, MEDIUM: 2, HIGH: 0, total: 2 }),
-        [MetricKey.maintainability_issues]: JSON.stringify({
-          LOW: 3,
-          MEDIUM: 0,
-          HIGH: 0,
-          total: 3,
-        }),
+        [MetricKey.software_quality_security_issues]: '1',
+        [MetricKey.software_quality_reliability_issues]: '2',
+        [MetricKey.software_quality_maintainability_issues]: '3',
         [MetricKey.software_quality_maintainability_rating]: '2',
         [MetricKey.software_quality_reliability_rating]: '2',
         [MetricKey.software_quality_security_rating]: '2',
@@ -242,14 +237,9 @@ describe('upgrade scenario (awaiting scan)', () => {
       ...PROJECT,
       measures: {
         ...MEASURES,
-        [MetricKey.security_issues]: JSON.stringify({ LOW: 0, MEDIUM: 0, HIGH: 1, total: 1 }),
-        [MetricKey.reliability_issues]: JSON.stringify({ LOW: 0, MEDIUM: 2, HIGH: 0, total: 2 }),
-        [MetricKey.maintainability_issues]: JSON.stringify({
-          LOW: 3,
-          MEDIUM: 0,
-          HIGH: 0,
-          total: 3,
-        }),
+        [MetricKey.software_quality_security_issues]: '1',
+        [MetricKey.software_quality_reliability_issues]: '2',
+        [MetricKey.software_quality_maintainability_issues]: '3',
         [MetricKey.code_smells]: '4',
         [MetricKey.bugs]: '5',
         [MetricKey.vulnerabilities]: '6',
@@ -340,14 +330,9 @@ describe('upgrade scenario (awaiting scan)', () => {
       ...PROJECT,
       measures: {
         ...MEASURES,
-        [MetricKey.security_issues]: JSON.stringify({ LOW: 0, MEDIUM: 0, HIGH: 1, total: 1 }),
-        [MetricKey.reliability_issues]: JSON.stringify({ LOW: 0, MEDIUM: 2, HIGH: 0, total: 2 }),
-        [MetricKey.maintainability_issues]: JSON.stringify({
-          LOW: 3,
-          MEDIUM: 0,
-          HIGH: 0,
-          total: 3,
-        }),
+        [MetricKey.software_quality_security_issues]: '1',
+        [MetricKey.software_quality_reliability_issues]: '2',
+        [MetricKey.software_quality_maintainability_issues]: '3',
         [MetricKey.software_quality_maintainability_rating]: '2',
         [MetricKey.software_quality_reliability_rating]: '2',
         [MetricKey.software_quality_security_rating]: '2',
index bbaaa1391f8129470318a53d5a0eb42a5b32409b..a18321c8f8b0320e94211026bbb84cf50ea787b6 100644 (file)
@@ -42,9 +42,15 @@ beforeEach(() => {
 describe('Overall measures', () => {
   it('should be rendered properly', async () => {
     renderProjectCardMeasures();
-    expect(await screen.findByTitle('metric.security_issues.short_name')).toBeInTheDocument();
-    expect(screen.getByTitle('metric.reliability_issues.short_name')).toBeInTheDocument();
-    expect(screen.getByTitle('metric.maintainability_issues.short_name')).toBeInTheDocument();
+    expect(
+      await screen.findByTitle('metric.software_quality_security_issues.short_name'),
+    ).toBeInTheDocument();
+    expect(
+      screen.getByTitle('metric.software_quality_reliability_issues.short_name'),
+    ).toBeInTheDocument();
+    expect(
+      screen.getByTitle('metric.software_quality_maintainability_issues.short_name'),
+    ).toBeInTheDocument();
     expect(screen.queryByTitle('metric.vulnerabilities.short_name')).not.toBeInTheDocument();
     expect(screen.queryByTitle('metric.bugs.short_name')).not.toBeInTheDocument();
     expect(screen.queryByTitle('metric.code_smells.short_name')).not.toBeInTheDocument();
@@ -56,9 +62,15 @@ describe('Overall measures', () => {
     expect(await screen.findByTitle('metric.vulnerabilities.short_name')).toBeInTheDocument();
     expect(screen.getByTitle('metric.bugs.short_name')).toBeInTheDocument();
     expect(screen.getByTitle('metric.code_smells.short_name')).toBeInTheDocument();
-    expect(screen.queryByTitle('metric.security_issues.short_name')).not.toBeInTheDocument();
-    expect(screen.queryByTitle('metric.reliability_issues.short_name')).not.toBeInTheDocument();
-    expect(screen.queryByTitle('metric.maintainability_issues.short_name')).not.toBeInTheDocument();
+    expect(
+      screen.queryByTitle('metric.software_quality_security_issues.short_name'),
+    ).not.toBeInTheDocument();
+    expect(
+      screen.queryByTitle('metric.software_quality_software_quality_reliability_issues.short_name'),
+    ).not.toBeInTheDocument();
+    expect(
+      screen.queryByTitle('metric.software_quality_maintainability_issues.short_name'),
+    ).not.toBeInTheDocument();
   });
 
   it("should be not be rendered if there's no line of code", () => {
@@ -92,9 +104,9 @@ function renderProjectCardMeasures(
     [MetricKey.code_smells]: '132',
     [MetricKey.coverage]: '88.3',
     [MetricKey.duplicated_lines_density]: '9.8',
-    [MetricKey.maintainability_issues]: JSON.stringify({ total: 10 }),
-    [MetricKey.reliability_issues]: JSON.stringify({ total: 10 }),
-    [MetricKey.security_issues]: JSON.stringify({ total: 10 }),
+    [MetricKey.software_quality_maintainability_issues]: '10',
+    [MetricKey.software_quality_reliability_issues]: '10',
+    [MetricKey.software_quality_security_issues]: '10',
     [MetricKey.ncloc]: '2053',
     [MetricKey.reliability_rating]: '1.0',
     [MetricKey.security_rating]: '1.0',
index 8cafffbc8e3b1ecc8fd9b2ed963255be2f875d2d..3f0630b43fa27d1dec7ada0194175df8f89f2686 100644 (file)
@@ -89,15 +89,15 @@ const PAGE_SIZE = 50;
 
 export const METRICS = [
   MetricKey.alert_status,
-  MetricKey.reliability_issues,
+  MetricKey.software_quality_reliability_issues,
   MetricKey.bugs,
   MetricKey.reliability_rating,
   MetricKey.software_quality_reliability_rating,
-  MetricKey.security_issues,
+  MetricKey.software_quality_security_issues,
   MetricKey.vulnerabilities,
   MetricKey.security_rating,
   MetricKey.software_quality_security_rating,
-  MetricKey.maintainability_issues,
+  MetricKey.software_quality_maintainability_issues,
   MetricKey.code_smells,
   MetricKey.sqale_rating,
   MetricKey.software_quality_maintainability_rating,
index 4f74bc8ede3775d9fd03b67c9c9b10c7b2314f8a..54e36c9644312400d63a6cad6a458bcbffbb10b1 100644 (file)
@@ -100,9 +100,7 @@ export default function SourceViewerHeader(props: Readonly<Props>) {
               const measure = componentMeasures.find(
                 (m) => m.metric === (areCCTMeasuresComputed ? metric : deprecatedMetric),
               );
-              const measureValue = areCCTMeasuresComputed
-                ? JSON.parse(measure?.value ?? 'null').total
-                : (measure?.value ?? 0);
+              const measureValue = measure?.value ?? 0;
 
               const linkUrl = getComponentIssuesUrl(project, {
                 ...getBranchLikeQuery(branchLike),
index a1b5a0a8657da4161924e8fe6a0c3cd4fbfdef12..d2a9dc2c0fff907ce0e2bbacf843e3adf68c45b6 100644 (file)
@@ -345,14 +345,18 @@ it('should show software quality measures in header', async () => {
   renderSourceViewer({ componentMeasures: generateMeasures(), showMeasures: true });
 
   expect(
-    await byLabelText('source_viewer.issue_link_x.3.metric.security_issues.short_name').find(),
+    await byLabelText(
+      'source_viewer.issue_link_x.3.metric.software_quality_security_issues.short_name',
+    ).find(),
   ).toBeInTheDocument();
   expect(
-    await byLabelText('source_viewer.issue_link_x.3.metric.reliability_issues.short_name').find(),
+    await byLabelText(
+      'source_viewer.issue_link_x.3.metric.software_quality_reliability_issues.short_name',
+    ).find(),
   ).toBeInTheDocument();
   expect(
     await byLabelText(
-      'source_viewer.issue_link_x.3.metric.maintainability_issues.short_name',
+      'source_viewer.issue_link_x.3.metric.software_quality_maintainability_issues.short_name',
     ).find(),
   ).toBeInTheDocument();
 });
@@ -366,14 +370,18 @@ it('should show old issue measures in header', async () => {
   });
 
   expect(
-    await byLabelText('source_viewer.issue_link_x.1.metric.security_issues.short_name').find(),
+    await byLabelText(
+      'source_viewer.issue_link_x.1.metric.software_quality_security_issues.short_name',
+    ).find(),
   ).toBeInTheDocument();
   expect(
-    await byLabelText('source_viewer.issue_link_x.1.metric.reliability_issues.short_name').find(),
+    await byLabelText(
+      'source_viewer.issue_link_x.1.metric.software_quality_reliability_issues.short_name',
+    ).find(),
   ).toBeInTheDocument();
   expect(
     await byLabelText(
-      'source_viewer.issue_link_x.1.metric.maintainability_issues.short_name',
+      'source_viewer.issue_link_x.1.metric.software_quality_maintainability_issues.short_name',
     ).find(),
   ).toBeInTheDocument();
 });
@@ -396,12 +404,10 @@ it('should show correct message when component does not exist', async () => {
 function generateMeasures(qualitiesValue = '3.0', overallValue = '1.0', newValue = '2.0') {
   return [
     ...[
-      MetricKey.security_issues,
-      MetricKey.reliability_issues,
-      MetricKey.maintainability_issues,
-    ].map((metric) =>
-      mockMeasure({ metric, value: JSON.stringify({ total: qualitiesValue }), period: undefined }),
-    ),
+      MetricKey.software_quality_security_issues,
+      MetricKey.software_quality_reliability_issues,
+      MetricKey.software_quality_maintainability_issues,
+    ].map((metric) => mockMeasure({ metric, value: qualitiesValue, period: undefined })),
     ...[
       MetricKey.ncloc,
       MetricKey.new_lines,
index e144fcf292971afb0386090ab88b162dd0e1adda..5e76f3e45c88c6a77fb4233af613286a1c0fcd38 100644 (file)
@@ -55,7 +55,7 @@ describe('rendering', () => {
   });
 
   it.each([
-    ['MQR', 'true', MetricKey.maintainability_issues],
+    ['MQR', 'true', MetricKey.software_quality_maintainability_issues],
     ['Standard', 'false', MetricKey.code_smells],
   ])('should show the correct legend items in %s mode', async (_, mode, metric) => {
     settingsHandler.set(SettingsKey.MQRMode, mode);
@@ -125,9 +125,9 @@ it.each([
   [
     'MQR',
     'true',
-    MetricKey.reliability_issues,
-    MetricKey.maintainability_issues,
-    MetricKey.security_issues,
+    MetricKey.software_quality_reliability_issues,
+    MetricKey.software_quality_maintainability_issues,
+    MetricKey.software_quality_security_issues,
   ],
   ['Standard', 'false', MetricKey.bugs, MetricKey.code_smells, MetricKey.vulnerabilities],
 ])(
@@ -204,7 +204,9 @@ function getPageObject() {
 
     // Add/remove metrics.
     addMetricBtn: byRole('button', { name: 'project_activity.graphs.custom.add' }),
-    maintainabilityIssuesCheckbox: byRole('checkbox', { name: MetricKey.maintainability_issues }),
+    maintainabilityIssuesCheckbox: byRole('checkbox', {
+      name: MetricKey.software_quality_maintainability_issues,
+    }),
     newBugsCheckbox: byRole('checkbox', { name: MetricKey.new_bugs }),
     burnedBudgetCheckbox: byRole('checkbox', { name: MetricKey.burned_budget }),
     hiddenOptionsAlert: byText('project_activity.graphs.custom.type_x_message', {
@@ -284,9 +286,9 @@ function renderActivityGraph(
       MetricKey.bugs,
       MetricKey.code_smells,
       MetricKey.vulnerabilities,
-      MetricKey.maintainability_issues,
-      MetricKey.reliability_issues,
-      MetricKey.security_issues,
+      MetricKey.software_quality_maintainability_issues,
+      MetricKey.software_quality_reliability_issues,
+      MetricKey.software_quality_security_issues,
       MetricKey.blocker_violations,
       MetricKey.lines_to_cover,
       MetricKey.uncovered_lines,
index 9b6562d018bf278e964cd117a7e788ee998abbdb..06ef722bd9e2e06b7df307bb1f67b95fed5144df 100644 (file)
@@ -167,11 +167,8 @@ export function generateSeries(
         );
         return {
           data: measure.history.map((analysis) => {
-            let { value } = analysis;
+            const { value } = analysis;
 
-            if (value !== undefined && isSoftwareQualityMetric) {
-              value = JSON.parse(value).total;
-            }
             return {
               x: analysis.date,
               y: metric?.type === MetricType.Level ? value : Number(value),
index 2afd6152403618aafd2b3114119a9f4f8cdc6ea6..aa702fc32e701bb196a36ff4ee40abb485117957 100644 (file)
@@ -87,15 +87,15 @@ export const ISSUE_TYPES: IssueType[] = [
 ];
 
 export const CCT_SOFTWARE_QUALITY_METRICS = [
-  MetricKey.security_issues,
-  MetricKey.reliability_issues,
-  MetricKey.maintainability_issues,
+  MetricKey.software_quality_security_issues,
+  MetricKey.software_quality_reliability_issues,
+  MetricKey.software_quality_maintainability_issues,
 ];
 
 export const LEAK_CCT_SOFTWARE_QUALITY_METRICS = [
-  MetricKey.new_security_issues,
-  MetricKey.new_reliability_issues,
-  MetricKey.new_maintainability_issues,
+  MetricKey.new_software_quality_security_issues,
+  MetricKey.new_software_quality_reliability_issues,
+  MetricKey.new_software_quality_maintainability_issues,
 ];
 
 export const OLD_TAXONOMY_METRICS = [
@@ -132,9 +132,18 @@ export const LEAK_OLD_TAXONOMY_RATINGS = [
 ];
 
 export const OLD_TO_NEW_TAXONOMY_METRICS_MAP: { [key in MetricKey]?: MetricKey } = {
-  [MetricKey.vulnerabilities]: MetricKey.security_issues,
-  [MetricKey.bugs]: MetricKey.reliability_issues,
-  [MetricKey.code_smells]: MetricKey.maintainability_issues,
+  [MetricKey.vulnerabilities]: MetricKey.software_quality_security_issues,
+  [MetricKey.bugs]: MetricKey.software_quality_reliability_issues,
+  [MetricKey.code_smells]: MetricKey.software_quality_maintainability_issues,
+};
+
+export const SOFTWARE_QUALITIES_ISSUES_KEYS_MAP: Record<string, MetricKey> = {
+  [MetricKey.maintainability_issues]: MetricKey.software_quality_maintainability_issues,
+  [MetricKey.new_maintainability_issues]: MetricKey.new_software_quality_maintainability_issues,
+  [MetricKey.reliability_issues]: MetricKey.software_quality_reliability_issues,
+  [MetricKey.new_reliability_issues]: MetricKey.new_software_quality_reliability_issues,
+  [MetricKey.security_issues]: MetricKey.software_quality_security_issues,
+  [MetricKey.new_security_issues]: MetricKey.new_software_quality_security_issues,
 };
 
 export const RESOLUTIONS = [
index 6f55df61794ecd0e41febe2bec58b03a179f9e18..2964d45b7f9a5b84f85627753889d3aaf1039094 100644 (file)
@@ -177,19 +177,19 @@ export function getIssueTypeBySoftwareQuality(quality: SoftwareQuality): IssueTy
 
 export const SOFTWARE_QUALITIES_METRIC_KEYS_MAP = {
   [SoftwareQuality.Security]: {
-    metric: MetricKey.security_issues,
+    metric: MetricKey.software_quality_security_issues,
     deprecatedMetric: MetricKey.vulnerabilities,
     rating: MetricKey.security_rating,
     newRating: MetricKey.new_security_rating,
   },
   [SoftwareQuality.Reliability]: {
-    metric: MetricKey.reliability_issues,
+    metric: MetricKey.software_quality_reliability_issues,
     deprecatedMetric: MetricKey.bugs,
     rating: MetricKey.reliability_rating,
     newRating: MetricKey.new_reliability_rating,
   },
   [SoftwareQuality.Maintainability]: {
-    metric: MetricKey.maintainability_issues,
+    metric: MetricKey.software_quality_maintainability_issues,
     deprecatedMetric: MetricKey.code_smells,
     rating: MetricKey.sqale_rating,
     newRating: MetricKey.new_maintainability_rating,
index 90044e80d159e820b0125e8b691212fb41197f84..364ee85d42cff7ccb1e1fa979a2e9cbb1986db5c 100644 (file)
@@ -79,10 +79,7 @@ export function getDisplayMetrics(metrics: Metric[]) {
   return metrics.filter(
     (metric) =>
       !metric.hidden &&
-      ([...CCT_SOFTWARE_QUALITY_METRICS, ...LEAK_CCT_SOFTWARE_QUALITY_METRICS].includes(
-        metric.key as MetricKey,
-      ) ||
-        ![MetricType.Data, MetricType.Distribution].includes(metric.type as MetricType)),
+      ![MetricType.Data, MetricType.Distribution].includes(metric.type as MetricType),
   );
 }
 
@@ -150,18 +147,6 @@ function isMeasureEnhanced(measure: Measure | MeasureEnhanced): measure is Measu
   return (measure.metric as Metric)?.key !== undefined;
 }
 
-export const getCCTMeasureValue = (key: string, value?: string) => {
-  if (
-    CCT_SOFTWARE_QUALITY_METRICS.concat(LEAK_CCT_SOFTWARE_QUALITY_METRICS).includes(
-      key as MetricKey,
-    ) &&
-    value !== undefined
-  ) {
-    return JSON.parse(value).total;
-  }
-  return value;
-};
-
 type RatingValue = 'A' | 'B' | 'C' | 'D' | 'E';
 const RATING_VALUES: RatingValue[] = ['A', 'B', 'C', 'D', 'E'];
 export function formatRating(value: string | number | undefined): RatingValue | undefined {
index 1ebd3ff29b2852ec9001f2e5784fa5fa7e409fa4..7422fcb52d41288601f8fdbab09b17005a8761a0 100644 (file)
@@ -3742,10 +3742,13 @@ metric.new_software_quality_medium_issues.name=New Medium Severity Issues
 metric.new_software_quality_low_issues.description=New Low Severity issues
 metric.new_software_quality_low_issues.name=New Low Severity Issues
 metric.software_quality_maintainability_issues.name=Maintainability Issues
+metric.software_quality_maintainability_issues.short_name=Maintainability
 metric.software_quality_maintainability_issues.description=Maintainability issues
 metric.software_quality_reliability_issues.name=Reliability Issues
+metric.software_quality_reliability_issues.short_name=Reliability
 metric.software_quality_reliability_issues.description=Reliability issues
 metric.software_quality_security_issues.name=Security Issues
+metric.software_quality_security_issues.short_name=Security
 metric.software_quality_security_issues.description=Security issues
 metric.new_software_quality_maintainability_issues.name=New Maintainability Issues
 metric.new_software_quality_maintainability_issues.description=New maintainability issues
@@ -4666,13 +4669,19 @@ component_measures.not_all_measures_are_shown=Not all projects and applications
 component_measures.not_all_measures_are_shown.help=You do not have access to all projects and/or applications. Measures are still computed based on all projects and applications.
 
 component_measures.metric.new_security_issues.name=Issues
+component_measures.metric.new_software_quality_security_issues.name=Issues
 component_measures.metric.new_security_issues.detailed_name=New Issues
+component_measures.metric.new_software_quality_security_issues.detailed_name=New Issues
 component_measures.metric.new_vulnerabilities.name=Vulnerabilities
 component_measures.metric.new_vulnerabilities.detailed_name=New Vulnerabilities
 component_measures.metric.new_reliability_issues.name=Issues
+component_measures.metric.new_software_quality_reliability_issues.name=Issues
 component_measures.metric.new_reliability_issues.detailed_name=New Issues
+component_measures.metric.new_software_quality_reliability_issues.detailed_name=New Issues
 component_measures.metric.new_maintainability_issues.name=Issues
+component_measures.metric.new_software_quality_maintainability_issues.name=Issues
 component_measures.metric.new_maintainability_issues.detailed_name=New Issues
+component_measures.metric.new_software_quality_maintainability_issues.detailed_name=New Issues
 component_measures.metric.new_code_smells.name=Code Smells
 component_measures.metric.new_code_smells.detailed_name=New Code Smells
 component_measures.metric.new_violations.name=Open Issues
@@ -4682,10 +4691,13 @@ component_measures.metric.new_accepted_issues.detailed_name=New Accepted Issues
 component_measures.metric.new_bugs.name=Bugs
 component_measures.metric.new_bugs.detailed_name=New Bugs
 component_measures.metric.security_issues.name=Issues
+component_measures.metric.software_quality_security_issues.name=Issues
 component_measures.metric.vulnerabilities.name=Vulnerabilities
 component_measures.metric.reliability_issues.name=Issues
+component_measures.metric.software_quality_reliability_issues.name=Issues
 component_measures.metric.bugs.name=Bugs
 component_measures.metric.maintainability_issues.name=Issues
+component_measures.metric.software_quality_maintainability_issues.name=Issues
 component_measures.metric.code_smells.name=Code Smells
 component_measures.metric.violations.name=Open Issues
 component_measures.metric.accepted_issues.name=Accepted Issues