extensions.add(LineCoverageDecorator.class);
extensions.add(CoverageDecorator.class);
extensions.add(BranchCoverageDecorator.class);
- extensions.add(UncoveredComplexityDecorator.class);
extensions.add(ApplyProjectRolesDecorator.class);
extensions.add(ExcludedResourceFilter.class);
extensions.add(CommentDensityDecorator.class);
+++ /dev/null
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.plugins.core.sensors;
-
-import org.sonar.api.batch.Decorator;
-import org.sonar.api.batch.DecoratorContext;
-import org.sonar.api.batch.DependedUpon;
-import org.sonar.api.batch.DependsUpon;
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.measures.Measure;
-import org.sonar.api.measures.MeasureUtils;
-import org.sonar.api.measures.Metric;
-import org.sonar.api.resources.Project;
-import org.sonar.api.resources.Resource;
-import org.sonar.api.utils.KeyValueFormat;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * @deprecated the metric <code>CoreMetrics.UNCOVERED_COMPLEXITY_BY_TESTS</code> is deprecated since v.1.11.
- * It's replaced by uncovered_line and uncovered_conditions
- */
-@Deprecated
-public class UncoveredComplexityDecorator implements Decorator {
-
- @DependsUpon
- public List<Metric> dependsUponMetrics() {
- return Arrays.asList(CoreMetrics.COVERAGE, CoreMetrics.COMPLEXITY);
- }
-
- @DependedUpon
- public Metric generatesMetric() {
- return CoreMetrics.UNCOVERED_COMPLEXITY_BY_TESTS;
- }
-
- public boolean shouldExecuteOnProject(Project project) {
- return true;
- }
-
- public void decorate(Resource resource, DecoratorContext context) {
- Measure coverage = context.getMeasure(CoreMetrics.COVERAGE);
- Measure complexity = context.getMeasure(CoreMetrics.COMPLEXITY);
-
- if (MeasureUtils.haveValues(coverage, complexity)) {
- double value = complexity.getValue() - (complexity.getValue() * (coverage.getValue() / 100.0));
- String data = KeyValueFormat.format("CMP", complexity.getValue().intValue(), "COV", coverage.getValue());
- context.saveMeasure(new Measure(CoreMetrics.UNCOVERED_COMPLEXITY_BY_TESTS, value, data));
- }
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName();
- }
-}
-
+++ /dev/null
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.plugins.core.sensors;
-
-import static org.hamcrest.core.IsNot.not;
-import static org.hamcrest.number.OrderingComparisons.greaterThan;
-import static org.junit.Assert.assertThat;
-import org.junit.Test;
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Mockito.*;
-import org.sonar.api.batch.DecoratorContext;
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.measures.Measure;
-import org.sonar.api.test.IsMeasure;
-
-public class UncoveredComplexityDecoratorTest {
-
- @Test
- public void nothingWhenNoMeasures() {
- DecoratorContext context = mock(DecoratorContext.class);
- UncoveredComplexityDecorator decorator = new UncoveredComplexityDecorator();
- decorator.decorate(null, context);
-
- verify(context, never()).saveMeasure((Measure) anyObject());
- }
-
- @Test
- public void quotientWhenMeasures() {
- DecoratorContext context = mock(DecoratorContext.class);
- when(context.getMeasure(CoreMetrics.COMPLEXITY)).thenReturn(new Measure(CoreMetrics.COMPLEXITY, 1048.0));
- when(context.getMeasure(CoreMetrics.COVERAGE)).thenReturn(new Measure(CoreMetrics.COVERAGE, 32.5));
-
- UncoveredComplexityDecorator decorator = new UncoveredComplexityDecorator();
- decorator.decorate(null, context);
-
- verify(context).saveMeasure(argThat(new IsMeasure(CoreMetrics.UNCOVERED_COMPLEXITY_BY_TESTS, 707.4)));
- verify(context).saveMeasure(argThat(new IsMeasure(CoreMetrics.UNCOVERED_COMPLEXITY_BY_TESTS, "CMP=1048;COV=32.5")));
- }
-
- @Test
- public void declareDependencies() {
- UncoveredComplexityDecorator decorator = new UncoveredComplexityDecorator();
- assertThat(decorator.dependsUponMetrics().size(), greaterThan(0));
- assertThat(decorator.generatesMetric(), not(isNull()));
- }
-}
.setDomain(DOMAIN_TESTS)
.create();
- /**
- * @deprecated replaced since 1.11 by UNCOVERED_LINES and UNCOVERED_CONDITIONS
- */
- @Deprecated
- public static final String UNCOVERED_COMPLEXITY_BY_TESTS_KEY = "uncovered_complexity_by_tests";
- /**
- * @deprecated replaced since 1.11 by UNCOVERED_LINES and UNCOVERED_CONDITIONS
- */
- @Deprecated
- public static final Metric UNCOVERED_COMPLEXITY_BY_TESTS = new Metric(UNCOVERED_COMPLEXITY_BY_TESTS_KEY, "Uncovered complexity",
- "Uncovered complexity", Metric.ValueType.INT, Metric.DIRECTION_WORST, false, DOMAIN_COMPLEXITY).setFormula(new SumChildValuesFormula(
- false));
public static final String DUPLICATED_LINES_KEY = "duplicated_lines";
public static final Metric DUPLICATED_LINES = new Metric(DUPLICATED_LINES_KEY, "Duplicated lines", "Duplicated lines",
AVG_CMPX_BY_FILE = 'file_complexity'
CLASSES_CMPX_DISTRIBUTION = 'class_complexity_distribution'
FUNCTIONS_CMPX_DISTRIBUTION = 'function_complexity_distribution'
- UNCOVERED_CMPX_BY_TESTS = 'uncovered_complexity_by_tests'
DUPLICATED_FILES = 'duplicated_files'
DUPLICATED_LINES = 'duplicated_lines'