forked from phoedos/pmd
Merge branch 'master' into experimental-apex-parser
This commit is contained in:
commit
17848c484d
@ -323,7 +323,7 @@ ${rendered_release_notes}"
|
||||
#
|
||||
function pmd_ci_dogfood() {
|
||||
local mpmdVersion=()
|
||||
./mvnw versions:set -DnewVersion="${PMD_CI_MAVEN_PROJECT_VERSION}-dogfood" -DgenerateBackupPoms=false
|
||||
./mvnw versions:set -DnewVersion="${PMD_CI_MAVEN_PROJECT_VERSION%-SNAPSHOT}-dogfood-SNAPSHOT" -DgenerateBackupPoms=false
|
||||
sed -i 's/<version>[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}.*<\/version>\( *<!-- pmd.dogfood.version -->\)/<version>'"${PMD_CI_MAVEN_PROJECT_VERSION}"'<\/version>\1/' pom.xml
|
||||
./mvnw verify --show-version --errors --batch-mode "${PMD_MAVEN_EXTRA_OPTS[@]}" \
|
||||
"${mpmdVersion[@]}" \
|
||||
|
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -41,7 +41,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.m2/repository
|
||||
|
2
.github/workflows/troubleshooting.yml
vendored
2
.github/workflows/troubleshooting.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.m2/repository
|
||||
|
@ -84,17 +84,12 @@ if [ "${BUILD_TOOLS_VERSION}" != "${BUILD_TOOLS_VERSION_RELEASE}" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RELEASE_RULESET="pmd-core/src/main/resources/rulesets/releases/${RELEASE_VERSION//\./}.xml"
|
||||
|
||||
echo "* Update date info in **docs/_config.yml**."
|
||||
echo " date: $(date -u +%d-%B-%Y)"
|
||||
echo
|
||||
echo "* Update version info in **docs/_config.yml**."
|
||||
echo " remove the SNAPSHOT from site.pmd.version"
|
||||
echo
|
||||
echo "* Ensure all the new rules are listed in the proper file:"
|
||||
echo " ${RELEASE_RULESET}"
|
||||
echo
|
||||
echo "* Update **pmd-apex/src/main/resources/rulesets/apex/quickstart.xml** and"
|
||||
echo " **pmd-java/src/main/resources/rulesets/java/quickstart.xml** with the new rules."
|
||||
echo
|
||||
@ -151,11 +146,6 @@ EOF
|
||||
|
||||
echo "Committing current changes (pmd)"
|
||||
|
||||
if [[ -e "${RELEASE_RULESET}" ]]
|
||||
then
|
||||
git add "${RELEASE_RULESET}"
|
||||
fi
|
||||
|
||||
git commit -a -m "Prepare pmd release ${RELEASE_VERSION}"
|
||||
(
|
||||
cd ../pmd.github.io
|
||||
|
@ -119,15 +119,15 @@ definitely don't come for free. It is much effort and requires perseverance to i
|
||||
|
||||
### 5. Create a TokenManager
|
||||
* This is needed to support CPD (copy paste detection)
|
||||
* We provide a default implementation using [`AntlrTokenManager`](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/cpd/impl/AntlrTokenizer.java).
|
||||
* You must create your own "AntlrTokenizer" such as we do with
|
||||
[`SwiftTokenizer`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/cpd/SwiftTokenizer.java).
|
||||
* We provide a default implementation using [`AntlrTokenManager`](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrTokenManager.java).
|
||||
* You must create your own "AntlrCpdLexer" such as we do with
|
||||
[`SwiftCpdLexer`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/cpd/SwiftCpdLexer.java).
|
||||
* If you wish to filter specific tokens (e.g. comments to support CPD suppression via "CPD-OFF" and "CPD-ON")
|
||||
you can create your own implementation of
|
||||
[`AntlrTokenFilter`](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/cpd/impl/AntlrTokenFilter.java).
|
||||
You'll need to override then the protected method `getTokenFilter(AntlrTokenManager)`
|
||||
and return your custom filter. See the tokenizer for C# as an exmaple:
|
||||
[`CsTokenizer`](https://github.com/pmd/pmd/blob/master/pmd-cs/src/main/java/net/sourceforge/pmd/lang/cs/cpd/CsTokenizer.java).
|
||||
and return your custom filter. See the CpdLexer for C# as an exmaple:
|
||||
[`CsCpdLexer`](https://github.com/pmd/pmd/blob/master/pmd-cs/src/main/java/net/sourceforge/pmd/lang/cs/cpd/CsCpdLexer.java).
|
||||
|
||||
If you don't need a custom token filter, you don't need to override the method. It returns the default
|
||||
`AntlrTokenFilter` which doesn't filter anything.
|
||||
|
@ -11,7 +11,7 @@ author: Matías Fraga, Clément Fournier
|
||||
## Adding support for a CPD language
|
||||
|
||||
CPD works generically on the tokens produced by a {% jdoc core::cpd.Tokenizer %}.
|
||||
To add support for a new language, the crucial piece is writing a tokenizer that
|
||||
To add support for a new language, the crucial piece is writing a CpdLexer that
|
||||
splits the source file into the tokens specific to your language. Thankfully you
|
||||
can use a stock [Antlr grammar](https://github.com/antlr/grammars-v4) or JavaCC
|
||||
grammar to generate a lexer for you. If you cannot use a lexer generator, for
|
||||
@ -31,12 +31,12 @@ Use the following guide to set up a new language module that supports CPD.
|
||||
the lexer from the grammar. To do so, edit `pom.xml` (eg like [the Golang module](https://github.com/pmd/pmd/tree/master/pmd-go/pom.xml)).
|
||||
Once that is done, `mvn generate-sources` should generate the lexer sources for you.
|
||||
|
||||
You can now implement a tokenizer, for instance by extending {% jdoc core::cpd.impl.AntlrTokenizer %}. The following reproduces the Go implementation:
|
||||
You can now implement a CpdLexer, for instance by extending {% jdoc core::cpd.impl.AntlrCpdLexer %}. The following reproduces the Go implementation:
|
||||
```java
|
||||
// mind the package convention if you are going to make a PR
|
||||
package net.sourceforge.pmd.lang.go.cpd;
|
||||
|
||||
public class GoTokenizer extends AntlrTokenizer {
|
||||
public class GoCpdLexer extends AntlrCpdLexer {
|
||||
|
||||
@Override
|
||||
protected Lexer getLexerForSource(CharStream charStream) {
|
||||
@ -64,9 +64,9 @@ If your language only supports CPD, then you can subclass {% jdoc core::lang.imp
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tokenizer createCpdTokenizer(LanguagePropertyBundle bundle) {
|
||||
// This method should return an instance of the tokenizer you created.
|
||||
return new GoTokenizer();
|
||||
public Tokenizer createCpdLexer(LanguagePropertyBundle bundle) {
|
||||
// This method should return an instance of the CpdLexer you created.
|
||||
return new GoCpdLexer();
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -77,7 +77,7 @@ If your language only supports CPD, then you can subclass {% jdoc core::lang.imp
|
||||
|
||||
4. Update the test that asserts the list of supported languages by updating the `SUPPORTED_LANGUAGES` constant in [BinaryDistributionIT](https://github.com/pmd/pmd/blob/master/pmd-dist/src/test/java/net/sourceforge/pmd/it/BinaryDistributionIT.java).
|
||||
|
||||
5. Add some tests for your tokenizer by following the [section below](#testing-your-implementation).
|
||||
5. Add some tests for your CpdLexer by following the [section below](#testing-your-implementation).
|
||||
|
||||
6. Finishing up your new language module by adding a page in the documentation. Create a new markdown file
|
||||
`<langId>.md` in `docs/pages/pmd/languages/`. This file should have the following frontmatter:
|
||||
@ -100,10 +100,10 @@ If your language only supports CPD, then you can subclass {% jdoc core::lang.imp
|
||||
{% endraw %}
|
||||
```
|
||||
|
||||
### Declaring tokenizer options
|
||||
### Declaring CpdLexer options
|
||||
|
||||
To make the tokenizer configurable, first define some property descriptors using
|
||||
{% jdoc core::properties.PropertyFactory %}. Look at {% jdoc core::cpd.Tokenizer %}
|
||||
To make the CpdLexer configurable, first define some property descriptors using
|
||||
{% jdoc core::properties.PropertyFactory %}. Look at {% jdoc core::cpd.CpdLexer %}
|
||||
for some predefined ones which you can reuse (prefer reusing property descriptors if you can).
|
||||
You need to override {% jdoc core::Language#newPropertyBundle() %}
|
||||
and call `definePropertyDescriptor` to register the descriptors.
|
||||
@ -112,13 +112,13 @@ of {% jdoc core::cpd.CpdCapableLanguage#createCpdTokenizer(core::lang.LanguagePr
|
||||
|
||||
To implement simple token filtering, you can use {% jdoc core::cpd.impl.BaseTokenFilter %}
|
||||
as a base class, or another base class in {% jdoc_package core::cpd.impl %}.
|
||||
Take a look at the [Kotlin token filter implementation](https://github.com/pmd/pmd/blob/master/pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/cpd/KotlinTokenizer.java), or the [Java one](https://github.com/pmd/pmd/blob/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/cpd/JavaTokenizer.java).
|
||||
Take a look at the [Kotlin token filter implementation](https://github.com/pmd/pmd/blob/master/pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/cpd/KotlinCpdLexer.java), or the [Java one](https://github.com/pmd/pmd/blob/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/cpd/JavaCpdLexer.java).
|
||||
|
||||
|
||||
### Testing your implementation
|
||||
|
||||
Add a Maven dependency on `pmd-lang-test` (scope `test`) in your `pom.xml`.
|
||||
This contains utilities to test your tokenizer.
|
||||
This contains utilities to test your CpdLexer.
|
||||
|
||||
Create a test class extending from {% jdoc lang-test::cpd.test.CpdTextComparisonTest %}.
|
||||
To add tests, you need to write regular JUnit `@Test`-annotated methods, and
|
||||
|
@ -24,7 +24,7 @@ PropertyName is the name of the property converted to SCREAMING_SNAKE_CASE, that
|
||||
|
||||
As a convention, properties whose name start with an *x* are internal and may be removed or changed without notice.
|
||||
|
||||
Properties whose name start with **CPD** are used to configure CPD tokenizer options.
|
||||
Properties whose name start with **CPD** are used to configure CPD CpdLexer options.
|
||||
|
||||
Programmatically, the language properties can be set on `PMDConfiguration` (or `CPDConfiguration`) before using the
|
||||
{%jdoc core::PmdAnalyzer %} (or {%jdoc core::cpd.CpdAnalyzer %}) instance
|
||||
|
@ -81,8 +81,6 @@ pmd:
|
||||
The release type could be one of "bugfix" (e.g. 6.34.x), "minor" (6.x.0), or "major" (x.0.0).
|
||||
|
||||
The release notes usually mention any new rules that have been added since the last release.
|
||||
Please double-check the file `pmd-core/src/main/resources/rulesets/releases/<version>.xml`, so
|
||||
that all new rules are listed.
|
||||
|
||||
Add the new rules as comments to the quickstart rulesets:
|
||||
* `pmd-apex/src/main/resources/rulesets/apex/quickstart.xml`
|
||||
|
@ -42,6 +42,22 @@ There are a couple of deprecated things in PMD 6, you might encounter:
|
||||
```
|
||||
and often already suggest an alternative.
|
||||
|
||||
* If you still reference rulesets or rules the old way which has been deprecated since 6.46.0:
|
||||
- `<lang-name>-<ruleset-name>`, eg `java-basic`, which resolves to `rulesets/java/basic.xml`
|
||||
- the internal release number, eg `600`, which resolves to `rulesets/releases/600.xml`
|
||||
|
||||
Such usages produce deprecation warnings that should be easy to spot, e.g.
|
||||
```
|
||||
Ruleset reference 'java-basic' uses a deprecated form, use 'rulesets/java/basic.xml' instead
|
||||
```
|
||||
|
||||
Use the explicit forms of these references to be compatible with PMD 7.
|
||||
|
||||
Note: Since PMD 6, all rules are sorted into categories (such as "Best Practices", "Design", "Error Prone")
|
||||
and the old rulesets like `basic.xml` have been deprecated and have been removed with PMD 7.
|
||||
It is about time to create a [custom ruleset](pmd_userdocs_making_rulesets.html).
|
||||
|
||||
|
||||
## Use cases
|
||||
|
||||
### I'm using only built-in rules
|
||||
@ -97,6 +113,9 @@ After you have migrated your XPath rules to XPath 2.0, remove the "version" prop
|
||||
with PMD 7. PMD 7 by default uses XPath 3.1.
|
||||
See below [XPath](#xpath-migrating-from-10-to-20) for details.
|
||||
|
||||
There are some general changes for AST nodes regarding the `@Image` attribute.
|
||||
See below [General AST Changes to avoid @Image](#general-ast-changes-to-avoid-image).
|
||||
|
||||
Additional infos:
|
||||
* The custom XPath function `typeOf` has been removed (deprecated since 6.4.0).
|
||||
Use the function `pmd-java:typeIs` or `pmd-java:typeIsExactly` instead.
|
||||
@ -184,6 +203,7 @@ Most notable changes:
|
||||
an error message such as `[main] ERROR net.sourceforge.pmd.cli.commands.internal.PmdCommand - No such file false`.
|
||||
* PMD tries to display a progress bar. If you don't want this (e.g. on a CI build server), you can disable this
|
||||
with `--no-progress`.
|
||||
* `--no-ruleset-compatibility` has been removed
|
||||
|
||||
### Custom distribution packages
|
||||
|
||||
@ -387,6 +407,144 @@ XPath 1.0 and 2.0 queries. Here's a list of known incompatibilities:
|
||||
since there is a built-in function available since XPath 2.0 which can be used instead. If you use "pmd:matches"
|
||||
simply remove the "pmd:" prefix.
|
||||
|
||||
### General AST Changes to avoid @Image
|
||||
|
||||
An abstract syntax tree should be abstract, but in the same time, should not be too abstract. One of the
|
||||
base interfaces for PMD's AST for all languages is {% jdoc core::lang.ast.Node %}, which provides
|
||||
the methods {% jdoc core::lang.ast.Node#getImage() %} and {% jdoc core::lang.ast.Node#hasImageEqualTo(java.lang.String) %}.
|
||||
However, these methods don't necessarily make sense for all nodes in all contexts. That's why `getImage()`
|
||||
often returns just `null`. Also, the name is not very describing. AST nodes should try to use more specific
|
||||
names, such as `getValue()` or `getName()`.
|
||||
|
||||
For PMD 7, most languages have been adapted. And when writing XPath rules, you need to replace `@Image` with
|
||||
whatever is appropriate now (e.g. `@Name`). See below for details.
|
||||
|
||||
#### Apex and Visualforce
|
||||
|
||||
There are many usages of `@Image`. These will be refactored after PMD 7 is released
|
||||
by deprecating the attribute and providing alternatives.
|
||||
|
||||
See also issue [Deprecate getImage/@Image #4787](https://github.com/pmd/pmd/issues/4787).
|
||||
|
||||
#### Html
|
||||
|
||||
* {% jdoc html::lang.html.ast.ASTHtmlTextNode %}: `@Image` ➡️ `@Text`, `@NormalizedText` ➡️ `@Text`, `@Text` ➡️ `@WholeText`.
|
||||
|
||||
#### Java
|
||||
|
||||
There are still many usages of `@Image` which are not refactored yet. This will be done after PMD 7 is released
|
||||
by deprecating the attribute and providing alternatives.
|
||||
|
||||
See also issue [Deprecate getImage/@Image #4787](https://github.com/pmd/pmd/issues/4787).
|
||||
|
||||
Some nodes have already the image attribute (and others) deprecated. These deprecated attributes are removed now:
|
||||
|
||||
* {% jdoc java::lang.java.ast.ASTAnnotationTypeDeclaration %}: `@Image` ➡️ `@SimpleName`
|
||||
* {% jdoc java::lang.java.ast.ASTAnonymousClassDeclaration %}: `@Image` ➡️ `@SimpleName`
|
||||
* {% jdoc java::lang.java.ast.ASTClassOrInterfaceDeclaration %}: `@Image` ➡️ `@SimpleName`
|
||||
* {% jdoc java::lang.java.ast.ASTEnumDeclaration %}: `@Image` ➡️ `@SimpleName`
|
||||
* {% jdoc java::lang.java.ast.ASTFieldDeclaration %}: `@VariableName` ➡️ `VariableDeclaratorId/@Name`
|
||||
* {% jdoc java::lang.java.ast.ASTMethodDeclaration %}: `@MethodName` ➡️ `@Name`
|
||||
* {% jdoc java::lang.java.ast.ASTRecordDeclaration %}: `@Image` ➡️ `@SimpleName`
|
||||
* {% jdoc java::lang.java.ast.ASTVariableDeclaratorId %}: `@Image` ➡️ `@Name`
|
||||
* {% jdoc java::lang.java.ast.ASTVariableDeclaratorId %}: `@VariableName` ➡️ `@Name`
|
||||
* {% jdoc java::lang.java.ast.ASTVariableDeclaratorId %}: `@Array` ➡️ `@ArrayType`
|
||||
|
||||
#### JavaScript
|
||||
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTAssignment %}: `@Image` ➡️ `@Operator`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTBigIntLiteral %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTBreakStatement %}: `@Image` ➡️ `Name/@Identifier`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTContinueStatement %}: `@Image` ➡️ `Name/@Identifier`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTErrorNode %}: `@Image` ➡️ `@Message`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTFunctionNode %}: `@Image` ➡️ `Name/@Identifier`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTInfixExpression %}: `@Image` ➡️ `@Operator`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTKeywordLiteral %}: `@Image` ➡️ `@Literal`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTLabel %}: `@Image` ➡️ `@Name`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTName %}: `@Image` ➡️ `@Identifier`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTNumberLiteral %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTObjectProperty %}: `@Image` ➡️ `@Operator`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTPropertyGet %}: `@Image` ➡️ `@Operator`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTRegExpLiteral %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTStringLiteral %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTUnaryExpression %}: `@Image` ➡️ `@Operator`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTUpdateExpression %}: `@Image` ➡️ `@Operator`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTXmlDotQuery %}: `@Image` ➡️ `@Operator`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTXmlMemberGet %}: `@Image` ➡️ `@Operator`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTXmlPropRef %}: `@Image` ➡️ `Name[last()]/@Identifier`
|
||||
* {% jdoc javascript::lang.ecmascript.ast.ASTXmlString %}: `@Image` ➡️ `@Xml`
|
||||
|
||||
#### JSP
|
||||
|
||||
* {% jdoc jsp::lang.jsp.ast.ASTAttributeValue %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc jsp::lang.jsp.ast.ASTCData %}: `@Image` ➡️ `@Content`
|
||||
* {% jdoc jsp::lang.jsp.ast.ASTCommentTag %}: `@Image` ➡️ `@Content`
|
||||
* {% jdoc jsp::lang.jsp.ast.ASTElExpression %}: `@Image` ➡️ `@Content`
|
||||
* {% jdoc jsp::lang.jsp.ast.ASTHtmlScript %}: `@Image` ➡️ `@Content`
|
||||
* {% jdoc jsp::lang.jsp.ast.ASTJspComment %}: `@Image` ➡️ `@Content`
|
||||
* {% jdoc jsp::lang.jsp.ast.ASTJspDeclaration %}: `@Image` ➡️ `@Content`
|
||||
* {% jdoc jsp::lang.jsp.ast.ASTJspExpression %}: `@Image` ➡️ `@Content`
|
||||
* {% jdoc jsp::lang.jsp.ast.ASTJspExpressionInAttribute %}: `@Image` ➡️ `@Content`
|
||||
* {% jdoc jsp::lang.jsp.ast.ASTJspScriptlet %}: `@Image` ➡️ `@Content`
|
||||
* {% jdoc jsp::lang.jsp.ast.ASTText %}: `@Image` ➡️ `@Content`
|
||||
* {% jdoc jsp::lang.jsp.ast.ASTUnparsedText %}: `@Image` ➡️ `@Content`
|
||||
* {% jdoc jsp::lang.jsp.ast.ASTValueBinding %}: `@Image` ➡️ `@Content`
|
||||
|
||||
#### Modelica
|
||||
|
||||
* {% jdoc modelica::lang.modelica.ast.ASTAddOp %}: `@Image` ➡️ `@Operator`
|
||||
* {% jdoc modelica::lang.modelica.ast.ASTDerClassSpecifier %}: `@Image` ➡️ `@SimpleClassName`
|
||||
* {% jdoc modelica::lang.modelica.ast.ASTEnumerationShortClassSpecifier %}: `@Image` ➡️ `@SimpleClassName`
|
||||
* {% jdoc modelica::lang.modelica.ast.ASTExtendingLongClassSpecifier %}: `@Image` ➡️ `@SimpleClassName`
|
||||
* {% jdoc modelica::lang.modelica.ast.ASTFactor %}: `@Image` ➡️ `@Operator`
|
||||
* {% jdoc modelica::lang.modelica.ast.ASTLanguageSpecification %}: `@Image` ➡️ `@ExternalLanguage`
|
||||
* {% jdoc modelica::lang.modelica.ast.ASTMulOp %}: `@Image` ➡️ `@Operator`
|
||||
* {% jdoc modelica::lang.modelica.ast.ASTName %}: `@Image` ➡️ `@Name`
|
||||
* {% jdoc modelica::lang.modelica.ast.ASTNumberLiteral %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc modelica::lang.modelica.ast.ASTRelOp %}: `@Image` ➡️ `@Operator`
|
||||
* {% jdoc modelica::lang.modelica.ast.ASTSimpleLongClassSpecifier %}: `@Image` ➡️ `@SimpleClassName`
|
||||
* {% jdoc modelica::lang.modelica.ast.ASTSimpleName %}: `@Image` ➡️ `@Name`
|
||||
* {% jdoc modelica::lang.modelica.ast.ASTSimpleShortClassSpecifier %}: `@Image` ➡️ `@SimpleClassName`
|
||||
* {% jdoc modelica::lang.modelica.ast.ASTStoredDefinition %}: `@Image` ➡️ `@Name`
|
||||
* {% jdoc modelica::lang.modelica.ast.ASTStringComment %}: `@Image` ➡️ `@Comment`
|
||||
* {% jdoc modelica::lang.modelica.ast.ASTStringLiteral %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc modelica::lang.modelica.ast.ASTWithinClause %}: `@Image` ➡️ `@Name`
|
||||
|
||||
#### PLSQL
|
||||
|
||||
There are many usages of `@Image`. These will be refactored after PMD 7 is released
|
||||
by deprecating the attribute and providing alternatives.
|
||||
|
||||
See also issue [Deprecate getImage/@Image #4787](https://github.com/pmd/pmd/issues/4787).
|
||||
|
||||
#### Scala
|
||||
|
||||
* {% jdoc scala::lang.scala.ast.ASTLitBoolean %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc scala::lang.scala.ast.ASTLitByte %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc scala::lang.scala.ast.ASTLitChar %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc scala::lang.scala.ast.ASTLitDouble %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc scala::lang.scala.ast.ASTLitFloat %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc scala::lang.scala.ast.ASTLitInt %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc scala::lang.scala.ast.ASTLitLong %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc scala::lang.scala.ast.ASTLitNull %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc scala::lang.scala.ast.ASTLitShort %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc scala::lang.scala.ast.ASTLitString %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc scala::lang.scala.ast.ASTLitSymbol %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc scala::lang.scala.ast.ASTLitUnit %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc scala::lang.scala.ast.ASTNameAnonymous %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc scala::lang.scala.ast.ASTNameIndeterminate %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc scala::lang.scala.ast.ASTTermName %}: `@Image` ➡️ `@Value`
|
||||
* {% jdoc scala::lang.scala.ast.ASTTypeName %}: `@Image` ➡️ `@Value`
|
||||
|
||||
#### XML (and POM)
|
||||
|
||||
When using {% jdoc core::lang.rule.XPathRule %}, text of text nodes was exposed as `@Image` of
|
||||
normal element type nodes. Now the attribute is called `@Text`.
|
||||
|
||||
Note: In general, it is recommended to use {% jdoc xml::lang.xml.rule.DomXPathRule %} instead,
|
||||
which exposes text nodes as real XPath/XML text nodes which conforms to the XPath spec.
|
||||
There is no difference, text of text nodes can be selected using `text()`.
|
||||
|
||||
### Java AST
|
||||
|
||||
The Java grammar has been refactored substantially in order to make it easier to maintain and more correct
|
||||
|
@ -254,10 +254,6 @@ Was expecting one of:
|
||||
* warnings: 2
|
||||
</pre>
|
||||
|
||||
**Properties:**
|
||||
|
||||
* color: Enables colors with anything other than `false` or `0`. Default: yes.
|
||||
|
||||
## textpad
|
||||
|
||||
TextPad integration.
|
||||
|
@ -83,6 +83,12 @@ in the Migration Guide.
|
||||
* We now support [suppression](pmd_userdocs_cpd.html#suppression) through `CPD-ON`/`CPD-OFF` comment pairs.
|
||||
* See [PR #4726](https://github.com/pmd/pmd/pull/4726) for details.
|
||||
|
||||
##### Updated PMD Designer
|
||||
|
||||
This PMD release ships a new version of the pmd-designer.
|
||||
For the changes, see
|
||||
* [PMD Designer Changelog (7.0.0)](https://github.com/pmd/pmd-designer/releases/tag/7.0.0).
|
||||
|
||||
#### Rule Changes
|
||||
|
||||
**New Rules**
|
||||
@ -97,6 +103,67 @@ in the Migration Guide.
|
||||
* {% rule java/codestyle/EmptyControlStatement %}: The rule has a new property to allow empty blocks when
|
||||
they contain a comment (`allowCommentedBlocks`).
|
||||
|
||||
**Removed deprecated rulesets**
|
||||
|
||||
The following previously deprecated rulesets have been removed. These were the left-over rulesets from PMD 5.
|
||||
The rules have been moved into categories with PMD 6.
|
||||
|
||||
* rulesets/apex/apexunit.xml
|
||||
* rulesets/apex/braces.xml
|
||||
* rulesets/apex/complexity.xml
|
||||
* rulesets/apex/empty.xml
|
||||
* rulesets/apex/metrics.xml
|
||||
* rulesets/apex/performance.xml
|
||||
* rulesets/apex/ruleset.xml
|
||||
* rulesets/apex/securty.xml
|
||||
* rulesets/apex/style.xml
|
||||
* rulesets/java/android.xml
|
||||
* rulesets/java/basic.xml
|
||||
* rulesets/java/clone.xml
|
||||
* rulesets/java/codesize.xml
|
||||
* rulesets/java/comments.xml
|
||||
* rulesets/java/controversial.xml
|
||||
* rulesets/java/coupling.xml
|
||||
* rulesets/java/design.xml
|
||||
* rulesets/java/empty.xml
|
||||
* rulesets/java/finalizers.xml
|
||||
* rulesets/java/imports.xml
|
||||
* rulesets/java/j2ee.xml
|
||||
* rulesets/java/javabeans.xml
|
||||
* rulesets/java/junit.xml
|
||||
* rulesets/java/logging-jakarta-commons.xml
|
||||
* rulesets/java/logging-java.xml
|
||||
* rulesets/java/metrics.xml
|
||||
* rulesets/java/migrating.xml
|
||||
* rulesets/java/migrating_to_13.xml
|
||||
* rulesets/java/migrating_to_14.xml
|
||||
* rulesets/java/migrating_to_15.xml
|
||||
* rulesets/java/migrating_to_junit4.xml
|
||||
* rulesets/java/naming.xml
|
||||
* rulesets/java/optimizations.xml
|
||||
* rulesets/java/strictexception.xml
|
||||
* rulesets/java/strings.xml
|
||||
* rulesets/java/sunsecure.xml
|
||||
* rulesets/java/typeresolution.xml
|
||||
* rulesets/java/unnecessary.xml
|
||||
* rulesets/java/unusedcode.xml
|
||||
* rulesets/ecmascript/basic.xml
|
||||
* rulesets/ecmascript/braces.xml
|
||||
* rulesets/ecmascript/controversial.xml
|
||||
* rulesets/ecmascript/unnecessary.xml
|
||||
* rulesets/jsp/basic.xml
|
||||
* rulesets/jsp/basic-jsf.xml
|
||||
* rulesets/plsql/codesize.xml
|
||||
* rulesets/plsql/dates.xml
|
||||
* rulesets/plsql/strictsyntax.xml
|
||||
* rulesets/plsql/TomKytesDespair.xml
|
||||
* rulesets/vf/security.xml
|
||||
* rulesets/vm/basic.xml
|
||||
* rulesets/pom/basic.xml
|
||||
* rulesets/xml/basic.xml
|
||||
* rulesets/xsl/xpath.xml
|
||||
* rulesets/releases/*
|
||||
|
||||
#### Fixed issues
|
||||
|
||||
* cli
|
||||
@ -105,10 +172,16 @@ in the Migration Guide.
|
||||
* [#4723](https://github.com/pmd/pmd/issues/4723): \[cli] Launch fails for "bash pmd"
|
||||
* core
|
||||
* [#1027](https://github.com/pmd/pmd/issues/1027): \[core] Apply the new PropertyDescriptor<Pattern> type where applicable
|
||||
* [#4065](https://github.com/pmd/pmd/issues/4065): \[core] Rename TokenMgrError to LexException, Tokenizer to CpdLexer
|
||||
* [#4312](https://github.com/pmd/pmd/issues/4312): \[core] Remove unnecessary property `color` and system property `pmd.color` in `TextColorRenderer`
|
||||
* [#4313](https://github.com/pmd/pmd/issues/4313): \[core] Remove support for <lang>-<ruleset> hyphen notation for ruleset references
|
||||
* [#4314](https://github.com/pmd/pmd/issues/4314): \[core] Remove ruleset compatibility filter (RuleSetFactoryCompatibility) and CLI option `--no-ruleset-compatibility`
|
||||
* [#4378](https://github.com/pmd/pmd/issues/4378): \[core] Ruleset loading processes commented rules
|
||||
* [#4674](https://github.com/pmd/pmd/issues/4674): \[core] WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass
|
||||
* [#4694](https://github.com/pmd/pmd/pull/4694): \[core] Fix line/col numbers in TokenMgrError
|
||||
* [#4717](https://github.com/pmd/pmd/issues/4717): \[core] XSLTRenderer doesn't close report file
|
||||
* [#4750](https://github.com/pmd/pmd/pull/4750): \[core] Fix flaky SummaryHTMLRenderer
|
||||
* [#4782](https://github.com/pmd/pmd/pull/4782): \[core] Avoid using getImage/@<!-- -->Image
|
||||
* doc
|
||||
* [#995](https://github.com/pmd/pmd/issues/995): \[doc] Document API evolution principles as ADR
|
||||
* [#2511](https://github.com/pmd/pmd/issues/2511): \[doc] Review guides for writing java/xpath rules for correctness with PMD 7
|
||||
@ -125,6 +198,7 @@ in the Migration Guide.
|
||||
* [#4736](https://github.com/pmd/pmd/issues/4736): \[ci] Improve build procedure
|
||||
* [#4741](https://github.com/pmd/pmd/pull/4741): Add pmd-compat6 module for maven-pmd-plugin
|
||||
* [#4749](https://github.com/pmd/pmd/pull/4749): Fixes NoSuchMethodError on processing errors in pmd-compat6
|
||||
* [#4796](https://github.com/pmd/pmd/pull/4796): Remove deprecated and release rulesets
|
||||
* apex-performance
|
||||
* [#4675](https://github.com/pmd/pmd/issues/4675): \[apex] New Rule: OperationWithHighCostInLoop
|
||||
* groovy
|
||||
@ -154,6 +228,11 @@ in the Migration Guide.
|
||||
|
||||
#### API Changes
|
||||
|
||||
**General AST Changes to avoid `@Image`**
|
||||
|
||||
See [General AST Changes to avoid @Image]({{ baseurl }}pmd_userdocs_migrating_to_pmd7.html#general-ast-changes-to-avoid-image)
|
||||
in the migration guide for details.
|
||||
|
||||
**Removed classes and methods (previously deprecated)**
|
||||
|
||||
The following previously deprecated classes have been removed:
|
||||
@ -200,6 +279,27 @@ The following previously deprecated classes have been removed:
|
||||
* The node `ASTClassOrInterfaceBody` has been renamed to {% jdoc java::lang.ast.ASTClassBody %}. XPath rules
|
||||
need to be adjusted.
|
||||
|
||||
**Renamed classes and methods**
|
||||
|
||||
* pmd-core
|
||||
* {%jdoc_old core::lang.ast.TokenMgrError %} has been renamed to {% jdoc core::lang.ast.LexException %}
|
||||
* {%jdoc_old core::cpd.Tokenizer %} has been renamed to {% jdoc core::cpd.CpdLexer %}. Along with this rename,
|
||||
all the implementations have been renamed as well (`Tokenizer` -> `CpdLexer`), e.g. "CppCpdLexer", "JavaCpdLexer".
|
||||
This affects all language modules.
|
||||
* {%jdoc_old core::cpd.AnyTokenizer %} has been renamed to {% jdoc core::cpd.AnyCpdLexer %}.
|
||||
|
||||
**Removed functionality**
|
||||
|
||||
* The CLI parameter `--no-ruleset-compatibility` has been removed. It was only used to allow loading
|
||||
some rulesets originally written for PMD 5 also in PMD 6 without fixing the rulesets.
|
||||
* The class {% jdoc_old core::RuleSetFactoryCompatibility %} has been removed without replacement.
|
||||
The different ways to enable/disable this filter in {% jdoc core::PMDConfiguration %}
|
||||
(Property "RuleSetFactoryCompatibilityEnabled") and
|
||||
{% jdoc ant::ant.PMDTask %} (Property "noRuleSetCompatibility") have been removed as well.
|
||||
* `textcolor` renderer ({%jdoc core::renderers.TextColorRenderer %}) now renders always in color.
|
||||
The property `color` has been removed. The possibility to override this with the system property `pmd.color`
|
||||
has been removed as well. If you don't want colors, use `text` renderer ({%jdoc core::renderers.TextRenderer %}).
|
||||
|
||||
#### External Contributions
|
||||
* [#4640](https://github.com/pmd/pmd/pull/4640): \[cli] Launch script fails if run via "bash pmd" - [Shai Bennathan](https://github.com/shai-bennathan) (@shai-bennathan)
|
||||
* [#4673](https://github.com/pmd/pmd/pull/4673): \[javascript] CPD: Added support for decorator notation - [Wener](https://github.com/wener-tiobe) (@wener-tiobe)
|
||||
@ -265,7 +365,10 @@ Contributors: [Lucas Soncini](https://github.com/lsoncini) (@lsoncini),
|
||||
#### 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/releases/tag/7.0.0-rc1).
|
||||
For the changes, see
|
||||
* [PMD Designer Changelog (7.0.0-rc1)](https://github.com/pmd/pmd-designer/releases/tag/7.0.0-rc1).
|
||||
* [PMD Designer Changelog (7.0.0-rc4)](https://github.com/pmd/pmd-designer/releases/tag/7.0.0-rc4).
|
||||
* [PMD Designer Changelog (7.0.0)](https://github.com/pmd/pmd-designer/releases/tag/7.0.0).
|
||||
|
||||
#### New CPD report format cpdhtml-v2.xslt
|
||||
|
||||
@ -571,6 +674,7 @@ See also [Detailed Release Notes for PMD 7]({{ baseurl }}pmd_release_notes_pmd7.
|
||||
* [#4736](https://github.com/pmd/pmd/issues/4736): \[ci] Improve build procedure
|
||||
* [#4741](https://github.com/pmd/pmd/pull/4741): Add pmd-compat6 module for maven-pmd-plugin
|
||||
* [#4749](https://github.com/pmd/pmd/pull/4749): Fixes NoSuchMethodError on processing errors in pmd-compat6
|
||||
* [#4796](https://github.com/pmd/pmd/pull/4796): Remove deprecated and release rulesets
|
||||
* ant
|
||||
* [#4080](https://github.com/pmd/pmd/issues/4080): \[ant] Split off Ant integration into a new submodule
|
||||
* core
|
||||
@ -603,14 +707,19 @@ See also [Detailed Release Notes for PMD 7]({{ baseurl }}pmd_release_notes_pmd7.
|
||||
* [#3919](https://github.com/pmd/pmd/issues/3919): \[core] Merge CPD and PMD language
|
||||
* [#3922](https://github.com/pmd/pmd/pull/3922): \[core] Better error reporting for the ruleset parser
|
||||
* [#4035](https://github.com/pmd/pmd/issues/4035): \[core] ConcurrentModificationException in DefaultRuleViolationFactory
|
||||
* [#4065](https://github.com/pmd/pmd/issues/4065): \[core] Rename TokenMgrError to LexException, Tokenizer to CpdLexer
|
||||
* [#4120](https://github.com/pmd/pmd/issues/4120): \[core] Explicitly name all language versions
|
||||
* [#4204](https://github.com/pmd/pmd/issues/4204): \[core] Provide a CpdAnalysis class as a programmatic entry point into CPD
|
||||
* [#4301](https://github.com/pmd/pmd/issues/4301): \[core] Remove deprecated property concrete classes
|
||||
* [#4302](https://github.com/pmd/pmd/issues/4302): \[core] Migrate Property Framework API to Java 8
|
||||
* [#4312](https://github.com/pmd/pmd/issues/4312): \[core] Remove unnecessary property `color` and system property `pmd.color` in `TextColorRenderer`
|
||||
* [#4313](https://github.com/pmd/pmd/issues/4313): \[core] Remove support for <lang>-<ruleset> hyphen notation for ruleset references
|
||||
* [#4314](https://github.com/pmd/pmd/issues/4314): \[core] Remove ruleset compatibility filter (RuleSetFactoryCompatibility) and CLI option `--no-ruleset-compatibility`
|
||||
* [#4323](https://github.com/pmd/pmd/issues/4323): \[core] Refactor CPD integration
|
||||
* [#4353](https://github.com/pmd/pmd/pull/4353): \[core] Micro optimizations for Node API
|
||||
* [#4365](https://github.com/pmd/pmd/pull/4365): \[core] Improve benchmarking
|
||||
* [#4397](https://github.com/pmd/pmd/pull/4397): \[core] Refactor CPD
|
||||
* [#4378](https://github.com/pmd/pmd/issues/4378): \[core] Ruleset loading processes commented rules
|
||||
* [#4420](https://github.com/pmd/pmd/pull/4420): \[core] Remove PMD.EOL
|
||||
* [#4425](https://github.com/pmd/pmd/pull/4425): \[core] Replace TextFile::pathId
|
||||
* [#4454](https://github.com/pmd/pmd/issues/4454): \[core] "Unknown option: '-min'" but is referenced in documentation
|
||||
@ -620,6 +729,7 @@ See also [Detailed Release Notes for PMD 7]({{ baseurl }}pmd_release_notes_pmd7.
|
||||
* [#4694](https://github.com/pmd/pmd/pull/4694): \[core] Fix line/col numbers in TokenMgrError
|
||||
* [#4717](https://github.com/pmd/pmd/issues/4717): \[core] XSLTRenderer doesn't close report file
|
||||
* [#4750](https://github.com/pmd/pmd/pull/4750): \[core] Fix flaky SummaryHTMLRenderer
|
||||
* [#4782](https://github.com/pmd/pmd/pull/4782): \[core] Avoid using getImage/@<!-- -->Image
|
||||
* cli
|
||||
* [#2234](https://github.com/pmd/pmd/issues/2234): \[core] Consolidate PMD CLI into a single command
|
||||
* [#3828](https://github.com/pmd/pmd/issues/3828): \[core] Progress reporting
|
||||
|
@ -280,6 +280,13 @@
|
||||
<file name="${tokenmgr-file}" />
|
||||
</replaceregexp>
|
||||
|
||||
<!-- Use own LexException instead of JavaCC's TokenMgrError -->
|
||||
<replaceregexp>
|
||||
<regexp pattern='throw new TokenMgrError\(EOFSeen' />
|
||||
<substitution expression='throw new net.sourceforge.pmd.lang.ast.LexException(EOFSeen' />
|
||||
<file name="${tokenmgr-file}" />
|
||||
</replaceregexp>
|
||||
|
||||
<!-- Useless argument, also replace lex state ID with its name -->
|
||||
<replaceregexp>
|
||||
<regexp pattern='curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR\)' />
|
||||
|
@ -45,11 +45,6 @@
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.tomakehurst</groupId>
|
||||
<artifactId>wiremock-jre8</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest</artifactId>
|
||||
|
@ -61,7 +61,6 @@ public class PMDTask extends Task {
|
||||
private final List<Path> relativizePathsWith = new ArrayList<>();
|
||||
private String suppressMarker;
|
||||
private String rulesetFiles;
|
||||
private boolean noRuleSetCompatibility;
|
||||
private String encoding;
|
||||
private int threads = 1; // same default as in PMDParameters (CLI)
|
||||
private int minimumPriority = RulePriority.LOW.getPriority(); // inclusive
|
||||
@ -267,14 +266,6 @@ public class PMDTask extends Task {
|
||||
return nestedRules;
|
||||
}
|
||||
|
||||
public boolean isNoRuleSetCompatibility() {
|
||||
return noRuleSetCompatibility;
|
||||
}
|
||||
|
||||
public void setNoRuleSetCompatibility(boolean noRuleSetCompatibility) {
|
||||
this.noRuleSetCompatibility = noRuleSetCompatibility;
|
||||
}
|
||||
|
||||
public String getCacheLocation() {
|
||||
return cacheLocation;
|
||||
}
|
||||
|
@ -68,7 +68,6 @@ public class PMDTaskImpl {
|
||||
configuration.setRuleSets(Arrays.asList(task.getRulesetFiles().split(",")));
|
||||
}
|
||||
|
||||
configuration.setRuleSetFactoryCompatibilityEnabled(!task.isNoRuleSetCompatibility());
|
||||
if (task.getEncoding() != null) {
|
||||
configuration.setSourceEncoding(Charset.forName(task.getEncoding()));
|
||||
}
|
||||
|
@ -5,12 +5,12 @@
|
||||
package net.sourceforge.pmd.lang.apex;
|
||||
|
||||
import net.sourceforge.pmd.cpd.CpdCapableLanguage;
|
||||
import net.sourceforge.pmd.cpd.Tokenizer;
|
||||
import net.sourceforge.pmd.cpd.CpdLexer;
|
||||
import net.sourceforge.pmd.lang.LanguageModuleBase;
|
||||
import net.sourceforge.pmd.lang.LanguageProcessor;
|
||||
import net.sourceforge.pmd.lang.LanguagePropertyBundle;
|
||||
import net.sourceforge.pmd.lang.PmdCapableLanguage;
|
||||
import net.sourceforge.pmd.lang.apex.cpd.ApexTokenizer;
|
||||
import net.sourceforge.pmd.lang.apex.cpd.ApexCpdLexer;
|
||||
|
||||
public class ApexLanguageModule extends LanguageModuleBase implements PmdCapableLanguage, CpdCapableLanguage {
|
||||
private static final String ID = "apex";
|
||||
@ -47,7 +47,7 @@ public class ApexLanguageModule extends LanguageModuleBase implements PmdCapable
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tokenizer createCpdTokenizer(LanguagePropertyBundle bundle) {
|
||||
return new ApexTokenizer();
|
||||
public CpdLexer createCpdLexer(LanguagePropertyBundle bundle) {
|
||||
return new ApexCpdLexer();
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,6 @@ public final class ASTAnnotation extends AbstractApexNode.Single<AnnotationModif
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public String getImage() {
|
||||
return getName();
|
||||
}
|
||||
|
@ -47,7 +47,6 @@ public final class ASTAnnotationParameter extends AbstractApexNode.Single<Elemen
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public String getImage() {
|
||||
return getValue();
|
||||
}
|
||||
|
@ -4,8 +4,6 @@
|
||||
|
||||
package net.sourceforge.pmd.lang.apex.ast;
|
||||
|
||||
import net.sourceforge.pmd.annotation.DeprecatedUntil700;
|
||||
|
||||
import com.google.summit.ast.declaration.TypeDeclaration;
|
||||
|
||||
abstract class BaseApexClass<T extends TypeDeclaration> extends AbstractApexNode.Single<T> implements ASTUserClassOrInterface<T> {
|
||||
@ -21,12 +19,7 @@ abstract class BaseApexClass<T extends TypeDeclaration> extends AbstractApexNode
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getSimpleName()}
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
@DeprecatedUntil700
|
||||
public String getImage() {
|
||||
return getSimpleName();
|
||||
}
|
||||
|
@ -11,13 +11,13 @@ import org.antlr.v4.runtime.CharStream;
|
||||
import org.antlr.v4.runtime.CharStreams;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
import net.sourceforge.pmd.cpd.CpdLexer;
|
||||
import net.sourceforge.pmd.cpd.TokenFactory;
|
||||
import net.sourceforge.pmd.cpd.Tokenizer;
|
||||
import net.sourceforge.pmd.lang.document.TextDocument;
|
||||
|
||||
import com.nawforce.apexparser.ApexLexer;
|
||||
|
||||
public class ApexTokenizer implements Tokenizer {
|
||||
public class ApexCpdLexer implements CpdLexer {
|
||||
|
||||
@Override
|
||||
public void tokenize(TextDocument document, TokenFactory tokenEntries) throws IOException {
|
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<ruleset name="ApexUnit"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||
<description>
|
||||
These rules deal with different problems that can occur with Apex unit tests.
|
||||
</description>
|
||||
|
||||
<rule ref="category/apex/bestpractices.xml/ApexUnitTestClassShouldHaveAsserts" deprecated="true" />
|
||||
<rule ref="category/apex/bestpractices.xml/ApexUnitTestShouldNotUseSeeAllDataTrue" deprecated="true" />
|
||||
|
||||
</ruleset>
|
@ -1,16 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<ruleset name="Braces"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||
<description>
|
||||
The Braces ruleset contains rules regarding the use and placement of braces.
|
||||
</description>
|
||||
|
||||
<rule ref="category/apex/codestyle.xml/ForLoopsMustUseBraces" deprecated="true" />
|
||||
<rule ref="category/apex/codestyle.xml/IfElseStmtsMustUseBraces" deprecated="true" />
|
||||
<rule ref="category/apex/codestyle.xml/IfStmtsMustUseBraces" deprecated="true" />
|
||||
<rule ref="category/apex/codestyle.xml/WhileLoopsMustUseBraces" deprecated="true" />
|
||||
|
||||
</ruleset>
|
@ -1,21 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<ruleset name="Complexity" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||
|
||||
<description>
|
||||
The Complexity ruleset contains rules that find problems related to code size or complexity.
|
||||
</description>
|
||||
|
||||
<rule ref="category/apex/design.xml/AvoidDeeplyNestedIfStmts" deprecated="true" />
|
||||
<rule ref="category/apex/design.xml/ExcessiveClassLength" deprecated="true" />
|
||||
<rule ref="category/apex/design.xml/ExcessiveParameterList" deprecated="true" />
|
||||
<rule ref="category/apex/design.xml/ExcessivePublicCount" deprecated="true" />
|
||||
<rule ref="category/apex/design.xml/NcssConstructorCount" deprecated="true" />
|
||||
<rule ref="category/apex/design.xml/NcssMethodCount" deprecated="true" />
|
||||
<rule ref="category/apex/design.xml/NcssTypeCount" deprecated="true" />
|
||||
<rule ref="category/apex/design.xml/StdCyclomaticComplexity" deprecated="true" />
|
||||
<rule ref="category/apex/design.xml/TooManyFields" deprecated="true" />
|
||||
|
||||
</ruleset>
|
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<ruleset name="Empty Code"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||
<description>
|
||||
The Empty Code ruleset contains rules that find empty statements of any kind (empty method,
|
||||
empty block statement, empty try or catch block,...).
|
||||
</description>
|
||||
|
||||
<rule ref="category/apex/errorprone.xml/EmptyCatchBlock" deprecated="true" />
|
||||
<rule ref="category/apex/errorprone.xml/EmptyIfStmt" deprecated="true" />
|
||||
<rule ref="category/apex/errorprone.xml/EmptyStatementBlock" deprecated="true" />
|
||||
<rule ref="category/apex/errorprone.xml/EmptyTryOrFinallyBlock" deprecated="true" />
|
||||
<rule ref="category/apex/errorprone.xml/EmptyWhileStmt" deprecated="true" />
|
||||
|
||||
</ruleset>
|
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<ruleset name="Metrics temporary ruleset"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||
|
||||
<description>
|
||||
These are rules which use the Metrics Framework to calculate metrics.
|
||||
</description>
|
||||
|
||||
<rule ref="category/apex/design.xml/CyclomaticComplexity" deprecated="true" />
|
||||
</ruleset>
|
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<ruleset name="Performance"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||
<description>
|
||||
The Performance ruleset contains a collection of good practices which should be followed.
|
||||
</description>
|
||||
|
||||
<rule ref="category/apex/performance.xml/AvoidDmlStatementsInLoops" deprecated="true" />
|
||||
<rule ref="category/apex/performance.xml/AvoidSoqlInLoops" deprecated="true" />
|
||||
<rule ref="category/apex/performance.xml/AvoidSoslInLoops" deprecated="true" />
|
||||
|
||||
</ruleset>
|
@ -1,54 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ruleset xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Default ruleset used by the CodeClimate Engine for Salesforce.com Apex" xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||
<description>
|
||||
Default ruleset used by the Code Climate Engine for Salesforce.com Apex
|
||||
|
||||
Note: This ruleset is deprecated. Use "rulesets/apex/quickstart.xml" instead.
|
||||
</description>
|
||||
|
||||
<rule ref="rulesets/apex/quickstart.xml/ExcessiveClassLength" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/ExcessiveParameterList" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/ExcessivePublicCount" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/NcssConstructorCount" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/NcssMethodCount" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/NcssTypeCount" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/StdCyclomaticComplexity" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/TooManyFields" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/AvoidDeeplyNestedIfStmts" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/CyclomaticComplexity" deprecated="true" />
|
||||
<rule ref="category/apex/performance.xml/AvoidSoqlInLoops" deprecated="true" />
|
||||
<rule ref="category/apex/performance.xml/AvoidSoslInLoops" deprecated="true" />
|
||||
<rule ref="category/apex/performance.xml/AvoidDmlStatementsInLoops" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/AvoidDirectAccessTriggerMap" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/AvoidLogicInTrigger" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/AvoidGlobalModifier" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/AvoidNonExistentAnnotations" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/AvoidHardcodingId" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/ClassNamingConventions" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/MethodNamingConventions" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/MethodWithSameNameAsEnclosingClass" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/ApexUnitTestClassShouldHaveAsserts" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/ApexUnitTestShouldNotUseSeeAllDataTrue" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/ApexSharingViolations" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/ApexInsecureEndpoint" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/ApexCSRF" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/ApexOpenRedirect" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/ApexSOQLInjection" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/ApexXSSFromURLParam" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/ApexXSSFromEscapeFalse" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/ApexBadCrypto" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/ApexCRUDViolation" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/ApexDangerousMethods" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/ApexSuggestUsingNamedCred" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/IfStmtsMustUseBraces" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/WhileLoopsMustUseBraces" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/IfElseStmtsMustUseBraces" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/ForLoopsMustUseBraces" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/EmptyCatchBlock" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/EmptyIfStmt" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/EmptyWhileStmt" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/EmptyTryOrFinallyBlock" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/EmptyStatementBlock" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/OneDeclarationPerLine" deprecated="true" />
|
||||
<rule ref="rulesets/apex/quickstart.xml/ApexDoc" deprecated="true" />
|
||||
</ruleset>
|
@ -1,11 +0,0 @@
|
||||
#
|
||||
# BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
#
|
||||
rulesets.filenames=\
|
||||
category/apex/bestpractices.xml,\
|
||||
category/apex/codestyle.xml,\
|
||||
category/apex/design.xml,\
|
||||
category/apex/documentation.xml,\
|
||||
category/apex/errorprone.xml,\
|
||||
category/apex/performance.xml,\
|
||||
category/apex/security.xml
|
@ -1,23 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<ruleset name="Security" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||
|
||||
<description>
|
||||
These rules deal with different security problems that can occur within Apex.
|
||||
</description>
|
||||
|
||||
<rule ref="category/apex/security.xml/ApexBadCrypto" deprecated="true" />
|
||||
<rule ref="category/apex/security.xml/ApexCRUDViolation" deprecated="true" />
|
||||
<rule ref="category/apex/errorprone.xml/ApexCSRF" deprecated="true" />
|
||||
<rule ref="category/apex/security.xml/ApexDangerousMethods" deprecated="true" />
|
||||
<rule ref="category/apex/security.xml/ApexInsecureEndpoint" deprecated="true" />
|
||||
<rule ref="category/apex/security.xml/ApexOpenRedirect" deprecated="true" />
|
||||
<rule ref="category/apex/security.xml/ApexSharingViolations" deprecated="true" />
|
||||
<rule ref="category/apex/security.xml/ApexSOQLInjection" deprecated="true" />
|
||||
<rule ref="category/apex/security.xml/ApexSuggestUsingNamedCred" deprecated="true" />
|
||||
<rule ref="category/apex/security.xml/ApexXSSFromEscapeFalse" deprecated="true" />
|
||||
<rule ref="category/apex/security.xml/ApexXSSFromURLParam" deprecated="true" />
|
||||
|
||||
</ruleset>
|
@ -1,21 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<ruleset name="Style"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||
<description>
|
||||
The Style Ruleset contains rules regarding preferred usage of names and identifiers.
|
||||
</description>
|
||||
|
||||
<rule ref="category/apex/codestyle.xml/ClassNamingConventions" deprecated="true" />
|
||||
<rule ref="category/apex/codestyle.xml/MethodNamingConventions" deprecated="true" />
|
||||
|
||||
<rule ref="category/apex/errorprone.xml/AvoidDirectAccessTriggerMap" deprecated="true" />
|
||||
<rule ref="category/apex/errorprone.xml/AvoidHardcodingId" deprecated="true" />
|
||||
<rule ref="category/apex/errorprone.xml/MethodWithSameNameAsEnclosingClass" deprecated="true" />
|
||||
|
||||
<rule ref="category/apex/bestpractices.xml/AvoidGlobalModifier" deprecated="true" />
|
||||
<rule ref="category/apex/bestpractices.xml/AvoidLogicInTrigger" deprecated="true" />
|
||||
|
||||
</ruleset>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user