SakaiBogoBugs for the scoreboard
SakaiBogoBugs
Feel free to add, remove rules, change weightings and generally make comments.
OK, so some bugs are worse than others so lets change that to Weighted SakaiBogoBugs per thousand lines of code.
Resources
http://findbugs.sourceforge.net/bugDescriptions.html
http://pmd.sourceforge.net/rules/index.html
Suggested rules and weightings
1=trivial
50=Extremely bad
Rule |
Weight |
Description |
PMD |
||
EmptyCatchBlock |
10 |
Empty Catch Block finds instances where an exception is caught, but nothing is done. In most circumstances, this swallows an exception which should either be acted on or reported. |
OverrideBothEqualsAndHashcode |
5 |
|
DoubleCheckedLocking |
20 |
|
|
|
|
IntegerInstantiation |
1 |
|
AvoidReassigningParameters |
2 |
|
PositionLiteralsFirstInComparisons |
2 |
|
UnusedLocalVariable |
1 |
|
UnusedPrivateField |
1 |
|
AvoidCatchingThrowable |
10 |
|
UnusedPrivateMethod |
5 |
|
MissingSerialVersionUID |
5 |
|
UnsynchronizedStaticDateFormatter |
20 |
|
FindBugs |
||
BC_IMPOSSIBLE_CAST |
30 |
This cast will always throw a ClassCastException |
|
10 |
This instanceof test will always return false. Although this is safe, make sure it isn't an indication of some misunderstanding or some other logic error. |
DLS_DEAD_STORE_OF_CLASS_LITERAL |
8 |
This instruction assigns a class literal to a variable and then never uses it. The behavior of this differs in Java 1.4 and in Java 5. In Java 1.4 and earlier, a reference to Foo.class would force the static initializer for Foo to be executed, if it has not been executed already. In Java 5 and later, it does not |
DMI_INVOKING_TOSTRING_ON_ANONYMOUS_ARRAY |
1 |
The code invokes toString on an (anonymous) array. Calling toString on an array generates a fairly useless result such as [C@16f0472. Consider using Arrays.toString to convert the array into a readable String that gives the contents of the array. See Programming Puzzlers, chapter 3, puzzle 12. |
EC_ARRAY_AND_NONARRAY |
10 |
This method invokes the .equals(Object o) to compare an array and a reference that doesn't seem to be an array. If things being compared are of different types, they are guaranteed to be unequal and the comparison is almost certainly an error. Even if they are both arrays, the equals method on arrays only determines of the two arrays are the same object. To compare the contents of the arrays, use java.util.Arrays.equals(Object[], Object[]) |
EC_UNRELATED_CLASS_AND_INTERFACE |
10 |
Wrong sort of comparisons always returning true or false |
HE_USE_OF_UNHASHABLE_CLASS |
20 |
A class defines an equals(Object) method but not a hashCode() method, and thus doesn't fulfill the requirement that equal Objects have equal hashCodes. An instance of this class is used in a hash data structure, making the need to fix this problem of highest importance. |
IL_INFINITE_LOOP |
30 |
Infinite loops under certain conditions |
NP_ALWAYS_NULL |
10 |
Possible Null pointer generation |
DL_SYNCHRONIZATION_ON_BOOLEAN |
20 |
Synchronization |
DM_BOXED_PRIMITIVE_TOSTRING |
1 |
|
HSC_HUGE_SHARED_STRING_CONSTANT |
6 |
A large String constant is duplicated across multiple class files. This is likely because a final field is initialized to a String constant, and the Java language mandates that all references to a final field from other classes be inlined into that classfile. See JDK bug 6447475 for a description of an occurrence of this bug in the JDK and how resolving it reduced the size of the JDK by 1 megabyte. |