From 0c2a8872425ac2bf09120f09ae43076156726c35 Mon Sep 17 00:00:00 2001 From: Christian Wulf <chw@informatik.uni-kiel.de> Date: Tue, 16 Dec 2014 15:38:13 +0100 Subject: [PATCH] removed rulesets/java/j2see#DoNotUseThreads --- .checkstyle | 13 ++++++++++--- .project | 6 ++++++ .settings/edu.umd.cs.findbugs.core.prefs | 2 +- conf/quality-config/pmd-ruleset.xml | 6 +++++- .../teetime/framework/AbstractInterThreadPipe.java | 2 +- .../teetime/framework/AnalysisConfiguration.java | 2 +- src/main/java/teetime/framework/RunnableStage.java | 2 +- src/main/java/teetime/framework/Stage.java | 6 +++--- .../java/teetime/util/classpath/FileSearcher.java | 4 ++-- .../util/list/CommittableResizableArrayQueue.java | 2 +- .../teetime/util/classpath/FileSearcherTest.java | 6 +++--- 11 files changed, 34 insertions(+), 17 deletions(-) diff --git a/.checkstyle b/.checkstyle index e073af44..e8ce6f32 100644 --- a/.checkstyle +++ b/.checkstyle @@ -1,10 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> -<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false"> +<fileset-config file-format-version="1.2.0" simple-config="false" sync-formatter="false"> <local-check-config name="TeeTime" location="conf/quality-config/cs-conf.xml" type="project" description=""> <additional-data name="protect-config-file" value="false"/> </local-check-config> - <fileset name="all" enabled="true" check-config-name="TeeTime" local="true"> - <file-match-pattern match-pattern="." include-pattern="true"/> + <local-check-config name="maven-checkstyle-plugin default" location="file:/C:/Users/chw/Repositories/teetime/conf/quality-config/cs-conf.xml" type="remote" description="maven-checkstyle-plugin configuration default"> + <property name="checkstyle.cache.file" value="${project_loc}/target/checkstyle-cachefile"/> + <property name="checkstyle.header.file" value="C:\Users\chw\Repositories\teetime\target\checkstyle-header-default.txt"/> + </local-check-config> + <fileset name="java-sources-default" enabled="true" check-config-name="maven-checkstyle-plugin default" local="true"> + <file-match-pattern match-pattern="src/main/java/.*\.java" include-pattern="true"/> + <file-match-pattern match-pattern="src/test/java/.*\.java" include-pattern="true"/> + <file-match-pattern match-pattern="src/main/resources/.*\.properties" include-pattern="true"/> + <file-match-pattern match-pattern="src/test/resources/.*\.properties" include-pattern="true"/> </fileset> </fileset-config> diff --git a/.project b/.project index 9c7a3eb0..c3dde7d0 100644 --- a/.project +++ b/.project @@ -25,11 +25,17 @@ <arguments> </arguments> </buildCommand> + <buildCommand> + <name>net.sf.eclipsecs.core.CheckstyleBuilder</name> + <arguments> + </arguments> + </buildCommand> </buildSpec> <natures> <nature>org.eclipse.m2e.core.maven2Nature</nature> <nature>org.eclipse.jdt.core.javanature</nature> <nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature> <nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature> + <nature>net.sf.eclipsecs.core.CheckstyleNature</nature> </natures> </projectDescription> diff --git a/.settings/edu.umd.cs.findbugs.core.prefs b/.settings/edu.umd.cs.findbugs.core.prefs index 9df0c3ff..875d0623 100644 --- a/.settings/edu.umd.cs.findbugs.core.prefs +++ b/.settings/edu.umd.cs.findbugs.core.prefs @@ -1,5 +1,5 @@ #FindBugs User Preferences -#Tue Dec 16 13:48:45 CET 2014 +#Tue Dec 16 15:34:05 CET 2014 detector_threshold=3 effort=max excludefilter0=.fbExcludeFilterFile|true diff --git a/conf/quality-config/pmd-ruleset.xml b/conf/quality-config/pmd-ruleset.xml index 7d6aadd1..ca85b86a 100644 --- a/conf/quality-config/pmd-ruleset.xml +++ b/conf/quality-config/pmd-ruleset.xml @@ -21,7 +21,7 @@ <rule ref="rulesets/java/empty.xml" /> <rule ref="rulesets/java/finalizers.xml" /> <rule ref="rulesets/java/imports.xml" /> - <rule ref="rulesets/java/j2ee.xml" /> +<!-- <rule ref="rulesets/java/j2ee.xml" /> --> <rule ref="rulesets/java/javabeans.xml" /> <rule ref="rulesets/java/junit.xml" /> <rule ref="rulesets/java/logging-jakarta-commons.xml" /> @@ -62,6 +62,10 @@ <rule ref="rulesets/java/controversial.xml"> <exclude name="AtLeastOneConstructor" /> </rule> + + <rule ref="rulesets/java/j2ee.xml"> + <exclude name="DoNotUseThreads" /> + </rule> <rule ref="rulesets/java/naming.xml/VariableNamingConventions"> <priority>5</priority> diff --git a/src/main/java/teetime/framework/AbstractInterThreadPipe.java b/src/main/java/teetime/framework/AbstractInterThreadPipe.java index 98021089..37d49567 100644 --- a/src/main/java/teetime/framework/AbstractInterThreadPipe.java +++ b/src/main/java/teetime/framework/AbstractInterThreadPipe.java @@ -32,7 +32,7 @@ public abstract class AbstractInterThreadPipe extends AbstractPipe { } @Override - public void reportNewElement() { // NOPMD + public void reportNewElement() { // do nothing } } diff --git a/src/main/java/teetime/framework/AnalysisConfiguration.java b/src/main/java/teetime/framework/AnalysisConfiguration.java index bb8cbb8b..35a11e97 100644 --- a/src/main/java/teetime/framework/AnalysisConfiguration.java +++ b/src/main/java/teetime/framework/AnalysisConfiguration.java @@ -12,7 +12,7 @@ public class AnalysisConfiguration { public AnalysisConfiguration() {} - List<Stage> getThreadableStageJobs() { // NOPMD only Analysis should use this method + List<Stage> getThreadableStageJobs() { return this.threadableStageJobs; } diff --git a/src/main/java/teetime/framework/RunnableStage.java b/src/main/java/teetime/framework/RunnableStage.java index 89340d20..464f695e 100644 --- a/src/main/java/teetime/framework/RunnableStage.java +++ b/src/main/java/teetime/framework/RunnableStage.java @@ -11,7 +11,7 @@ import teetime.framework.validation.AnalysisNotValidException; public class RunnableStage implements Runnable { private final Stage stage; - private final Logger logger; // NOPMD + private final Logger logger; private boolean validationEnabled; public RunnableStage(final Stage stage) { diff --git a/src/main/java/teetime/framework/Stage.java b/src/main/java/teetime/framework/Stage.java index f947b215..11cccdc9 100644 --- a/src/main/java/teetime/framework/Stage.java +++ b/src/main/java/teetime/framework/Stage.java @@ -10,7 +10,7 @@ import org.slf4j.LoggerFactory; import teetime.framework.signal.ISignal; import teetime.framework.validation.InvalidPortConnection; -public abstract class Stage { // NOPMD (should not start with "Abstract") +public abstract class Stage { private static final ConcurrentMap<String, Integer> INSTANCES_COUNTER = new ConcurrentHashMap<String, Integer>(); @@ -18,7 +18,7 @@ public abstract class Stage { // NOPMD (should not start with "Abstract") /** * A unique logger instance per stage instance */ - protected final Logger logger; // NOPMD + protected final Logger logger; protected Stage() { this.id = this.createId(); @@ -47,7 +47,7 @@ public abstract class Stage { // NOPMD (should not start with "Abstract") return newId; } - static void clearInstanceCounters() { // NOPMD (package-private to clear map in tests) + static void clearInstanceCounters() { INSTANCES_COUNTER.clear(); } diff --git a/src/main/java/teetime/util/classpath/FileSearcher.java b/src/main/java/teetime/util/classpath/FileSearcher.java index 7476a9b2..016537e1 100644 --- a/src/main/java/teetime/util/classpath/FileSearcher.java +++ b/src/main/java/teetime/util/classpath/FileSearcher.java @@ -18,8 +18,8 @@ public final class FileSearcher { final List<URL> list = new ArrayList<URL>(); final Enumeration<URL> systemRes = CLASS_LOADER.getResources(name); - while (systemRes.hasMoreElements()) { // NOPMD - list.add(systemRes.nextElement()); // NOPMD + while (systemRes.hasMoreElements()) { + list.add(systemRes.nextElement()); } return list; } diff --git a/src/main/java/teetime/util/list/CommittableResizableArrayQueue.java b/src/main/java/teetime/util/list/CommittableResizableArrayQueue.java index 2e31a320..73a5079b 100644 --- a/src/main/java/teetime/util/list/CommittableResizableArrayQueue.java +++ b/src/main/java/teetime/util/list/CommittableResizableArrayQueue.java @@ -17,7 +17,7 @@ public class CommittableResizableArrayQueue<T> implements CommittableQueue<T> { this.elements = this.arrayPool.acquire(initialCapacity + 1); this.elements[0] = (T) emptyObject; // optimization: avoids the use of an index out-of-bounds check - this.clear(); // NOPMD + this.clear(); } @Override diff --git a/src/test/java/teetime/util/classpath/FileSearcherTest.java b/src/test/java/teetime/util/classpath/FileSearcherTest.java index 44ca4ad7..9ebd0425 100644 --- a/src/test/java/teetime/util/classpath/FileSearcherTest.java +++ b/src/test/java/teetime/util/classpath/FileSearcherTest.java @@ -16,19 +16,19 @@ public class FileSearcherTest { @Test public void fileInClasspath() throws IOException { final List<URL> list = FileSearcher.loadResources("pipe-factories.conf"); - Assert.assertEquals(false, list.isEmpty()); // NOPMD + Assert.assertEquals(false, list.isEmpty()); } @Test public void multipleFiles() throws IOException { final List<URL> list = FileSearcher.loadResources("LICENSE.txt"); - Assert.assertEquals(true, list.size() > 1); // NOPMD + Assert.assertEquals(true, list.size() > 1); } @Test public void missingFile() throws IOException { final List<URL> list = FileSearcher.loadResources("filethatdoesnotexistinanyproject.nope"); - Assert.assertEquals(true, list.isEmpty()); // NOPMD + Assert.assertEquals(true, list.isEmpty()); } } -- GitLab