]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-21455 Change security hotspot review condition label to 'required .. reviewed'
author7PH <benjamin.raymond@sonarsource.com>
Thu, 1 Feb 2024 09:07:02 +0000 (10:07 +0100)
committersonartech <sonartech@sonarsource.com>
Thu, 1 Feb 2024 20:02:48 +0000 (20:02 +0000)
server/sonar-web/src/main/js/apps/overview/branches/NewCodeMeasuresPanel.tsx
server/sonar-web/src/main/js/apps/overview/utils.tsx
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index b45c3c3780c9287d445b9d797dfaa6055f485336..172eb8717ba4cca302c5990b1821332f0aa62687 100644 (file)
@@ -62,7 +62,7 @@ export default function NewCodeMeasuresPanel(props: Readonly<Props>) {
   const failedConditions = qgStatuses?.flatMap((qg) => qg.failedConditions) ?? [];
 
   const newIssues = getLeakValue(findMeasure(measures, MetricKey.new_violations));
-  const newIssuesCondition = failedConditions.find((c) => c.metric === MetricKey.new_violations);
+  const newIssuesCondition = conditions.find((c) => c.metric === MetricKey.new_violations);
   const issuesConditionFailed = newIssuesCondition?.level === Status.ERROR;
   const newAcceptedIssues = getLeakValue(findMeasure(measures, MetricKey.new_accepted_issues));
   const newSecurityHotspots = getLeakValue(
index 0745bc437970af1c280af4b57fce008ed9ea40b4..40c962140d106c14381d8df03a16ac077ccbaac9 100644 (file)
@@ -252,6 +252,18 @@ export function getAnalysisVariations(measures: MeasureHistory[], analysesCount:
   }, emptyVariations);
 }
 
+export function getConditionRequiredTranslateId(metric: MetricKey) {
+  if (
+    [MetricKey.security_hotspots_reviewed, MetricKey.new_security_hotspots_reviewed].includes(
+      metric,
+    )
+  ) {
+    return 'overview.quality_gate.required_x_reviewed';
+  }
+
+  return 'overview.quality_gate.required_x';
+}
+
 export function getConditionRequiredLabel(
   condition: QualityGateStatusConditionEnhanced,
   intl: IntlShape,
@@ -271,20 +283,16 @@ export function getConditionRequiredLabel(
     operator = '=';
   }
 
-  const conditionEl = (
-    <>
-      {operator}{' '}
-      {formatMeasure(condition.error, condition.measure.metric.type, {
-        decimals: 2,
-        omitExtraDecimalZeros: true,
-      })}
-    </>
-  );
+  const conditionEl = formatMeasure(condition.error, condition.measure.metric.type, {
+    decimals: 2,
+    omitExtraDecimalZeros: true,
+  });
 
   return intl.formatMessage(
-    { id: 'overview.quality_gate.required_x' },
+    { id: getConditionRequiredTranslateId(condition.metric) },
 
     {
+      operator,
       requirement: failed ? <b>{conditionEl}</b> : conditionEl,
     },
   );
index 996c5548215e47929b3f7f927890de816c3c2c68..0ccf0d6c394d2a9cb5d7d33bbe65c85eb307803a 100644 (file)
@@ -3898,7 +3898,8 @@ overview.quality_gate.on_x_new_lines=On {link} New Lines.
 overview.quality_gate.x_estimated_after_merge={value} Estimated after merge
 overview.quality_gate.require_fixing={count, plural, one {requires} other {require}} fixing
 overview.quality_gate.require_reviewing={count, plural, one {requires} other {require}} reviewing
-overview.quality_gate.required_x=Required {requirement}
+overview.quality_gate.required_x=Required {operator} {requirement}
+overview.quality_gate.required_x_reviewed=Required review: {requirement}
 overview.quality_profiles=Quality Profiles used
 overview.new_code_period_x=New Code: {0}
 overview.max_new_code_period_from_x=Max New Code from: {0}