]> source.dussan.org Git - sonarqube.git/commitdiff
forbid to use boolean and string metrics in quality gates
authorStas Vilchik <stas.vilchik@sonarsource.com>
Thu, 13 Dec 2018 13:54:53 +0000 (14:54 +0100)
committerSonarTech <sonartech@sonarsource.com>
Tue, 8 Jan 2019 19:21:06 +0000 (20:21 +0100)
server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx

index a61b6da38ff03f10fda44be84ed3470e8c0e0cf5..5e36418900fcb769305a1b9c1d36df3f01eb0456 100644 (file)
@@ -38,6 +38,8 @@ interface Props {
   qualityGate: T.QualityGate;
 }
 
+const FORBIDDEN_METRIC_TYPES = ['DATA', 'DISTRIB', 'STRING', 'BOOL'];
+
 export default class Conditions extends React.PureComponent<Props> {
   getConditionKey = (condition: T.Condition, index: number) => {
     return condition.id ? condition.id : `new-${index}`;
@@ -69,7 +71,7 @@ export default class Conditions extends React.PureComponent<Props> {
 
     const availableMetrics = differenceWith(
       map(metrics, metric => metric).filter(
-        metric => !metric.hidden && !['DATA', 'DISTRIB'].includes(metric.type)
+        metric => !metric.hidden && !FORBIDDEN_METRIC_TYPES.includes(metric.type)
       ),
       conditions,
       (metric, condition) => metric.key === condition.metric