aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViktor Vorona <viktor.vorona@sonarsource.com>2024-04-04 16:47:35 +0200
committersonartech <sonartech@sonarsource.com>2024-04-05 20:02:38 +0000
commitc28b1f00f5a22ae0c13d7206eb54e8b7f396f44d (patch)
treec0a81a49a7f2e7cd7e763084f3a239aa0a5a7983
parentb8d7d82877921e539d984240ab3163063add1d07 (diff)
downloadsonarqube-c28b1f00f5a22ae0c13d7206eb54e8b7f396f44d.tar.gz
sonarqube-c28b1f00f5a22ae0c13d7206eb54e8b7f396f44d.zip
SONAR-21910 Remove custom mapping for measure domains
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/utils.ts21
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/metrics.ts9
2 files changed, 10 insertions, 20 deletions
diff --git a/server/sonar-web/src/main/js/apps/component-measures/utils.ts b/server/sonar-web/src/main/js/apps/component-measures/utils.ts
index fb947000929..558ad1bf8fa 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/utils.ts
+++ b/server/sonar-web/src/main/js/apps/component-measures/utils.ts
@@ -30,11 +30,11 @@ import {
import { getLocalizedMetricName, translate } from '../../helpers/l10n';
import {
MEASURES_REDIRECTION,
- areLeakCCTMeasuresComputed,
areCCTMeasuresComputed,
+ areLeakCCTMeasuresComputed,
+ getCCTMeasureValue,
getDisplayMetrics,
isDiffMetric,
- getCCTMeasureValue,
} from '../../helpers/measures';
import {
cleanQuery,
@@ -74,15 +74,6 @@ export const KNOWN_DOMAINS = [
'Complexity',
];
-const CCT_METRIC_DOMAIN_MAP: Dict<string> = {
- [MetricKey.security_issues]: 'Security',
- [MetricKey.new_security_issues]: 'Security',
- [MetricKey.reliability_issues]: 'Reliability',
- [MetricKey.new_reliability_issues]: 'Reliability',
- [MetricKey.maintainability_issues]: 'Maintainability',
- [MetricKey.new_maintainability_issues]: 'Maintainability',
-};
-
const DEPRECATED_METRICS = [
MetricKey.blocker_violations,
MetricKey.new_blocker_violations,
@@ -118,14 +109,10 @@ export const populateDomainsFromMeasures = memoize((measures: MeasureEnhanced[])
return {
...measure,
- metric: {
- ...measure.metric,
- domain: CCT_METRIC_DOMAIN_MAP[measure.metric.key] ?? measure.metric.domain,
- },
- ...(!isDiff && { value: calculatedValue }),
- ...(isDiff && { leak: calculatedValue }),
+ ...{ [isDiff ? 'leak' : 'value']: calculatedValue },
};
});
+
if (areLeakCCTMeasuresComputed(measures)) {
populatedMeasures = populatedMeasures.filter(
(measure) => !LEAK_OLD_TAXONOMY_METRICS.includes(measure.metric.key as MetricKey),
diff --git a/server/sonar-web/src/main/js/helpers/mocks/metrics.ts b/server/sonar-web/src/main/js/helpers/mocks/metrics.ts
index a909cef1232..60febc0fb71 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/metrics.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/metrics.ts
@@ -915,6 +915,7 @@ export const DEFAULT_METRICS: Dict<Metric> = {
type: 'DATA',
name: 'Reliability',
description: 'Reliability issues',
+ domain: 'Reliability',
direction: 0,
qualitative: false,
hidden: false,
@@ -924,6 +925,7 @@ export const DEFAULT_METRICS: Dict<Metric> = {
type: 'DATA',
name: 'New Reliability',
description: 'New Reliability issues',
+ domain: 'Reliability',
direction: 0,
qualitative: false,
hidden: false,
@@ -1035,6 +1037,7 @@ export const DEFAULT_METRICS: Dict<Metric> = {
type: 'DATA',
name: 'Security',
description: 'Security issues',
+ domain: 'Security',
direction: 0,
qualitative: false,
hidden: false,
@@ -1044,7 +1047,7 @@ export const DEFAULT_METRICS: Dict<Metric> = {
type: 'DATA',
name: 'Security',
description: 'New Security issues',
- domain: 'Issues',
+ domain: 'Security',
direction: 0,
qualitative: false,
hidden: false,
@@ -1214,7 +1217,7 @@ export const DEFAULT_METRICS: Dict<Metric> = {
type: 'DATA',
name: 'Maintainability',
description: 'Maintainability issues',
- domain: 'Issues',
+ domain: 'Maintainability',
direction: 0,
qualitative: false,
hidden: false,
@@ -1224,7 +1227,7 @@ export const DEFAULT_METRICS: Dict<Metric> = {
type: 'DATA',
name: 'Maintainability',
description: 'New Maintainability issues',
- domain: 'Issues',
+ domain: 'Maintainability',
direction: 0,
qualitative: false,
hidden: false,