mirror of
https://github.com/SonarSource/sonarqube.git
synced 2024-08-03 08:18:00 +02:00
Fix coding violations
This commit is contained in:
parent
2b560c35ab
commit
d4ae5228bb
@ -113,7 +113,9 @@ import java.util.List;
|
||||
@Property(
|
||||
key = "sonar.timemachine.period1",
|
||||
name = "Period 1",
|
||||
description = "Period used to compare measures and track new violations. Values are : <ul class='bullet'><li>Number of days before analysis, for example 5.</li><li>A custom date. Format is yyyy-MM-dd, for example 2010-12-25</li><li>'previous_analysis' to compare to previous analysis</li><li>A version, for example 1.2</li></ul>",
|
||||
description = "Period used to compare measures and track new violations. Values are : <ul class='bullet'><li>Number of days before " +
|
||||
"analysis, for example 5.</li><li>A custom date. Format is yyyy-MM-dd, for example 2010-12-25</li><li>'previous_analysis' to " +
|
||||
"compare to previous analysis</li><li>A version, for example 1.2</li></ul>",
|
||||
project = false,
|
||||
global = true,
|
||||
defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_1
|
||||
@ -137,7 +139,9 @@ import java.util.List;
|
||||
@Property(
|
||||
key = "sonar.timemachine.period4",
|
||||
name = "Period 4",
|
||||
description = "Period used to compare measures and track new violations. This property is specific to the project. Values are : <ul class='bullet'><li>Number of days before analysis, for example 5.</li><li>A custom date. Format is yyyy-MM-dd, for example 2010-12-25</li><li>'previous_analysis' to compare to previous analysis</li><li>A version, for example 1.2</li></ul>",
|
||||
description = "Period used to compare measures and track new violations. This property is specific to the project. Values are : " +
|
||||
"<ul class='bullet'><li>Number of days before analysis, for example 5.</li><li>A custom date. Format is yyyy-MM-dd, " +
|
||||
"for example 2010-12-25</li><li>'previous_analysis' to compare to previous analysis</li><li>A version, for example 1.2</li></ul>",
|
||||
project = true,
|
||||
global = false,
|
||||
defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_4
|
||||
|
@ -20,7 +20,6 @@
|
||||
package org.sonar.plugins.core.sensors;
|
||||
|
||||
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.MeasureUtils;
|
||||
@ -28,7 +27,6 @@ import org.sonar.api.measures.Metric;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public final class CoverageDecorator extends AbstractCoverageDecorator {
|
||||
|
||||
@ -61,7 +59,6 @@ public final class CoverageDecorator extends AbstractCoverageDecorator {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected Metric getGeneratedMetricForNewCode() {
|
||||
return CoreMetrics.NEW_COVERAGE;
|
||||
@ -70,7 +67,7 @@ public final class CoverageDecorator extends AbstractCoverageDecorator {
|
||||
@Override
|
||||
protected Long countElementsForNewCode(DecoratorContext context, int periodIndex) {
|
||||
Long newLinesToCover = MeasureUtils.getVariationAsLong(context.getMeasure(CoreMetrics.NEW_LINES_TO_COVER), periodIndex);
|
||||
if (newLinesToCover!=null) {
|
||||
if (newLinesToCover != null) {
|
||||
long newConditionsToCover = MeasureUtils.getVariationAsLong(context.getMeasure(CoreMetrics.NEW_CONDITIONS_TO_COVER), periodIndex, 0L);
|
||||
return newLinesToCover + newConditionsToCover;
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ import org.sonar.api.measures.Metric;
|
||||
import org.sonar.api.measures.MetricFinder;
|
||||
import org.sonar.api.resources.Project;
|
||||
import org.sonar.api.resources.Resource;
|
||||
import org.sonar.api.resources.ResourceUtils;
|
||||
import org.sonar.api.resources.Scopes;
|
||||
import org.sonar.batch.components.TimeMachineConfiguration;
|
||||
|
||||
|
@ -19,11 +19,14 @@
|
||||
*/
|
||||
package org.sonar.plugins.cpd;
|
||||
|
||||
import org.sonar.api.*;
|
||||
import org.sonar.api.CoreProperties;
|
||||
import org.sonar.api.Plugin;
|
||||
import org.sonar.api.Properties;
|
||||
import org.sonar.api.Property;
|
||||
import org.sonar.plugins.cpd.decorators.DuplicationDensityDecorator;
|
||||
import org.sonar.plugins.cpd.decorators.SumDuplicationsDecorator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Properties({
|
||||
@ -36,14 +39,14 @@ import java.util.List;
|
||||
module = true,
|
||||
global = true),
|
||||
@Property(
|
||||
key = CoreProperties.CPD_IGNORE_LITERALS_PROPERTY,
|
||||
defaultValue = CoreProperties.CPD_IGNORE_LITERALS_DEFAULT_VALUE + "",
|
||||
name = "Ignore literals",
|
||||
description = "if true, CPD ignores literal value differences when evaluating a duplicate block. " +
|
||||
"This means that foo=\"first string\"; and foo=\"second string\"; will be seen as equivalent.",
|
||||
project = true,
|
||||
module = true,
|
||||
global = true),
|
||||
key = CoreProperties.CPD_IGNORE_LITERALS_PROPERTY,
|
||||
defaultValue = CoreProperties.CPD_IGNORE_LITERALS_DEFAULT_VALUE + "",
|
||||
name = "Ignore literals",
|
||||
description = "if true, CPD ignores literal value differences when evaluating a duplicate block. " +
|
||||
"This means that foo=\"first string\"; and foo=\"second string\"; will be seen as equivalent.",
|
||||
project = true,
|
||||
module = true,
|
||||
global = true),
|
||||
@Property(
|
||||
key = CoreProperties.CPD_IGNORE_IDENTIFIERS_PROPERTY,
|
||||
defaultValue = CoreProperties.CPD_IGNORE_IDENTIFIERS_DEFAULT_VALUE + "",
|
||||
@ -75,12 +78,7 @@ public class CpdPlugin implements Plugin {
|
||||
return "Find duplicated source code within project.";
|
||||
}
|
||||
|
||||
public List<Class<? extends Extension>> getExtensions() {
|
||||
List<Class<? extends Extension>> list = new ArrayList<Class<? extends Extension>>();
|
||||
list.add(CpdSensor.class);
|
||||
list.add(SumDuplicationsDecorator.class);
|
||||
list.add(DuplicationDensityDecorator.class);
|
||||
list.add(JavaCpdMapping.class);
|
||||
return list;
|
||||
public List getExtensions() {
|
||||
return Arrays.asList(CpdSensor.class, SumDuplicationsDecorator.class, DuplicationDensityDecorator.class, JavaCpdMapping.class);
|
||||
}
|
||||
}
|
@ -19,27 +19,25 @@
|
||||
*/
|
||||
package org.sonar.plugins.findbugs;
|
||||
|
||||
import org.sonar.api.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.sonar.api.CoreProperties;
|
||||
import org.sonar.api.Extension;
|
||||
import org.sonar.api.Plugin;
|
||||
import org.sonar.api.Properties;
|
||||
import org.sonar.api.Property;
|
||||
|
||||
@Properties({
|
||||
@Property(
|
||||
key = CoreProperties.FINDBUGS_EFFORT_PROPERTY,
|
||||
defaultValue = CoreProperties.FINDBUGS_EFFORT_DEFAULT_VALUE,
|
||||
name = "Effort",
|
||||
description = "Effort of the bug finders. Valid values are Min, Default and Max. Setting 'Max' increases precision but also increases memory consumption.",
|
||||
description = "Effort of the bug finders. Valid values are Min, Default and Max. Setting 'Max' increases precision but also increases " +
|
||||
"memory consumption.",
|
||||
project = true, module = true, global = true),
|
||||
@Property(
|
||||
key = CoreProperties.FINDBUGS_TIMEOUT_PROPERTY,
|
||||
defaultValue = CoreProperties.FINDBUGS_TIMEOUT_DEFAULT_VALUE + "",
|
||||
name = "Timeout",
|
||||
description = "Specifies the amount of time, in milliseconds, that FindBugs may run before it is assumed to be hung and is terminated. The default is 600,000 milliseconds, which is ten minutes.",
|
||||
description = "Specifies the amount of time, in milliseconds, that FindBugs may run before it is assumed to be hung and is terminated. " +
|
||||
"The default is 600,000 milliseconds, which is ten minutes.",
|
||||
project = true, module = true, global = true) })
|
||||
public class FindbugsPlugin implements Plugin {
|
||||
|
||||
@ -52,7 +50,8 @@ public class FindbugsPlugin implements Plugin {
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return "FindBugs is a program that uses static analysis to look for bugs in Java code. It can detect a variety of common coding mistakes, including thread synchronization problems, misuse of API methods... You can find more by going to the <a href='http://findbugs.sourceforge.net'>Findbugs web site</a>.";
|
||||
return "FindBugs is a program that uses static analysis to look for bugs in Java code. It can detect a variety of common coding mistakes, " +
|
||||
"including thread synchronization problems, misuse of API methods... You can find more by going to the <a href='http://findbugs.sourceforge.net'>Findbugs web site</a>.";
|
||||
}
|
||||
|
||||
public List<Class<? extends Extension>> getExtensions() {
|
||||
|
@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.sonar.api.BatchExtension;
|
||||
import org.sonar.api.resources.Java;
|
||||
import org.sonar.api.resources.Project;
|
||||
import org.sonar.api.utils.SonarException;
|
||||
import org.sonar.api.utils.TimeProfiler;
|
||||
import org.sonar.java.api.JavaUtils;
|
||||
|
||||
@ -122,7 +123,7 @@ public class PmdExecutor implements BatchExtension {
|
||||
return stream;
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException("The PMD ruleset can not be found: " + rulesetPath);
|
||||
throw new SonarException("The PMD ruleset can not be found: " + rulesetPath, e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,7 +160,7 @@ public class PmdExecutor implements BatchExtension {
|
||||
LOG.info("Java version: " + javaVersion);
|
||||
pmd.setJavaVersion(sourceType);
|
||||
} else {
|
||||
throw new RuntimeException("Unsupported Java version for PMD: " + javaVersion);
|
||||
throw new SonarException("Unsupported Java version for PMD: " + javaVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,6 @@ package org.sonar.plugins.squid.bridges;
|
||||
|
||||
import org.sonar.api.measures.CoreMetrics;
|
||||
import org.sonar.api.resources.Resource;
|
||||
import org.sonar.java.api.JavaClass;
|
||||
import org.sonar.squid.api.SourceClass;
|
||||
import org.sonar.squid.api.SourceFile;
|
||||
import org.sonar.squid.measures.Metric;
|
||||
|
||||
@ -39,7 +37,7 @@ public class ChidamberKemererBridge extends Bridge {
|
||||
context.saveMeasure(sonarFile, CoreMetrics.RFC, squidFile.getDouble(Metric.RFC));
|
||||
|
||||
double lcom4 = squidFile.getDouble(Metric.LCOM4);
|
||||
if (lcom4>0.0) {
|
||||
if (lcom4 > 0.0) {
|
||||
context.saveMeasure(sonarFile, CoreMetrics.LCOM4, lcom4);
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public abstract class Module {
|
||||
/**
|
||||
* @return this
|
||||
*/
|
||||
private final Module init(MutablePicoContainer container) {
|
||||
private Module init(MutablePicoContainer container) {
|
||||
this.container = container;
|
||||
configure();
|
||||
return this;
|
||||
|
@ -23,14 +23,12 @@ import org.sonar.api.BatchExtension;
|
||||
import org.sonar.api.CoreProperties;
|
||||
import org.sonar.api.database.DatabaseSession;
|
||||
import org.sonar.api.database.model.Snapshot;
|
||||
import org.sonar.api.resources.Project;
|
||||
import org.sonar.api.resources.Qualifiers;
|
||||
import org.sonar.api.utils.DateUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
import org.sonar.api.resources.Qualifiers;
|
||||
|
||||
public class PastSnapshotFinderByPreviousAnalysis implements BatchExtension {
|
||||
|
||||
private DatabaseSession session;
|
||||
|
@ -27,7 +27,6 @@ import org.sonar.api.BatchExtension;
|
||||
import org.sonar.api.CoreProperties;
|
||||
import org.sonar.api.database.model.Snapshot;
|
||||
import org.sonar.api.resources.Qualifiers;
|
||||
import org.sonar.api.resources.Resource;
|
||||
import org.sonar.api.utils.Logs;
|
||||
|
||||
import java.util.Collections;
|
||||
|
@ -228,7 +228,7 @@ public final class DefaultResourcePersister implements ResourcePersister {
|
||||
return model;
|
||||
|
||||
} catch (NonUniqueResultException e) {
|
||||
throw new SonarException("The resource '" + resource.getEffectiveKey() + "' is duplicated in database.");
|
||||
throw new SonarException("The resource '" + resource.getEffectiveKey() + "' is duplicated in database.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,15 +20,9 @@
|
||||
package org.sonar.jpa.dao;
|
||||
|
||||
import org.sonar.api.database.DatabaseSession;
|
||||
import org.sonar.api.database.model.RuleFailureModel;
|
||||
import org.sonar.api.database.model.Snapshot;
|
||||
import org.sonar.api.profiles.RulesProfile;
|
||||
import org.sonar.api.rules.ActiveRule;
|
||||
import org.sonar.api.rules.ActiveRuleParam;
|
||||
import org.sonar.api.rules.Rule;
|
||||
import org.sonar.api.rules.RuleParam;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class RulesDao extends BaseDao {
|
||||
|
@ -59,10 +59,12 @@ public class Match implements Comparable<Match> {
|
||||
public static final Comparator<Match> LabelComparator = new Comparator<Match>() {
|
||||
|
||||
public int compare(Match ma, Match mb) {
|
||||
if (ma.getLabel() == null)
|
||||
if (ma.getLabel() == null) {
|
||||
return 1;
|
||||
if (mb.getLabel() == null)
|
||||
}
|
||||
if (mb.getLabel() == null) {
|
||||
return -1;
|
||||
}
|
||||
return mb.getLabel().compareTo(ma.getLabel());
|
||||
}
|
||||
};
|
||||
|
@ -29,6 +29,7 @@ import org.sonar.api.resources.Project;
|
||||
* @since 1.10
|
||||
* @deprecated since 2.6 was superseded by interface {@link CoverageExtension}
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class AbstractCoverageExtension implements CoverageExtension {
|
||||
|
||||
/**
|
||||
|
@ -194,7 +194,7 @@ public interface SensorContext {
|
||||
* if the source has already been set on this resource
|
||||
* @since 1.10. Returns a boolean since 2.6.
|
||||
*/
|
||||
void saveSource(Resource reference, String source) throws DuplicatedSourceException;
|
||||
void saveSource(Resource reference, String source);
|
||||
|
||||
// ----------- LINKS --------------
|
||||
|
||||
|
@ -138,7 +138,7 @@ public final class AnnotationCheckFactory extends CheckFactory {
|
||||
throw new SonarException("The type of the field " + field + " is not supported: " + field.getType());
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new SonarException("Can not set the value of the field " + field + " in the class: " + check.getClass().getName());
|
||||
throw new SonarException("Can not set the value of the field " + field + " in the class: " + check.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
package org.sonar.api.database.model;
|
||||
|
||||
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang.builder.ToStringStyle;
|
||||
import org.sonar.api.database.DatabaseSession;
|
||||
import org.sonar.api.measures.Metric;
|
||||
|
@ -365,6 +365,9 @@ public final class CoreMetrics {
|
||||
.setBestValue(100.0)
|
||||
.create();
|
||||
|
||||
/**
|
||||
* @deprecated since 2.7. Replaced by COVERED_CONDITIONS_BY_LINE_KEY and COVERED_CONDITIONS_BY_LINE_KEY
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String BRANCH_COVERAGE_HITS_DATA_KEY = "branch_coverage_hits_data";
|
||||
|
||||
|
@ -31,11 +31,16 @@ public final class Iso9126RulesCategories {
|
||||
private Iso9126RulesCategories() {
|
||||
}
|
||||
|
||||
public static final RulesCategory RELIABILITY = new RulesCategory("Reliability", "The extent to which the project can be expected to perform its intended function with rescission. Some examples : are loop indexes range tested? Is input data checked for range errors ? Is divide-by-zero avoided ? Is exception handling provided ?");
|
||||
public static final RulesCategory EFFICIENCY = new RulesCategory("Efficiency", "The extent to which the project fulfills its purpose without waste of resources. This means resources in the sense of memory utilisation and processor speed.");
|
||||
public static final RulesCategory PORTABILITY = new RulesCategory("Portability", "The extent to which the project can be operated easily and well on multiple computer configurations. Portability can mean both between different hardware setups and between different operating systems -- such as running on both Mac OS X and GNU/Linux.");
|
||||
public static final RulesCategory USABILITY = new RulesCategory("Usability", "The extent to which the project can be understood, learned, operated, attractive and compliant with usability regulations and guidelines. It commonly relies on naming conventions and formatting rules.");
|
||||
public static final RulesCategory MAINTAINABILITY = new RulesCategory("Maintainability", "The extent to which the project facilitates updating to satisfy new requirements. Thus the the project which is maintainable should be not complex.");
|
||||
public static final RulesCategory RELIABILITY = new RulesCategory("Reliability",
|
||||
"The extent to which the project can be expected to perform its intended function with rescission. Some examples : are loop indexes range tested? Is input data checked for range errors ? Is divide-by-zero avoided ? Is exception handling provided ?");
|
||||
public static final RulesCategory EFFICIENCY = new RulesCategory("Efficiency",
|
||||
"The extent to which the project fulfills its purpose without waste of resources. This means resources in the sense of memory utilisation and processor speed.");
|
||||
public static final RulesCategory PORTABILITY = new RulesCategory("Portability",
|
||||
"The extent to which the project can be operated easily and well on multiple computer configurations. Portability can mean both between different hardware setups and between different operating systems -- such as running on both Mac OS X and GNU/Linux.");
|
||||
public static final RulesCategory USABILITY = new RulesCategory("Usability",
|
||||
"The extent to which the project can be understood, learned, operated, attractive and compliant with usability regulations and guidelines. It commonly relies on naming conventions and formatting rules.");
|
||||
public static final RulesCategory MAINTAINABILITY = new RulesCategory("Maintainability",
|
||||
"The extent to which the project facilitates updating to satisfy new requirements. Thus the the project which is maintainable should be not complex.");
|
||||
|
||||
public static final List<RulesCategory> ALL = Collections.unmodifiableList(Arrays.asList(RELIABILITY, EFFICIENCY, PORTABILITY, USABILITY, MAINTAINABILITY));
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public final class DateUtils {
|
||||
return dateFormat.parse(s);
|
||||
|
||||
} catch (ParseException e) {
|
||||
throw new SonarException("The date '" + s + "' does not respect format '" + DATE_FORMAT + "'");
|
||||
throw new SonarException("The date '" + s + "' does not respect format '" + DATE_FORMAT + "'", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ public final class DateUtils {
|
||||
return dateTimeFormat.parse(s);
|
||||
|
||||
} catch (ParseException e) {
|
||||
throw new SonarException("The date '" + s + "' does not respect format '" + DATETIME_FORMAT + "'");
|
||||
throw new SonarException("The date '" + s + "' does not respect format '" + DATETIME_FORMAT + "'", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -432,7 +432,7 @@ public final class KeyValueFormat {
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated since 2.7 replaced by Converter
|
||||
* @deprecated since 2.7. Replaced by Converter
|
||||
*/
|
||||
@Deprecated
|
||||
public interface Transformer<KEY, VALUE> {
|
||||
@ -452,6 +452,7 @@ public final class KeyValueFormat {
|
||||
|
||||
/**
|
||||
* Implementation of Transformer<Double, Double>
|
||||
* @deprecated since 2.7. Replaced by Converter
|
||||
*/
|
||||
@Deprecated
|
||||
public static class DoubleNumbersPairTransformer implements Transformer<Double, Double> {
|
||||
@ -462,6 +463,7 @@ public final class KeyValueFormat {
|
||||
|
||||
/**
|
||||
* Implementation of Transformer<Integer, Integer>
|
||||
* @deprecated since 2.7. Replaced by Converter
|
||||
*/
|
||||
@Deprecated
|
||||
public static class IntegerNumbersPairTransformer implements Transformer<Integer, Integer> {
|
||||
@ -473,6 +475,7 @@ public final class KeyValueFormat {
|
||||
|
||||
/**
|
||||
* Implementation of Transformer<RulePriority, Integer>
|
||||
* @deprecated since 2.7. Replaced by Converter
|
||||
*/
|
||||
@Deprecated
|
||||
public static class RulePriorityNumbersPairTransformer implements Transformer<RulePriority, Integer> {
|
||||
|
@ -96,7 +96,7 @@ public class ServerHttpClient implements BatchComponent {
|
||||
|
||||
protected String executeAction(String action) {
|
||||
String result = getRemoteContent(url + action);
|
||||
if (result.trim().length() == 0) {
|
||||
if (StringUtils.isBlank(result)) {
|
||||
throw new ServerApiEmptyContentException("Empty " + action + " returned from server");
|
||||
}
|
||||
return result;
|
||||
|
@ -157,7 +157,7 @@ public final class ZipUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static interface ZipEntryFilter {
|
||||
private static interface ZipEntryFilter {
|
||||
boolean accept(ZipEntry entry);
|
||||
}
|
||||
|
||||
|
@ -45,12 +45,13 @@ import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class TrendsChart extends BaseChart {
|
||||
|
||||
private XYPlot plot;
|
||||
private TreeMap<Long, TimeSeries> seriesById;
|
||||
private SortedMap<Long, TimeSeries> seriesById;
|
||||
private int percentAxisId = -1;
|
||||
private boolean displayLegend;
|
||||
|
||||
|
@ -58,7 +58,7 @@ public final class ConfigurationFactory {
|
||||
return result;
|
||||
}
|
||||
|
||||
protected PropertiesConfiguration getConfigurationFromPropertiesFile(String filename) throws ConfigurationException {
|
||||
protected PropertiesConfiguration getConfigurationFromPropertiesFile(String filename) {
|
||||
try {
|
||||
return new PropertiesConfiguration(ConfigurationFactory.class.getResource(filename));
|
||||
|
||||
@ -67,7 +67,7 @@ public final class ConfigurationFactory {
|
||||
}
|
||||
}
|
||||
|
||||
public PropertiesConfiguration getConfigurationFromPropertiesFile() throws ConfigurationException {
|
||||
public PropertiesConfiguration getConfigurationFromPropertiesFile() {
|
||||
return getConfigurationFromPropertiesFile("/conf/sonar.properties");
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ package org.sonar.server.filters;
|
||||
|
||||
import org.apache.commons.collections.comparators.ReverseComparator;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
public class FilterResult {
|
||||
@ -97,7 +98,8 @@ public class FilterResult {
|
||||
}
|
||||
}
|
||||
|
||||
static class RowComparator implements Comparator {
|
||||
static final class RowComparator implements Comparator, Serializable {
|
||||
private static final long serialVersionUID = 4627704879575964978L;
|
||||
private int index;
|
||||
|
||||
RowComparator(int index) {
|
||||
|
@ -20,8 +20,6 @@
|
||||
package org.sonar.server.platform;
|
||||
|
||||
import org.apache.commons.configuration.Configuration;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.sonar.server.configuration.ConfigurationFactory;
|
||||
|
||||
import javax.servlet.ServletContextEvent;
|
||||
@ -29,8 +27,6 @@ import javax.servlet.ServletContextListener;
|
||||
|
||||
public final class PlatformLifecycleListener implements ServletContextListener {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(PlatformLifecycleListener.class);
|
||||
|
||||
public void contextInitialized(ServletContextEvent event) {
|
||||
Configuration configuration = new ConfigurationFactory().getConfiguration(event);
|
||||
Platform.getInstance().init(configuration);
|
||||
|
@ -37,8 +37,8 @@ public final class EnableProfiles {
|
||||
private Language[] languages;
|
||||
private DatabaseSessionFactory sessionFactory;
|
||||
|
||||
// NOSONAR the parameter registerProfilesBefore is used to define the execution order of startup components
|
||||
public EnableProfiles(Language[] languages, DatabaseSessionFactory sessionFactory, RegisterProvidedProfiles registerProfilesBefore) {
|
||||
|
||||
public EnableProfiles(Language[] languages, DatabaseSessionFactory sessionFactory, RegisterProvidedProfiles registerProfilesBefore) {// NOSONAR the parameter registerProfilesBefore is used to define the execution order of startup components
|
||||
this.languages = languages;
|
||||
this.sessionFactory = sessionFactory;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public final class RegisterProvidedProfiles {
|
||||
private RuleFinder ruleFinder;
|
||||
|
||||
public RegisterProvidedProfiles(RuleFinder ruleFinder, DatabaseSessionFactory sessionFactory,
|
||||
DeprecatedProfiles deprecatedBridge, RegisterRules registerRulesBefore,
|
||||
DeprecatedProfiles deprecatedBridge, RegisterRules registerRulesBefore,// NOSONAR the parameter registerRulesBefore is unused must be declared for execution order of tasks
|
||||
ProfileDefinition[] definitions) {
|
||||
this.ruleFinder = ruleFinder;
|
||||
this.sessionFactory = sessionFactory;
|
||||
@ -55,7 +55,7 @@ public final class RegisterProvidedProfiles {
|
||||
}
|
||||
|
||||
public RegisterProvidedProfiles(RuleFinder ruleFinder, DatabaseSessionFactory sessionFactory,
|
||||
DeprecatedProfiles deprecatedBridge, RegisterRules registerRulesBefore) {
|
||||
DeprecatedProfiles deprecatedBridge, RegisterRules registerRulesBefore) {// NOSONAR the parameter registerRulesBefore is unused must be declared for execution order of tasks
|
||||
this.ruleFinder = ruleFinder;
|
||||
this.sessionFactory = sessionFactory;
|
||||
this.deprecatedProfiles = deprecatedBridge;
|
||||
|
@ -29,8 +29,7 @@ public final class RegisterQualityModels {
|
||||
/**
|
||||
* @param registerRulesBeforeModels used only to be started after the creation of check templates
|
||||
*/
|
||||
// NOSONAR the parameter registerRulesBeforeModels is only used to provide the execution order by picocontainer
|
||||
public RegisterQualityModels(ModelManager manager, RegisterRules registerRulesBeforeModels) {
|
||||
public RegisterQualityModels(ModelManager manager, RegisterRules registerRulesBeforeModels) {// NOSONAR the parameter registerRulesBeforeModels is only used to provide the execution order by picocontainer
|
||||
this.manager = manager;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@ package org.sonar.server.ui;
|
||||
|
||||
import org.sonar.api.measures.CoreMetrics;
|
||||
import org.sonar.api.resources.Qualifiers;
|
||||
import org.sonar.api.resources.Resource;
|
||||
import org.sonar.api.web.*;
|
||||
|
||||
/**
|
||||
@ -84,7 +83,8 @@ public final class DefaultPages {
|
||||
CoreMetrics.CRITICAL_VIOLATIONS_KEY, CoreMetrics.MAJOR_VIOLATIONS_KEY, CoreMetrics.MINOR_VIOLATIONS_KEY, CoreMetrics.INFO_VIOLATIONS_KEY,
|
||||
CoreMetrics.NEW_VIOLATIONS_KEY, CoreMetrics.NEW_BLOCKER_VIOLATIONS_KEY, CoreMetrics.NEW_CRITICAL_VIOLATIONS_KEY, CoreMetrics.NEW_MAJOR_VIOLATIONS_KEY,
|
||||
CoreMetrics.NEW_MINOR_VIOLATIONS_KEY, CoreMetrics.NEW_INFO_VIOLATIONS_KEY})
|
||||
@ResourceQualifier({Qualifiers.VIEW, Qualifiers.SUBVIEW, Qualifiers.PROJECT, Qualifiers.MODULE, Qualifiers.PACKAGE, Qualifiers.DIRECTORY, Qualifiers.FILE, Qualifiers.CLASS}) /* all exept unit tests...*/
|
||||
@ResourceQualifier({Qualifiers.VIEW, Qualifiers.SUBVIEW, Qualifiers.PROJECT, Qualifiers.MODULE, Qualifiers.PACKAGE, Qualifiers.DIRECTORY, Qualifiers.FILE, Qualifiers.CLASS})
|
||||
/* all exept unit tests...*/
|
||||
@UserRole(UserRole.CODEVIEWER)
|
||||
private static final class ViolationsTab implements RubyRailsPage {
|
||||
public String getTemplate() {
|
||||
|
@ -141,6 +141,7 @@ public abstract class SourceCode implements Measurable, Comparable<SourceCode> {
|
||||
/**
|
||||
* @deprecated since 2.1. It's replaced by getData(MetricDef). It's still defined for binary compatibility.
|
||||
*/
|
||||
@Deprecated
|
||||
public Object getData(Metric metric) {
|
||||
return measures.getData(metric);
|
||||
}
|
||||
|
@ -107,13 +107,13 @@ public class TestUtils {
|
||||
try {
|
||||
FileUtils.deleteDirectory(dir);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Can not delete the directory " + dir);
|
||||
throw new SonarException("Can not delete the directory " + dir, e);
|
||||
}
|
||||
}
|
||||
try {
|
||||
FileUtils.forceMkdir(dir);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Can not create the directory " + dir);
|
||||
throw new SonarException("Can not create the directory " + dir, e);
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
@ -134,7 +134,6 @@ public class TestUtils {
|
||||
|
||||
static Diff isSimilarXml(String expectedXml, String xml) throws IOException, SAXException {
|
||||
XMLUnit.setIgnoreWhitespace(true);
|
||||
Diff diff = XMLUnit.compareXML(xml, expectedXml);
|
||||
return diff;
|
||||
return XMLUnit.compareXML(xml, expectedXml);
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ package org.sonar.test.channel;
|
||||
|
||||
import org.hamcrest.BaseMatcher;
|
||||
import org.hamcrest.Description;
|
||||
import org.sonar.channel.Channel;
|
||||
import org.sonar.channel.CodeReader;
|
||||
|
||||
public class ReaderHasNextCharMatcher extends BaseMatcher<CodeReader> {
|
||||
|
@ -134,7 +134,9 @@ public class Dependency extends Model {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ package org.sonar.wsclient.services;
|
||||
/**
|
||||
* @since 2.7
|
||||
*/
|
||||
public class ProfileQuery extends Query<Profile> {
|
||||
public final class ProfileQuery extends Query<Profile> {
|
||||
public static final String BASE_URL = "/api/profiles";
|
||||
|
||||
private String language;
|
||||
|
@ -22,7 +22,7 @@ package org.sonar.wsclient.services;
|
||||
/**
|
||||
* @since 2.4
|
||||
*/
|
||||
public class UpdateCenterQuery extends Query<Plugin> {
|
||||
public final class UpdateCenterQuery extends Query<Plugin> {
|
||||
|
||||
public static final String BASE_URL = "/api/updatecenter/";
|
||||
private String action;
|
||||
|
Loading…
Reference in New Issue
Block a user