forked from phoedos/pmd
Merge branch 'pmd/7.0.x' of github.com:pmd/pmd into feature/swift-rules
This commit is contained in:
@ -39,14 +39,12 @@ matrix:
|
||||
env: BUILD=deploy
|
||||
|
||||
before_install:
|
||||
- wget https://github.com/sormuras/bach/raw/master/install-jdk.sh
|
||||
- bash .travis/setup-secrets.sh
|
||||
- bash .travis/configure-maven.sh
|
||||
- rvm install 2.4.1
|
||||
- rvm use 2.4.1
|
||||
# Install OpenJDK 11 - see https://sormuras.github.io/blog/2018-03-20-jdk-matrix.html
|
||||
install:
|
||||
- . ./install-jdk.sh -F 11 -L GPL -W $HOME/jdk
|
||||
- . .travis/install-openjdk.sh
|
||||
- gem install bundler
|
||||
- bundle install --with=release_notes_preprocessing --path=vendor/bundle
|
||||
before_script: true
|
||||
@ -85,8 +83,8 @@ notifications:
|
||||
cache:
|
||||
directories:
|
||||
- "$HOME/.m2"
|
||||
- "$HOME/.cache"
|
||||
- vendor/bundle
|
||||
- "$HOME/jdk"
|
||||
- "$HOME/.rvm/"
|
||||
|
||||
# Secure Keys, that need to be set for snapshot builds
|
||||
|
@ -60,9 +60,14 @@ elif travis_isPullRequest; then
|
||||
log_info "This is a pull-request build"
|
||||
./mvnw verify $MVN_BUILD_FLAGS
|
||||
(
|
||||
set +e
|
||||
log_info "Running danger"
|
||||
bundle exec danger --verbose
|
||||
set +e
|
||||
# Create a corresponding remote branch locally
|
||||
if ! git show-ref --verify --quiet refs/heads/${TRAVIS_BRANCH}; then
|
||||
git fetch --no-tags origin +refs/heads/${TRAVIS_BRANCH}:refs/remotes/origin/${TRAVIS_BRANCH}
|
||||
git branch ${TRAVIS_BRANCH} origin/${TRAVIS_BRANCH}
|
||||
fi
|
||||
log_info "Running danger"
|
||||
bundle exec danger --verbose
|
||||
)
|
||||
|
||||
elif travis_isPush; then
|
||||
|
30
.travis/install-openjdk.sh
Normal file
30
.travis/install-openjdk.sh
Normal file
@ -0,0 +1,30 @@
|
||||
#
|
||||
# Original sources:
|
||||
# Linux: https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/jdk-11.0.3%2B7/
|
||||
# https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-x64_linux_11.0.3_7.tar.gz
|
||||
# MacOSX: https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/jdk-11.0.3%2B7/
|
||||
# https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-jdk_x64_mac_hotspot_11.0.3_7.tar.gz
|
||||
#
|
||||
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
OPENJDK_ARCHIVE=OpenJDK11U-jdk_x64_mac_hotspot_11.0.3_7.tar.gz
|
||||
COMPONENTS_TO_STRIP=3 # e.g. jdk-11.0.3+7/Contents/Home/bin/java
|
||||
else
|
||||
OPENJDK_ARCHIVE=OpenJDK11U-x64_linux_11.0.3_7.tar.gz
|
||||
COMPONENTS_TO_STRIP=1 # e.g. openjdk-11.0.3+7/bin/java
|
||||
fi
|
||||
|
||||
DOWNLOAD_URL=https://pmd-code.org/${OPENJDK_ARCHIVE}
|
||||
LOCAL_DIR=${HOME}/.cache/openjdk
|
||||
TARGET_DIR=${HOME}/openjdk11
|
||||
|
||||
mkdir -p ${LOCAL_DIR}
|
||||
mkdir -p ${TARGET_DIR}
|
||||
wget --quiet --directory-prefix ${LOCAL_DIR} --timestamping --continue ${DOWNLOAD_URL}
|
||||
tar --extract --file ${LOCAL_DIR}/${OPENJDK_ARCHIVE} -C ${TARGET_DIR} --strip-components=${COMPONENTS_TO_STRIP}
|
||||
|
||||
export JAVA_HOME=${TARGET_DIR}
|
||||
export PATH=${JAVA_HOME}/bin:$PATH
|
||||
|
||||
java -version
|
@ -1,11 +1,13 @@
|
||||
repository: pmd/pmd
|
||||
|
||||
pmd:
|
||||
version: 6.14.0
|
||||
previous_version: 6.13.0
|
||||
date: ??-April-2019
|
||||
version: 6.16.0
|
||||
previous_version: 6.15.0
|
||||
date: ??-June-2019
|
||||
release_type: minor
|
||||
|
||||
# release types: major, minor, bugfix
|
||||
|
||||
output: web
|
||||
# this property is useful for conditional filtering of content that is separate from the PDF.
|
||||
|
||||
|
@ -34,7 +34,9 @@ This is a {{ site.pmd.release_type }} release.
|
||||
|
||||
### External Contributions
|
||||
|
||||
* [#1658](https://github.com/pmd/pmd/pull/1658/): \[core] Node support for Antlr-based languages
|
||||
* [#1658](https://github.com/pmd/pmd/pull/1658): \[core] Node support for Antlr-based languages - [Matías Fraga](https://github.com/matifraga)
|
||||
* [#1698](https://github.com/pmd/pmd/pull/1698): \[core] [swift] Antlr Base Parser adapter and Swift Implementation - [Lucas Soncini](https://github.com/lsoncini)
|
||||
* [#1774](https://github.com/pmd/pmd/pull/1774): \[core] Antlr visitor rules - [Lucas Soncini](https://github.com/lsoncini)
|
||||
|
||||
{% endtocmaker %}
|
||||
|
||||
|
@ -73,6 +73,29 @@ the breaking API changes will be performed in 7.0.0.
|
||||
an API is tagged as `@Deprecated` or not in the latest minor release. During the development of 7.0.0,
|
||||
we may decide to remove some APIs that were not tagged as deprecated, though we'll try to avoid it." %}
|
||||
|
||||
#### 6.15.0
|
||||
|
||||
##### Deprecated APIs
|
||||
|
||||
###### For removal
|
||||
|
||||
* The `DumpFacades` in all languages, that could be used to transform a AST into a textual representation,
|
||||
will be removed with PMD 7. The rule designer is a better way to inspect nodes.
|
||||
* {% jdoc !q!apex::lang.apex.ast.DumpFacade %}
|
||||
* {% jdoc !q!java::lang.java.ast.DumpFacade %}
|
||||
* {% jdoc !q!javascript::lang.ecmascript.ast.DumpFacade %}
|
||||
* {% jdoc !q!jsp::lang.jsp.ast.DumpFacade %}
|
||||
* {% jdoc !q!plsql::lang.plsql.ast.DumpFacade %}
|
||||
* {% jdoc !q!visualforce::lang.vf.ast.DumpFacade %}
|
||||
* {% jdoc !q!vm::lang.vm.ast.AbstractVmNode#dump(String, boolean, Writer) %}
|
||||
* {% jdoc !q!xml::lang.xml.ast.DumpFacade %}
|
||||
* The method {% jdoc !c!core::lang.LanguageVersionHandler#getDumpFacade(Writer, String, boolean) %} will be
|
||||
removed as well. It is deprecated, along with all its implementations in the subclasses of {% jdoc core::lang.LanguageVersionHandler %}.
|
||||
|
||||
#### 6.14.0
|
||||
|
||||
No changes.
|
||||
|
||||
#### 6.13.0
|
||||
|
||||
##### Command Line Interface
|
||||
|
@ -22,13 +22,17 @@ folder: pmd/rules
|
||||
|
||||
{% include callout.html content="Rules which enforce a specific coding style." %}
|
||||
|
||||
* [ClassNamingConventions](pmd_rules_apex_codestyle.html#classnamingconventions): Class names should always begin with an upper case character.
|
||||
* [ClassNamingConventions](pmd_rules_apex_codestyle.html#classnamingconventions): Configurable naming conventions for type declarations. This rule reports type declarat...
|
||||
* [FieldNamingConventions](pmd_rules_apex_codestyle.html#fieldnamingconventions): Configurable naming conventions for field declarations. This rule reports variable declarations ...
|
||||
* [ForLoopsMustUseBraces](pmd_rules_apex_codestyle.html#forloopsmustusebraces): Avoid using 'for' statements without using surrounding braces. If the code formatting orindentati...
|
||||
* [FormalParameterNamingConventions](pmd_rules_apex_codestyle.html#formalparameternamingconventions): Configurable naming conventions for formal parameters of methods. This rule reports fo...
|
||||
* [IfElseStmtsMustUseBraces](pmd_rules_apex_codestyle.html#ifelsestmtsmustusebraces): Avoid using if..else statements without using surrounding braces. If the code formattingor indent...
|
||||
* [IfStmtsMustUseBraces](pmd_rules_apex_codestyle.html#ifstmtsmustusebraces): Avoid using if statements without using braces to surround the code block. If the codeformatting ...
|
||||
* [MethodNamingConventions](pmd_rules_apex_codestyle.html#methodnamingconventions): Method names should always begin with a lower case character, and should not contain underscores.
|
||||
* [LocalVariableNamingConventions](pmd_rules_apex_codestyle.html#localvariablenamingconventions): Configurable naming conventions for local variable declarations. This rule reports var...
|
||||
* [MethodNamingConventions](pmd_rules_apex_codestyle.html#methodnamingconventions): Configurable naming conventions for method declarations. This rule reports method decl...
|
||||
* [OneDeclarationPerLine](pmd_rules_apex_codestyle.html#onedeclarationperline): Apex allows the use of several variables declaration of the same type on one line. However, itcan...
|
||||
* [VariableNamingConventions](pmd_rules_apex_codestyle.html#variablenamingconventions): A variable naming conventions rule - customize this to your liking. Currently, itchecks for fina...
|
||||
* [PropertyNamingConventions](pmd_rules_apex_codestyle.html#propertynamingconventions): Configurable naming conventions for property declarations. This rule reports property ...
|
||||
* [VariableNamingConventions](pmd_rules_apex_codestyle.html#variablenamingconventions): <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> A variable naming conventions rule - customize this to your liking. Currently, itchecks for fina...
|
||||
* [WhileLoopsMustUseBraces](pmd_rules_apex_codestyle.html#whileloopsmustusebraces): Avoid using 'while' statements without using braces to surround the code block. If the codeformat...
|
||||
|
||||
## Design
|
||||
@ -116,7 +120,7 @@ folder: pmd/rules
|
||||
|
||||
[AvoidDeeplyNestedIfStmts](pmd_rules_apex_design.html#avoiddeeplynestedifstmts), [ExcessiveClassLength](pmd_rules_apex_design.html#excessiveclasslength), [ExcessiveParameterList](pmd_rules_apex_design.html#excessiveparameterlist), [ExcessivePublicCount](pmd_rules_apex_design.html#excessivepubliccount), [NcssConstructorCount](pmd_rules_apex_design.html#ncssconstructorcount), [NcssMethodCount](pmd_rules_apex_design.html#ncssmethodcount), [NcssTypeCount](pmd_rules_apex_design.html#ncsstypecount), [StdCyclomaticComplexity](pmd_rules_apex_design.html#stdcyclomaticcomplexity), [TooManyFields](pmd_rules_apex_design.html#toomanyfields)
|
||||
|
||||
* Default ruleset used by the CodeClimate Engine for Salesforce.com Apex (`rulesets/apex/ruleset.xml`):
|
||||
* Default ruleset for Salesforce.com Apex (`rulesets/apex/ruleset.xml`):
|
||||
|
||||
<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.
|
||||
|
||||
@ -154,7 +158,7 @@ folder: pmd/rules
|
||||
|
||||
It contains the following rules:
|
||||
|
||||
[ApexBadCrypto](pmd_rules_apex_security.html#apexbadcrypto), [ApexCRUDViolation](pmd_rules_apex_security.html#apexcrudviolation), [ApexCSRF](pmd_rules_apex_security.html#apexcsrf), [ApexDangerousMethods](pmd_rules_apex_security.html#apexdangerousmethods), [ApexDoc](pmd_rules_apex_documentation.html#apexdoc), [ApexInsecureEndpoint](pmd_rules_apex_security.html#apexinsecureendpoint), [ApexOpenRedirect](pmd_rules_apex_security.html#apexopenredirect), [ApexSharingViolations](pmd_rules_apex_security.html#apexsharingviolations), [ApexSOQLInjection](pmd_rules_apex_security.html#apexsoqlinjection), [ApexSuggestUsingNamedCred](pmd_rules_apex_security.html#apexsuggestusingnamedcred), [ApexUnitTestClassShouldHaveAsserts](pmd_rules_apex_bestpractices.html#apexunittestclassshouldhaveasserts), [ApexUnitTestShouldNotUseSeeAllDataTrue](pmd_rules_apex_bestpractices.html#apexunittestshouldnotuseseealldatatrue), [ApexXSSFromEscapeFalse](pmd_rules_apex_security.html#apexxssfromescapefalse), [ApexXSSFromURLParam](pmd_rules_apex_security.html#apexxssfromurlparam), [AvoidDeeplyNestedIfStmts](pmd_rules_apex_design.html#avoiddeeplynestedifstmts), [AvoidDirectAccessTriggerMap](pmd_rules_apex_errorprone.html#avoiddirectaccesstriggermap), [AvoidDmlStatementsInLoops](pmd_rules_apex_performance.html#avoiddmlstatementsinloops), [AvoidGlobalModifier](pmd_rules_apex_bestpractices.html#avoidglobalmodifier), [AvoidHardcodingId](pmd_rules_apex_errorprone.html#avoidhardcodingid), [AvoidLogicInTrigger](pmd_rules_apex_bestpractices.html#avoidlogicintrigger), [AvoidNonExistentAnnotations](pmd_rules_apex_errorprone.html#avoidnonexistentannotations), [AvoidSoqlInLoops](pmd_rules_apex_performance.html#avoidsoqlinloops), [AvoidSoslInLoops](pmd_rules_apex_performance.html#avoidsoslinloops), [ClassNamingConventions](pmd_rules_apex_codestyle.html#classnamingconventions), [CyclomaticComplexity](pmd_rules_apex_design.html#cyclomaticcomplexity), [EmptyCatchBlock](pmd_rules_apex_errorprone.html#emptycatchblock), [EmptyIfStmt](pmd_rules_apex_errorprone.html#emptyifstmt), [EmptyStatementBlock](pmd_rules_apex_errorprone.html#emptystatementblock), [EmptyTryOrFinallyBlock](pmd_rules_apex_errorprone.html#emptytryorfinallyblock), [EmptyWhileStmt](pmd_rules_apex_errorprone.html#emptywhilestmt), [ExcessiveClassLength](pmd_rules_apex_design.html#excessiveclasslength), [ExcessiveParameterList](pmd_rules_apex_design.html#excessiveparameterlist), [ExcessivePublicCount](pmd_rules_apex_design.html#excessivepubliccount), [ForLoopsMustUseBraces](pmd_rules_apex_codestyle.html#forloopsmustusebraces), [IfElseStmtsMustUseBraces](pmd_rules_apex_codestyle.html#ifelsestmtsmustusebraces), [IfStmtsMustUseBraces](pmd_rules_apex_codestyle.html#ifstmtsmustusebraces), [MethodNamingConventions](pmd_rules_apex_codestyle.html#methodnamingconventions), [MethodWithSameNameAsEnclosingClass](pmd_rules_apex_errorprone.html#methodwithsamenameasenclosingclass), [NcssConstructorCount](pmd_rules_apex_design.html#ncssconstructorcount), [NcssMethodCount](pmd_rules_apex_design.html#ncssmethodcount), [NcssTypeCount](pmd_rules_apex_design.html#ncsstypecount), [OneDeclarationPerLine](pmd_rules_apex_codestyle.html#onedeclarationperline), [StdCyclomaticComplexity](pmd_rules_apex_design.html#stdcyclomaticcomplexity), [TooManyFields](pmd_rules_apex_design.html#toomanyfields), [VariableNamingConventions](pmd_rules_apex_codestyle.html#variablenamingconventions), [WhileLoopsMustUseBraces](pmd_rules_apex_codestyle.html#whileloopsmustusebraces)
|
||||
[ApexBadCrypto](pmd_rules_apex_security.html#apexbadcrypto), [ApexCRUDViolation](pmd_rules_apex_security.html#apexcrudviolation), [ApexCSRF](pmd_rules_apex_security.html#apexcsrf), [ApexDangerousMethods](pmd_rules_apex_security.html#apexdangerousmethods), [ApexDoc](pmd_rules_apex_documentation.html#apexdoc), [ApexInsecureEndpoint](pmd_rules_apex_security.html#apexinsecureendpoint), [ApexOpenRedirect](pmd_rules_apex_security.html#apexopenredirect), [ApexSharingViolations](pmd_rules_apex_security.html#apexsharingviolations), [ApexSOQLInjection](pmd_rules_apex_security.html#apexsoqlinjection), [ApexSuggestUsingNamedCred](pmd_rules_apex_security.html#apexsuggestusingnamedcred), [ApexUnitTestClassShouldHaveAsserts](pmd_rules_apex_bestpractices.html#apexunittestclassshouldhaveasserts), [ApexUnitTestShouldNotUseSeeAllDataTrue](pmd_rules_apex_bestpractices.html#apexunittestshouldnotuseseealldatatrue), [ApexXSSFromEscapeFalse](pmd_rules_apex_security.html#apexxssfromescapefalse), [ApexXSSFromURLParam](pmd_rules_apex_security.html#apexxssfromurlparam), [AvoidDeeplyNestedIfStmts](pmd_rules_apex_design.html#avoiddeeplynestedifstmts), [AvoidDirectAccessTriggerMap](pmd_rules_apex_errorprone.html#avoiddirectaccesstriggermap), [AvoidDmlStatementsInLoops](pmd_rules_apex_performance.html#avoiddmlstatementsinloops), [AvoidGlobalModifier](pmd_rules_apex_bestpractices.html#avoidglobalmodifier), [AvoidHardcodingId](pmd_rules_apex_errorprone.html#avoidhardcodingid), [AvoidLogicInTrigger](pmd_rules_apex_bestpractices.html#avoidlogicintrigger), [AvoidNonExistentAnnotations](pmd_rules_apex_errorprone.html#avoidnonexistentannotations), [AvoidSoqlInLoops](pmd_rules_apex_performance.html#avoidsoqlinloops), [AvoidSoslInLoops](pmd_rules_apex_performance.html#avoidsoslinloops), [ClassNamingConventions](pmd_rules_apex_codestyle.html#classnamingconventions), [CyclomaticComplexity](pmd_rules_apex_design.html#cyclomaticcomplexity), [EmptyCatchBlock](pmd_rules_apex_errorprone.html#emptycatchblock), [EmptyIfStmt](pmd_rules_apex_errorprone.html#emptyifstmt), [EmptyStatementBlock](pmd_rules_apex_errorprone.html#emptystatementblock), [EmptyTryOrFinallyBlock](pmd_rules_apex_errorprone.html#emptytryorfinallyblock), [EmptyWhileStmt](pmd_rules_apex_errorprone.html#emptywhilestmt), [ExcessiveClassLength](pmd_rules_apex_design.html#excessiveclasslength), [ExcessiveParameterList](pmd_rules_apex_design.html#excessiveparameterlist), [ExcessivePublicCount](pmd_rules_apex_design.html#excessivepubliccount), [FieldNamingConventions](pmd_rules_apex_codestyle.html#fieldnamingconventions), [ForLoopsMustUseBraces](pmd_rules_apex_codestyle.html#forloopsmustusebraces), [FormalParameterNamingConventions](pmd_rules_apex_codestyle.html#formalparameternamingconventions), [IfElseStmtsMustUseBraces](pmd_rules_apex_codestyle.html#ifelsestmtsmustusebraces), [IfStmtsMustUseBraces](pmd_rules_apex_codestyle.html#ifstmtsmustusebraces), [LocalVariableNamingConventions](pmd_rules_apex_codestyle.html#localvariablenamingconventions), [MethodNamingConventions](pmd_rules_apex_codestyle.html#methodnamingconventions), [MethodWithSameNameAsEnclosingClass](pmd_rules_apex_errorprone.html#methodwithsamenameasenclosingclass), [NcssConstructorCount](pmd_rules_apex_design.html#ncssconstructorcount), [NcssMethodCount](pmd_rules_apex_design.html#ncssmethodcount), [NcssTypeCount](pmd_rules_apex_design.html#ncsstypecount), [OneDeclarationPerLine](pmd_rules_apex_codestyle.html#onedeclarationperline), [PropertyNamingConventions](pmd_rules_apex_codestyle.html#propertynamingconventions), [StdCyclomaticComplexity](pmd_rules_apex_design.html#stdcyclomaticcomplexity), [TooManyFields](pmd_rules_apex_design.html#toomanyfields), [WhileLoopsMustUseBraces](pmd_rules_apex_codestyle.html#whileloopsmustusebraces)
|
||||
|
||||
* Security (`rulesets/apex/security.xml`):
|
||||
|
||||
|
@ -36,15 +36,7 @@ public class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Bug Risk|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|100|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/bestpractices.xml/ApexAssertionsShouldIncludeMessage" />
|
||||
```
|
||||
@ -74,15 +66,7 @@ public class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Bug Risk|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|100|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/bestpractices.xml/ApexUnitTestClassShouldHaveAsserts" />
|
||||
```
|
||||
@ -119,15 +103,7 @@ private class ATest {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Bug Risk|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|100|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/bestpractices.xml/ApexUnitTestMethodShouldHaveIsTestAnnotation" />
|
||||
```
|
||||
@ -156,15 +132,7 @@ public class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Bug Risk|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|100|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/bestpractices.xml/ApexUnitTestShouldNotUseSeeAllDataTrue" />
|
||||
```
|
||||
@ -190,15 +158,7 @@ global class Unchangeable {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Style|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|100|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/bestpractices.xml/AvoidGlobalModifier" />
|
||||
```
|
||||
@ -234,15 +194,7 @@ trigger Accounts on Account (before insert, before update, before delete, after
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Style|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|200|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/bestpractices.xml/AvoidLogicInTrigger" />
|
||||
```
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -39,9 +39,6 @@ public class Foo {
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Complexity|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|200|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|problemDepth|3|The if statement depth reporting threshold|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
@ -73,7 +70,7 @@ program. As such, they include all control flow statements, such as 'if', 'while
|
||||
|
||||
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. By default, this rule reports methods with a complexity >= 10.
|
||||
Additionnally, classes with many methods of moderate complexity get reported as well once the total of their
|
||||
Additionally, classes with many methods of moderate complexity get reported as well once the total of their
|
||||
methods' complexities reaches 40, even if none of the methods was directly reported.
|
||||
|
||||
Reported methods should be broken down into several smaller methods. Reported classes should probably be broken down
|
||||
@ -113,9 +110,6 @@ public class Complicated {
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Style|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|1|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|classReportLevel|40|Total class complexity reporting threshold|no|
|
||||
|methodReportLevel|10|Cyclomatic complexity reporting threshold|no|
|
||||
|
||||
@ -169,12 +163,7 @@ public class Foo {
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|topscore||<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Top score value|no|
|
||||
|minimum|1000.0|Minimum reporting threshold|no|
|
||||
|cc\_categories|Complexity|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|150|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|sigma||<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Sigma value|no|
|
||||
|minimum|1000|Threshold above which a node is reported|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
``` xml
|
||||
@ -185,7 +174,7 @@ public class Foo {
|
||||
``` xml
|
||||
<rule ref="category/apex/design.xml/ExcessiveClassLength">
|
||||
<properties>
|
||||
<property name="minimum" value="1000.0" />
|
||||
<property name="minimum" value="1000" />
|
||||
</properties>
|
||||
</rule>
|
||||
```
|
||||
@ -218,12 +207,7 @@ public void addPerson(Date birthdate, BodyMeasurements measurements, int ssn) {
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|topscore||<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Top score value|no|
|
||||
|minimum|4.0|Minimum reporting threshold|no|
|
||||
|cc\_categories|Complexity|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|50|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|sigma||<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Sigma value|no|
|
||||
|minimum|4|Threshold above which a node is reported|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
``` xml
|
||||
@ -234,7 +218,7 @@ public void addPerson(Date birthdate, BodyMeasurements measurements, int ssn) {
|
||||
``` xml
|
||||
<rule ref="category/apex/design.xml/ExcessiveParameterList">
|
||||
<properties>
|
||||
<property name="minimum" value="4.0" />
|
||||
<property name="minimum" value="4" />
|
||||
</properties>
|
||||
</rule>
|
||||
```
|
||||
@ -272,12 +256,7 @@ public class Foo {
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|topscore||<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Top score value|no|
|
||||
|minimum|20.0|Minimum reporting threshold|no|
|
||||
|cc\_categories|Complexity|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|150|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|sigma||<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Sigma value|no|
|
||||
|minimum|20|Threshold above which a node is reported|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
``` xml
|
||||
@ -288,7 +267,7 @@ public class Foo {
|
||||
``` xml
|
||||
<rule ref="category/apex/design.xml/ExcessivePublicCount">
|
||||
<properties>
|
||||
<property name="minimum" value="20.0" />
|
||||
<property name="minimum" value="20" />
|
||||
</properties>
|
||||
</rule>
|
||||
```
|
||||
@ -325,12 +304,7 @@ public class Foo extends Bar {
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|topscore||<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Top score value|no|
|
||||
|minimum|20.0|Minimum reporting threshold|no|
|
||||
|cc\_categories|Complexity|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|50|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|sigma||<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Sigma value|no|
|
||||
|minimum|20|Threshold above which a node is reported|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
``` xml
|
||||
@ -341,7 +315,7 @@ public class Foo extends Bar {
|
||||
``` xml
|
||||
<rule ref="category/apex/design.xml/NcssConstructorCount">
|
||||
<properties>
|
||||
<property name="minimum" value="20.0" />
|
||||
<property name="minimum" value="20" />
|
||||
</properties>
|
||||
</rule>
|
||||
```
|
||||
@ -377,12 +351,7 @@ public class Foo extends Bar {
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|topscore||<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Top score value|no|
|
||||
|minimum|40.0|Minimum reporting threshold|no|
|
||||
|cc\_categories|Complexity|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|50|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|sigma||<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Sigma value|no|
|
||||
|minimum|40|Threshold above which a node is reported|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
``` xml
|
||||
@ -393,7 +362,7 @@ public class Foo extends Bar {
|
||||
``` xml
|
||||
<rule ref="category/apex/design.xml/NcssMethodCount">
|
||||
<properties>
|
||||
<property name="minimum" value="40.0" />
|
||||
<property name="minimum" value="40" />
|
||||
</properties>
|
||||
</rule>
|
||||
```
|
||||
@ -431,12 +400,7 @@ public class Foo extends Bar {
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|topscore||<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Top score value|no|
|
||||
|minimum|500.0|Minimum reporting threshold|no|
|
||||
|cc\_categories|Complexity|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|250|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|sigma||<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Sigma value|no|
|
||||
|minimum|500|Threshold above which a node is reported|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
``` xml
|
||||
@ -447,7 +411,7 @@ public class Foo extends Bar {
|
||||
``` xml
|
||||
<rule ref="category/apex/design.xml/NcssTypeCount">
|
||||
<properties>
|
||||
<property name="minimum" value="500.0" />
|
||||
<property name="minimum" value="500" />
|
||||
</properties>
|
||||
</rule>
|
||||
```
|
||||
@ -510,9 +474,6 @@ public class Foo {
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Complexity|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|250|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|reportLevel|10|Cyclomatic Complexity reporting threshold|no|
|
||||
|showClassesComplexity|true|Add class average violations to the report|no|
|
||||
|showMethodsComplexity|true|Add method average violations to the report|no|
|
||||
@ -568,9 +529,6 @@ public class Person {
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Complexity|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|200|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|maxfields|15|Max allowable fields|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
|
@ -44,15 +44,7 @@ public class HelloWorld {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Style|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|1|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/documentation.xml/ApexDoc" />
|
||||
```
|
||||
|
@ -34,15 +34,7 @@ trigger AccountTrigger on Account (before insert, before update) {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Style|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|1|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/errorprone.xml/AvoidDirectAccessTriggerMap" />
|
||||
```
|
||||
@ -74,15 +66,7 @@ public without sharing class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Style|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|100|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/errorprone.xml/AvoidHardcodingId" />
|
||||
```
|
||||
@ -110,15 +94,7 @@ A full list of supported annotations can be found at https://developer.salesforc
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Style|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|1|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/errorprone.xml/AvoidNonExistentAnnotations" />
|
||||
```
|
||||
@ -151,15 +127,7 @@ public void doSomething() {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Style|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|1|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/errorprone.xml/EmptyCatchBlock" />
|
||||
```
|
||||
@ -190,15 +158,7 @@ public class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Style|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|1|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/errorprone.xml/EmptyIfStmt" />
|
||||
```
|
||||
@ -231,15 +191,7 @@ public class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Style|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|1|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/errorprone.xml/EmptyStatementBlock" />
|
||||
```
|
||||
@ -281,15 +233,7 @@ public class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Style|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|1|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/errorprone.xml/EmptyTryOrFinallyBlock" />
|
||||
```
|
||||
@ -319,15 +263,7 @@ public void bar(Integer a, Integer b) {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Style|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|1|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/errorprone.xml/EmptyWhileStmt" />
|
||||
```
|
||||
@ -353,15 +289,7 @@ public class MyClass {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Style|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|50|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/errorprone.xml/MethodWithSameNameAsEnclosingClass" />
|
||||
```
|
||||
|
@ -33,15 +33,7 @@ public class Something {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Performance|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|150|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/performance.xml/AvoidDmlStatementsInLoops" />
|
||||
```
|
||||
@ -68,15 +60,7 @@ public class Something {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Performance|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|150|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/performance.xml/AvoidSoqlInLoops" />
|
||||
```
|
||||
@ -103,15 +87,7 @@ public class Something {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Performance|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|150|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/performance.xml/AvoidSoslInLoops" />
|
||||
```
|
||||
|
@ -31,15 +31,7 @@ public without sharing class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Security|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|100|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/security.xml/ApexBadCrypto" />
|
||||
```
|
||||
@ -75,15 +67,7 @@ public class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Security|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|100|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/security.xml/ApexCRUDViolation" />
|
||||
```
|
||||
@ -113,15 +97,7 @@ public class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Security|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|100|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/security.xml/ApexCSRF" />
|
||||
```
|
||||
@ -153,15 +129,7 @@ public class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Security|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|100|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/security.xml/ApexDangerousMethods" />
|
||||
```
|
||||
@ -188,15 +156,7 @@ public without sharing class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Security|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|100|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/security.xml/ApexInsecureEndpoint" />
|
||||
```
|
||||
@ -223,15 +183,7 @@ public without sharing class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Security|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|100|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/security.xml/ApexOpenRedirect" />
|
||||
```
|
||||
@ -255,15 +207,7 @@ public without sharing class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Security|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|100|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/security.xml/ApexSharingViolations" />
|
||||
```
|
||||
@ -288,15 +232,7 @@ public class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Security|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|100|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/security.xml/ApexSOQLInjection" />
|
||||
```
|
||||
@ -335,15 +271,7 @@ public class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Security|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|100|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/security.xml/ApexSuggestUsingNamedCred" />
|
||||
```
|
||||
@ -368,15 +296,7 @@ public without sharing class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Security|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|100|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/security.xml/ApexXSSFromEscapeFalse" />
|
||||
```
|
||||
@ -401,15 +321,7 @@ public without sharing class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc\_categories|Security|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc\_remediation\_points\_multiplier|50|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Remediation Points multiplier|no|
|
||||
|cc\_block\_highlighting|false|<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Code Climate Block Highlighting|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/security.xml/ApexXSSFromURLParam" />
|
||||
```
|
||||
|
@ -75,7 +75,7 @@ folder: pmd/rules
|
||||
* [BooleanGetMethodName](pmd_rules_java_codestyle.html#booleangetmethodname): Methods that return boolean results should be named as predicate statements to denote this.I.e, '...
|
||||
* [CallSuperInConstructor](pmd_rules_java_codestyle.html#callsuperinconstructor): It is a good practice to call super() in a constructor. If super() is not called butanother const...
|
||||
* [ClassNamingConventions](pmd_rules_java_codestyle.html#classnamingconventions): Configurable naming conventions for type declarations. This rule reports type declarat...
|
||||
* [CommentDefaultAccessModifier](pmd_rules_java_codestyle.html#commentdefaultaccessmodifier): To avoid mistakes if we want that a Method, Constructor, Field or Nested class have a default acc...
|
||||
* [CommentDefaultAccessModifier](pmd_rules_java_codestyle.html#commentdefaultaccessmodifier): To avoid mistakes if we want that an Annotation, Class, Enum, Method, Constructor or Field have a...
|
||||
* [ConfusingTernary](pmd_rules_java_codestyle.html#confusingternary): Avoid negation within an "if" expression with an "else" clause. For example, rephrase:'if (x != ...
|
||||
* [ControlStatementBraces](pmd_rules_java_codestyle.html#controlstatementbraces): Enforce a policy for braces on control statements. It is recommended to use braces on 'if ... els...
|
||||
* [DefaultPackage](pmd_rules_java_codestyle.html#defaultpackage): Use explicit scoping instead of accidental usage of default package private level.The rule allows...
|
||||
@ -102,7 +102,7 @@ folder: pmd/rules
|
||||
* [MethodArgumentCouldBeFinal](pmd_rules_java_codestyle.html#methodargumentcouldbefinal): A method argument that is never re-assigned within the method can be declared final.
|
||||
* [MethodNamingConventions](pmd_rules_java_codestyle.html#methodnamingconventions): Configurable naming conventions for method declarations. This rule reports method decl...
|
||||
* [MIsLeadingVariableName](pmd_rules_java_codestyle.html#misleadingvariablename): <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Detects when a non-field has a name starting with 'm_'. This usually denotes a field and could b...
|
||||
* [NoPackage](pmd_rules_java_codestyle.html#nopackage): Detects when a class or interface does not have a package definition.
|
||||
* [NoPackage](pmd_rules_java_codestyle.html#nopackage): Detects when a class, interface, enum or annotation does not have a package definition.
|
||||
* [OnlyOneReturn](pmd_rules_java_codestyle.html#onlyonereturn): A method should have only one exit point, and that should be the last statement in the method.
|
||||
* [PackageCase](pmd_rules_java_codestyle.html#packagecase): Detects when a package definition contains uppercase characters.
|
||||
* [PrematureDeclaration](pmd_rules_java_codestyle.html#prematuredeclaration): Checks for variables that are defined before they might be used. A reference is deemed to be prem...
|
||||
@ -122,6 +122,7 @@ folder: pmd/rules
|
||||
* [UseDiamondOperator](pmd_rules_java_codestyle.html#usediamondoperator): Use the diamond operator to let the type be inferred automatically. With the Diamond operator it ...
|
||||
* [UselessParentheses](pmd_rules_java_codestyle.html#uselessparentheses): Useless parentheses should be removed.
|
||||
* [UselessQualifiedThis](pmd_rules_java_codestyle.html#uselessqualifiedthis): Reports qualified this usages in the same class.
|
||||
* [UseShortArrayInitializer](pmd_rules_java_codestyle.html#useshortarrayinitializer): When declaring and initializing array fields or variables, it is not necessary to explicitly crea...
|
||||
* [UseUnderscoresInNumericLiterals](pmd_rules_java_codestyle.html#useunderscoresinnumericliterals): Since Java 1.7, numeric literals can use underscores to separate digits. This rule enforces that ...
|
||||
* [VariableNamingConventions](pmd_rules_java_codestyle.html#variablenamingconventions): <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> A variable naming conventions rule - customize this to your liking. Currently, itchecks for fina...
|
||||
* [WhileLoopsMustUseBraces](pmd_rules_java_codestyle.html#whileloopsmustusebraces): <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Avoid using 'while' statements without using braces to surround the code block. If the code forma...
|
||||
@ -255,7 +256,7 @@ folder: pmd/rules
|
||||
* [JumbledIncrementer](pmd_rules_java_errorprone.html#jumbledincrementer): Avoid jumbled loop incrementers - its usually a mistake, and is confusing even if intentional.
|
||||
* [JUnitSpelling](pmd_rules_java_errorprone.html#junitspelling): Some JUnit framework methods are easy to misspell.
|
||||
* [JUnitStaticSuite](pmd_rules_java_errorprone.html#junitstaticsuite): The suite() method in a JUnit test needs to be both public and static.
|
||||
* [LoggerIsNotStaticFinal](pmd_rules_java_errorprone.html#loggerisnotstaticfinal): In most cases, the Logger reference can be declared as static and final.
|
||||
* [LoggerIsNotStaticFinal](pmd_rules_java_errorprone.html#loggerisnotstaticfinal): <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> In most cases, the Logger reference can be declared as static and final.This rule is deprecated a...
|
||||
* [MethodWithSameNameAsEnclosingClass](pmd_rules_java_errorprone.html#methodwithsamenameasenclosingclass): Non-constructor methods should not have the same name as the enclosing class.
|
||||
* [MisplacedNullCheck](pmd_rules_java_errorprone.html#misplacednullcheck): The null check here is misplaced. If the variable is null a NullPointerException will be thrown.E...
|
||||
* [MissingBreakInSwitch](pmd_rules_java_errorprone.html#missingbreakinswitch): Switch statements without break or return statements for each case optionmay indicate problematic...
|
||||
|
@ -806,7 +806,7 @@ This rule checks for JUnit4, JUnit5 and TestNG Tests, as well as methods startin
|
||||
|
||||
**This rule is defined by the following XPath expression:**
|
||||
``` xpath
|
||||
//MethodDeclarator[@Image[fn:matches(.,'^test')] or ../../Annotation/MarkerAnnotation/Name[
|
||||
//MethodDeclarator[@Image[matches(.,'^test')] or ../../Annotation/MarkerAnnotation/Name[
|
||||
pmd-java:typeIs('org.junit.Test')
|
||||
or pmd-java:typeIs('org.junit.jupiter.api.Test')
|
||||
or pmd-java:typeIs('org.junit.jupiter.api.RepeatedTest')
|
||||
@ -815,7 +815,7 @@ This rule checks for JUnit4, JUnit5 and TestNG Tests, as well as methods startin
|
||||
or pmd-java:typeIs('org.junit.jupiter.params.ParameterizedTest')
|
||||
or pmd-java:typeIs('org.testng.annotations.Test')
|
||||
]]
|
||||
[count(..//PrimaryPrefix/Name[@Image[fn:matches(.,'^assert')]]) > $maximumAsserts]
|
||||
[count(..//PrimaryPrefix/Name[@Image[matches(.,'^assert')]]) > $maximumAsserts]
|
||||
```
|
||||
|
||||
**Example(s):**
|
||||
@ -1468,7 +1468,7 @@ public class Something {
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|ignoredAnnotations|lombok.Setter \| lombok.Getter \| lombok.Builder \| lombok.Data \| lombok.RequiredArgsConstructor \| lombok.AllArgsConstructor \| lombok.Value \| lombok.NoArgsConstructor \| java.lang.Deprecated \| javafx.fxml.FXML|Fully qualified names of the annotation types that should be ignored by this rule|yes. Delimiter is '\|'.|
|
||||
|ignoredAnnotations|lombok.Setter \| lombok.Getter \| lombok.Builder \| lombok.Data \| lombok.RequiredArgsConstructor \| lombok.AllArgsConstructor \| lombok.Value \| lombok.NoArgsConstructor \| java.lang.Deprecated \| javafx.fxml.FXML \| lombok.experimental.Delegate|Fully qualified names of the annotation types that should be ignored by this rule|yes. Delimiter is '\|'.|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
``` xml
|
||||
@ -1479,7 +1479,7 @@ public class Something {
|
||||
``` xml
|
||||
<rule ref="category/java/bestpractices.xml/UnusedPrivateField">
|
||||
<properties>
|
||||
<property name="ignoredAnnotations" value="lombok.Setter|lombok.Getter|lombok.Builder|lombok.Data|lombok.RequiredArgsConstructor|lombok.AllArgsConstructor|lombok.Value|lombok.NoArgsConstructor|java.lang.Deprecated|javafx.fxml.FXML" />
|
||||
<property name="ignoredAnnotations" value="lombok.Setter|lombok.Getter|lombok.Builder|lombok.Data|lombok.RequiredArgsConstructor|lombok.AllArgsConstructor|lombok.Value|lombok.NoArgsConstructor|java.lang.Deprecated|javafx.fxml.FXML|lombok.experimental.Delegate" />
|
||||
</properties>
|
||||
</rule>
|
||||
```
|
||||
|
@ -5,7 +5,7 @@ permalink: pmd_rules_java_codestyle.html
|
||||
folder: pmd/rules/java
|
||||
sidebaractiveurl: /pmd_rules_java.html
|
||||
editmepath: ../pmd-java/src/main/resources/category/java/codestyle.xml
|
||||
keywords: Code Style, AbstractNaming, AtLeastOneConstructor, AvoidDollarSigns, AvoidFinalLocalVariable, AvoidPrefixingMethodParameters, AvoidProtectedFieldInFinalClass, AvoidProtectedMethodInFinalClassNotExtending, AvoidUsingNativeCode, BooleanGetMethodName, CallSuperInConstructor, ClassNamingConventions, CommentDefaultAccessModifier, ConfusingTernary, ControlStatementBraces, DefaultPackage, DontImportJavaLang, DuplicateImports, EmptyMethodInAbstractClassShouldBeAbstract, ExtendsObject, FieldDeclarationsShouldBeAtStartOfClass, FieldNamingConventions, ForLoopShouldBeWhileLoop, ForLoopsMustUseBraces, FormalParameterNamingConventions, GenericsNaming, IdenticalCatchBranches, IfElseStmtsMustUseBraces, IfStmtsMustUseBraces, LinguisticNaming, LocalHomeNamingConvention, LocalInterfaceSessionNamingConvention, LocalVariableCouldBeFinal, LocalVariableNamingConventions, LongVariable, MDBAndSessionBeanNamingConvention, MethodArgumentCouldBeFinal, MethodNamingConventions, MIsLeadingVariableName, NoPackage, UseUnderscoresInNumericLiterals, OnlyOneReturn, PackageCase, PrematureDeclaration, RemoteInterfaceNamingConvention, RemoteSessionInterfaceNamingConvention, ShortClassName, ShortMethodName, ShortVariable, SuspiciousConstantFieldName, TooManyStaticImports, UnnecessaryAnnotationValueElement, UnnecessaryConstructor, UnnecessaryFullyQualifiedName, UnnecessaryLocalBeforeReturn, UnnecessaryModifier, UnnecessaryReturn, UseDiamondOperator, UselessParentheses, UselessQualifiedThis, VariableNamingConventions, WhileLoopsMustUseBraces
|
||||
keywords: Code Style, AbstractNaming, AtLeastOneConstructor, AvoidDollarSigns, AvoidFinalLocalVariable, AvoidPrefixingMethodParameters, AvoidProtectedFieldInFinalClass, AvoidProtectedMethodInFinalClassNotExtending, AvoidUsingNativeCode, BooleanGetMethodName, CallSuperInConstructor, ClassNamingConventions, CommentDefaultAccessModifier, ConfusingTernary, ControlStatementBraces, DefaultPackage, DontImportJavaLang, DuplicateImports, EmptyMethodInAbstractClassShouldBeAbstract, ExtendsObject, FieldDeclarationsShouldBeAtStartOfClass, FieldNamingConventions, ForLoopShouldBeWhileLoop, ForLoopsMustUseBraces, FormalParameterNamingConventions, GenericsNaming, IdenticalCatchBranches, IfElseStmtsMustUseBraces, IfStmtsMustUseBraces, LinguisticNaming, LocalHomeNamingConvention, LocalInterfaceSessionNamingConvention, LocalVariableCouldBeFinal, LocalVariableNamingConventions, LongVariable, MDBAndSessionBeanNamingConvention, MethodArgumentCouldBeFinal, MethodNamingConventions, MIsLeadingVariableName, NoPackage, UseUnderscoresInNumericLiterals, OnlyOneReturn, PackageCase, PrematureDeclaration, RemoteInterfaceNamingConvention, RemoteSessionInterfaceNamingConvention, ShortClassName, ShortMethodName, ShortVariable, SuspiciousConstantFieldName, TooManyStaticImports, UnnecessaryAnnotationValueElement, UnnecessaryConstructor, UnnecessaryFullyQualifiedName, UnnecessaryLocalBeforeReturn, UnnecessaryModifier, UnnecessaryReturn, UseDiamondOperator, UselessParentheses, UselessQualifiedThis, UseShortArrayInitializer, VariableNamingConventions, WhileLoopsMustUseBraces
|
||||
language: Java
|
||||
---
|
||||
<!-- DO NOT EDIT THIS FILE. This file is generated from file ../pmd-java/src/main/resources/category/java/codestyle.xml. -->
|
||||
@ -473,7 +473,7 @@ public class Éléphant {}
|
||||
|
||||
**Priority:** Medium (3)
|
||||
|
||||
To avoid mistakes if we want that a Method, Constructor, Field or Nested class have a default access modifier
|
||||
To avoid mistakes if we want that an Annotation, Class, Enum, Method, Constructor or Field have a default access modifier
|
||||
we must add a comment at the beginning of it's declaration.
|
||||
By default the comment must be `/* default */` or `/* package */`, if you want another, you have to provide a regular expression.
|
||||
This rule ignores by default all cases that have a @VisibleForTesting annotation. Use the
|
||||
@ -900,7 +900,7 @@ class Foo {
|
||||
|finalFieldPattern|\[a-z\]\[a-zA-Z0-9\]\*|Regex which applies to final field names|no|
|
||||
|staticFieldPattern|\[a-z\]\[a-zA-Z0-9\]\*|Regex which applies to static field names|no|
|
||||
|defaultFieldPattern|\[a-z\]\[a-zA-Z0-9\]\*|Regex which applies to field names|no|
|
||||
|exclusions|serialVersionUID|Names of fields to whitelist.|yes. Delimiter is '\|'.|
|
||||
|exclusions|serialVersionUID \| serialPersistentFields|Names of fields to whitelist.|yes. Delimiter is '\|'.|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
``` xml
|
||||
@ -917,7 +917,7 @@ class Foo {
|
||||
<property name="finalFieldPattern" value="[a-z][a-zA-Z0-9]*" />
|
||||
<property name="staticFieldPattern" value="[a-z][a-zA-Z0-9]*" />
|
||||
<property name="defaultFieldPattern" value="[a-z][a-zA-Z0-9]*" />
|
||||
<property name="exclusions" value="serialVersionUID" />
|
||||
<property name="exclusions" value="serialVersionUID|serialPersistentFields" />
|
||||
</properties>
|
||||
</rule>
|
||||
```
|
||||
@ -1689,11 +1689,11 @@ public class Foo {
|
||||
|
||||
**Priority:** Medium (3)
|
||||
|
||||
Detects when a class or interface does not have a package definition.
|
||||
Detects when a class, interface, enum or annotation does not have a package definition.
|
||||
|
||||
**This rule is defined by the following XPath expression:**
|
||||
``` xpath
|
||||
//ClassOrInterfaceDeclaration[count(preceding::PackageDeclaration) = 0]
|
||||
/CompilationUnit[not(./PackageDeclaration)]/TypeDeclaration[1]
|
||||
```
|
||||
|
||||
**Example(s):**
|
||||
@ -2499,6 +2499,36 @@ public class Foo {
|
||||
<rule ref="category/java/codestyle.xml/UselessQualifiedThis" />
|
||||
```
|
||||
|
||||
## UseShortArrayInitializer
|
||||
|
||||
**Since:** PMD 6.15.0
|
||||
|
||||
**Priority:** Medium (3)
|
||||
|
||||
When declaring and initializing array fields or variables, it is not necessary to explicitly create a new array
|
||||
using `new`. Instead one can simply define the initial content of the array as a expression in curly braces.
|
||||
|
||||
E.g. `int[] x = new int[] { 1, 2, 3 };` can be written as `int[] x = { 1, 2, 3 };`.
|
||||
|
||||
**This rule is defined by the following XPath expression:**
|
||||
``` xpath
|
||||
//VariableDeclarator
|
||||
[VariableDeclaratorId[@ArrayType = true() and @TypeInferred = false()]]
|
||||
[VariableInitializer/Expression/PrimaryExpression/PrimaryPrefix/AllocationExpression/ArrayDimsAndInits/ArrayInitializer]
|
||||
```
|
||||
|
||||
**Example(s):**
|
||||
|
||||
``` java
|
||||
Foo[] x = new Foo[] { ... }; // Overly verbose
|
||||
Foo[] x = { ... }; //Equivalent to above line
|
||||
```
|
||||
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/java/codestyle.xml/UseShortArrayInitializer" />
|
||||
```
|
||||
|
||||
## UseUnderscoresInNumericLiterals
|
||||
|
||||
**Since:** PMD 6.10.0
|
||||
|
@ -464,7 +464,7 @@ details on the calculation, see the documentation of the [Cyclo metric](pmd_java
|
||||
|
||||
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. By default, this rule reports methods with a complexity >= 10.
|
||||
Additionnally, classes with many methods of moderate complexity get reported as well once the total of their
|
||||
Additionally, classes with many methods of moderate complexity get reported as well once the total of their
|
||||
methods' complexities reaches 80, even if none of the methods was directly reported.
|
||||
|
||||
Reported methods should be broken down into several smaller methods. Reported classes should probably be broken down
|
||||
@ -1779,7 +1779,7 @@ public class Foo {
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|ignoredAnnotations|lombok.Setter \| lombok.Getter \| lombok.Builder \| lombok.Data \| lombok.RequiredArgsConstructor \| lombok.AllArgsConstructor \| lombok.Value \| lombok.NoArgsConstructor|Fully qualified names of the annotation types that should be ignored by this rule|yes. Delimiter is '\|'.|
|
||||
|ignoredAnnotations|lombok.Setter \| lombok.Getter \| lombok.Builder \| lombok.Data \| lombok.RequiredArgsConstructor \| lombok.AllArgsConstructor \| lombok.Value \| lombok.NoArgsConstructor \| lombok.experimental.Delegate|Fully qualified names of the annotation types that should be ignored by this rule|yes. Delimiter is '\|'.|
|
||||
|checkInnerClasses|false|Check inner classes|no|
|
||||
|disallowNotAssignment|false|Disallow violations where the first usage is not an assignment|no|
|
||||
|
||||
@ -1792,7 +1792,7 @@ public class Foo {
|
||||
``` xml
|
||||
<rule ref="category/java/design.xml/SingularField">
|
||||
<properties>
|
||||
<property name="ignoredAnnotations" value="lombok.Setter|lombok.Getter|lombok.Builder|lombok.Data|lombok.RequiredArgsConstructor|lombok.AllArgsConstructor|lombok.Value|lombok.NoArgsConstructor" />
|
||||
<property name="ignoredAnnotations" value="lombok.Setter|lombok.Getter|lombok.Builder|lombok.Data|lombok.RequiredArgsConstructor|lombok.AllArgsConstructor|lombok.Value|lombok.NoArgsConstructor|lombok.experimental.Delegate" />
|
||||
<property name="checkInnerClasses" value="false" />
|
||||
<property name="disallowNotAssignment" value="false" />
|
||||
</properties>
|
||||
@ -2141,8 +2141,23 @@ public class MaybeAUtility {
|
||||
}
|
||||
```
|
||||
|
||||
**Use this rule by referencing it:**
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|ignoredAnnotations|lombok.experimental.UtilityClass|Fully qualified names of the annotation types that should be ignored by this rule|yes. Delimiter is '\|'.|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/java/design.xml/UseUtilityClass" />
|
||||
```
|
||||
|
||||
**Use this rule and customize it:**
|
||||
``` xml
|
||||
<rule ref="category/java/design.xml/UseUtilityClass">
|
||||
<properties>
|
||||
<property name="ignoredAnnotations" value="lombok.experimental.UtilityClass" />
|
||||
</properties>
|
||||
</rule>
|
||||
```
|
||||
|
||||
|
@ -79,6 +79,7 @@ Denotes whether comments are required (or unwanted) for specific language elemen
|
||||
|protectedMethodCommentRequirement|Required|Protected method constructor comments. Possible values: \[Required, Ignored, Unwanted\]|no|
|
||||
|enumCommentRequirement|Required|Enum comments. Possible values: \[Required, Ignored, Unwanted\]|no|
|
||||
|serialVersionUIDCommentRequired|Ignored|Serial version UID comments. Possible values: \[Required, Ignored, Unwanted\]|no|
|
||||
|serialPersistentFieldsCommentRequired|Ignored|Serial persistent fields comments. Possible values: \[Required, Ignored, Unwanted\]|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
``` xml
|
||||
@ -97,6 +98,7 @@ Denotes whether comments are required (or unwanted) for specific language elemen
|
||||
<property name="protectedMethodCommentRequirement" value="Required" />
|
||||
<property name="enumCommentRequirement" value="Required" />
|
||||
<property name="serialVersionUIDCommentRequired" value="Ignored" />
|
||||
<property name="serialPersistentFieldsCommentRequired" value="Ignored" />
|
||||
</properties>
|
||||
</rule>
|
||||
```
|
||||
|
@ -2391,12 +2391,17 @@ public class Foo extends TestCase {
|
||||
|
||||
## LoggerIsNotStaticFinal
|
||||
|
||||
<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f;">Deprecated</span>
|
||||
|
||||
**Since:** PMD 2.0
|
||||
|
||||
**Priority:** Medium High (2)
|
||||
|
||||
In most cases, the Logger reference can be declared as static and final.
|
||||
|
||||
This rule is deprecated and will be removed with PMD 7.0.0.
|
||||
The rule is replaced by {% rule java/errorprone/ProperLogger %}.
|
||||
|
||||
**This rule is defined by the following XPath expression:**
|
||||
``` xpath
|
||||
//VariableDeclarator
|
||||
@ -2845,21 +2850,36 @@ class Foo{
|
||||
**Priority:** Medium (3)
|
||||
|
||||
A logger should normally be defined private static final and be associated with the correct class.
|
||||
Private final Log log; is also allowed for rare cases where loggers need to be passed around,
|
||||
`private final Log log;` is also allowed for rare cases where loggers need to be passed around,
|
||||
with the restriction that the logger needs to be passed into the constructor.
|
||||
|
||||
**This rule is defined by the following XPath expression:**
|
||||
``` xpath
|
||||
//ClassOrInterfaceBodyDeclaration[FieldDeclaration//ClassOrInterfaceType[@Image='Log']
|
||||
and
|
||||
not(FieldDeclaration[@Final='true'][@Static='true'][@Private='true'][.//VariableDeclaratorId[@Image=$staticLoggerName]]
|
||||
and
|
||||
//ArgumentList//ClassOrInterfaceType[@Image = ancestor::ClassOrInterfaceDeclaration/@Image or @Image = ancestor::EnumDeclaration/@Image])
|
||||
and
|
||||
not(FieldDeclaration[@Final='true'][@Private='true'][.//VariableDeclaratorId[@Image='log']]
|
||||
[count(.//VariableInitializer)=0]
|
||||
[ancestor::ClassOrInterfaceBody//StatementExpression[.//PrimaryExpression/descendant::*[@Image='log']][count(.//AllocationExpression)=0]]
|
||||
)]
|
||||
//FieldDeclaration
|
||||
[.//ClassOrInterfaceType[pmd-java:typeIs($loggerClass)]]
|
||||
[
|
||||
(: check modifiers :)
|
||||
(@Private = false() or @Final = false())
|
||||
(: check logger name :)
|
||||
or (@Static and .//VariableDeclaratorId[@Image != $staticLoggerName])
|
||||
or (@Static = false() and .//VariableDeclaratorId[@Image != $loggerName])
|
||||
|
||||
(: check logger argument type matches class or enum name :)
|
||||
or .//ArgumentList//ClassOrInterfaceType[@Image != ancestor::ClassOrInterfaceDeclaration/@Image]
|
||||
or .//ArgumentList//ClassOrInterfaceType[@Image != ancestor::EnumDeclaration/@Image]
|
||||
]
|
||||
[not(
|
||||
(: special case - final logger initialized inside constructor :)
|
||||
count(.//VariableInitializer)=0
|
||||
and @Static = false()
|
||||
and
|
||||
ancestor::ClassOrInterfaceBody//ConstructorDeclaration//StatementExpression
|
||||
[PrimaryExpression[PrimaryPrefix[@ThisModifier]]/PrimarySuffix[@Image=$loggerName]]
|
||||
[AssignmentOperator[@Image = '=']]
|
||||
[Expression/PrimaryExpression/PrimaryPrefix/Name[@Image = ancestor::ConstructorDeclaration//FormalParameter/VariableDeclaratorId/@Image]]
|
||||
[count(.//AllocationExpression)=0]
|
||||
)
|
||||
]
|
||||
```
|
||||
|
||||
**Example(s):**
|
||||
@ -2878,6 +2898,8 @@ public class Foo {
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|staticLoggerName|LOG|Name of the static Logger variable|no|
|
||||
|loggerName|log|Name of the Logger instance variable|no|
|
||||
|loggerClass|Log|Class name of the logger|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
``` xml
|
||||
@ -2889,6 +2911,8 @@ public class Foo {
|
||||
<rule ref="category/java/errorprone.xml/ProperLogger">
|
||||
<properties>
|
||||
<property name="staticLoggerName" value="LOG" />
|
||||
<property name="loggerName" value="log" />
|
||||
<property name="loggerClass" value="Log" />
|
||||
</properties>
|
||||
</rule>
|
||||
```
|
||||
|
@ -293,7 +293,7 @@ public static Foo getFoo() {
|
||||
|
||||
SimpleDateFormat instances are not synchronized. Sun recommends using separate format instances
|
||||
for each thread. If multiple threads must access a static formatter, the formatter must be
|
||||
synchronized either on method or block level.
|
||||
synchronized on block level.
|
||||
|
||||
This rule has been deprecated in favor of the rule {% rule UnsynchronizedStaticFormatter %}.
|
||||
|
||||
@ -307,17 +307,34 @@ public class Foo {
|
||||
void bar() {
|
||||
sdf.format(); // poor, no thread-safety
|
||||
}
|
||||
synchronized void foo() {
|
||||
sdf.format(); // preferred
|
||||
void foo() {
|
||||
synchronized (sdf) { // preferred
|
||||
sdf.format();
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Use this rule by referencing it:**
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|allowMethodLevelSynchronization|false|If true, method level synchronization is allowed as well as synchronized block. Otherwise only synchronized blocks are allowed.|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/java/multithreading.xml/UnsynchronizedStaticDateFormatter" />
|
||||
```
|
||||
|
||||
**Use this rule and customize it:**
|
||||
``` xml
|
||||
<rule ref="category/java/multithreading.xml/UnsynchronizedStaticDateFormatter">
|
||||
<properties>
|
||||
<property name="allowMethodLevelSynchronization" value="false" />
|
||||
</properties>
|
||||
</rule>
|
||||
```
|
||||
|
||||
## UnsynchronizedStaticFormatter
|
||||
|
||||
**Since:** PMD 6.11.0
|
||||
@ -327,7 +344,7 @@ public class Foo {
|
||||
Instances of `java.text.Format` are generally not synchronized.
|
||||
Sun recommends using separate format instances for each thread.
|
||||
If multiple threads must access a static formatter, the formatter must be
|
||||
synchronized either on method or block level.
|
||||
synchronized on block level.
|
||||
|
||||
**This rule is defined by the following Java class:** [net.sourceforge.pmd.lang.java.rule.multithreading.UnsynchronizedStaticFormatterRule](https://github.com/pmd/pmd/blob/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/multithreading/UnsynchronizedStaticFormatterRule.java)
|
||||
|
||||
@ -339,17 +356,34 @@ public class Foo {
|
||||
void bar() {
|
||||
sdf.format(); // poor, no thread-safety
|
||||
}
|
||||
synchronized void foo() {
|
||||
sdf.format(); // preferred
|
||||
void foo() {
|
||||
synchronized (sdf) { // preferred
|
||||
sdf.format();
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Use this rule by referencing it:**
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|allowMethodLevelSynchronization|false|If true, method level synchronization is allowed as well as synchronized block. Otherwise only synchronized blocks are allowed.|no|
|
||||
|
||||
**Use this rule with the default properties by just referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/java/multithreading.xml/UnsynchronizedStaticFormatter" />
|
||||
```
|
||||
|
||||
**Use this rule and customize it:**
|
||||
``` xml
|
||||
<rule ref="category/java/multithreading.xml/UnsynchronizedStaticFormatter">
|
||||
<properties>
|
||||
<property name="allowMethodLevelSynchronization" value="false" />
|
||||
</properties>
|
||||
</rule>
|
||||
```
|
||||
|
||||
## UseConcurrentHashMap
|
||||
|
||||
**Since:** PMD 4.2.6
|
||||
|
@ -187,10 +187,15 @@ of no use.
|
||||
### The property `violationSuppressXPath`
|
||||
|
||||
This property defines an XPath query to be executed *using the
|
||||
violation node as the starting point*. If the XPath query matches anything,
|
||||
then the violation will be suppressed.
|
||||
violation node as the context node*. If the XPath query matches anything,
|
||||
then the violation will be suppressed. Note that the query shouldn't be finding
|
||||
the violation nodes to suppress, but rather, finding a non-empty sequence of nodes
|
||||
when evaluated with the violation node as a context node.
|
||||
|
||||
For example, to suppress reporting specifically typed parameters which are unused:
|
||||
The XPath version used by those queries is XPath 1.0, so it doesn't support various XPath 2.0
|
||||
features. This will be updated with PMD 7.0.0.
|
||||
|
||||
For example, to suppress reporting specifically "String" parameters which are unused:
|
||||
|
||||
```xml
|
||||
<rule ref="rulesets/java/unusedcode.xml/UnusedFormalParameter">
|
||||
@ -200,6 +205,25 @@ For example, to suppress reporting specifically typed parameters which are unuse
|
||||
</rule>
|
||||
```
|
||||
|
||||
Note the use of `.` to refer to the context node. Using `//` at the start of the
|
||||
expression should be avoided, as it would test all nodes in the file, and suppress
|
||||
more violations than expected.
|
||||
|
||||
Another example, to suppress violations occurring in classes whose name contains `Bean`:
|
||||
```xml
|
||||
<property name="violationSuppressXPath" value="./ancestor::ClassOrInterfaceDeclaration[contains(@Image, 'Bean')]"/>
|
||||
```
|
||||
|
||||
You can also use regex for string comparison. The next example suppresses violations in classes ending with `Bean`:
|
||||
```xml
|
||||
<property name="violationSuppressXPath" value="./ancestor::ClassOrInterfaceDeclaration[matches(@Image, '^.*Bean$')]"/>
|
||||
```
|
||||
|
||||
|
||||
Note here the usage of the `./ancestor::` axis instead of `//`. The latter would match
|
||||
any ClassOrInterfaceDeclaration in the file, while the former matches only class
|
||||
declaration nodes that *enclose the violation node*, which is usually what you'd want.
|
||||
|
||||
Note for XPath based suppression to work, you must know how to write
|
||||
an XPath query that matches the AST structure of the nodes of the
|
||||
violations you wish to suppress. XPath queries are explained in
|
||||
|
@ -14,6 +14,38 @@ author: >
|
||||
|
||||
Runs a set of static code analysis rules on some source code files and generates a list of problems found.
|
||||
|
||||
### Installation
|
||||
|
||||
Before you can use the `pmd` task in your ant `build.xml` file, you need to install PMD and its libraries into
|
||||
ant's classpath, as described in [Optional Tasks](https://ant.apache.org/manual/install.html#optionalTasks).
|
||||
|
||||
First you need to download PMD's binary distribution zip file.
|
||||
Then you can either copy all "*.jar" files from PMD's lib folder into one of ANT's library folders
|
||||
(`ANT_HOME/lib`, `${user.home}/.ant/lib`) or using the `-lib` command line parameter.
|
||||
|
||||
However, the preferred way is to define a `<classpath>` for pmd itself and use this classpath when
|
||||
adding the PMD Task. Assuming, you have extracted the PMD zip file to `/home/joe/pmd-bin-{{site.pmd.version}}`,
|
||||
then you can make use of the PMD Task like this:
|
||||
|
||||
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask">
|
||||
<classpath>
|
||||
<fileset dir="/home/joe/pmd-bin-{{site.pmd.version}}/lib">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
</classpath>
|
||||
</taskdef>
|
||||
|
||||
Alternatively, a path can be defined and used via `classpathref`:
|
||||
|
||||
<path id="pmd.classpath">
|
||||
<fileset dir="/home/joe/pmd-bin-{{site.pmd.version}}/lib">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
</path>
|
||||
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath" />
|
||||
|
||||
The examples below won't repeat this taskdef element, as this is always required.
|
||||
|
||||
### Parameters
|
||||
|
||||
<table>
|
||||
@ -93,7 +125,8 @@ Runs a set of static code analysis rules on some source code files and generates
|
||||
</table>
|
||||
|
||||
|
||||
`formatter` nested element - specifies the format of and the files to which the report is written.
|
||||
`formatter` nested element - specifies the format of and the files to which the report is written. You can
|
||||
configure multiple formatters.
|
||||
|
||||
<table>
|
||||
<tr><th>Name</th><th>Values</th></tr>
|
||||
@ -120,47 +153,58 @@ Runs a set of static code analysis rules on some source code files and generates
|
||||
<dt>encoding</dt>
|
||||
<dd>Specifies the encoding to be used in the generated report (only honored when used with `toFile`). When rendering `toConsole` PMD will automatically detect the terminal's encoding and use it, unless the output is being redirected / piped, in which case `file.encoding` is used. See example below.</dd>
|
||||
<dt>linkPrefix</dt>
|
||||
<dd>Used for linking to online HTMLized source (like <a href="xref/net/sourceforge/pmd/PMD.html">this</a>). See example below.</dd>
|
||||
<dd>Used for linking to online HTMLized source (like <a href="https://maven.apache.org/plugins/maven-pmd-plugin/xref/org/apache/maven/plugins/pmd/PmdReport.html">this</a>). See example below. Note, this only works with [maven-jxr-plugin](https://maven.apache.org/jxr/maven-jxr-plugin/index.html).</dd>
|
||||
<dt>linePrefix</dt>
|
||||
<dd>Used for linking to online HTMLized source (like <a href="xref/net/sourceforge/pmd/PMD.html#102">this</a>). See example below.</dd>
|
||||
<dd>Used for linking to online HTMLized source (like <a href="https://maven.apache.org/plugins/maven-pmd-plugin/xref/org/apache/maven/plugins/pmd/PmdReport.html#L375">this</a>). See example below. Note, this only works with [maven-jxr-plugin](https://maven.apache.org/jxr/maven-jxr-plugin/index.html).</dd>
|
||||
</dl>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
`classpath` nested element - useful for specifying custom rule. More details on the `classpath`
|
||||
element are in the Ant documentation [here](http://ant.apache.org/manual/using.html#path) and there's
|
||||
`classpath` nested element - useful for specifying custom rules. More details on the `classpath`
|
||||
element are in the Ant documentation for [path-like structures](https://ant.apache.org/manual/using.html#path) and there's
|
||||
an example below.
|
||||
|
||||
`auxclasspath` nested element - extra classpath used for Type Resolution rules.
|
||||
`auxclasspath` nested element - extra classpath used for type resolution. Some rules make use of type resolution
|
||||
in order to avoid false positives. The `auxclasspath` is configured also with [path-like structures](https://ant.apache.org/manual/using.html#path). It should contain the compiled classes of the project that is being analyzed and all the compile time
|
||||
dependencies.
|
||||
|
||||
`sourceLanguage` nested element - specify which language (Java, Ecmascript, XML,...)
|
||||
and the associated version (1.5, 1.6,...)
|
||||
and the associated version (1.5, 1.6,...). This element is optional. The language is determined by file extension
|
||||
automatically and the latest language version is used.
|
||||
|
||||
`ruleset` nested element - another way to specify rulesets. Here's an example:
|
||||
`ruleset` nested element - another way to specify rulesets. You can specify multiple elements. Here's an example:
|
||||
|
||||
<target name="pmd">
|
||||
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
|
||||
<pmd shortFilenames="true">
|
||||
<sourceLanguage name="java" version="1.6"/>
|
||||
<ruleset>rulesets/java/design.xml</ruleset>
|
||||
<ruleset>java-basic</ruleset>
|
||||
<formatter type="html" toFile="pmd_report.html">
|
||||
<param name="linkPrefix" value="http://pmd.sourceforge.net/xref/"/>
|
||||
</formatter>
|
||||
<fileset dir="/usr/local/j2sdk1.4.1_01/src/">
|
||||
<include name="java/lang/*.java"/>
|
||||
</fileset>
|
||||
</pmd>
|
||||
</target>
|
||||
|
||||
`fileset` nested element - specify the actual java source files, that PMD should analyze. You can use multiple
|
||||
fileset elements. See [FileSet](https://ant.apache.org/manual/Types/fileset.html) for the syntax and usage.
|
||||
|
||||
### Language version selection
|
||||
|
||||
The specific version of a language to be used for parsing is selected via the `sourceLanguage`
|
||||
PMD selects the language automatically using the file extension. If multiple versions of a language are
|
||||
supported, PMD uses the latest version as default. This is currently the case for Java only, which has
|
||||
support for multiple versions.
|
||||
|
||||
If a languages supports multiple versions, you can select a specific version here, so that e.g. rules, that only apply
|
||||
to specific versions, are not executed. E.g. the rule {% rule "java/bestpractices/UseTryWithResources" %} only makes
|
||||
sense with Java 1.7 and later. If your project uses Java 1.5, then you should configure the `sourceLanguage`
|
||||
accordingly and this rule won't be executed.
|
||||
|
||||
The specific version of a language to be used is selected via the `sourceLanguage`
|
||||
nested element. Possible values are:
|
||||
|
||||
<sourceLanguage name="apex" version=""/>
|
||||
<sourceLanguage name="apex" version="45"/>
|
||||
<sourceLanguage name="ecmascript" version="3"/>
|
||||
<sourceLanguage name="java" version="1.3"/>
|
||||
<sourceLanguage name="java" version="1.4"/>
|
||||
@ -169,6 +213,9 @@ nested element. Possible values are:
|
||||
<sourceLanguage name="java" version="1.7"/>
|
||||
<sourceLanguage name="java" version="1.8"/>
|
||||
<sourceLanguage name="java" version="9"/>
|
||||
<sourceLanguage name="java" version="10"/>
|
||||
<sourceLanguage name="java" version="11"/>
|
||||
<sourceLanguage name="java" version="12"/> <!-- this is the default -->
|
||||
<sourceLanguage name="jsp" version=""/>
|
||||
<sourceLanguage name="pom" version=""/>
|
||||
<sourceLanguage name="plsql" version=""/>
|
||||
@ -183,22 +230,21 @@ Several folks (most recently, Wouter Zelle) have written XSLT scripts
|
||||
which you can use to transform the XML report into nifty HTML. To do this,
|
||||
make sure you use the XML formatter in the PMD task invocation, i.e.:
|
||||
|
||||
<formatter type="xml" toFile="${tempbuild}/$report_pmd.xml">
|
||||
<formatter type="xml" toFile="${tempbuild}/report_pmd.xml">
|
||||
<param name="encoding" value="UTF-8" /> <!-- enforce UTF-8 encoding for the XML -->
|
||||
</formatter>
|
||||
|
||||
Then, after the end of the PMD task, do this:
|
||||
|
||||
<xslt in="${tempbuild}/$report_pmd.xml" style="${pmdConfig}/wz-pmd-report.xslt" out="${pmdOutput}/$report_pmd.html" />
|
||||
<xslt in="${tempbuild}/report_pmd.xml" style="${pmdConfig}/wz-pmd-report.xslt" out="${pmdOutput}/report_pmd.html" />
|
||||
|
||||
### Examples
|
||||
|
||||
#### One ruleset
|
||||
|
||||
Running one ruleset to produce a HTML report (and printing the report to the console as well) using a file cache
|
||||
|
||||
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
|
||||
|
||||
<target name="pmd">
|
||||
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
|
||||
<pmd rulesetfiles="java-imports" cacheLocation="build/pmd/pmd.cache">
|
||||
<formatter type="html" toFile="pmd_report.html" toConsole="true"/>
|
||||
<fileset dir="C:\j2sdk1.4.1_01\src\java\lang\">
|
||||
@ -207,12 +253,11 @@ Running one ruleset to produce a HTML report (and printing the report to the con
|
||||
</pmd>
|
||||
</target>
|
||||
|
||||
#### Multiple rulesets
|
||||
|
||||
Running multiple rulesets to produce an XML report with the same analysis cache
|
||||
|
||||
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
|
||||
|
||||
<target name="pmd">
|
||||
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
|
||||
<pmd rulesetfiles="rulesets/java/imports.xml,java-unusedcode" cacheLocation="build/pmd/pmd.cache">
|
||||
<formatter type="xml" toFile="c:\pmd_report.xml"/>
|
||||
<fileset dir="C:\j2sdk1.4.1_01\src\java\lang\">
|
||||
@ -221,9 +266,19 @@ Running multiple rulesets to produce an XML report with the same analysis cache
|
||||
</pmd>
|
||||
</target>
|
||||
|
||||
Using a custom renderer
|
||||
#### Custom renderer
|
||||
|
||||
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
|
||||
Using a custom renderer. For this to work, you need to add you custom renderer to the classpath of PMD. This
|
||||
need to be configured when defining the task:
|
||||
|
||||
<path id="pmd.classpath">
|
||||
<fileset dir="/home/joe/pmd-bin-{{site.pmd.version}}/lib">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
<!-- the custom renderer is expected to be in /home/joe/pmd-addons/com/company/MyRenderer.class -->
|
||||
<pathelement location="/home/joe/pmd-addons" />
|
||||
</path>
|
||||
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath" />
|
||||
|
||||
<target name="pmd">
|
||||
<pmd rulesetfiles="rulesets/java/design.xml">
|
||||
@ -234,27 +289,57 @@ Using a custom renderer
|
||||
</pmd>
|
||||
</target>
|
||||
|
||||
Using a classpath reference in the taskdef
|
||||
#### Full example with auxclasspath
|
||||
|
||||
<path id="pmd.classpath">
|
||||
<pathelement location="${build}"/>
|
||||
<fileset dir="/path/to/my/pmd/lib/">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
</path>
|
||||
Full build file example using the correct auxclasspath configuration.
|
||||
Your project needs to be compiled first which happens in the target "compile":
|
||||
|
||||
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath"/>
|
||||
<project name="MyProject" default="pmd" basedir=".">
|
||||
<property name="src" location="src"/>
|
||||
<property name="build" location="build"/>
|
||||
<path id="project.dependencies">
|
||||
<pathelement location="lib/third-party.jar"/>
|
||||
<pathelement location="lib/xyz.jar"/>
|
||||
</path>
|
||||
<path id="pmd.classpath">
|
||||
<fileset dir="/home/joe/pmd-bin-{{site.pmd.version}}/lib">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
</path>
|
||||
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath" />
|
||||
|
||||
<target name="init">
|
||||
<mkdir dir="${build}"/>
|
||||
</target>
|
||||
|
||||
<target name="compile" depends="init">
|
||||
<javac srcdir="${src}" destdir="${build}" classpathref="project.dependencies"
|
||||
source="1.8" target="1.8" />
|
||||
</target>
|
||||
|
||||
<target name="pmd" depends="compile">
|
||||
<pmd cacheLocation="${build}/pmd.cache">
|
||||
<auxclasspath>
|
||||
<pathelement location="${build}"/>
|
||||
<path refid="project.dependencies"/>
|
||||
</auxclasspath>
|
||||
<ruleset>rulesets/java/quickstart.xml</ruleset>
|
||||
<formatter type="html" toFile="${build}/pmd_report.html"/>
|
||||
<sourceLanguage name="java" version="1.8"/>
|
||||
<fileset dir="${src}">
|
||||
<include name="**/*.java"/>
|
||||
</fileset>
|
||||
</pmd>
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="${build}"/>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
<target name="pmd">
|
||||
<pmd rulesetfiles="rulesets/java/design.xml">
|
||||
<formatter type="net.sourceforge.pmd.renderers.HTMLRenderer" toFile="foo.html"/>
|
||||
<fileset dir="/path/to/java/src">
|
||||
<include name="**/*.java"/>
|
||||
</fileset>
|
||||
</pmd>
|
||||
</target>
|
||||
You can run pmd then with `ant pmd`.
|
||||
|
||||
Getting verbose output
|
||||
#### Getting verbose output
|
||||
|
||||
[tom@hal bin]$ ant -v pmd
|
||||
Apache Ant version 1.6.2 compiled on July 16 2004
|
||||
@ -287,27 +372,16 @@ Getting verbose output
|
||||
Total time: 2 seconds
|
||||
[tom@hal bin]$
|
||||
|
||||
An HTML report with the "linkPrefix" gizmo
|
||||
#### HTML report with linkPrefix
|
||||
|
||||
An HTML report with the "linkPrefix" and "linePrefix" properties:
|
||||
|
||||
<target name="pmd">
|
||||
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
|
||||
<pmd rulesetfiles="java-basic" shortFilenames="true">
|
||||
<formatter type="html" toFile="pmd_report.html">
|
||||
<param name="linkPrefix" value="http://pmd.sourceforge.net/xref/"/>
|
||||
</formatter>
|
||||
<fileset dir="/usr/local/j2sdk1.4.1_01/src/">
|
||||
<include name="java/lang/*.java"/>
|
||||
</fileset>
|
||||
</pmd>
|
||||
</target>
|
||||
|
||||
An HTML report with the "linePrefix" gizmo
|
||||
|
||||
<target name="pmd">
|
||||
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
|
||||
<pmd rulesetfiles="java-basic" shortFilenames="true">
|
||||
<formatter type="html" toFile="pmd_report.html">
|
||||
<param name="linePrefix" value=".line"/>
|
||||
<param name="linkPrefix" value="https://maven.apache.org/plugins/maven-pmd-plugin/xref/"/>
|
||||
<param name="linePrefix" value="L"/>
|
||||
</formatter>
|
||||
<fileset dir="/usr/local/j2sdk1.4.1_01/src/">
|
||||
<include name="java/lang/*.java"/>
|
||||
|
@ -19,35 +19,87 @@ This is a {{ site.pmd.release_type }} release.
|
||||
|
||||
### New and noteworthy
|
||||
|
||||
#### Dart support
|
||||
#### PLSQL Grammar Updates
|
||||
|
||||
Thanks to the contribution from [Maikel Steneker](https://github.com/maikelsteneker), and built on top of the ongoing efforts to fully support Antlr-based languages,
|
||||
PMD now has CPD support for [Dart](https://www.dartlang.org/).
|
||||
The grammar has been updated to support Inline Constraints in CREATE TABLE statements. Additionally, the
|
||||
CREATE TABLE statement may now be followed by physical properties and table properties. However, these
|
||||
properties are skipped over during parsing.
|
||||
|
||||
Being based on a proper Antlr grammar, CPD can:
|
||||
* ignore comments
|
||||
* ignore imports / libraries
|
||||
* honor [comment-based suppressions](pmd_userdocs_cpd.html#suppression)
|
||||
The CREATE VIEW statement now supports subquery views.
|
||||
|
||||
The EXTRACT function can now be parsed correctly. It is used to extract values from a specified
|
||||
datetime field.
|
||||
|
||||
#### Modified Rules
|
||||
|
||||
* The Java rule {% rule "java/bestpractices/UnusedPrivateField" %} (`java-bestpractices`) now ignores by
|
||||
default fields, that are annotated with the Lombok experimental annotation `@Delegate`. This can be
|
||||
customized with the property `ignoredAnnotations`.
|
||||
|
||||
* The Java rule {% rule "java/design/SingularField" %} (`java-design`) now ignores by
|
||||
default fields, that are annotated with the Lombok experimental annotation `@Delegate`. This can be
|
||||
customized with the property `ignoredAnnotations`.
|
||||
|
||||
* The Java rules {% rule "java/multithreading/UnsynchronizedStaticFormatter" %} and
|
||||
{% rule "java/multithreading/UnsynchronizedStaticDateFormatter" %} (`java-multithreading`)
|
||||
now prefer synchronized blocks by default. They will raise a violation, if the synchronization is implemented
|
||||
on the method level. To allow the old behavior, the new property `allowMethodLevelSynchronization` can
|
||||
be enabled.
|
||||
|
||||
* The Java rule {% rule "java/design/UseUtilityClass" %} (`java-design`) has a new property `ignoredAnnotations`.
|
||||
By default, classes that are annotated with Lombok's `@UtilityClass` are ignored now.
|
||||
|
||||
### Fixed Issues
|
||||
|
||||
* go
|
||||
* [#1751](https://github.com/pmd/pmd/issues/1751): \[go] Parsing errors encountered with escaped backslash
|
||||
* java
|
||||
* [#1729](https://github.com/pmd/pmd/issues/1729): \[java] JavaRuleViolation loses information in `className` field when class has package-private access level
|
||||
* [#1848](https://github.com/pmd/pmd/issues/1848): \[java] Local classes should preserve their modifiers
|
||||
* java-bestpractices
|
||||
* [#1720](https://github.com/pmd/pmd/issues/1720): \[java] UnusedImports false positive for Javadoc link with array type
|
||||
* [#1703](https://github.com/pmd/pmd/issues/1703): \[java] UnusedPrivateField on member annotated with lombok @Delegate
|
||||
* [#1845](https://github.com/pmd/pmd/issues/1845): \[java] Regression in MethodReturnsInternalArray not handling enums
|
||||
* java-design
|
||||
* [#1760](https://github.com/pmd/pmd/issues/1760): \[java] UseObjectForClearerAPI flags private methods
|
||||
* [#1094](https://github.com/pmd/pmd/issues/1094): \[java] UseUtilityClass should be LombokAware
|
||||
* java-multithreading
|
||||
* [#1814](https://github.com/pmd/pmd/issues/1814): \[java] UnsynchronizedStaticFormatter documentation and implementation wrong
|
||||
* [#1815](https://github.com/pmd/pmd/issues/1815): \[java] False negative in UnsynchronizedStaticFormatter
|
||||
* plsql
|
||||
* [#1828](https://github.com/pmd/pmd/issues/1828): \[plsql] Parentheses stopped working
|
||||
* [#1850](https://github.com/pmd/pmd/issues/1850): \[plsql] Parsing errors with INSERT using returning or records and TRIM expression
|
||||
|
||||
### API Changes
|
||||
|
||||
#### Deprecated APIs
|
||||
|
||||
> Reminder: Please don't use members marked with the annotation {% jdoc core::annotation.InternalApi %}, as they will likely be removed, hidden, or otherwise intentionally broken with 7.0.0.
|
||||
|
||||
|
||||
##### In ASTs
|
||||
|
||||
As part of the changes we'd like to do to AST classes for 7.0.0, we would like to
|
||||
hide some methods and constructors that rule writers should not have access to.
|
||||
The following usages are now deprecated **in the Java AST** (with other languages to come):
|
||||
|
||||
* Manual instantiation of nodes. **Constructors of node classes are deprecated** and marked {% jdoc core::annotation.InternalApi %}. Nodes should only be obtained from the parser, which for rules, means that never need to instantiate node themselves. Those constructors will be made package private with 7.0.0.
|
||||
* **Subclassing of abstract node classes, or usage of their type**. Version 7.0.0 will bring a new set of abstractions that will be public API, but the base classes are and will stay internal. You should not couple your code to them.
|
||||
* In the meantime you should use interfaces like {% jdoc java::lang.java.ast.JavaNode %} or {% jdoc core::lang.ast.Node %}, or the other published interfaces in this package, to refer to nodes generically.
|
||||
* Concrete node classes will **be made final** with 7.0.0.
|
||||
* Setters found in any node class or interface. **Rules should consider the AST immutable**. We will make those setters package private with 7.0.0.
|
||||
|
||||
Please look at {% jdoc_package java::lang.java.ast %} to find out the full list
|
||||
of deprecations.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### External Contributions
|
||||
|
||||
* [#1745](https://github.com/pmd/pmd/pull/1745): \[doc] Fixed some errors in docs - [0xflotus](https://github.com/0xflotus)
|
||||
* [#1746](https://github.com/pmd/pmd/pull/1746): \[java] Update rule to prevent UnusedImport when using JavaDoc with array type - [itaigilo](https://github.com/itaigilo)
|
||||
* [#1752](https://github.com/pmd/pmd/pull/1752): \[java] UseObjectForClearerAPI Only For Public - [Björn Kautler](https://github.com/Vampire)
|
||||
* [#1761](https://github.com/pmd/pmd/pull/1761): \[dart] \[cpd] Added CPD support for Dart - [Maikel Steneker](https://github.com/maikelsteneker)
|
||||
* [#1792](https://github.com/pmd/pmd/pull/1792): \[java] Added lombok.experimental to AbstractLombokAwareRule - [jakivey32](https://github.com/jakivey32)
|
||||
* [#1808](https://github.com/pmd/pmd/pull/1808): \[plsql] Fix PL/SQL Syntax errors - [kabroxiko](https://github.com/kabroxiko)
|
||||
* [#1829](https://github.com/pmd/pmd/pull/1829): \[java] Fix false negative in UnsynchronizedStaticFormatter - [Srinivasan Venkatachalam](https://github.com/Srini1993)
|
||||
* [#1847](https://github.com/pmd/pmd/pull/1847): \[java] Regression in MethodReturnsInternalArray not handling enums - [Artem](https://github.com/KroArtem)
|
||||
* [#1863](https://github.com/pmd/pmd/pull/1863): \[plsql] Add Table InlineConstraint - [kabroxiko](https://github.com/kabroxiko)
|
||||
* [#1864](https://github.com/pmd/pmd/pull/1864): \[plsql] Add support for Subquery Views - [kabroxiko](https://github.com/kabroxiko)
|
||||
* [#1865](https://github.com/pmd/pmd/pull/1865): \[plsql] Add Support for Extract Expression - [kabroxiko](https://github.com/kabroxiko)
|
||||
|
||||
{% endtocmaker %}
|
||||
|
||||
|
@ -5,6 +5,257 @@ permalink: pmd_release_notes_old.html
|
||||
|
||||
Previous versions of PMD can be downloaded here: https://github.com/pmd/pmd/releases
|
||||
|
||||
## 26-May-2019 - 6.15.0
|
||||
|
||||
The PMD team is pleased to announce PMD 6.15.0.
|
||||
|
||||
This is a minor release.
|
||||
|
||||
### Table Of Contents
|
||||
|
||||
* [New and noteworthy](#new-and-noteworthy)
|
||||
* [Enhanced Matlab support](#enhanced-matlab-support)
|
||||
* [Enhanced C++ support](#enhanced-c++-support)
|
||||
* [New Rules](#new-rules)
|
||||
* [Modified Rules](#modified-rules)
|
||||
* [Deprecated Rules](#deprecated-rules)
|
||||
* [Fixed Issues](#fixed-issues)
|
||||
* [API Changes](#api-changes)
|
||||
* [Deprecated APIs](#deprecated-apis)
|
||||
* [For removal](#for-removal)
|
||||
* [External Contributions](#external-contributions)
|
||||
|
||||
### New and noteworthy
|
||||
|
||||
#### Enhanced Matlab support
|
||||
|
||||
Thanks to the contributions from [Maikel Steneker](https://github.com/maikelsteneker) CPD for Matlab can
|
||||
now parse Matlab programs which use the question mark operator to specify access to
|
||||
class members:
|
||||
|
||||
```
|
||||
classdef Class1
|
||||
properties (SetAccess = ?Class2)
|
||||
```
|
||||
|
||||
CPD also understands now double quoted strings, which are supported since version R2017a of Matlab:
|
||||
|
||||
```
|
||||
str = "This is a string"
|
||||
```
|
||||
|
||||
#### Enhanced C++ support
|
||||
|
||||
CPD now supports digit separators in C++ (language module "cpp"). This is a C++14 feature.
|
||||
|
||||
Example: `auto integer_literal = 1'000'000;`
|
||||
|
||||
The single quotes can be used to add some structure to large numbers.
|
||||
|
||||
CPD also parses raw string literals now correctly (see [#1784](https://github.com/pmd/pmd/issues/1784)).
|
||||
|
||||
#### New Rules
|
||||
|
||||
* The new Apex rule [`FieldNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#fieldnamingconventions) (`apex-codestyle`) checks the naming
|
||||
conventions for field declarations. By default this rule uses the standard Apex naming convention (Camel case),
|
||||
but it can be configured through properties.
|
||||
|
||||
* The new Apex rule [`FormalParameterNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#formalparameternamingconventions) (`apex-codestyle`) checks the
|
||||
naming conventions for formal parameters of methods. By default this rule uses the standard Apex naming
|
||||
convention (Camel case), but it can be configured through properties.
|
||||
|
||||
* The new Apex rule [`LocalVariableNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#localvariablenamingconventions) (`apex-codestyle`) checks the
|
||||
naming conventions for local variable declarations. By default this rule uses the standard Apex naming
|
||||
convention (Camel case), but it can be configured through properties.
|
||||
|
||||
* The new Apex rule [`PropertyNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#propertynamingconventions) (`apex-codestyle`) checks the naming
|
||||
conventions for property declarations. By default this rule uses the standard Apex naming convention (Camel case),
|
||||
but it can be configured through properties.
|
||||
|
||||
* The new Java rule [`UseShortArrayInitializer`](https://pmd.github.io/pmd-6.15.0/pmd_rules_java_codestyle.html#useshortarrayinitializer) (`java-codestyle`) searches for
|
||||
array initialization expressions, which can be written shorter.
|
||||
|
||||
#### Modified Rules
|
||||
|
||||
* The Apex rule [`ClassNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#classnamingconventions) (`apex-codestyle`) can now be configured
|
||||
using various properties for the specific kind of type declarations (e.g. class, interface, enum).
|
||||
As before, this rule uses by default the standard Apex naming convention (Pascal case).
|
||||
|
||||
* The Apex rule [`MethodNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#methodnamingconventions) (`apex-codestyle`) can now be configured
|
||||
using various properties to differenciate e.g. static methods and test methods.
|
||||
As before, this rule uses by default the standard Apex naming convention (Camel case).
|
||||
|
||||
* The Java rule [`FieldNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_java_codestyle.html#fieldnamingconventions) (`java-codestyle`) now by default ignores
|
||||
the field `serialPersistentFields`. Since this is a field which needs to have this special name, no
|
||||
field naming conventions can be applied here. It is excluded the same way like `serialVersionUID` via the
|
||||
property `exclusions`.
|
||||
|
||||
* The Java rule [`CommentRequired`](https://pmd.github.io/pmd-6.15.0/pmd_rules_java_documentation.html#commentrequired) (`java-documentation`) has a new property
|
||||
`serialPersistentFieldsCommentRequired` with the default value "Ignored". This means that from now
|
||||
on comments for the field `serialPersistentFields` are not required anymore. You can change the property
|
||||
to restore the old behavior.
|
||||
|
||||
* The Java rule [`ProperLogger`](https://pmd.github.io/pmd-6.15.0/pmd_rules_java_errorprone.html#properlogger) (`java-errorprone`) has two new properties
|
||||
to configure the logger class (e.g. "org.slf4j.Logger") and the logger name of the special case,
|
||||
when the logger is not static. The name of the static logger variable was already configurable.
|
||||
The new property "loggerClass" allows to use this rule for different logging frameworks.
|
||||
This rule covers all the cases of the now deprecated rule [`LoggerIsNotStaticFinal`](https://pmd.github.io/pmd-6.15.0/pmd_rules_java_errorprone.html#loggerisnotstaticfinal).
|
||||
|
||||
* The Java rule [`CommentDefaultAccessModifier`](https://pmd.github.io/pmd-6.15.0/pmd_rules_java_codestyle.html#commentdefaultaccessmodifier) (`java-codestyle`) now reports also
|
||||
missing comments for top-level classes and annotations, that are package-private.
|
||||
|
||||
#### Deprecated Rules
|
||||
|
||||
* The Apex rule [`VariableNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#variablenamingconventions) (`apex-codestyle`) has been deprecated and
|
||||
will be removed with PMD 7.0.0. The rule is replaced by the more general rules
|
||||
[`FieldNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#fieldnamingconventions),
|
||||
[`FormalParameterNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#formalparameternamingconventions),
|
||||
[`LocalVariableNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#localvariablenamingconventions), and
|
||||
[`PropertyNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#propertynamingconventions).
|
||||
|
||||
* The Java rule [`LoggerIsNotStaticFinal`](https://pmd.github.io/pmd-6.15.0/pmd_rules_java_errorprone.html#loggerisnotstaticfinal) (`java-errorprone`) has been deprecated
|
||||
and will be removed with PMD 7.0.0. The rule is replaced by [`ProperLogger`](https://pmd.github.io/pmd-6.15.0/pmd_rules_java_errorprone.html#properlogger).
|
||||
|
||||
### Fixed Issues
|
||||
|
||||
* apex
|
||||
* [#1321](https://github.com/pmd/pmd/issues/1321): \[apex] Should VariableNamingConventions require properties to start with a lowercase letter?
|
||||
* [#1783](https://github.com/pmd/pmd/issues/1783): \[apex] comments on constructor not recognized when the Class has inner class
|
||||
* cpp
|
||||
* [#1784](https://github.com/pmd/pmd/issues/1784): \[cpp] Improve support for raw string literals
|
||||
* dart
|
||||
* [#1809](https://github.com/pmd/pmd/issues/1809): \[dart] \[cpd] Parse error with escape sequences
|
||||
* java
|
||||
* [#1842](https://github.com/pmd/pmd/issues/1842): \[java] Annotated module declarations cause parse error
|
||||
* java-bestpractices
|
||||
* [#1738](https://github.com/pmd/pmd/issues/1738): \[java] MethodReturnsInternalArray does not work in inner classes
|
||||
* java-codestyle
|
||||
* [#1495](https://github.com/pmd/pmd/issues/1495): \[java] Rule to detect overly verbose array initializiation
|
||||
* [#1684](https://github.com/pmd/pmd/issues/1684): \[java] Properly whitelist serialPersistentFields
|
||||
* [#1804](https://github.com/pmd/pmd/issues/1804): \[java] NPE in UnnecessaryLocalBeforeReturnRule
|
||||
* python
|
||||
* [#1810](https://github.com/pmd/pmd/issues/1810): \[python] \[cpd] Parse error when using Python 2 backticks
|
||||
* matlab
|
||||
* [#1830](https://github.com/pmd/pmd/issues/1830): \[matlab] \[cpd] Parse error with comments
|
||||
* [#1793](https://github.com/pmd/pmd/issues/1793): \[java] CommentDefaultAccessModifier not working for classes
|
||||
|
||||
### API Changes
|
||||
|
||||
#### Deprecated APIs
|
||||
|
||||
##### For removal
|
||||
|
||||
* The `DumpFacades` in all languages, that could be used to transform a AST into a textual representation,
|
||||
will be removed with PMD 7. The rule designer is a better way to inspect nodes.
|
||||
* [`net.sourceforge.pmd.lang.apex.ast.DumpFacade`](https://javadoc.io/page/net.sourceforge.pmd/pmd-apex/6.15.0/net/sourceforge/pmd/lang/apex/ast/DumpFacade.html#)
|
||||
* [`net.sourceforge.pmd.lang.java.ast.DumpFacade`](https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.15.0/net/sourceforge/pmd/lang/java/ast/DumpFacade.html#)
|
||||
* [`net.sourceforge.pmd.lang.ecmascript.ast.DumpFacade`](https://javadoc.io/page/net.sourceforge.pmd/pmd-javascript/6.15.0/net/sourceforge/pmd/lang/ecmascript/ast/DumpFacade.html#)
|
||||
* [`net.sourceforge.pmd.lang.jsp.ast.DumpFacade`](https://javadoc.io/page/net.sourceforge.pmd/pmd-jsp/6.15.0/net/sourceforge/pmd/lang/jsp/ast/DumpFacade.html#)
|
||||
* [`net.sourceforge.pmd.lang.plsql.ast.DumpFacade`](https://javadoc.io/page/net.sourceforge.pmd/pmd-plsql/6.15.0/net/sourceforge/pmd/lang/plsql/ast/DumpFacade.html#)
|
||||
* [`net.sourceforge.pmd.lang.vf.ast.DumpFacade`](https://javadoc.io/page/net.sourceforge.pmd/pmd-visualforce/6.15.0/net/sourceforge/pmd/lang/vf/ast/DumpFacade.html#)
|
||||
* [`net.sourceforge.pmd.lang.vm.ast.AbstractVmNode#dump`](https://javadoc.io/page/net.sourceforge.pmd/pmd-vm/6.15.0/net/sourceforge/pmd/lang/vm/ast/AbstractVmNode.html#dump(String,boolean,Writer))
|
||||
* [`net.sourceforge.pmd.lang.xml.ast.DumpFacade`](https://javadoc.io/page/net.sourceforge.pmd/pmd-xml/6.15.0/net/sourceforge/pmd/lang/xml/ast/DumpFacade.html#)
|
||||
* The method [`LanguageVersionHandler#getDumpFacade`](https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.15.0/net/sourceforge/pmd/lang/LanguageVersionHandler.html#getDumpFacade(Writer,String,boolean)) will be
|
||||
removed as well. It is deprecated, along with all its implementations in the subclasses of [`LanguageVersionHandler`](https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.15.0/net/sourceforge/pmd/lang/LanguageVersionHandler.html#).
|
||||
|
||||
### External Contributions
|
||||
|
||||
* [#1647](https://github.com/pmd/pmd/pull/1647): \[java] Rule to detect overly verbose array initialization - [Victor](https://github.com/IDoCodingStuffs)
|
||||
* [#1762](https://github.com/pmd/pmd/pull/1762): \[java] LoggerIsNotStaticFinal and ProperLogger - make class-name configurable - [Ivo Šmíd](https://github.com/bedla)
|
||||
* [#1798](https://github.com/pmd/pmd/pull/1798): \[java] Make CommentDefaultAccessModifier work for top-level classes - [Boris Petrov](https://github.com/boris-petrov)
|
||||
* [#1799](https://github.com/pmd/pmd/pull/1799): \[java] MethodReturnsInternalArray does not work in inner classes - Fixed #1738 - [Srinivasan Venkatachalam](https://github.com/Srini1993)
|
||||
* [#1802](https://github.com/pmd/pmd/pull/1802): \[python] \[cpd] Add support for Python 2 backticks - [Maikel Steneker](https://github.com/maikelsteneker)
|
||||
* [#1803](https://github.com/pmd/pmd/pull/1803): \[dart] \[cpd] Dart escape sequences - [Maikel Steneker](https://github.com/maikelsteneker)
|
||||
* [#1807](https://github.com/pmd/pmd/pull/1807): \[ci] Fix missing local branch issues when executing pmd-regression-tester - [BBG](https://github.com/djydewang)
|
||||
* [#1813](https://github.com/pmd/pmd/pull/1813): \[matlab] \[cpd] Matlab comments - [Maikel Steneker](https://github.com/maikelsteneker)
|
||||
* [#1816](https://github.com/pmd/pmd/pull/1816): \[apex] Fix ApexDoc handling with inner classes - [Jeff Hube](https://github.com/jeffhube)
|
||||
* [#1817](https://github.com/pmd/pmd/pull/1817): \[apex] Add configurable naming convention rules - [Jeff Hube](https://github.com/jeffhube)
|
||||
* [#1819](https://github.com/pmd/pmd/pull/1819): \[cpp] \[cpd] Add support for digit separators - [Maikel Steneker](https://github.com/maikelsteneker)
|
||||
* [#1820](https://github.com/pmd/pmd/pull/1820): \[cpp] \[cpd] Improve support for raw string literals - [Maikel Steneker](https://github.com/maikelsteneker)
|
||||
* [#1821](https://github.com/pmd/pmd/pull/1821): \[matlab] \[cpd] Matlab question mark token - [Maikel Steneker](https://github.com/maikelsteneker)
|
||||
* [#1822](https://github.com/pmd/pmd/pull/1822): \[matlab] \[cpd] Double quoted string - [Maikel Steneker](https://github.com/maikelsteneker)
|
||||
* [#1837](https://github.com/pmd/pmd/pull/1837): \[core] Minor performance improvements - [Michael Hausegger](https://github.com/TheRealHaui)
|
||||
* [#1838](https://github.com/pmd/pmd/pull/1838): \[dart] [cpd] Improved string tokenization - [Maikel Steneker](https://github.com/maikelsteneker)
|
||||
* [#1840](https://github.com/pmd/pmd/pull/1840): \[java] Whitelist serialPersistentFields - [Marcel Härle](https://github.com/marcelhaerle)
|
||||
|
||||
## 28-April-2019 - 6.14.0
|
||||
|
||||
The PMD team is pleased to announce PMD 6.14.0.
|
||||
|
||||
This is a minor release.
|
||||
|
||||
### Table Of Contents
|
||||
|
||||
* [New and noteworthy](#new-and-noteworthy)
|
||||
* [Dart support](#dart-support)
|
||||
* [Updated PMD Designer](#updated-pmd-designer)
|
||||
* [Modified Rules](#modified-rules)
|
||||
* [Fixed Issues](#fixed-issues)
|
||||
* [API Changes](#api-changes)
|
||||
* [External Contributions](#external-contributions)
|
||||
|
||||
### New and noteworthy
|
||||
|
||||
#### Dart support
|
||||
|
||||
Thanks to the contribution from [Maikel Steneker](https://github.com/maikelsteneker), and built on top of the ongoing efforts to fully support Antlr-based languages,
|
||||
PMD now has CPD support for [Dart](https://www.dartlang.org/).
|
||||
|
||||
Being based on a proper Antlr grammar, CPD can:
|
||||
* ignore comments
|
||||
* ignore imports / libraries
|
||||
* honor [comment-based suppressions](pmd_userdocs_cpd.html#suppression)
|
||||
|
||||
#### Updated PMD Designer
|
||||
|
||||
This PMD release ships a new version of the pmd-designer.
|
||||
For the changes, see [PMD Designer Changelog](https://github.com/pmd/pmd-designer/blob/6.14.0/CHANGELOG.md).
|
||||
|
||||
### Modified Rules
|
||||
|
||||
* The Java rule [`AssignmentToNonFinalStatic`](https://pmd.github.io/pmd-6.14.0/pmd_rules_java_errorprone.html#assignmenttononfinalstatic) (`java-errorprone`) will now report on each
|
||||
assignment made within a constructor rather than on the field declaration. This makes it easier for developers to
|
||||
find the offending statements.
|
||||
|
||||
* The Java rule [`NoPackage`](https://pmd.github.io/pmd-6.14.0/pmd_rules_java_codestyle.html#nopackage) (`java-codestyle`) will now report additionally enums
|
||||
and annotations that do not have a package declaration.
|
||||
|
||||
### Fixed Issues
|
||||
|
||||
* all
|
||||
* [#1515](https://github.com/pmd/pmd/issues/1515): \[core] Module pmd-lang-test is missing javadoc artifact
|
||||
* [#1788](https://github.com/pmd/pmd/issues/1788): \[cpd] \[core] Use better `ClassLoader` for `ServiceLoader` in `LanguageFactory`
|
||||
* [#1794](https://github.com/pmd/pmd/issues/1794): \[core] Ruleset Compatibility fails with excluding rules
|
||||
* go
|
||||
* [#1751](https://github.com/pmd/pmd/issues/1751): \[go] Parsing errors encountered with escaped backslash
|
||||
* java
|
||||
* [#1532](https://github.com/pmd/pmd/issues/1532): \[java] NPE with incomplete auxclasspath
|
||||
* [#1691](https://github.com/pmd/pmd/issues/1691): \[java] Possible Data Race in JavaTypeDefinitionSimple.getGenericType
|
||||
* [#1729](https://github.com/pmd/pmd/issues/1729): \[java] JavaRuleViolation loses information in `className` field when class has package-private access level
|
||||
* java-bestpractices
|
||||
* [#1190](https://github.com/pmd/pmd/issues/1190): \[java] UnusedLocalVariable/UnusedPrivateField false-positive
|
||||
* [#1720](https://github.com/pmd/pmd/issues/1720): \[java] UnusedImports false positive for Javadoc link with array type
|
||||
* java-codestyle
|
||||
* [#1755](https://github.com/pmd/pmd/issues/1775): \[java] False negative in UnnecessaryLocalBeforeReturn when splitting statements across multiple lines
|
||||
* [#1782](https://github.com/pmd/pmd/issues/1782): \[java] NoPackage: False Negative for enums
|
||||
* java-design
|
||||
* [#1760](https://github.com/pmd/pmd/issues/1760): \[java] UseObjectForClearerAPI flags private methods
|
||||
|
||||
### API Changes
|
||||
|
||||
No changes.
|
||||
|
||||
### External Contributions
|
||||
|
||||
* [#1745](https://github.com/pmd/pmd/pull/1745): \[doc] Fixed some errors in docs - [0xflotus](https://github.com/0xflotus)
|
||||
* [#1746](https://github.com/pmd/pmd/pull/1746): \[java] Update rule to prevent UnusedImport when using JavaDoc with array type - [itaigilo](https://github.com/itaigilo)
|
||||
* [#1752](https://github.com/pmd/pmd/pull/1752): \[java] UseObjectForClearerAPI Only For Public - [Björn Kautler](https://github.com/Vampire)
|
||||
* [#1761](https://github.com/pmd/pmd/pull/1761): \[dart] \[cpd] Added CPD support for Dart - [Maikel Steneker](https://github.com/maikelsteneker)
|
||||
* [#1776](https://github.com/pmd/pmd/pull/1776): \[java] Show more detailed message when can't resolve field type - [Andrey Fomin](https://github.com/andrey-fomin)
|
||||
* [#1781](https://github.com/pmd/pmd/pull/1781): \[java] Location change in AssignmentToNonFinalStatic - [Maikel Steneker](https://github.com/maikelsteneker)
|
||||
* [#1789](https://github.com/pmd/pmd/pull/1789): \[cpd] \[core] Use current classloader instead of Thread's classloader - [Andreas Schmid](https://github.com/aaschmid)
|
||||
* [#1791](https://github.com/pmd/pmd/pull/1791): \[dart] \[cpd] Dart escaped string - [Maikel Steneker](https://github.com/maikelsteneker)
|
||||
|
||||
## 31-March-2019 - 6.13.0
|
||||
|
||||
The PMD team is pleased to announce PMD 6.13.0.
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
package net.sourceforge.pmd.lang.apex;
|
||||
|
||||
import java.io.Writer;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@ -16,7 +15,6 @@ import net.sourceforge.pmd.lang.XPathHandler;
|
||||
import net.sourceforge.pmd.lang.apex.ast.ASTMethod;
|
||||
import net.sourceforge.pmd.lang.apex.ast.ASTUserClassOrInterface;
|
||||
import net.sourceforge.pmd.lang.apex.ast.ApexNode;
|
||||
import net.sourceforge.pmd.lang.apex.ast.DumpFacade;
|
||||
import net.sourceforge.pmd.lang.apex.metrics.ApexMetricsComputer;
|
||||
import net.sourceforge.pmd.lang.apex.metrics.api.ApexClassMetricKey;
|
||||
import net.sourceforge.pmd.lang.apex.metrics.api.ApexOperationMetricKey;
|
||||
@ -58,11 +56,6 @@ public class ApexHandler extends AbstractPmdLanguageVersionHandler {
|
||||
return new ApexParser(parserOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisitorStarter getDumpFacade(Writer writer, String prefix, boolean recurse) {
|
||||
return rootNode -> new DumpFacade().initializeWith(writer, prefix, recurse, (ApexNode<?>) rootNode);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public LanguageMetricsProvider<ASTUserClassOrInterface<?>, ASTMethod> getLanguageMetricsProvider() {
|
||||
|
@ -4,11 +4,8 @@
|
||||
|
||||
package net.sourceforge.pmd.lang.apex.ast;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.sourceforge.pmd.Rule;
|
||||
|
||||
import apex.jorje.data.Identifier;
|
||||
import apex.jorje.semantic.ast.compilation.UserClass;
|
||||
|
||||
public class ASTUserClass extends ApexRootNode<UserClass> implements ASTUserClassOrInterface<UserClass>,
|
||||
@ -29,14 +26,8 @@ public class ASTUserClass extends ApexRootNode<UserClass> implements ASTUserClas
|
||||
|
||||
@Override
|
||||
public String getImage() {
|
||||
try {
|
||||
Field field = node.getClass().getDeclaredField("name");
|
||||
field.setAccessible(true);
|
||||
Identifier name = (Identifier) field.get(node);
|
||||
return name.getValue();
|
||||
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
String apexName = node.getDefiningType().getApexName();
|
||||
return apexName.substring(apexName.lastIndexOf('.') + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,7 +19,8 @@ public class ASTUserEnum extends ApexRootNode<UserEnum> {
|
||||
|
||||
@Override
|
||||
public String getImage() {
|
||||
return node.getClass().getName();
|
||||
String apexName = node.getDefiningType().getApexName();
|
||||
return apexName.substring(apexName.lastIndexOf('.') + 1);
|
||||
}
|
||||
|
||||
public ASTModifierNode getModifiers() {
|
||||
|
@ -4,11 +4,8 @@
|
||||
|
||||
package net.sourceforge.pmd.lang.apex.ast;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.sourceforge.pmd.Rule;
|
||||
|
||||
import apex.jorje.data.Identifier;
|
||||
import apex.jorje.semantic.ast.compilation.UserInterface;
|
||||
|
||||
public class ASTUserInterface extends ApexRootNode<UserInterface> implements ASTUserClassOrInterface<UserInterface>,
|
||||
@ -27,14 +24,8 @@ public class ASTUserInterface extends ApexRootNode<UserInterface> implements AST
|
||||
|
||||
@Override
|
||||
public String getImage() {
|
||||
try {
|
||||
Field field = node.getClass().getDeclaredField("name");
|
||||
field.setAccessible(true);
|
||||
Identifier name = (Identifier) field.get(node);
|
||||
return name.getValue();
|
||||
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
String apexName = node.getDefiningType().getApexName();
|
||||
return apexName.substring(apexName.lastIndexOf('.') + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,9 +4,6 @@
|
||||
|
||||
package net.sourceforge.pmd.lang.apex.ast;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import apex.jorje.data.Identifier;
|
||||
import apex.jorje.semantic.ast.compilation.UserTrigger;
|
||||
|
||||
public class ASTUserTrigger extends ApexRootNode<UserTrigger> {
|
||||
@ -22,14 +19,7 @@ public class ASTUserTrigger extends ApexRootNode<UserTrigger> {
|
||||
|
||||
@Override
|
||||
public String getImage() {
|
||||
try {
|
||||
Field field = node.getClass().getDeclaredField("name");
|
||||
field.setAccessible(true);
|
||||
Identifier name = (Identifier) field.get(node);
|
||||
return name.getValue();
|
||||
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return node.getDefiningType().getApexName();
|
||||
}
|
||||
|
||||
public ASTModifierNode getModifiers() {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user