aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2017-02-09 16:37:56 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2017-02-10 10:19:53 +0100
commit7afdd2432c308f95d97d06ac45865d67d5040682 (patch)
tree3735bd0a5900bf0eaba893a28ff2e6ad6ba5748f /sonar-core
parent968bd79f0d5e57a03dd09b7c1c40514b323c30fb (diff)
downloadsonarqube-7afdd2432c308f95d97d06ac45865d67d5040682.tar.gz
sonarqube-7afdd2432c308f95d97d06ac45865d67d5040682.zip
SONAR-8760 Define 'Cognitive Complexity' metric
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/metric/ScannerMetrics.java2
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties2
-rw-r--r--sonar-core/src/test/java/org/sonar/core/metric/ScannerMetricsTest.java2
3 files changed, 5 insertions, 1 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/metric/ScannerMetrics.java b/sonar-core/src/main/java/org/sonar/core/metric/ScannerMetrics.java
index 295cd8416d9..9d9596cd57f 100644
--- a/sonar-core/src/main/java/org/sonar/core/metric/ScannerMetrics.java
+++ b/sonar-core/src/main/java/org/sonar/core/metric/ScannerMetrics.java
@@ -31,6 +31,7 @@ import org.sonar.api.measures.Metrics;
import static org.sonar.api.measures.CoreMetrics.ACCESSORS;
import static org.sonar.api.measures.CoreMetrics.CLASSES;
+import static org.sonar.api.measures.CoreMetrics.COGNITIVE_COMPLEXITY;
import static org.sonar.api.measures.CoreMetrics.COMMENT_LINES;
import static org.sonar.api.measures.CoreMetrics.COMMENT_LINES_DATA;
import static org.sonar.api.measures.CoreMetrics.COMPLEXITY;
@@ -95,6 +96,7 @@ public class ScannerMetrics {
COMPLEXITY,
COMPLEXITY_IN_CLASSES,
COMPLEXITY_IN_FUNCTIONS,
+ COGNITIVE_COMPLEXITY,
FILE_COMPLEXITY_DISTRIBUTION,
FUNCTION_COMPLEXITY_DISTRIBUTION,
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 317f5048d52..2d59b3c72cf 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -1930,6 +1930,8 @@ metric.class_complexity_distribution.description=Classes distribution /complexit
metric.class_complexity_distribution.name=Class Distribution / Complexity
metric.code_smells.description=Code Smells
metric.code_smells.name=Code Smells
+metric.cognitive_complexity.description=Cognitive complexity
+metric.cognitive_complexity.name=Cognitive Complexity
metric.commented_out_code_lines.description=Commented lines of code
metric.commented_out_code_lines.name=Commented-Out LOC
metric.comment_blank_lines.description=Comments that do not contain comments
diff --git a/sonar-core/src/test/java/org/sonar/core/metric/ScannerMetricsTest.java b/sonar-core/src/test/java/org/sonar/core/metric/ScannerMetricsTest.java
index fc44410de8d..80c9231b2c1 100644
--- a/sonar-core/src/test/java/org/sonar/core/metric/ScannerMetricsTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/metric/ScannerMetricsTest.java
@@ -36,7 +36,7 @@ public class ScannerMetricsTest {
@Test
public void check_number_of_allowed_core_metrics() throws Exception {
- assertThat(SENSOR_METRICS_WITHOUT_METRIC_PLUGIN.getMetrics()).hasSize(33);
+ assertThat(SENSOR_METRICS_WITHOUT_METRIC_PLUGIN.getMetrics()).hasSize(34);
}
@Test