diff options
author | Zeeshan Asghar <zeeshan.asghar@devfactory.com> | 2016-01-21 15:56:32 +0500 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-01-29 17:01:31 +0100 |
commit | bf071cefa1d04303ae246de745a8856c64b9617f (patch) | |
tree | 8d31b74cadac3271f8519d3d76566f04b2139e45 /sonar-batch | |
parent | 1fc88e490a8db848301e784d53d5170018b6d1e5 (diff) | |
download | sonarqube-bf071cefa1d04303ae246de745a8856c64b9617f.tar.gz sonarqube-bf071cefa1d04303ae246de745a8856c64b9617f.zip |
squid:S1213 members of an interface decleration or class should appear in a pre-defined order
Diffstat (limited to 'sonar-batch')
6 files changed, 26 insertions, 27 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/analysis/AnalysisTempFolderProvider.java b/sonar-batch/src/main/java/org/sonar/batch/analysis/AnalysisTempFolderProvider.java index 6b6a9f8e03b..68c2608b864 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/analysis/AnalysisTempFolderProvider.java +++ b/sonar-batch/src/main/java/org/sonar/batch/analysis/AnalysisTempFolderProvider.java @@ -33,6 +33,7 @@ import java.nio.file.Path; public class AnalysisTempFolderProvider extends ProviderAdapter implements ComponentLifecycle<TempFolder> { static final String TMP_NAME = ".sonartmp"; private DefaultTempFolder projectTempFolder; + private boolean started = false; public TempFolder provide(ProjectReactor projectReactor) { if (projectTempFolder == null) { @@ -55,8 +56,6 @@ public class AnalysisTempFolderProvider extends ProviderAdapter implements Compo started = true; } - private boolean started = false; - @Override public void stop(PicoContainer container) { if (projectTempFolder != null) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalTempFolderProvider.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalTempFolderProvider.java index bdc3d43f39e..78de896f011 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalTempFolderProvider.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalTempFolderProvider.java @@ -44,7 +44,8 @@ public class GlobalTempFolderProvider extends ProviderAdapter implements Compone private static final Logger LOG = Loggers.get(GlobalTempFolderProvider.class); private static final long CLEAN_MAX_AGE = TimeUnit.DAYS.toMillis(21); static final String TMP_NAME_PREFIX = ".sonartmp_"; - + private boolean started = false; + private System2 system; private DefaultTempFolder tempFolder; @@ -151,8 +152,6 @@ public class GlobalTempFolderProvider extends ProviderAdapter implements Compone started = true; } - private boolean started = false; - @Override public void stop(PicoContainer container) { if (tempFolder != null) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/RollingFileHashes.java b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/RollingFileHashes.java index 79507790e7d..aaf2ba7bdf5 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/RollingFileHashes.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/RollingFileHashes.java @@ -25,6 +25,10 @@ package org.sonar.batch.issue.tracking; public class RollingFileHashes { final int[] rollingHashes; + + private RollingFileHashes(int[] hashes) { + this.rollingHashes = hashes; + } public static RollingFileHashes create(FileHashes hashes, int halfBlockSize) { int size = hashes.length(); @@ -53,10 +57,6 @@ public class RollingFileHashes { return rollingHashes[line - 1]; } - private RollingFileHashes(int[] hashes) { - this.rollingHashes = hashes; - } - private static class RollingHashCalculator { private static final int PRIME_BASE = 31; diff --git a/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java b/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java index 2d40488eaf0..f03b84caaac 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java +++ b/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java @@ -71,6 +71,15 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx private final System2 system; private final File out; + + public PhasesSumUpTimeProfiler(System2 system, GlobalProperties bootstrapProps) { + String workingDirPath = StringUtils.defaultIfBlank(bootstrapProps.property(CoreProperties.WORKING_DIRECTORY), CoreProperties.WORKING_DIRECTORY_DEFAULT_VALUE); + File workingDir = new File(workingDirPath).getAbsoluteFile(); + this.out = new File(workingDir, "profiling"); + this.out.mkdirs(); + this.totalProfiling = new ModuleProfiling(null, system); + this.system = system; + } static void println(String msg) { LOG.info(msg); @@ -85,15 +94,6 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx println(sb.toString()); } - public PhasesSumUpTimeProfiler(System2 system, GlobalProperties bootstrapProps) { - String workingDirPath = StringUtils.defaultIfBlank(bootstrapProps.property(CoreProperties.WORKING_DIRECTORY), CoreProperties.WORKING_DIRECTORY_DEFAULT_VALUE); - File workingDir = new File(workingDirPath).getAbsoluteFile(); - this.out = new File(workingDir, "profiling"); - this.out.mkdirs(); - this.totalProfiling = new ModuleProfiling(null, system); - this.system = system; - } - @Override public void onProjectAnalysis(ProjectAnalysisEvent event) { Project module = event.getProject(); diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/RuleFinderCompatibility.java b/sonar-batch/src/main/java/org/sonar/batch/rule/RuleFinderCompatibility.java index d6d87cab209..fe763f873bd 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/rule/RuleFinderCompatibility.java +++ b/sonar-batch/src/main/java/org/sonar/batch/rule/RuleFinderCompatibility.java @@ -46,6 +46,12 @@ import java.util.Collections; public class RuleFinderCompatibility implements RuleFinder { private final Rules rules; + private static Function<org.sonar.api.batch.rule.Rule, Rule> ruleTransformer = new Function<org.sonar.api.batch.rule.Rule, Rule>() { + @Override + public Rule apply(@Nonnull org.sonar.api.batch.rule.Rule input) { + return toRule(input); + } + }; public RuleFinderCompatibility(Rules rules) { this.rules = rules; @@ -98,12 +104,7 @@ public class RuleFinderCompatibility implements RuleFinder { return Collections2.transform(rules.findByRepository(query.getRepositoryKey()), ruleTransformer); } - private static Function<org.sonar.api.batch.rule.Rule, Rule> ruleTransformer = new Function<org.sonar.api.batch.rule.Rule, Rule>() { - @Override - public Rule apply(@Nonnull org.sonar.api.batch.rule.Rule input) { - return toRule(input); - } - }; + private Collection<Rule> byKey(RuleQuery query) { Rule rule = toRule(rules.find(RuleKey.of(query.getRepositoryKey(), query.getKey()))); diff --git a/sonar-batch/src/main/java/org/sonar/batch/sensor/coverage/CoverageConstants.java b/sonar-batch/src/main/java/org/sonar/batch/sensor/coverage/CoverageConstants.java index 7c93b215e75..569ac157e42 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/sensor/coverage/CoverageConstants.java +++ b/sonar-batch/src/main/java/org/sonar/batch/sensor/coverage/CoverageConstants.java @@ -27,9 +27,6 @@ import java.util.Collection; public class CoverageConstants { - private CoverageConstants() { - } - public static final Collection<Metric> COVERAGE_METRICS = ImmutableList.<Metric>of(CoreMetrics.LINES_TO_COVER, CoreMetrics.UNCOVERED_LINES, CoreMetrics.NEW_LINES_TO_COVER, CoreMetrics.NEW_UNCOVERED_LINES, CoreMetrics.CONDITIONS_TO_COVER, CoreMetrics.UNCOVERED_CONDITIONS, CoreMetrics.NEW_CONDITIONS_TO_COVER, CoreMetrics.NEW_UNCOVERED_CONDITIONS); @@ -39,4 +36,7 @@ public class CoverageConstants { public static final Collection<Metric> BRANCH_COVERAGE_METRICS = ImmutableList.<Metric>of(CoreMetrics.UNCOVERED_CONDITIONS, CoreMetrics.CONDITIONS_TO_COVER, CoreMetrics.NEW_UNCOVERED_CONDITIONS, CoreMetrics.NEW_CONDITIONS_TO_COVER); + + private CoverageConstants() { + } } |