<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>sonar-plugin-api</artifactId>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easytesting</groupId>
+ <artifactId>fest-assert</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<build>
*/
package org.sonar.plugins.l10n;
-import org.sonar.api.Extension;
-
import org.sonar.api.SonarPlugin;
import java.util.Collections;
public final class EnglishPackPlugin extends SonarPlugin {
- public List<Class<? extends Extension>> getExtensions() {
+ public List<?> getExtensions() {
return Collections.emptyList();
}
}
--- /dev/null
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2012 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.l10n;
+
+import org.junit.Test;
+
+import static org.fest.assertions.Assertions.assertThat;
+
+public class EnglishPackPluginTest {
+ @Test
+ public void no_extensions() {
+ assertThat(new EnglishPackPlugin().getExtensions()).isEmpty();
+ }
+}
import org.sonar.api.batch.SonarIndex;
import org.sonar.api.database.model.ResourceModel;
import org.sonar.api.design.Dependency;
-import org.sonar.api.measures.*;
+import org.sonar.api.measures.Measure;
+import org.sonar.api.measures.MeasuresFilter;
+import org.sonar.api.measures.MeasuresFilters;
+import org.sonar.api.measures.Metric;
+import org.sonar.api.measures.MetricFinder;
import org.sonar.api.profiles.RulesProfile;
-import org.sonar.api.resources.*;
+import org.sonar.api.resources.Project;
+import org.sonar.api.resources.ProjectLink;
+import org.sonar.api.resources.Resource;
+import org.sonar.api.resources.ResourceUtils;
+import org.sonar.api.resources.Scopes;
import org.sonar.api.rules.ActiveRule;
import org.sonar.api.rules.Violation;
import org.sonar.api.utils.SonarException;
import org.sonar.batch.ResourceFilters;
import org.sonar.batch.ViolationFilters;
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
public class DefaultIndex extends SonarIndex {
if (!StringUtils.equals(Scopes.PROJECT, resource.getScope())) {
// not a project nor a library
uid = new StringBuilder(ResourceModel.KEY_SIZE)
- .append(project.getKey())
- .append(':')
- .append(resource.getKey())
- .toString();
+ .append(project.getKey())
+ .append(':')
+ .append(resource.getKey())
+ .toString();
}
return uid;
}
}
private void checkLock(Resource resource) {
- if (lock.isLocked() && !ResourceUtils.isLibrary(resource)) {
- if (lock.isFailWhenLocked()) {
- throw new SonarException("Index is locked, resource can not be indexed: " + resource);
- }
+ if (lock.isLocked() && !ResourceUtils.isLibrary(resource) && lock.isFailWhenLocked()) {
+ throw new SonarException("Index is locked, resource can not be indexed: " + resource);
}
}
import com.google.common.collect.Maps;
import org.sonar.api.utils.KeyValueFormat;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.SortedMap;
/**
* @since 2.7
* Metrics of generated measures
*/
public static final List<Metric> METRICS = Arrays.asList(
- CoreMetrics.LINES_TO_COVER, CoreMetrics.UNCOVERED_LINES, CoreMetrics.COVERAGE_LINE_HITS_DATA,
- CoreMetrics.CONDITIONS_TO_COVER, CoreMetrics.UNCOVERED_CONDITIONS, CoreMetrics.CONDITIONS_BY_LINE,
- CoreMetrics.COVERED_CONDITIONS_BY_LINE);
+ CoreMetrics.LINES_TO_COVER, CoreMetrics.UNCOVERED_LINES, CoreMetrics.COVERAGE_LINE_HITS_DATA,
+ CoreMetrics.CONDITIONS_TO_COVER, CoreMetrics.UNCOVERED_CONDITIONS, CoreMetrics.CONDITIONS_BY_LINE,
+ CoreMetrics.COVERED_CONDITIONS_BY_LINE);
private int totalCoveredLines = 0, totalConditions = 0, totalCoveredConditions = 0;
}
public CoverageMeasuresBuilder setConditions(int lineId, int conditions, int coveredConditions) {
- if (!conditionsByLine.containsKey(lineId)) {
- if (conditions > 0) {
- totalConditions += conditions;
- totalCoveredConditions += coveredConditions;
- conditionsByLine.put(lineId, conditions);
- coveredConditionsByLine.put(lineId, coveredConditions);
- }
+ if (conditions > 0 && !conditionsByLine.containsKey(lineId)) {
+ totalConditions += conditions;
+ totalCoveredConditions += coveredConditions;
+ conditionsByLine.put(lineId, conditions);
+ coveredConditionsByLine.put(lineId, coveredConditions);
}
return this;
}
private Measure createCoveredConditionsByLine() {
return new Measure(CoreMetrics.COVERED_CONDITIONS_BY_LINE)
- .setData(KeyValueFormat.format(coveredConditionsByLine))
- .setPersistenceMode(PersistenceMode.DATABASE);
+ .setData(KeyValueFormat.format(coveredConditionsByLine))
+ .setPersistenceMode(PersistenceMode.DATABASE);
}
private Measure createConditionsByLine() {
return new Measure(CoreMetrics.CONDITIONS_BY_LINE)
- .setData(KeyValueFormat.format(conditionsByLine))
- .setPersistenceMode(PersistenceMode.DATABASE);
+ .setData(KeyValueFormat.format(conditionsByLine))
+ .setPersistenceMode(PersistenceMode.DATABASE);
}
public static CoverageMeasuresBuilder create() {