From 224b4c237c4383fb9c7eb21758dcb613e801fefe Mon Sep 17 00:00:00 2001 From: Teryk Bellahsene Date: Tue, 17 Oct 2017 10:46:50 +0200 Subject: [PATCH] SONAR-8331 Rename Complexity to Cyclomatic Complexity --- .../src/main/resources/org/sonar/l10n/core.properties | 2 +- .../java/org/sonar/core/i18n/DefaultI18nTest.java | 11 +++-------- .../main/java/org/sonar/api/measures/CoreMetrics.java | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) 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 a6f52214b65..970c8424246 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -1497,7 +1497,7 @@ metric.comment_lines_density.description=Comments balanced by ncloc + comment li metric.comment_lines_density.name=Comments (%) metric.comment_lines_density.short_name=Comments metric.complexity.description=Cyclomatic complexity -metric.complexity.name=Complexity +metric.complexity.name=Cyclomatic Complexity metric.complexity_in_classes.description=Cyclomatic complexity in classes metric.complexity_in_classes.name=Complexity in Classes metric.complexity_in_functions.description=Cyclomatic complexity in functions diff --git a/sonar-core/src/test/java/org/sonar/core/i18n/DefaultI18nTest.java b/sonar-core/src/test/java/org/sonar/core/i18n/DefaultI18nTest.java index e310d4c97ff..2f2ac8e820e 100644 --- a/sonar-core/src/test/java/org/sonar/core/i18n/DefaultI18nTest.java +++ b/sonar-core/src/test/java/org/sonar/core/i18n/DefaultI18nTest.java @@ -26,13 +26,10 @@ import java.util.Locale; import java.util.TimeZone; import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Metric; import org.sonar.api.utils.DateUtils; -import org.sonar.api.utils.System2; +import org.sonar.api.utils.internal.TestSystem2; import org.sonar.core.platform.PluginInfo; import org.sonar.core.platform.PluginRepository; @@ -40,11 +37,9 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(MockitoJUnitRunner.class) public class DefaultI18nTest { - @Mock - System2 system2; + private TestSystem2 system2 = new TestSystem2(); DefaultI18n underTest; @@ -189,7 +184,7 @@ public class DefaultI18nTest { @Test public void get_age_from_now() { - when(system2.now()).thenReturn(DateUtils.parseDate("2014-01-02").getTime()); + system2.setNow(DateUtils.parseDate("2014-01-02").getTime()); assertThat(underTest.ageFromNow(Locale.ENGLISH, DateUtils.parseDate("2014-01-01"))).isEqualTo("a day"); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java index 1ff06ebfc36..59ca132e604 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java @@ -355,7 +355,7 @@ public final class CoreMetrics { // -------------------------------------------------------------------------------------------------------------------- public static final String COMPLEXITY_KEY = "complexity"; - public static final Metric COMPLEXITY = new Metric.Builder(COMPLEXITY_KEY, "Complexity", Metric.ValueType.INT) + public static final Metric COMPLEXITY = new Metric.Builder(COMPLEXITY_KEY, "Cyclomatic Complexity", Metric.ValueType.INT) .setDescription("Cyclomatic complexity") .setDirection(Metric.DIRECTION_WORST) .setQualitative(false) -- 2.39.5