Skip to content

Latest commit

 

History

History
54 lines (33 loc) · 3.01 KB

RUNNING.md

File metadata and controls

54 lines (33 loc) · 3.01 KB

Running

Please download the runnable.jar.

Make sure that your java path points to a JDK (version >= 8).

You can pass several path arguments to the jar, including directories and .java files. Make sure to provide full paths.

java -jar spongebugs-runner-2.0.0.jar /tmp/project/path/src

java -jar spongebugs-runner-2.0.0.jar /tmp/project/path/src/main/java/Main.java --rules=C8,C9 --ignoreTestFiles=false

java -jar spongebugs-runner-2.0.0.jar /tmp/project1/path /tmp/project2/path /tmp/project3/path/src/main/java/Main.java --rules=B1,B2

Parameters

Ignoring test files

--ignoreTestFiles=true (default)

--ignoreTestFiles=false

Including/excluding rules

You can either include some rules, or exclude rules. You cannot have both.

Use , as a separator if you want more than one rule, with no spaces in between.

See the Rules section for more details on each rule.

Running only with rules C1 and C5:

java -jar spongebugs-runner-2.0.0.jar project/path/src --rules=C1,C5

Running all rules expect B1:

java -jar spongebugs-runner-2.0.0.jar project/path/src --excludeRules=B1

Rules

Please note that Rules B2 and C6 were implemented together, therefore if you want to include/exclude one, you impact the other one as well.

ID Description
B1 Strings and Boxed types should be compared using "equals()"
B2 "BigDecimal(double)" should not be used (B2)
Constructors should not be used to instantiate "String", "BigInteger", "BigDecimal" and primitive-wrapper classes (C6)
C1 String literals should not be duplicated
C2 String function use should be optimized for single characters
C3 Strings should not be concatenated using '+' in a loop
C4 Parsing should be used to convert "Strings" to primitives
C5 Strings literals should be placed on the left side when checking for equality
C7 "entrySet()" should be iterated when both the key and value are needed
C8 Collection.isEmpty() should be used to test for emptiness
C9 "Collections.EMPTY_LIST", "EMPTY_MAP", and "EMPTY_SET" should not be used