Package net.sourceforge.pmd.rules.strings
Class Summary |
AppendCharacterWithChar |
This rule finds the following:
StringBuffer.append("c"); // appends a
single character
It is preferable to use StringBuffer.append('c'); // appends a single
character Implementation of PMD RFE 1373863 |
AvoidDuplicateLiteralsRule |
BSD-style license; for more info see http://pmd.sourceforge.net/license.html |
AvoidDuplicateLiteralsRule.ExceptionParser | |
ConsecutiveLiteralAppends |
This rule finds concurrent calls to StringBuffer.append where String literals
are used It would be much better to make these calls using one call to
.append
example:
StringBuffer buf = new StringBuffer();
buf.append("Hello");
buf.append(" ").append("World");
This would be more eloquently put as:
StringBuffer buf = new StringBuffer();
buf.append("Hello World");
The rule takes one parameter, threshold, which defines the lower limit of
consecutive appends before a violation is created. |
InefficientEmptyStringCheck |
This rule finds code which inefficiently determines empty strings. |
InefficientStringBuffering |
BSD-style license; for more info see http://pmd.sourceforge.net/license.html |
InsufficientStringBufferDeclaration |
This rule finds StringBuffers which may have been pre-sized incorrectly
See http://sourceforge.net/forum/forum.php? |
StringInstantiation | |
StringToStringRule |
BSD-style license; for more info see http://pmd.sourceforge.net/license.html |
UnnecessaryCaseChange | |
UseIndexOfChar | |
UselessStringValueOf | |
UseStringBufferLength |
This rule finds places where StringBuffer.toString() is called just to see if
the string is 0 length by either using .equals("") or toString().length()
StringBuffer sb = new StringBuffer("some string");
if (sb.toString().equals("")) {
// this is wrong
}
if (sb.length() == 0) {
// this is right
}
|