diff --git a/pmd-apex/src/main/resources/category/apex/design.xml b/pmd-apex/src/main/resources/category/apex/design.xml
index 4ae0320382..790c5cd416 100644
--- a/pmd-apex/src/main/resources/category/apex/design.xml
+++ b/pmd-apex/src/main/resources/category/apex/design.xml
@@ -92,7 +92,7 @@ public class Complicated {
class="net.sourceforge.pmd.lang.apex.rule.design.ExcessiveClassLengthRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_apex_design.html#excessiveclasslength">
-Excessive class file lengths are usually indications that the class may be burdened with excessive
+Excessive class file lengths are usually indications that the class may be burdened with excessive
responsibilities that could be provided by external classes or functions. In breaking these methods
apart the code becomes more managable and ripe for reuse.
@@ -133,7 +133,7 @@ same datatype. These situations usually denote the need for new objects to wrap
public void addPerson(int birthYear, int birthMonth, int birthDate, int height, int weight, int ssn) {
// ...
}
-// preferred approach
+// preferred approach
public void addPerson(Date birthdate, BodyMeasurements measurements, int ssn) {
// ...
}
@@ -260,8 +260,8 @@ public class Foo extends Bar {
class="net.sourceforge.pmd.lang.apex.rule.design.StdCyclomaticComplexityRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_apex_design.html#stdcyclomaticcomplexity">
-Complexity directly affects maintenance costs is determined by the number of decision points in a method
-plus one for the method entry. The decision points include 'if', 'while', 'for', and 'case labels' calls.
+Complexity directly affects maintenance costs is determined by the number of decision points in a method
+plus one for the method entry. The decision points include 'if', 'while', 'for', and 'case labels' calls.
Generally, numbers ranging from 1-4 denote low complexity, 5-7 denote moderate complexity, 8-10 denote
high complexity, and 11+ is very high complexity.
@@ -315,7 +315,7 @@ public class Foo {
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_apex_design.html#toomanyfields">
Classes that have too many fields can become unwieldy and could be redesigned to have fewer fields,
-possibly through grouping related fields in new objects. For example, a class with individual
+possibly through grouping related fields in new objects. For example, a class with individual
city/state/zip fields could park them within a single Address field.
3
diff --git a/pmd-apex/src/main/resources/category/apex/errorprone.xml b/pmd-apex/src/main/resources/category/apex/errorprone.xml
index 88e729b6f9..cd458821a1 100644
--- a/pmd-apex/src/main/resources/category/apex/errorprone.xml
+++ b/pmd-apex/src/main/resources/category/apex/errorprone.xml
@@ -71,8 +71,8 @@ Avoid directly accessing Trigger.old and Trigger.new as it can lead to a bug. Tr
-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
+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.
3
@@ -261,7 +261,7 @@ public class Foo {
class="net.sourceforge.pmd.lang.apex.rule.ApexXPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_apex_errorprone.html#emptywhilestmt">
-Empty While Statement finds all instances where a while statement does nothing.
+Empty While Statement finds all instances where a while statement does nothing.
If it is a timing loop, then you should use Thread.sleep() for it; if it is
a while loop that does a lot in the exit expression, rewrite it to make it clearer.
diff --git a/pmd-apex/src/main/resources/category/apex/performance.xml b/pmd-apex/src/main/resources/category/apex/performance.xml
index 01c4191bf8..cc3fad8698 100644
--- a/pmd-apex/src/main/resources/category/apex/performance.xml
+++ b/pmd-apex/src/main/resources/category/apex/performance.xml
@@ -21,7 +21,7 @@ Avoid DML statements inside loops to avoid hitting the DML governor limit. Inste
The rule validates you are checking for access permissions before a SOQL/SOSL/DML operation.
-Since Apex runs in system mode not having proper permissions checks results in escalation of
+Since Apex runs in system mode not having proper permissions checks results in escalation of
privilege and may produce runtime errors. This check forces you to handle such scenarios.
3
diff --git a/pmd-java/src/main/resources/category/java/bestpractices.xml b/pmd-java/src/main/resources/category/java/bestpractices.xml
index 85ce77b7a1..5c089e46d7 100644
--- a/pmd-java/src/main/resources/category/java/bestpractices.xml
+++ b/pmd-java/src/main/resources/category/java/bestpractices.xml
@@ -622,7 +622,7 @@ public class GoodTest {
typeResolution="true"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_bestpractices.html#junit4testshoulduseafterannotation">
-In JUnit 3, the tearDown method was used to clean up all data entities required in running tests.
+In JUnit 3, the tearDown method was used to clean up all data entities required in running tests.
JUnit 4 skips the tearDown method and executes all methods annotated with @After after running each test.
JUnit 5 introduced @AfterEach and @AfterAll annotations to execute methods after each test or after all tests in the class, respectively.
@@ -666,7 +666,7 @@ public class MyTest2 {
typeResolution="true"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_bestpractices.html#junit4testshouldusebeforeannotation">
-In JUnit 3, the setUp method was used to set up all data entities required in running tests.
+In JUnit 3, the setUp method was used to set up all data entities required in running tests.
JUnit 4 skips the setUp method and executes all methods annotated with @Before before all tests.
JUnit 5 introduced @BeforeEach and @BeforeAll annotations to execute methods before each test or before all tests in the class, respectively.
@@ -710,7 +710,7 @@ public class MyTest2 {
typeResolution="true"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_bestpractices.html#junit4testshouldusetestannotation">
-In JUnit 3, the framework executed all methods which started with the word test as a unit test.
+In JUnit 3, the framework executed all methods which started with the word test as a unit test.
In JUnit 4, only methods annotated with the @Test annotation are executed.
In JUnit 5, one of the following annotations should be used for tests: @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest.
@@ -758,7 +758,7 @@ public class MyTest {
class="net.sourceforge.pmd.lang.java.rule.bestpractices.JUnitAssertionsShouldIncludeMessageRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_bestpractices.html#junitassertionsshouldincludemessage">
-JUnit assertions should include an informative message - i.e., use the three-argument version of
+JUnit assertions should include an informative message - i.e., use the three-argument version of
assertEquals(), not the two-argument version.
3
@@ -784,7 +784,7 @@ public class Foo extends TestCase {
typeResolution="true"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_bestpractices.html#junittestcontainstoomanyasserts">
-Unit tests should not contain too many asserts. Many asserts are indicative of a complex test, for which
+Unit tests should not contain too many asserts. Many asserts are indicative of a complex test, for which
it is harder to verify correctness. Consider breaking the test scenario into multiple, shorter test scenarios.
Customize the maximum number of assertions used by this Rule to suit your needs.
@@ -837,7 +837,7 @@ public class MyTestCase extends TestCase {
class="net.sourceforge.pmd.lang.java.rule.bestpractices.JUnitTestsShouldIncludeAssertRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_bestpractices.html#junittestsshouldincludeassert">
-JUnit tests should include at least one assertion. This makes the tests more robust, and using assert
+JUnit tests should include at least one assertion. This makes the tests more robust, and using assert
with messages provide the developer a clearer idea of what the test does.
3
@@ -927,7 +927,7 @@ public class Bar {
class="net.sourceforge.pmd.lang.java.rule.bestpractices.MethodReturnsInternalArrayRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_bestpractices.html#methodreturnsinternalarray">
-Exposing internal arrays to the caller violates object encapsulation since elements can be
+Exposing internal arrays to the caller violates object encapsulation since elements can be
removed or replaced outside of the object that owns it. It is safer to return a copy of the array.
3
@@ -1300,8 +1300,8 @@ class Foo{
class="net.sourceforge.pmd.lang.java.rule.bestpractices.UnusedFormalParameterRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_bestpractices.html#unusedformalparameter">
-Avoid passing parameters to methods or constructors without actually referencing them in the method body.
-Removing unused formal parameters from public methods could cause a ripple effect through the code base.
+Avoid passing parameters to methods or constructors without actually referencing them in the method body.
+Removing unused formal parameters from public methods could cause a ripple effect through the code base.
Hence, by default, this rule only considers private methods. To include non-private methods, set the
`checkAll` property to `true`.
@@ -1455,7 +1455,7 @@ public class FooTest extends TestCase {
typeResolution="true"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_bestpractices.html#useassertnullinsteadofasserttrue">
-This rule detects JUnit assertions in object references equality. These assertions should be made by
+This rule detects JUnit assertions in object references equality. These assertions should be made by
more specific methods, like assertNull, assertNotNull.
3
@@ -1504,7 +1504,7 @@ public class FooTest extends TestCase {
typeResolution="true"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_bestpractices.html#useassertsameinsteadofasserttrue">
-This rule detects JUnit assertions in object references equality. These assertions should be made
+This rule detects JUnit assertions in object references equality. These assertions should be made
by more specific methods, like assertSame, assertNotSame.
3
diff --git a/pmd-java/src/main/resources/category/java/codestyle.xml b/pmd-java/src/main/resources/category/java/codestyle.xml
index c6a14810ef..6f8e3e2ae4 100644
--- a/pmd-java/src/main/resources/category/java/codestyle.xml
+++ b/pmd-java/src/main/resources/category/java/codestyle.xml
@@ -395,7 +395,7 @@ public class Foo extends Bar{
-Avoid using 'for' statements without using curly braces. If the code formatting or
-indentation is lost then it becomes difficult to separate the code being controlled
+Avoid using 'for' statements without using curly braces. If the code formatting or
+indentation is lost then it becomes difficult to separate the code being controlled
from the rest.
This rule is deprecated and will be removed with PMD 7.0.0. The rule is replaced
@@ -864,7 +864,7 @@ Names for references to generic values should be limited to a single uppercase l
1
+ string-length(@Image) > 1
or
string:upper-case(@Image) != @Image
]
@@ -934,8 +934,8 @@ try {
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_codestyle.html#ifelsestmtsmustusebraces">
-Avoid using if..else statements without using surrounding braces. If the code formatting
-or indentation is lost then it becomes difficult to separate the code being controlled
+Avoid using if..else statements without using surrounding braces. If the code formatting
+or indentation is lost then it becomes difficult to separate the code being controlled
from the rest.
This rule is deprecated and will be removed with PMD 7.0.0. The rule is replaced
@@ -976,7 +976,7 @@ if (foo)
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_codestyle.html#ifstmtsmustusebraces">
-Avoid using if statements without using braces to surround the code block. If the code
+Avoid using if statements without using braces to surround the code block. If the code
formatting or indentation is lost then it becomes difficult to separate the code being
controlled from the rest.
@@ -1755,14 +1755,14 @@ public class Foo {
message="Too many static imports may lead to messy code"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_codestyle.html#toomanystaticimports">
-If you overuse the static import feature, it can make your program unreadable and
-unmaintainable, polluting its namespace with all the static members you import.
-Readers of your code (including you, a few months after you wrote it) will not know
+If you overuse the static import feature, it can make your program unreadable and
+unmaintainable, polluting its namespace with all the static members you import.
+Readers of your code (including you, a few months after you wrote it) will not know
which class a static member comes from (Sun 1.5 Language Guide).
3
-
@@ -2200,7 +2200,7 @@ public class Foo {
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_codestyle.html#whileloopsmustusebraces">
-Avoid using 'while' statements without using braces to surround the code block. If the code
+Avoid using 'while' statements without using braces to surround the code block. If the code
formatting or indentation is lost then it becomes difficult to separate the code being
controlled from the rest.
@@ -2217,7 +2217,7 @@ by the rule {% rule java/codestyle/ControlStatementBraces %}.
*Effective Java, 3rd Edition, Item 72: Favor the use of standard exceptions*
>
->Arguably, every erroneous method invocation boils down to an illegal argument or state,
-but other exceptions are standardly used for certain kinds of illegal arguments and states.
-If a caller passes null in some parameter for which null values are prohibited, convention dictates that
+>Arguably, every erroneous method invocation boils down to an illegal argument or state,
+but other exceptions are standardly used for certain kinds of illegal arguments and states.
+If a caller passes null in some parameter for which null values are prohibited, convention dictates that
NullPointerException be thrown rather than IllegalArgumentException.
To implement that, you are encouraged to use `java.util.Objects.requireNonNull()`
@@ -219,7 +219,7 @@ Your parameter validation could thus look like the following:
```
public class Foo {
private String exampleValue;
-
+
void setExampleValue(String exampleValue) {
// check, throw and assignment in a single standard call
this.exampleValue = Objects.requireNonNull(exampleValue, "exampleValue must not be null!");
@@ -405,7 +405,7 @@ void bar() {
class="net.sourceforge.pmd.lang.java.rule.design.CouplingBetweenObjectsRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_design.html#couplingbetweenobjects">
-This rule counts the number of unique attributes, local variables, and return types within an object.
+This rule counts the number of unique attributes, local variables, and return types within an object.
A number higher than the specified threshold can indicate a high degree of coupling.
3
@@ -583,7 +583,7 @@ public void bar() {
class="net.sourceforge.pmd.lang.java.rule.design.ExcessiveClassLengthRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_design.html#excessiveclasslength">
-Excessive class file lengths are usually indications that the class may be burdened with excessive
+Excessive class file lengths are usually indications that the class may be burdened with excessive
responsibilities that could be provided by external classes or functions. In breaking these methods
apart the code becomes more manageable and ripe for reuse.
@@ -615,8 +615,8 @@ public class Foo {
class="net.sourceforge.pmd.lang.java.rule.design.ExcessiveImportsRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_design.html#excessiveimports">
-A high number of imports can indicate a high degree of coupling within an object. This rule
-counts the number of unique imports and reports a violation if the count is above the
+A high number of imports can indicate a high degree of coupling within an object. This rule
+counts the number of unique imports and reports a violation if the count is above the
user-specified threshold.
3
@@ -639,7 +639,7 @@ public class Foo {
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_design.html#excessivemethodlength">
When methods are excessively long this usually indicates that the method is doing more than its
-name/signature might suggest. They also become challenging for others to digest since excessive
+name/signature might suggest. They also become challenging for others to digest since excessive
scrolling causes readers to lose focus.
Try to reduce the method length by creating helper methods and removing any copy/pasted code.
@@ -672,7 +672,7 @@ public void addPerson( // too many arguments liable to be mixed up
. . . .
}
-
+
public void addPerson( // preferred approach
Date birthdate, BodyMeasurements measurements, int ssn) {
@@ -827,7 +827,7 @@ public class Foo {
// a constructor call, not a method call.
D d = new D();
// this method call is ok, because we have create the new instance of D locally.
- d.doSomethingElse();
+ d.doSomethingElse();
}
}
]]>
@@ -877,7 +877,7 @@ public boolean bar(int a, int b) {
class="net.sourceforge.pmd.lang.java.rule.design.LoosePackageCouplingRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_design.html#loosepackagecoupling">
-Avoid using classes from the configured package hierarchy outside of the package hierarchy,
+Avoid using classes from the configured package hierarchy outside of the package hierarchy,
except when using one of the configured allowed classes.
3
@@ -901,8 +901,8 @@ public class Bar {
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_design.html#modifiedcyclomaticcomplexity"
deprecated="true">
-Complexity directly affects maintenance costs is determined by the number of decision points in a method
-plus one for the method entry. The decision points include 'if', 'while', 'for', and 'case labels' calls.
+Complexity directly affects maintenance costs is determined by the number of decision points in a method
+plus one for the method entry. The decision points include 'if', 'while', 'for', and 'case labels' calls.
Generally, numbers ranging from 1-4 denote low complexity, 5-7 denote moderate complexity, 8-10 denote
high complexity, and 11+ is very high complexity. Modified complexity treats switch statements as a single
decision point.
@@ -1428,8 +1428,8 @@ public class Foo {
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_design.html#stdcyclomaticcomplexity"
deprecated="true">
-Complexity directly affects maintenance costs is determined by the number of decision points in a method
-plus one for the method entry. The decision points include 'if', 'while', 'for', and 'case labels' calls.
+Complexity directly affects maintenance costs is determined by the number of decision points in a method
+plus one for the method entry. The decision points include 'if', 'while', 'for', and 'case labels' calls.
Generally, numbers ranging from 1-4 denote low complexity, 5-7 denote moderate complexity, 8-10 denote
high complexity, and 11+ is very high complexity.
@@ -1516,7 +1516,7 @@ public class Foo {
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_design.html#toomanyfields">
Classes that have too many fields can become unwieldy and could be redesigned to have fewer fields,
-possibly through grouping related fields in new objects. For example, a class with individual
+possibly through grouping related fields in new objects. For example, a class with individual
city/state/zip fields could park them within a single Address field.
3
diff --git a/pmd-java/src/main/resources/category/java/documentation.xml b/pmd-java/src/main/resources/category/java/documentation.xml
index db378336b3..7b6d5cd81f 100644
--- a/pmd-java/src/main/resources/category/java/documentation.xml
+++ b/pmd-java/src/main/resources/category/java/documentation.xml
@@ -37,7 +37,7 @@ Denotes whether javadoc (formal) comments are required (or unwanted) for specifi
The method Object.finalize() is called by the garbage collector on an object when garbage collection determines
that there are no more references to the object. It should not be invoked by application logic.
-
+
Note that Oracle has declared Object.finalize() as deprecated since JDK 9.
3
@@ -211,7 +211,7 @@ void foo() {
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#avoidcatchingnpe">
-Code should never throw NullPointerExceptions under normal circumstances. A catch block may hide the
+Code should never throw NullPointerExceptions under normal circumstances. A catch block may hide the
original error, causing other, more subtle problems later on.
3
@@ -245,7 +245,7 @@ public class Foo {
class="net.sourceforge.pmd.lang.java.rule.errorprone.AvoidCatchingThrowableRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#avoidcatchingthrowable">
-Catching Throwable errors is not recommended since its scope is very broad. It includes runtime issues such as
+Catching Throwable errors is not recommended since its scope is very broad. It includes runtime issues such as
OutOfMemoryError that should be exposed and managed separately.
3
@@ -372,8 +372,8 @@ public class A {
class="net.sourceforge.pmd.lang.java.rule.errorprone.AvoidFieldNameMatchingMethodNameRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#avoidfieldnamematchingmethodname">
-It can be confusing to have a field name with the same name as a method. While this is permitted,
-having information (field) and actions (method) is not clear naming. Developers versed in
+It can be confusing to have a field name with the same name as a method. While this is permitted,
+having information (field) and actions (method) is not clear naming. Developers versed in
Smalltalk often prefer this approach as the methods denote accessor methods.
3
@@ -663,9 +663,9 @@ boolean x = (y == Double.NaN);
class="net.sourceforge.pmd.lang.java.rule.errorprone.BeanMembersShouldSerializeRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#beanmembersshouldserialize">
-If a class is a bean, or is referenced by a bean directly or indirectly it needs to be serializable.
-Member variables need to be marked as transient, static, or have accessor methods in the class. Marking
-variables as transient is the safest and easiest modification. Accessor methods should follow the Java
+If a class is a bean, or is referenced by a bean directly or indirectly it needs to be serializable.
+Member variables need to be marked as transient, static, or have accessor methods in the class. Marking
+variables as transient is the safest and easiest modification. Accessor methods should follow the Java
naming conventions, i.e. for a variable named foo, getFoo() and setFoo() accessor methods should be provided.
3
@@ -1373,7 +1373,7 @@ public class MyActivity extends Activity {
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#donotthrowexceptioninfinally">
-Throwing exceptions within a 'finally' block is confusing since they may mask other exceptions
+Throwing exceptions within a 'finally' block is confusing since they may mask other exceptions
or code defects.
Note: This is a PMD implementation of the Lint4j rule "A throw in a finally block"
@@ -1464,8 +1464,8 @@ public class Count {
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#emptycatchblock">
-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
+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.
3
@@ -1660,7 +1660,7 @@ public class Foo {
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#emptystatementnotinloop">
-An empty statement (or a semicolon by itself) that is not used as the sole body of a 'for'
+An empty statement (or a semicolon by itself) that is not used as the sole body of a 'for'
or 'while' loop is probably a bug. It could also be a double semicolon, which has no purpose
and should be removed.
@@ -1791,7 +1791,7 @@ public class Foo {
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#emptywhilestmt">
-Empty While Statement finds all instances where a while statement does nothing.
+Empty While Statement finds all instances where a while statement does nothing.
If it is a timing loop, then you should use Thread.sleep() for it; if it is
a while loop that does a lot in the exit expression, rewrite it to make it clearer.
@@ -1949,7 +1949,7 @@ protected void finalize() {
Methods named finalize() should not have parameters. It is confusing and most likely an attempt to
overload Object.finalize(). It will not be called by the VM.
-
+
Note that Oracle has declared Object.finalize() as deprecated since JDK 9.
3
@@ -1980,9 +1980,9 @@ public class Foo {
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#finalizeshouldbeprotected">
-When overriding the finalize(), the new method should be set as protected. If made public,
+When overriding the finalize(), the new method should be set as protected. If made public,
other classes may invoke it at inappropriate times.
-
+
Note that Oracle has declared Object.finalize() as deprecated since JDK 9.
3
@@ -2992,7 +2992,7 @@ new StringBuffer() // 16
new StringBuffer(6) // 6
new StringBuffer("hello world") // 11 + 16 = 27
new StringBuffer('A') // chr(A) = 65
-new StringBuffer("A") // 1 + 16 = 17
+new StringBuffer("A") // 1 + 16 = 17
new StringBuilder() // 16
new StringBuilder(6) // 6
@@ -3047,7 +3047,7 @@ intention to override the equals(Object) method.
-Test classes end with the suffix Test. Having a non-test class with that name is not a good practice,
+Test classes end with the suffix Test. Having a non-test class with that name is not a good practice,
since most people will assume it is a test case. Test classes have test methods named testXXX.
3
@@ -3522,7 +3522,7 @@ String z2 = a.toLowerCase(Locale.getDefault());
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#useproperclassloader">
-In J2EE, the getClassLoader() method might not work as expected. Use
+In J2EE, the getClassLoader() method might not work as expected. Use
Thread.currentThread().getContextClassLoader() instead.
3
diff --git a/pmd-java/src/main/resources/category/java/performance.xml b/pmd-java/src/main/resources/category/java/performance.xml
index 59d6c3ed30..7d0c75b226 100644
--- a/pmd-java/src/main/resources/category/java/performance.xml
+++ b/pmd-java/src/main/resources/category/java/performance.xml
@@ -23,14 +23,14 @@ It is much better to use one of the type-specific toString() methods instead.
-
-
@@ -439,7 +439,7 @@ sb.append(System.getProperty("java.io.tmpdir"));
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_performance.html#insufficientstringbufferdeclaration">
Failing to pre-size a StringBuffer or StringBuilder properly could cause it to re-size many times
-during runtime. This rule attempts to determine the total number the characters that are actually
+during runtime. This rule attempts to determine the total number the characters that are actually
passed into StringBuffer.append(), but represents a best guess "worst case" scenario. An empty
StringBuffer/StringBuilder constructor initializes the object to 16 characters. This default
is assumed if the length of the constructor can not be determined.
@@ -770,7 +770,7 @@ public class Foo {
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_performance.html#unnecessarywrapperobjectcreation">
Most wrapper classes provide static conversion methods that avoid the need to create intermediate objects
-just to create the primitive forms. Using these avoids the cost of creating objects that also need to be
+just to create the primitive forms. Using these avoids the cost of creating objects that also need to be
garbage-collected later.
3
@@ -834,7 +834,7 @@ public class SimpleTest extends TestCase {
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_performance.html#usearraysaslist">
-(Arrays.asList(...)) if that is inconvenient for you
PrimaryExpression/PrimaryPrefix/Name[
substring-before(@Image,'.add') = ancestor::MethodDeclaration//LocalVariableDeclaration[
./Type//ClassOrInterfaceType[
- @Image = 'Collection' or
+ @Image = 'Collection' or
@Image = 'List' or @Image='ArrayList'
]
]
@@ -948,7 +948,7 @@ public String convert(int i) {
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_performance.html#usestringbufferforstringappends">
The use of the '+=' operator for appending strings causes the JVM to create and use an internal StringBuffer.
-If a non-trivial number of these concatenations are being used then the explicit use of a StringBuilder or
+If a non-trivial number of these concatenations are being used then the explicit use of a StringBuilder or
threadsafe StringBuffer is recommended to avoid this.
3
@@ -995,7 +995,7 @@ if (sb.length() == 0) {} // preferred
"" + int
or "" + (int) i
and String.valueOf(int)
-
+
and using Integer.toString(int)
IntegerToStringShouldBeUsed
diff --git a/pmd-java/src/main/resources/category/java/security.xml b/pmd-java/src/main/resources/category/java/security.xml
index 8c81f3b7c8..cc6af00573 100644
--- a/pmd-java/src/main/resources/category/java/security.xml
+++ b/pmd-java/src/main/resources/category/java/security.xml
@@ -53,7 +53,7 @@ public class Foo {
void bad() {
byte[] iv = new byte[] { 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, };
}
-
+
void alsoBad() {
byte[] iv = "secret iv in here".getBytes();
}
diff --git a/pmd-jsp/src/main/resources/category/jsp/errorprone.xml b/pmd-jsp/src/main/resources/category/jsp/errorprone.xml
index 482eef476b..1006fb141d 100644
--- a/pmd-jsp/src/main/resources/category/jsp/errorprone.xml
+++ b/pmd-jsp/src/main/resources/category/jsp/errorprone.xml
@@ -26,8 +26,8 @@ A missing 'meta' tag or page directive will trigger this rule, as well as a non-
//CompilationUnit/Content[
not(Element[@Name="meta"][
Attribute[@Name="content"]/AttributeValue[contains(lower-case(@Image),"charset=utf-8")]
-])
-and
+])
+and
not(JspDirective[@Name='page']/JspDirectiveAttribute[@Name='contentType'][contains(lower-case(@Value),"charset=utf-8")])
]
]]>
diff --git a/pmd-plsql/src/main/resources/category/plsql/bestpractices.xml b/pmd-plsql/src/main/resources/category/plsql/bestpractices.xml
index 909c70cdd6..d18992823f 100644
--- a/pmd-plsql/src/main/resources/category/plsql/bestpractices.xml
+++ b/pmd-plsql/src/main/resources/category/plsql/bestpractices.xml
@@ -17,7 +17,7 @@ Rules which enforce generally accepted best practices.
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_plsql_bestpractices.html#tomkytesdespair">
-"WHEN OTHERS THEN NULL" hides all errors - (Re)RAISE an exception or call RAISE_APPLICATION_ERROR
+"WHEN OTHERS THEN NULL" hides all errors - (Re)RAISE an exception or call RAISE_APPLICATION_ERROR
3
diff --git a/pmd-plsql/src/main/resources/category/plsql/design.xml b/pmd-plsql/src/main/resources/category/plsql/design.xml
index d48d7c5461..1c5cf2b278 100644
--- a/pmd-plsql/src/main/resources/category/plsql/design.xml
+++ b/pmd-plsql/src/main/resources/category/plsql/design.xml
@@ -16,15 +16,15 @@ Rules that help you discover design issues.
class="net.sourceforge.pmd.lang.plsql.rule.design.CyclomaticComplexityRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_plsql_design.html#cyclomaticcomplexity">
-Complexity directly affects maintenance costs is determined by the number of decision points in a method
-plus one for the method entry. The decision points include 'if', 'while', 'for', and 'case labels' calls.
+Complexity directly affects maintenance costs is determined by the number of decision points in a method
+plus one for the method entry. The decision points include 'if', 'while', 'for', and 'case labels' calls.
Generally, numbers ranging from 1-4 denote low complexity, 5-7 denote moderate complexity, 8-10 denote
high complexity, and 11+ is very high complexity.
3
When methods are excessively long this usually indicates that the method is doing more than its
-name/signature might suggest. They also become challenging for others to digest since excessive
+name/signature might suggest. They also become challenging for others to digest since excessive
scrolling causes readers to lose focus.
Try to reduce the method length by creating helper methods and removing any copy/pasted code.
@@ -174,7 +174,7 @@ END;
class="net.sourceforge.pmd.lang.plsql.rule.design.ExcessiveObjectLengthRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_plsql_design.html#excessiveobjectlength">
-Excessive object line lengths are usually indications that the object may be burdened with excessive
+Excessive object line lengths are usually indications that the object may be burdened with excessive
responsibilities that could be provided by other objects. In breaking these methods
apart the code becomes more managable and ripe for reuse.
@@ -209,7 +209,7 @@ END;
class="net.sourceforge.pmd.lang.plsql.rule.design.ExcessivePackageBodyLengthRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_plsql_design.html#excessivepackagebodylength">
-Excessive class file lengths are usually indications that the class may be burdened with excessive
+Excessive class file lengths are usually indications that the class may be burdened with excessive
responsibilities that could be provided by external classes or functions. In breaking these methods
apart the code becomes more managable and ripe for reuse.
@@ -244,7 +244,7 @@ END;
class="net.sourceforge.pmd.lang.plsql.rule.design.ExcessivePackageSpecificationLengthRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_plsql_design.html#excessivepackagespecificationlength">
-Excessive class file lengths are usually indications that the class may be burdened with excessive
+Excessive class file lengths are usually indications that the class may be burdened with excessive
responsibilities that could be provided by external classes or functions. In breaking these methods
apart the code becomes more managable and ripe for reuse.
@@ -334,7 +334,7 @@ public class Foo {
class="net.sourceforge.pmd.lang.plsql.rule.design.ExcessiveTypeLengthRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_plsql_design.html#excessivetypelength">
-Excessive class file lengths are usually indications that the class may be burdened with excessive
+Excessive class file lengths are usually indications that the class may be burdened with excessive
responsibilities that could be provided by external classes or functions. In breaking these methods
apart the code becomes more managable and ripe for reuse.
@@ -420,7 +420,7 @@ CREATE OR REPLACE PACKAGE pkg_
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_plsql_design.html#npathcomplexity">
The NPath complexity of a method is the number of acyclic execution paths through that method.
-A threshold of 200 is generally considered the point where measures should be taken to reduce
+A threshold of 200 is generally considered the point where measures should be taken to reduce
complexity and increase readability.
3
@@ -470,7 +470,7 @@ END;
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_plsql_design.html#toomanyfields">
Classes that have too many fields can become unwieldy and could be redesigned to have fewer fields,
-possibly through grouping related fields in new objects. For example, a class with individual
+possibly through grouping related fields in new objects. For example, a class with individual
city/state/zip fields could park them within a single Address field.
3
@@ -508,7 +508,7 @@ have more fine grained objects.
or
local-name(.) = 'TypeSpecification'
)
- and
+ and
(
count(/descendant::ProgramUnit[
not (
diff --git a/pmd-vm/src/main/resources/category/vm/design.xml b/pmd-vm/src/main/resources/category/vm/design.xml
index e28b00d445..7bea5920f7 100644
--- a/pmd-vm/src/main/resources/category/vm/design.xml
+++ b/pmd-vm/src/main/resources/category/vm/design.xml
@@ -59,7 +59,7 @@ Avoid inline JavaScript. Import .js files instead.
diff --git a/pmd-xml/src/main/resources/category/xsl/performance.xml b/pmd-xml/src/main/resources/category/xsl/performance.xml
index 93180bb071..ebb954b755 100644
--- a/pmd-xml/src/main/resources/category/xsl/performance.xml
+++ b/pmd-xml/src/main/resources/category/xsl/performance.xml
@@ -35,7 +35,7 @@ cutting through 100% of the document.
contains(@select,'following::')
or
contains(@select,'descendant::')
- or
+ or
contains(@select,'descendant-self::')
or (
($checkSelfDescendantAbreviation = 'true' )