Change branch master to main
- Update documentation - Update release scripts - Update rule doc generation GitHub Action is only triggered from "main" branch now.
This commit is contained in:
parent
77b763e321
commit
91f17838d4
@ -45,12 +45,12 @@ Start docker without binding to local directory, so that we can do a fresh check
|
|||||||
|
|
||||||
```
|
```
|
||||||
export LANG=en_US.UTF-8
|
export LANG=en_US.UTF-8
|
||||||
export PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/master/scripts
|
export PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/main/scripts
|
||||||
|
|
||||||
export PMD_CI_SECRET_PASSPHRASE="xyz"
|
export PMD_CI_SECRET_PASSPHRASE="xyz"
|
||||||
export PMD_CI_DEBUG=true
|
export PMD_CI_DEBUG=true
|
||||||
|
|
||||||
MAIN_BRANCH="master"
|
MAIN_BRANCH="main"
|
||||||
eval $(~/create-gh-actions-env.sh push pmd/pmd $MAIN_BRANCH)
|
eval $(~/create-gh-actions-env.sh push pmd/pmd $MAIN_BRANCH)
|
||||||
|
|
||||||
cd /workspaces/pmd
|
cd /workspaces/pmd
|
||||||
@ -108,7 +108,7 @@ $(~/create-gh-actions-env.sh push adangel/pmd $MAIN_BRANCH)
|
|||||||
|
|
||||||
```
|
```
|
||||||
export LANG=en_US.UTF-8
|
export LANG=en_US.UTF-8
|
||||||
export PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/master/scripts
|
export PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/main/scripts
|
||||||
|
|
||||||
export PMD_CI_SECRET_PASSPHRASE="xyz"
|
export PMD_CI_SECRET_PASSPHRASE="xyz"
|
||||||
export PMD_CI_DEBUG=true
|
export PMD_CI_DEBUG=true
|
||||||
|
@ -280,9 +280,9 @@ function pmd_ci_deploy_build_artifacts() {
|
|||||||
# Renders release notes and uploads them as ReadMe.md to sourceforge
|
# Renders release notes and uploads them as ReadMe.md to sourceforge
|
||||||
#
|
#
|
||||||
function pmd_ci_build_and_upload_doc() {
|
function pmd_ci_build_and_upload_doc() {
|
||||||
# generate the site only for snapshots from master and for release builds for case a) (everything without cli/dist)
|
# generate the site only for snapshots from main and for release builds for case a) (everything without cli/dist)
|
||||||
# to avoid building it twice during a release...
|
# to avoid building it twice during a release...
|
||||||
if pmd_ci_maven_isSnapshotBuild && [ "${PMD_CI_BRANCH}" = "master" ] || [ "${BUILD_CLI_DIST_ONLY}" = "false" ]; then
|
if pmd_ci_maven_isSnapshotBuild && [ "${PMD_CI_BRANCH}" = "main" ] || [ "${BUILD_CLI_DIST_ONLY}" = "false" ]; then
|
||||||
pmd_doc_generate_jekyll_site
|
pmd_doc_generate_jekyll_site
|
||||||
pmd_doc_create_archive
|
pmd_doc_create_archive
|
||||||
|
|
||||||
@ -312,8 +312,8 @@ function pmd_ci_build_and_upload_doc() {
|
|||||||
pmd_ci_sourceforge_uploadReleaseNotes "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "${rendered_release_notes}"
|
pmd_ci_sourceforge_uploadReleaseNotes "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "${rendered_release_notes}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if pmd_ci_maven_isSnapshotBuild && [ "${PMD_CI_BRANCH}" = "master" ]; then
|
if pmd_ci_maven_isSnapshotBuild && [ "${PMD_CI_BRANCH}" = "main" ]; then
|
||||||
# only for snapshot builds from branch master: https://docs.pmd-code.org/snapshot -> pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}
|
# only for snapshot builds from branch main: https://docs.pmd-code.org/snapshot -> pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}
|
||||||
pmd_code_createSymlink "${PMD_CI_MAVEN_PROJECT_VERSION}" "snapshot"
|
pmd_code_createSymlink "${PMD_CI_MAVEN_PROJECT_VERSION}" "snapshot"
|
||||||
|
|
||||||
# update github pages https://pmd.github.io/pmd/
|
# update github pages https://pmd.github.io/pmd/
|
||||||
|
@ -4,7 +4,7 @@ function fetch_ci_scripts() {
|
|||||||
local inc_dir
|
local inc_dir
|
||||||
local inc_url
|
local inc_url
|
||||||
inc_dir="$(dirname "$0")/inc"
|
inc_dir="$(dirname "$0")/inc"
|
||||||
inc_url="${PMD_CI_SCRIPTS_URL:-https://raw.githubusercontent.com/pmd/build-tools/master/scripts}/inc"
|
inc_url="${PMD_CI_SCRIPTS_URL:-https://raw.githubusercontent.com/pmd/build-tools/main/scripts}/inc"
|
||||||
|
|
||||||
mkdir -p "${inc_dir}"
|
mkdir -p "${inc_dir}"
|
||||||
|
|
||||||
|
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@ -4,7 +4,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- master
|
|
||||||
tags:
|
tags:
|
||||||
- '**'
|
- '**'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
1
.github/workflows/git-repo-sync.yml
vendored
1
.github/workflows/git-repo-sync.yml
vendored
@ -4,7 +4,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- master
|
|
||||||
tags:
|
tags:
|
||||||
- '**'
|
- '**'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
@ -7,12 +7,12 @@ By participating in this project you agree to abide by its terms.
|
|||||||
|
|
||||||
You can find the code of conduct in the file [code_of_conduct.md](code_of_conduct.md).
|
You can find the code of conduct in the file [code_of_conduct.md](code_of_conduct.md).
|
||||||
|
|
||||||
| NB: the rule designer is developed over at [pmd/pmd-designer](https://github.com/pmd/pmd-designer). Please refer to the specific [contributor documentation](https://github.com/pmd/pmd-designer/blob/master/CONTRIBUTING.md) if your issue, feature request or PR touches the designer. |
|
| NB: the rule designer is developed over at [pmd/pmd-designer](https://github.com/pmd/pmd-designer). Please refer to the specific [contributor documentation](https://github.com/pmd/pmd-designer/blob/main/CONTRIBUTING.md) if your issue, feature request or PR touches the designer. |
|
||||||
| --- |
|
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
|
||||||
## Pull requests
|
## Pull requests
|
||||||
|
|
||||||
* Please create your pull request against the `master` branch. We will rebase/merge it to the maintenance
|
* Please create your pull request against the `main` branch. We will rebase/merge it to the maintenance
|
||||||
branches, if necessary.
|
branches, if necessary.
|
||||||
|
|
||||||
* We are using [checkstyle](http://checkstyle.sourceforge.net/) to enforce a common code style.
|
* We are using [checkstyle](http://checkstyle.sourceforge.net/) to enforce a common code style.
|
||||||
@ -36,7 +36,7 @@ When filing a bug report, please provide as much information as possible, so tha
|
|||||||
There is some documentation available under <https://docs.pmd-code.org/latest>. Feel free to create a bug report if
|
There is some documentation available under <https://docs.pmd-code.org/latest>. Feel free to create a bug report if
|
||||||
documentation is missing, incomplete or outdated. See [Bug reports](#bug-reports).
|
documentation is missing, incomplete or outdated. See [Bug reports](#bug-reports).
|
||||||
|
|
||||||
The documentation is generated as a Jekyll site, the source is available at: <https://github.com/pmd/pmd/tree/master/docs>. You can find build instructions there.
|
The documentation is generated as a Jekyll site, the source is available at: <https://github.com/pmd/pmd/tree/main/docs>. You can find build instructions there.
|
||||||
For more on contributing documentation check <https://docs.pmd-code.org/latest/pmd_devdocs_writing_documentation.html>
|
For more on contributing documentation check <https://docs.pmd-code.org/latest/pmd_devdocs_writing_documentation.html>
|
||||||
|
|
||||||
## Questions
|
## Questions
|
||||||
@ -53,8 +53,8 @@ There are various channels, on which you can ask questions:
|
|||||||
|
|
||||||
PMD uses [checkstyle](http://checkstyle.sourceforge.net/) to enforce a common code style.
|
PMD uses [checkstyle](http://checkstyle.sourceforge.net/) to enforce a common code style.
|
||||||
|
|
||||||
See [pmd-checkstyle-config.xml](https://github.com/pmd/build-tools/blob/master/src/main/resources/net/sourceforge/pmd/pmd-checkstyle-config.xml) for the configuration and
|
See [pmd-checkstyle-config.xml](https://github.com/pmd/build-tools/blob/main/src/main/resources/net/sourceforge/pmd/pmd-checkstyle-config.xml) for the configuration and
|
||||||
[the eclipse configuration files](https://github.com/pmd/build-tools/tree/master/eclipse) that can
|
[the eclipse configuration files](https://github.com/pmd/build-tools/tree/main/eclipse) that can
|
||||||
be imported into a fresh workspace.
|
be imported into a fresh workspace.
|
||||||
|
|
||||||
## Add yourself as contributor
|
## Add yourself as contributor
|
||||||
|
@ -39,9 +39,9 @@ def run_pmdtester
|
|||||||
FileUtils.mv 'target/reports/diff', 'target/diff1'
|
FileUtils.mv 'target/reports/diff', 'target/diff1'
|
||||||
message1 = create_message
|
message1 = create_message
|
||||||
|
|
||||||
# run against master branch (if the PR is not already against master)
|
# run against main branch (if the PR is not already against main)
|
||||||
unless ENV['PMD_CI_BRANCH'] == 'master'
|
unless ENV['PMD_CI_BRANCH'] == 'main'
|
||||||
@base_branch = 'master'
|
@base_branch = 'main'
|
||||||
@logger.info "\n\n--------------------------------------"
|
@logger.info "\n\n--------------------------------------"
|
||||||
@logger.info "Run against #{@base_branch}"
|
@logger.info "Run against #{@base_branch}"
|
||||||
@summary = PmdTester::Runner.new(get_args(@base_branch, false, 'target/diff1/patch_config.xml')).run
|
@summary = PmdTester::Runner.new(get_args(@base_branch, false, 'target/diff1/patch_config.xml')).run
|
||||||
|
2
Gemfile
2
Gemfile
@ -1,7 +1,7 @@
|
|||||||
source 'https://rubygems.org/'
|
source 'https://rubygems.org/'
|
||||||
|
|
||||||
# bleeding edge from git
|
# bleeding edge from git
|
||||||
#gem 'pmdtester', :git => 'https://github.com/pmd/pmd-regression-tester.git', branch: 'master'
|
#gem 'pmdtester', :git => 'https://github.com/pmd/pmd-regression-tester.git', branch: 'main'
|
||||||
|
|
||||||
gem 'pmdtester'
|
gem 'pmdtester'
|
||||||
gem 'danger'
|
gem 'danger'
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
# PMD - source code analyzer
|
# PMD - source code analyzer
|
||||||
|
|
||||||
![PMD Logo](https://raw.githubusercontent.com/pmd/pmd/pmd/7.0.x/docs/images/logo/pmd-logo-300px.png)
|
![PMD Logo](https://raw.githubusercontent.com/pmd/pmd/pmd/main/docs/images/logo/pmd-logo-300px.png)
|
||||||
|
|
||||||
[![Join the chat](https://img.shields.io/gitter/room/pmd/pmd)](https://app.gitter.im/#/room/#pmd_pmd:gitter.im?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
[![Join the chat](https://img.shields.io/gitter/room/pmd/pmd)](https://app.gitter.im/#/room/#pmd_pmd:gitter.im?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
[![Build Status](https://github.com/pmd/pmd/workflows/build/badge.svg?branch=master)](https://github.com/pmd/pmd/actions)
|
[![Build Status](https://github.com/pmd/pmd/workflows/build/badge.svg?branch=main)](https://github.com/pmd/pmd/actions)
|
||||||
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.sourceforge.pmd/pmd/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.sourceforge.pmd/pmd)
|
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.sourceforge.pmd/pmd/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.sourceforge.pmd/pmd)
|
||||||
[![Reproducible Builds](https://img.shields.io/badge/Reproducible_Builds-ok-green?labelColor=blue)](https://github.com/jvm-repo-rebuild/reproducible-central/tree/master/content/net/sourceforge/pmd#readme)
|
[![Reproducible Builds](https://img.shields.io/badge/Reproducible_Builds-ok-green?labelColor=blue)](https://github.com/jvm-repo-rebuild/reproducible-central/tree/master/content/net/sourceforge/pmd#readme)
|
||||||
[![Coverage Status](https://coveralls.io/repos/github/pmd/pmd/badge.svg)](https://coveralls.io/github/pmd/pmd)
|
[![Coverage Status](https://coveralls.io/repos/github/pmd/pmd/badge.svg)](https://coveralls.io/github/pmd/pmd)
|
||||||
|
@ -311,7 +311,7 @@ echo " <https://repo.maven.apache.org/maven2/net/sourceforge/pmd/pmd/maven-me
|
|||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
echo "Then proceed with releasing pmd-designer..."
|
echo "Then proceed with releasing pmd-designer..."
|
||||||
echo "<https://github.com/pmd/pmd-designer/blob/master/releasing.md>"
|
echo "<https://github.com/pmd/pmd-designer/blob/main/releasing.md>"
|
||||||
echo
|
echo
|
||||||
echo "Press enter to continue when pmd-designer is available in maven-central..."
|
echo "Press enter to continue when pmd-designer is available in maven-central..."
|
||||||
echo "<https://repo.maven.apache.org/maven2/net/sourceforge/pmd/pmd-designer/maven-metadata.xml>."
|
echo "<https://repo.maven.apache.org/maven2/net/sourceforge/pmd/pmd-designer/maven-metadata.xml>."
|
||||||
|
@ -21,7 +21,7 @@ site_title: PMD Source Code Analyzer
|
|||||||
company_name: PMD Open Source Project
|
company_name: PMD Open Source Project
|
||||||
# this appears in the footer
|
# this appears in the footer
|
||||||
|
|
||||||
github_editme_path: pmd/pmd/blob/master/docs/
|
github_editme_path: pmd/pmd/blob/main/docs/
|
||||||
# if you're using Github, provide the basepath to the branch you've created for reviews, following the sample here. if not, leave this value blank.
|
# if you're using Github, provide the basepath to the branch you've created for reviews, following the sample here. if not, leave this value blank.
|
||||||
|
|
||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
|
@ -524,7 +524,7 @@ entries:
|
|||||||
url: /pmd_devdocs_building.html
|
url: /pmd_devdocs_building.html
|
||||||
output: web, pdf
|
output: web, pdf
|
||||||
- title: Contributing
|
- title: Contributing
|
||||||
external_url: https://github.com/pmd/pmd/blob/master/CONTRIBUTING.md
|
external_url: https://github.com/pmd/pmd/blob/main/CONTRIBUTING.md
|
||||||
output: web, pdf
|
output: web, pdf
|
||||||
- title: Writing documentation
|
- title: Writing documentation
|
||||||
url: /pmd_devdocs_writing_documentation.html
|
url: /pmd_devdocs_writing_documentation.html
|
||||||
|
@ -45,9 +45,9 @@ See also
|
|||||||
|
|
||||||
## Git branches/tags policy
|
## Git branches/tags policy
|
||||||
|
|
||||||
* Main development happens on the main branch (currently called `master`).
|
* Main development happens on the main branch (currently called `main`).
|
||||||
* PR and enhancements are done on the main branch.
|
* PR and enhancements are done on the main branch.
|
||||||
* Release are usually done directly from the main branch, we don't create release branches.
|
* Releases are usually done directly from the main branch, we don't create release branches.
|
||||||
* Each release has its own tag named `pmd_releases/MAJOR.MINOR.PATCH`.
|
* Each release has its own tag named `pmd_releases/MAJOR.MINOR.PATCH`.
|
||||||
* In case of a patch release, we either do it from the main branch (if there was no development ongoing)
|
* In case of a patch release, we either do it from the main branch (if there was no development ongoing)
|
||||||
or create a separate branch off the last release tag.
|
or create a separate branch off the last release tag.
|
||||||
|
@ -36,5 +36,5 @@ The latest release documentation is always available under [docs.pmd-code.org/la
|
|||||||
|
|
||||||
First off, thanks for taking the time to contribute!
|
First off, thanks for taking the time to contribute!
|
||||||
|
|
||||||
Please have a look at [CONTRIBUTING.md](https://github.com/pmd/pmd/blob/master/CONTRIBUTING.md) and
|
Please have a look at [CONTRIBUTING.md](https://github.com/pmd/pmd/blob/main/CONTRIBUTING.md) and
|
||||||
[BUILDING.md](https://github.com/pmd/pmd/blob/master/BUILDING.md).
|
[BUILDING.md](https://github.com/pmd/pmd/blob/main/BUILDING.md).
|
||||||
|
@ -64,7 +64,7 @@ definitely don't come for free. It is much effort and requires perseverance to i
|
|||||||
### 2. Implement an AST parser for your language
|
### 2. Implement an AST parser for your language
|
||||||
* ANTLR will generate the parser for you based on the grammar file. The grammar file needs to be placed in the
|
* ANTLR will generate the parser for you based on the grammar file. The grammar file needs to be placed in the
|
||||||
folder `src/main/antlr4` in the appropriate sub package `ast` of the language. E.g. for swift, the grammar
|
folder `src/main/antlr4` in the appropriate sub package `ast` of the language. E.g. for swift, the grammar
|
||||||
file is [Swift.g4](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/antlr4/net/sourceforge/pmd/lang/swift/ast/Swift.g4)
|
file is [Swift.g4](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/antlr4/net/sourceforge/pmd/lang/swift/ast/Swift.g4)
|
||||||
and is placed in the package `net.sourceforge.pmd.lang.swift.ast`.
|
and is placed in the package `net.sourceforge.pmd.lang.swift.ast`.
|
||||||
* Configure the options "superClass" and "contextSuperClass". These are the base classes for the generated
|
* Configure the options "superClass" and "contextSuperClass". These are the base classes for the generated
|
||||||
classes.
|
classes.
|
||||||
@ -72,39 +72,39 @@ definitely don't come for free. It is much effort and requires perseverance to i
|
|||||||
### 3. Create AST node classes
|
### 3. Create AST node classes
|
||||||
* The individual AST nodes are generated, but you need to define the common interface for them.
|
* The individual AST nodes are generated, but you need to define the common interface for them.
|
||||||
* You need to define the supertype interface for all nodes of the language. For that, we provide
|
* You need to define the supertype interface for all nodes of the language. For that, we provide
|
||||||
[`AntlrNode`](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrNode.java).
|
[`AntlrNode`](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrNode.java).
|
||||||
* See [`SwiftNode`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftNode.java)
|
* See [`SwiftNode`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftNode.java)
|
||||||
as an example.
|
as an example.
|
||||||
* Additionally, you need several base classes:
|
* Additionally, you need several base classes:
|
||||||
* a language specific inner node - these nodes represent the production rules from the grammar.
|
* a language specific inner node - these nodes represent the production rules from the grammar.
|
||||||
In Antlr, they are called "ParserRuleContext". We call them "InnerNode". Use the
|
In Antlr, they are called "ParserRuleContext". We call them "InnerNode". Use the
|
||||||
base class from pmd-core
|
base class from pmd-core
|
||||||
[`BaseAntlrInnerNode`](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/BaseAntlrInnerNode.java)
|
[`BaseAntlrInnerNode`](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/BaseAntlrInnerNode.java)
|
||||||
. And example is [`SwiftInnerNode`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftInnerNode.java).
|
. And example is [`SwiftInnerNode`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftInnerNode.java).
|
||||||
Note that this language specific inner node is package-private, as it is only the base class for the concrete
|
Note that this language specific inner node is package-private, as it is only the base class for the concrete
|
||||||
nodes generated by ANLTR.
|
nodes generated by ANLTR.
|
||||||
* a language specific root node - this provides the root of the AST and our parser will return
|
* a language specific root node - this provides the root of the AST and our parser will return
|
||||||
subtypes of this node. The root node itself is a "InnerNode".
|
subtypes of this node. The root node itself is a "InnerNode".
|
||||||
See [`SwiftRootNode`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftRootNode.java).
|
See [`SwiftRootNode`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftRootNode.java).
|
||||||
Note that this language specific root node is package-private, as it is only the base class for the concrete
|
Note that this language specific root node is package-private, as it is only the base class for the concrete
|
||||||
node generated by ANLTR.
|
node generated by ANLTR.
|
||||||
* a language specific terminal node.
|
* a language specific terminal node.
|
||||||
See [`SwiftTerminalNode`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftTerminalNode.java).
|
See [`SwiftTerminalNode`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftTerminalNode.java).
|
||||||
* a language specific error node.
|
* a language specific error node.
|
||||||
See [`SwiftErrorNode`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftErrorNode.java).
|
See [`SwiftErrorNode`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftErrorNode.java).
|
||||||
* a language name dictionary. This is used to convert ANTLR node names to useful XPath node names.
|
* a language name dictionary. This is used to convert ANTLR node names to useful XPath node names.
|
||||||
See [`SwiftNameDictionary'](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftNameDictionary.java).
|
See [`SwiftNameDictionary'](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftNameDictionary.java).
|
||||||
* Once these base classes exist, you need to change the ANTLR grammar to add additional members via `@parser::members`
|
* Once these base classes exist, you need to change the ANTLR grammar to add additional members via `@parser::members`
|
||||||
* Define a package private field `DICO` which creates a new instance of your language name dictionary using the
|
* Define a package private field `DICO` which creates a new instance of your language name dictionary using the
|
||||||
vocabulary from the generated parser (`VOCABULARY`).
|
vocabulary from the generated parser (`VOCABULARY`).
|
||||||
* Define two additional methods to help converting the ANTLR context objects into PMD AST nodes.
|
* Define two additional methods to help converting the ANTLR context objects into PMD AST nodes.
|
||||||
The methods are abstract in [`AntlrGeneratedParserBase`](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrGeneratedParserBase.java)
|
The methods are abstract in [`AntlrGeneratedParserBase`](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrGeneratedParserBase.java)
|
||||||
and need to be implemented here for the concrete language: `createPmdTerminal()` and `createPmdError()`.
|
and need to be implemented here for the concrete language: `createPmdTerminal()` and `createPmdError()`.
|
||||||
* In order for the generated code to match and use our custom classes, we have a common ant script, that fiddles with
|
* In order for the generated code to match and use our custom classes, we have a common ant script, that fiddles with
|
||||||
the generated code. The ant script is [`antlr4-wrapper.xml`](https://github.com/pmd/pmd/blob/master/antlr4-wrapper.xml)
|
the generated code. The ant script is [`antlr4-wrapper.xml`](https://github.com/pmd/pmd/blob/main/antlr4-wrapper.xml)
|
||||||
and does not need to be adjusted - it has plenty of parameters that can be configured.
|
and does not need to be adjusted - it has plenty of parameters that can be configured.
|
||||||
The ant script is added in the language module's `pom.xml` where the parameters are set (e.g. name of root name
|
The ant script is added in the language module's `pom.xml` where the parameters are set (e.g. name of root name
|
||||||
class). Have a look at Swift's example: [`pmd-swift/pom.xml`](https://github.com/pmd/pmd/blob/master/pmd-swift/pom.xml).
|
class). Have a look at Swift's example: [`pmd-swift/pom.xml`](https://github.com/pmd/pmd/blob/main/pmd-swift/pom.xml).
|
||||||
* You can add additional methods in your "InnerNode" (e.g. `SwiftInnerNode`) that are available on all nodes.
|
* You can add additional methods in your "InnerNode" (e.g. `SwiftInnerNode`) that are available on all nodes.
|
||||||
But on most cases you won't need to do anything.
|
But on most cases you won't need to do anything.
|
||||||
|
|
||||||
@ -115,31 +115,31 @@ definitely don't come for free. It is much effort and requires perseverance to i
|
|||||||
have the parser generated.
|
have the parser generated.
|
||||||
* The generated code will be placed under `target/generated-sources/antlr4` and will not be committed to
|
* The generated code will be placed under `target/generated-sources/antlr4` and will not be committed to
|
||||||
source control.
|
source control.
|
||||||
* You should review [`pmd-swift/pom.xml`](https://github.com/pmd/pmd/blob/master/pmd-swift/pom.xml).
|
* You should review [`pmd-swift/pom.xml`](https://github.com/pmd/pmd/blob/main/pmd-swift/pom.xml).
|
||||||
|
|
||||||
### 5. Create a TokenManager
|
### 5. Create a TokenManager
|
||||||
* This is needed to support CPD (copy paste detection)
|
* 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/lang/ast/impl/antlr4/AntlrTokenManager.java).
|
* We provide a default implementation using [`AntlrTokenManager`](https://github.com/pmd/pmd/blob/main/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
|
* 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).
|
[`SwiftCpdLexer`](https://github.com/pmd/pmd/blob/main/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")
|
* 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
|
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).
|
[`AntlrTokenFilter`](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/cpd/impl/AntlrTokenFilter.java).
|
||||||
You'll need to override then the protected method `getTokenFilter(AntlrTokenManager)`
|
You'll need to override then the protected method `getTokenFilter(AntlrTokenManager)`
|
||||||
and return your custom filter. See the CpdLexer for C# as an exmaple:
|
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).
|
[`CsCpdLexer`](https://github.com/pmd/pmd/blob/main/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
|
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.
|
`AntlrTokenFilter` which doesn't filter anything.
|
||||||
|
|
||||||
### 6. Create a PMD parser “adapter”
|
### 6. Create a PMD parser “adapter”
|
||||||
* Create your own parser, that adapts the ANLTR interface to PMD's parser interface.
|
* Create your own parser, that adapts the ANLTR interface to PMD's parser interface.
|
||||||
* We provide a [`AntlrBaseParser`](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrBaseParser.java)
|
* We provide a [`AntlrBaseParser`](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrBaseParser.java)
|
||||||
implementation that you need to extend to create your own adapter as we do with
|
implementation that you need to extend to create your own adapter as we do with
|
||||||
[`PmdSwiftParser`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/PmdSwiftParser.java).
|
[`PmdSwiftParser`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/PmdSwiftParser.java).
|
||||||
|
|
||||||
### 7. Create a language version handler
|
### 7. Create a language version handler
|
||||||
* Now you need to create your version handler, as we did with [`SwiftHandler`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftHandler.java).
|
* Now you need to create your version handler, as we did with [`SwiftHandler`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftHandler.java).
|
||||||
* This class is sort of a gateway between PMD and all parsing logic specific to your language.
|
* This class is sort of a gateway between PMD and all parsing logic specific to your language.
|
||||||
* For a minimal implementation, it just needs to return a parser *(see step #6)*.
|
* For a minimal implementation, it just needs to return a parser *(see step #6)*.
|
||||||
* It can be used to provide other features for your language like
|
* It can be used to provide other features for your language like
|
||||||
@ -154,15 +154,15 @@ definitely don't come for free. It is much effort and requires perseverance to i
|
|||||||
* A parser visitor adapter is not needed anymore with PMD 7. The visitor interface now provides a default
|
* A parser visitor adapter is not needed anymore with PMD 7. The visitor interface now provides a default
|
||||||
implementation.
|
implementation.
|
||||||
* The visitor for ANTLR based AST is generated along the parser from the ANTLR grammar file. The
|
* The visitor for ANTLR based AST is generated along the parser from the ANTLR grammar file. The
|
||||||
base interface for a visitor is [`AstVisitor`](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/AstVisitor.java).
|
base interface for a visitor is [`AstVisitor`](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/AstVisitor.java).
|
||||||
* The generated visitor class for Swift is called `SwiftVisitor`.
|
* The generated visitor class for Swift is called `SwiftVisitor`.
|
||||||
* In order to help use this visitor later on, a base visitor class should be created.
|
* In order to help use this visitor later on, a base visitor class should be created.
|
||||||
See [`SwiftVisitorBase`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftVisitorBase.java)
|
See [`SwiftVisitorBase`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftVisitorBase.java)
|
||||||
as an example.
|
as an example.
|
||||||
|
|
||||||
### 9. Make PMD recognize your language
|
### 9. Make PMD recognize your language
|
||||||
* Create your own subclass of `net.sourceforge.pmd.lang.impl.SimpleLanguageModuleBase`, see Swift as an example:
|
* Create your own subclass of `net.sourceforge.pmd.lang.impl.SimpleLanguageModuleBase`, see Swift as an example:
|
||||||
[`SwiftLanguageModule`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftLanguageModule.java).
|
[`SwiftLanguageModule`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftLanguageModule.java).
|
||||||
* Add for each version of your language a call to `addVersion` in your language module’s constructor.
|
* Add for each version of your language a call to `addVersion` in your language module’s constructor.
|
||||||
Use `addDefaultVersion` for defining the default version.
|
Use `addDefaultVersion` for defining the default version.
|
||||||
* You’ll need to refer the language version handler created in step #7.
|
* You’ll need to refer the language version handler created in step #7.
|
||||||
@ -172,9 +172,9 @@ definitely don't come for free. It is much effort and requires perseverance to i
|
|||||||
### 10. Create an abstract rule class for the language
|
### 10. Create an abstract rule class for the language
|
||||||
* You need to create your own abstract rule class in order to interface your language with PMD's generic rule
|
* You need to create your own abstract rule class in order to interface your language with PMD's generic rule
|
||||||
execution.
|
execution.
|
||||||
* See [`AbstractSwiftRule`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/rule/AbstractSwiftRule.java) as an example.
|
* See [`AbstractSwiftRule`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/rule/AbstractSwiftRule.java) as an example.
|
||||||
* The rule basically just extends
|
* The rule basically just extends
|
||||||
[`AbstractVisitorRule`](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractVisitorRule.java)
|
[`AbstractVisitorRule`](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractVisitorRule.java)
|
||||||
and only redefines the abstract `buildVisitor()` method to return our own type of visitor.
|
and only redefines the abstract `buildVisitor()` method to return our own type of visitor.
|
||||||
In this case our `SwiftVisitor` is used.
|
In this case our `SwiftVisitor` is used.
|
||||||
While there is no real functionality added, every language should have its own base class for rules.
|
While there is no real functionality added, every language should have its own base class for rules.
|
||||||
@ -192,7 +192,7 @@ definitely don't come for free. It is much effort and requires perseverance to i
|
|||||||
* PMD supports 2 types of rules, through visitors or XPath.
|
* PMD supports 2 types of rules, through visitors or XPath.
|
||||||
* To add a visitor rule:
|
* To add a visitor rule:
|
||||||
* You need to extend the abstract rule you created on the previous step, you can use the swift
|
* You need to extend the abstract rule you created on the previous step, you can use the swift
|
||||||
rule [UnavailableFunctionRule](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/UnavailableFunctionRule.java)
|
rule [UnavailableFunctionRule](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/UnavailableFunctionRule.java)
|
||||||
as an example. Note, that all rule classes should be suffixed with `Rule` and should be placed
|
as an example. Note, that all rule classes should be suffixed with `Rule` and should be placed
|
||||||
in a package the corresponds to their category.
|
in a package the corresponds to their category.
|
||||||
* To add an XPath rule you can follow our guide [Writing XPath Rules](pmd_userdocs_extending_writing_xpath_rules.html).
|
* To add an XPath rule you can follow our guide [Writing XPath Rules](pmd_userdocs_extending_writing_xpath_rules.html).
|
||||||
@ -213,16 +213,16 @@ definitely don't come for free. It is much effort and requires perseverance to i
|
|||||||
* Testing rules is described in depth in [Testing your rules](pmd_userdocs_extending_testing.html).
|
* Testing rules is described in depth in [Testing your rules](pmd_userdocs_extending_testing.html).
|
||||||
* Each rule has its own test class: Create a test class for your rule extending `PmdRuleTst`
|
* Each rule has its own test class: Create a test class for your rule extending `PmdRuleTst`
|
||||||
*(see
|
*(see
|
||||||
[`UnavailableFunctionTest`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/test/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/UnavailableFunctionTest.java)
|
[`UnavailableFunctionTest`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/test/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/UnavailableFunctionTest.java)
|
||||||
for example)*
|
for example)*
|
||||||
* Create a category rule set for your language *(see
|
* Create a category rule set for your language *(see
|
||||||
[`pmd-swift/src/main/resources/bestpractices.xml`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/resources/category/swift/bestpractices.xml)
|
[`pmd-swift/src/main/resources/bestpractices.xml`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/resources/category/swift/bestpractices.xml)
|
||||||
for example)*
|
for example)*
|
||||||
* Place the test XML file with the test cases in the correct location
|
* Place the test XML file with the test cases in the correct location
|
||||||
* When executing the test class
|
* When executing the test class
|
||||||
* this triggers the unit test to read the corresponding XML file with the rule test data
|
* this triggers the unit test to read the corresponding XML file with the rule test data
|
||||||
*(see
|
*(see
|
||||||
[`UnavailableFunction.xml`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/rule/bestpractices/xml/UnavailableFunction.xml)
|
[`UnavailableFunction.xml`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/rule/bestpractices/xml/UnavailableFunction.xml)
|
||||||
for example)*
|
for example)*
|
||||||
* This test XML file contains sample pieces of code which should trigger a specified number of
|
* This test XML file contains sample pieces of code which should trigger a specified number of
|
||||||
violations of this rule. The unit test will execute the rule on this piece of code, and verify
|
violations of this rule. The unit test will execute the rule on this piece of code, and verify
|
||||||
|
@ -20,7 +20,7 @@ easy to implement the Tokenizer interface.
|
|||||||
|
|
||||||
Use the following guide to set up a new language module that supports CPD.
|
Use the following guide to set up a new language module that supports CPD.
|
||||||
|
|
||||||
1. Create a new Maven module for your language. You can take [the Golang module](https://github.com/pmd/pmd/tree/master/pmd-go/pom.xml) as an example.
|
1. Create a new Maven module for your language. You can take [the Golang module](https://github.com/pmd/pmd/tree/main/pmd-go/pom.xml) as an example.
|
||||||
- Make sure to add your new module to the parent pom as `<module>` entry, so that it is built alongside the
|
- Make sure to add your new module to the parent pom as `<module>` entry, so that it is built alongside the
|
||||||
other languages.
|
other languages.
|
||||||
- Also add your new module to the dependencies list in "pmd-languages-deps/pom.xml", so that the new language
|
- Also add your new module to the dependencies list in "pmd-languages-deps/pom.xml", so that the new language
|
||||||
@ -28,7 +28,7 @@ Use the following guide to set up a new language module that supports CPD.
|
|||||||
|
|
||||||
2. Implement a {% jdoc core::cpd.CpdLexer %}.
|
2. Implement a {% jdoc core::cpd.CpdLexer %}.
|
||||||
- For Antlr grammars you can take the grammar from [antlr/grammars-v4](https://github.com/antlr/grammars-v4) and place it in `src/main/antlr4` followed by the package name of the language. You then need to call the appropriate ant wrapper to generate
|
- For Antlr grammars you can take the grammar from [antlr/grammars-v4](https://github.com/antlr/grammars-v4) and place it in `src/main/antlr4` followed by the package name of the language. You then need to call the appropriate ant wrapper to generate
|
||||||
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)).
|
the lexer from the grammar. To do so, edit `pom.xml` (eg like [the Golang module](https://github.com/pmd/pmd/tree/main/pmd-go/pom.xml)).
|
||||||
Once that is done, `mvn generate-sources` should generate the lexer sources for you.
|
Once that is done, `mvn generate-sources` should generate the lexer sources for you.
|
||||||
|
|
||||||
You can now implement a CpdLexer, for instance by extending {% jdoc core::cpd.impl.AntlrCpdLexer %}. 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:
|
||||||
@ -49,7 +49,7 @@ Use the following guide to set up a new language module that supports CPD.
|
|||||||
change each token e.g. into uppercase, so that CPD sees the same strings and can find duplicates even when
|
change each token e.g. into uppercase, so that CPD sees the same strings and can find duplicates even when
|
||||||
the casing differs. See {% jdoc tsql::lang.tsql.cpd.TSqlCpdLexer %} for an example. You will also need a
|
the casing differs. See {% jdoc tsql::lang.tsql.cpd.TSqlCpdLexer %} for an example. You will also need a
|
||||||
"CaseChangingCharStream", so that antlr itself is case-insensitive.
|
"CaseChangingCharStream", so that antlr itself is case-insensitive.
|
||||||
- For JavaCC grammars, place your grammar in `etc/grammar` and edit the `pom.xml` like the [Python implementation](https://github.com/pmd/pmd/blob/master/pmd-python/pom.xml) does.
|
- For JavaCC grammars, place your grammar in `etc/grammar` and edit the `pom.xml` like the [Python implementation](https://github.com/pmd/pmd/blob/main/pmd-python/pom.xml) does.
|
||||||
You can then subclass {% jdoc core::cpd.impl.JavaccCpdLexer %} instead of AntlrCpdLexer.
|
You can then subclass {% jdoc core::cpd.impl.JavaccCpdLexer %} instead of AntlrCpdLexer.
|
||||||
- If your JavaCC based language is case-insensitive (option `IGNORE_CASE=true`), then you need to implement
|
- If your JavaCC based language is case-insensitive (option `IGNORE_CASE=true`), then you need to implement
|
||||||
{%jdoc core::lang.ast.impl.javacc.JavaccTokenDocument.TokenDocumentBehavior %}, which can change each token
|
{%jdoc core::lang.ast.impl.javacc.JavaccTokenDocument.TokenDocumentBehavior %}, which can change each token
|
||||||
@ -82,7 +82,7 @@ If your language only supports CPD, then you can subclass {% jdoc core::lang.imp
|
|||||||
|
|
||||||
At this point the new language module should be available in {% jdoc core::lang.LanguageRegistry#CPD %} and usable by CPD like any other language.
|
At this point the new language module should be available in {% jdoc core::lang.LanguageRegistry#CPD %} and usable by CPD like any other language.
|
||||||
|
|
||||||
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/dist/BinaryDistributionIT.java).
|
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/main/pmd-dist/src/test/java/net/sourceforge/pmd/dist/BinaryDistributionIT.java).
|
||||||
|
|
||||||
5. Add some tests for your CpdLexer by following the [section below](#testing-your-implementation).
|
5. Add some tests for your CpdLexer by following the [section below](#testing-your-implementation).
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ of {% jdoc core::cpd.CpdCapableLanguage#createCpdTokenizer(core::lang.LanguagePr
|
|||||||
|
|
||||||
To implement simple token filtering, you can use {% jdoc core::cpd.impl.BaseTokenFilter %}
|
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 %}.
|
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/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).
|
Take a look at the [Kotlin token filter implementation](https://github.com/pmd/pmd/blob/main/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
|
### Testing your implementation
|
||||||
|
@ -17,8 +17,8 @@ Regression difference reports are commented back to the PR for the reviewer's in
|
|||||||
|
|
||||||
**Verifying your local changes and generate a diff-report locally**
|
**Verifying your local changes and generate a diff-report locally**
|
||||||
|
|
||||||
`pmdtester -r YOUR_LOCAL_PMD_GIT_REPO_ROOT_DIR -b master -p YOUR_DEVELOPMENT_BRANCH`
|
`pmdtester -r YOUR_LOCAL_PMD_GIT_REPO_ROOT_DIR -b main -p YOUR_DEVELOPMENT_BRANCH`
|
||||||
|
|
||||||
The regression difference report is placed in the `YOUR_WORKING_DIR/target/reports/diff` directory.
|
The regression difference report is placed in the `YOUR_WORKING_DIR/target/reports/diff` directory.
|
||||||
|
|
||||||
For more documentation on pmdtester, see [README.rdoc](https://github.com/pmd/pmd-regression-tester/blob/master/README.rdoc)
|
For more documentation on pmdtester, see [README.rdoc](https://github.com/pmd/pmd-regression-tester/blob/main/README.rdoc)
|
||||||
|
@ -33,7 +33,7 @@ This makes it easy to view the documentation also offline.
|
|||||||
|
|
||||||
The categories for a language `%lang%` are located in
|
The categories for a language `%lang%` are located in
|
||||||
`pmd-%lang%/src/main/resources/category/%lang% `. So for Java the categories
|
`pmd-%lang%/src/main/resources/category/%lang% `. So for Java the categories
|
||||||
can be found under [pmd-java/src/main/resources/category/java](https://github.com/pmd/pmd/tree/master/pmd-java/src/main/resources/category/java).
|
can be found under [pmd-java/src/main/resources/category/java](https://github.com/pmd/pmd/tree/main/pmd-java/src/main/resources/category/java).
|
||||||
The XML category files in this directory are transformed during build into markdown pages
|
The XML category files in this directory are transformed during build into markdown pages
|
||||||
describing the rules they contain. These pages are placed under `docs/` like the handwritten
|
describing the rules they contain. These pages are placed under `docs/` like the handwritten
|
||||||
documentation, and are then rendered with Jekyll like the rest of them. The rule documentation
|
documentation, and are then rendered with Jekyll like the rest of them. The rule documentation
|
||||||
@ -83,7 +83,7 @@ Here's a short overview:
|
|||||||
|
|
||||||
For the javadoc tags, the standard PMD maven modules are already defined as namespaces, e.g. `core`, `java`, `apex`, ....
|
For the javadoc tags, the standard PMD maven modules are already defined as namespaces, e.g. `core`, `java`, `apex`, ....
|
||||||
|
|
||||||
For the implementation of these tags, see the [_plugins](https://github.com/pmd/pmd/tree/master/docs/_plugins) folder.
|
For the implementation of these tags, see the [_plugins](https://github.com/pmd/pmd/tree/main/docs/_plugins) folder.
|
||||||
|
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
@ -199,4 +199,4 @@ You can access these via {% jdoc core::reporting.RuleViolation#getAdditionalInfo
|
|||||||
There is no API yet for dataflow analysis. However, some rules such as {% rule java/bestpractices/UnusedAssignment %}
|
There is no API yet for dataflow analysis. However, some rules such as {% rule java/bestpractices/UnusedAssignment %}
|
||||||
or {% rule java/design/ImmutableField %} are using an internal implementation of an additional
|
or {% rule java/design/ImmutableField %} are using an internal implementation of an additional
|
||||||
AST pass that adds dataflow information. The implementation can be found in
|
AST pass that adds dataflow information. The implementation can be found in
|
||||||
[net.sourceforge.pmd.lang.java.rule.internal.DataflowPass](https://github.com/pmd/pmd/blob/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java).
|
[net.sourceforge.pmd.lang.java.rule.internal.DataflowPass](https://github.com/pmd/pmd/blob/main/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java).
|
||||||
|
@ -18,15 +18,15 @@ It usually takes 15 minutes.
|
|||||||
## Contents
|
## Contents
|
||||||
|
|
||||||
* Main page - aka "Landing page": <https://pmd.github.io>
|
* Main page - aka "Landing page": <https://pmd.github.io>
|
||||||
* Layout: [_layouts/default.html](https://github.com/pmd/pmd.github.io/blob/master/_layouts/default.html).
|
* Layout: [_layouts/default.html](https://github.com/pmd/pmd.github.io/blob/main/_layouts/default.html).
|
||||||
It includes all the sub section, which can be found in the includes directory [_includes/](https://github.com/pmd/pmd.github.io/tree/master/_includes)
|
It includes all the sub section, which can be found in the includes directory [_includes/](https://github.com/pmd/pmd.github.io/tree/main/_includes)
|
||||||
* The latest PMD version is configured in `_config.yml` and the variables `site.pmd.latestVersion` are used
|
* The latest PMD version is configured in `_config.yml` and the variables `site.pmd.latestVersion` are used
|
||||||
e.g. in [_includes/home.html](https://github.com/pmd/pmd.github.io/blob/master/_includes/home.html).
|
e.g. in [_includes/home.html](https://github.com/pmd/pmd.github.io/blob/main/_includes/home.html).
|
||||||
* Blog - aka "News": <https://pmd.github.io/news/>
|
* Blog - aka "News": <https://pmd.github.io/news/>
|
||||||
* This is a section on main page. It shows the 5 latest news. See [_includes/news.html](https://github.com/pmd/pmd.github.io/blob/master/_includes/news.html).
|
* This is a section on main page. It shows the 5 latest news. See [_includes/news.html](https://github.com/pmd/pmd.github.io/blob/main/_includes/news.html).
|
||||||
* There is also a sub page "news" which lists all news.
|
* There is also a sub page "news" which lists all news.
|
||||||
* Layout: [_layouts/news.html](https://github.com/pmd/pmd.github.io/blob/master/_layouts/news.html)
|
* Layout: [_layouts/news.html](https://github.com/pmd/pmd.github.io/blob/main/_layouts/news.html)
|
||||||
* Page (which is pretty empty): [news.html](https://github.com/pmd/pmd.github.io/blob/master/news.html)
|
* Page (which is pretty empty): [news.html](https://github.com/pmd/pmd.github.io/blob/main/news.html)
|
||||||
|
|
||||||
## Building the page locally
|
## Building the page locally
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ last_updated: October 2021
|
|||||||
author: Andreas Dangel <andreas.dangel@adangel.org>
|
author: Andreas Dangel <andreas.dangel@adangel.org>
|
||||||
---
|
---
|
||||||
|
|
||||||
## Example 1: Merging PR #123 into master
|
## Example 1: Merging PR #123 into main
|
||||||
|
|
||||||
1. Review the pull request
|
1. Review the pull request
|
||||||
|
|
||||||
@ -20,15 +20,15 @@ author: Andreas Dangel <andreas.dangel@adangel.org>
|
|||||||
|
|
||||||
2. The actual merge commands:
|
2. The actual merge commands:
|
||||||
|
|
||||||
We assume, that the PR has been created from the master branch. If this is not the case,
|
We assume, that the PR has been created from the main branch. If this is not the case,
|
||||||
then we'll either need to rebase or ask for rebasing before merging.
|
then we'll either need to rebase or ask for rebasing before merging.
|
||||||
|
|
||||||
```
|
```
|
||||||
git checkout master && git pull origin master # make sure, you have the latest code
|
git checkout main && git pull origin main # make sure, you have the latest code
|
||||||
git fetch origin pull/123/head:pr-123 && git checkout pr-123 # creates a new temporary branch "pr-123"
|
git fetch origin pull/123/head:pr-123 && git checkout pr-123 # creates a new temporary branch "pr-123"
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Update the [release notes](https://github.com/pmd/pmd/blob/master/docs/pages/release_notes.md):
|
3. Update the [release notes](https://github.com/pmd/pmd/blob/main/docs/pages/release_notes.md):
|
||||||
|
|
||||||
* Are there any API changes, that need to be documented? (Section "API Changes")
|
* Are there any API changes, that need to be documented? (Section "API Changes")
|
||||||
* Are there any significant changes to existing rules, that should be mentioned?
|
* Are there any significant changes to existing rules, that should be mentioned?
|
||||||
@ -61,13 +61,13 @@ author: Andreas Dangel <andreas.dangel@adangel.org>
|
|||||||
And follow the instructions. This will create a new commit into to the current branch (pr-123) updating both
|
And follow the instructions. This will create a new commit into to the current branch (pr-123) updating both
|
||||||
the file `.all-contributorsrc` and `docs/pages/pmd/projectdocs/credits.md`.
|
the file `.all-contributorsrc` and `docs/pages/pmd/projectdocs/credits.md`.
|
||||||
|
|
||||||
5. Now merge the pull request into the master branch:
|
5. Now merge the pull request into the main branch:
|
||||||
|
|
||||||
```
|
```
|
||||||
git checkout master
|
git checkout main
|
||||||
git merge --no-ff pr-123 -m "Merge pull request #123 from xyz:branch
|
git merge --no-ff pr-123 -m "Full-title-of-the-pr (#123)
|
||||||
|
|
||||||
Full-title-of-the-pr #123" --log
|
Merge pull request #123 from xyz:branch" --log
|
||||||
```
|
```
|
||||||
|
|
||||||
{%include note.html content="If there are merge conflicts, you'll need to deal with them here." %}
|
{%include note.html content="If there are merge conflicts, you'll need to deal with them here." %}
|
||||||
@ -75,7 +75,7 @@ author: Andreas Dangel <andreas.dangel@adangel.org>
|
|||||||
6. Run the complete build: `./mvnw clean verify -Pgenerate-rule-docs`
|
6. Run the complete build: `./mvnw clean verify -Pgenerate-rule-docs`
|
||||||
|
|
||||||
{% include note.html content="This will execute all the unit tests and the checkstyle tests. It ensures,
|
{% include note.html content="This will execute all the unit tests and the checkstyle tests. It ensures,
|
||||||
that the complete project can be build and is functioning on top of the current master." %}
|
that the complete project can be build and is functioning on top of the current main." %}
|
||||||
|
|
||||||
{% include note.html content="The profile `generate-rule-docs` will run the doc checks, that would
|
{% include note.html content="The profile `generate-rule-docs` will run the doc checks, that would
|
||||||
otherwise only run on github actions and fail the build, if e.g. a jdoc or rule reference is wrong." %}
|
otherwise only run on github actions and fail the build, if e.g. a jdoc or rule reference is wrong." %}
|
||||||
@ -83,7 +83,7 @@ author: Andreas Dangel <andreas.dangel@adangel.org>
|
|||||||
7. If the build was successful, you are ready to push:
|
7. If the build was successful, you are ready to push:
|
||||||
|
|
||||||
```
|
```
|
||||||
git push origin master
|
git push origin main
|
||||||
```
|
```
|
||||||
|
|
||||||
Since the temporary branch is now not needed anymore, you can delete it:
|
Since the temporary branch is now not needed anymore, you can delete it:
|
||||||
@ -92,7 +92,7 @@ author: Andreas Dangel <andreas.dangel@adangel.org>
|
|||||||
|
|
||||||
## Example 2: Merging PR #124 into a maintenance branch
|
## Example 2: Merging PR #124 into a maintenance branch
|
||||||
|
|
||||||
We ask, to create every pull request against master, to make it easier to contribute.
|
We ask, to create every pull request against main, to make it easier to contribute.
|
||||||
But if a pull request is intended to fix a bug in an older version of PMD, then we need to backport this pull request.
|
But if a pull request is intended to fix a bug in an older version of PMD, then we need to backport this pull request.
|
||||||
|
|
||||||
### Creating a maintenance branch
|
### Creating a maintenance branch
|
||||||
@ -124,7 +124,7 @@ PMD version 5.8.0, so that we can create a bugfix release 5.8.1.
|
|||||||
|
|
||||||
```
|
```
|
||||||
git fetch origin pull/124/head:pr-124 && git checkout pr-124 # creates a new temporary branch
|
git fetch origin pull/124/head:pr-124 && git checkout pr-124 # creates a new temporary branch
|
||||||
git rebase master --onto pmd/5.8.x
|
git rebase main --onto pmd/5.8.x
|
||||||
./mvnw clean verify # make sure, everything works after the rebase
|
./mvnw clean verify # make sure, everything works after the rebase
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ PMD version 5.8.0, so that we can create a bugfix release 5.8.1.
|
|||||||
You need to manually close the pull request. Leave a comment, that it has been
|
You need to manually close the pull request. Leave a comment, that it has been
|
||||||
rebased onto the maintenance branch.
|
rebased onto the maintenance branch.
|
||||||
|
|
||||||
### Merging into master
|
### Merging into main
|
||||||
|
|
||||||
Now the PR has been merged into the maintenance branch, but it is missing in any later version of PMD.
|
Now the PR has been merged into the maintenance branch, but it is missing in any later version of PMD.
|
||||||
Therefore, we merge first into the next minor version maintenance branch (if existing):
|
Therefore, we merge first into the next minor version maintenance branch (if existing):
|
||||||
@ -162,17 +162,17 @@ Therefore, we merge first into the next minor version maintenance branch (if exi
|
|||||||
git checkout pmd/5.9.x
|
git checkout pmd/5.9.x
|
||||||
git merge pmd/5.8.x
|
git merge pmd/5.8.x
|
||||||
|
|
||||||
After that, we merge the changes into the master branch:
|
After that, we merge the changes into the main branch:
|
||||||
|
|
||||||
git checkout master
|
git checkout main
|
||||||
git merge pmd/5.9.x
|
git merge pmd/5.9.x
|
||||||
|
|
||||||
{%include note.html content="This ensures, that every change on the maintenance branch eventually ends
|
{%include note.html content="This ensures, that every change on the maintenance branch eventually ends
|
||||||
up in the master branch and therefore in any future version of PMD.<br>
|
up in the main branch and therefore in any future version of PMD.<br>
|
||||||
The downside is however, that there are inevitable merge conflicts for the maven `pom.xml` files, since
|
The downside is however, that there are inevitable merge conflicts for the maven `pom.xml` files, since
|
||||||
every branch changed the version number differently.<br>
|
every branch changed the version number differently.<br>
|
||||||
We could avoid this by merging only the temporary branch \"pr-124\" into each maintenance branch and
|
We could avoid this by merging only the temporary branch \"pr-124\" into each maintenance branch and
|
||||||
eventually into master, with the risk of missing single commits in a maintenance branch, that have been
|
eventually into main, with the risk of missing single commits in a maintenance branch, that have been
|
||||||
done outside the temporary branch." %}
|
done outside the temporary branch." %}
|
||||||
|
|
||||||
### Merging vs. Cherry-Picking
|
### Merging vs. Cherry-Picking
|
||||||
@ -181,4 +181,4 @@ We are not using cherry-picking, so that each fix is represented by a single com
|
|||||||
Cherry-picking would duplicate the commit and you can't see in the log, on which branches the fix has been
|
Cherry-picking would duplicate the commit and you can't see in the log, on which branches the fix has been
|
||||||
integrated (e.g. gitk and github show the branches, from which the specific commit is reachable).
|
integrated (e.g. gitk and github show the branches, from which the specific commit is reachable).
|
||||||
|
|
||||||
The downside is a more complex history - the maintenance branches and master branch are "connected" and not separate.
|
The downside is a more complex history - the maintenance branches and main branch are "connected" and not separate.
|
||||||
|
@ -140,7 +140,7 @@ echo "* Days since last release: $(( ( $(date +%s) - $(git log --max-count=1 --f
|
|||||||
|
|
||||||
Note: both shell snippets are also integrated into `do-release.sh`.
|
Note: both shell snippets are also integrated into `do-release.sh`.
|
||||||
|
|
||||||
Check in all (version) changes to branch master or any other branch, from which the release takes place:
|
Check in all (version) changes to branch main or any other branch, from which the release takes place:
|
||||||
|
|
||||||
$ git commit -a -m "Prepare pmd release <version>"
|
$ git commit -a -m "Prepare pmd release <version>"
|
||||||
$ git push
|
$ git push
|
||||||
@ -180,7 +180,7 @@ NEW_RELEASE_NOTES=$(bundle exec docs/render_release_notes.rb docs/pages/release_
|
|||||||
cat > "../pmd.github.io/${RELEASE_NOTES_POST}" <<EOF
|
cat > "../pmd.github.io/${RELEASE_NOTES_POST}" <<EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
Check in all (version, blog post) changes to branch master:
|
Check in all (version, blog post) changes to branch main:
|
||||||
|
|
||||||
$ git commit -a -m "Prepare pmd release <version>"
|
$ git commit -a -m "Prepare pmd release <version>"
|
||||||
$ git push
|
$ git push
|
||||||
@ -259,7 +259,7 @@ Here is, what happens:
|
|||||||
under <https://pmd.sourceforge.io/archive.phtml>.
|
under <https://pmd.sourceforge.io/archive.phtml>.
|
||||||
|
|
||||||
The release on GitHub Actions currently takes about 30-45 minutes. Once this is done, you
|
The release on GitHub Actions currently takes about 30-45 minutes. Once this is done, you
|
||||||
can proceed with releasing pmd designer, see <https://github.com/pmd/pmd-designer/blob/master/releasing.md>.
|
can proceed with releasing pmd designer, see <https://github.com/pmd/pmd-designer/blob/main/releasing.md>.
|
||||||
Make sure to release the version, you have used earlier for the property `pmd-designer.version`.
|
Make sure to release the version, you have used earlier for the property `pmd-designer.version`.
|
||||||
|
|
||||||
Once the pmd-designer release is done, you can proceed with part 2. This is simply triggering manually
|
Once the pmd-designer release is done, you can proceed with part 2. This is simply triggering manually
|
||||||
@ -374,7 +374,7 @@ This is a {{ site.pmd.release_type }} release.
|
|||||||
Finally, commit and push the changes:
|
Finally, commit and push the changes:
|
||||||
|
|
||||||
$ git commit -m "Prepare next development version"
|
$ git commit -m "Prepare next development version"
|
||||||
$ git push origin master
|
$ git push origin main
|
||||||
|
|
||||||
|
|
||||||
## Branches
|
## Branches
|
||||||
@ -382,7 +382,7 @@ Finally, commit and push the changes:
|
|||||||
### Merging
|
### Merging
|
||||||
|
|
||||||
If the release was done on a maintenance branch, such as `pmd/5.4.x`, then this branch should be
|
If the release was done on a maintenance branch, such as `pmd/5.4.x`, then this branch should be
|
||||||
merged into the next "higher" branches, such as `pmd/5.5.x` and `master`.
|
merged into the next "higher" branches, such as `pmd/5.5.x` and `main`.
|
||||||
|
|
||||||
This ensures, that all fixes done on the maintenance branch, finally end up in the other branches.
|
This ensures, that all fixes done on the maintenance branch, finally end up in the other branches.
|
||||||
In theory, the fixes should already be there, but you never now.
|
In theory, the fixes should already be there, but you never now.
|
||||||
@ -392,7 +392,7 @@ In theory, the fixes should already be there, but you never now.
|
|||||||
|
|
||||||
If releases from multiple branches are being done, the order matters. You should start from the "oldest" branch,
|
If releases from multiple branches are being done, the order matters. You should start from the "oldest" branch,
|
||||||
e.g. `pmd/5.4.x`, release from there. Then merge (see above) into the next branch, e.g. `pmd/5.5.x` and release
|
e.g. `pmd/5.4.x`, release from there. Then merge (see above) into the next branch, e.g. `pmd/5.5.x` and release
|
||||||
from there. Then merge into the `master` branch and release from there. This way, the last release done, becomes
|
from there. Then merge into the `main` branch and release from there. This way, the last release done, becomes
|
||||||
automatically the latest release on <https://docs.pmd-code.org/latest/> and on sourceforge.
|
automatically the latest release on <https://docs.pmd-code.org/latest/> and on sourceforge.
|
||||||
|
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ e.g. `xalan` (see <https://xalan.apache.org/>).
|
|||||||
|
|
||||||
### cpdhtml.xslt
|
### cpdhtml.xslt
|
||||||
|
|
||||||
This stylesheet is available in the sources or from GitHub at: <https://raw.githubusercontent.com/pmd/pmd/master/pmd-core/etc/xslt/cpdhtml.xslt>.
|
This stylesheet is available in the sources or from GitHub at: <https://raw.githubusercontent.com/pmd/pmd/main/pmd-core/etc/xslt/cpdhtml.xslt>.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
xalan -in cpd-report-sample.xml -xsl cpdhtml.xslt -out cpd-report-sample-cpdhtml.html
|
xalan -in cpd-report-sample.xml -xsl cpdhtml.xslt -out cpd-report-sample-cpdhtml.html
|
||||||
@ -284,7 +284,7 @@ xalan -in cpd-report-sample.xml -xsl cpdhtml.xslt -out cpd-report-sample-cpdhtml
|
|||||||
|
|
||||||
### cpdhtml-v2.xslt
|
### cpdhtml-v2.xslt
|
||||||
|
|
||||||
This stylesheet is available in the sources or from GitHub at: <https://raw.githubusercontent.com/pmd/pmd/master/pmd-core/etc/xslt/cpdhtml-v2.xslt>.
|
This stylesheet is available in the sources or from GitHub at: <https://raw.githubusercontent.com/pmd/pmd/main/pmd-core/etc/xslt/cpdhtml-v2.xslt>.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
xalan -in pmd-core-cpd-report.xml -xsl etc/xslt/cpdhtml-v2.xslt -out pmd-core-cpd-report-v2.html
|
xalan -in pmd-core-cpd-report.xml -xsl etc/xslt/cpdhtml-v2.xslt -out pmd-core-cpd-report-v2.html
|
||||||
|
@ -97,7 +97,7 @@ static PropertyDescriptor<Mode> modeProperty
|
|||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
You can see an example of properties used in a PMD rule such as [AvoidReassigningLoopVariables](https://github.com/pmd/pmd/blob/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/AvoidReassigningLoopVariablesRule.java#L40).
|
You can see an example of properties used in a PMD rule such as [AvoidReassigningLoopVariables](https://github.com/pmd/pmd/blob/main/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/AvoidReassigningLoopVariablesRule.java#L40).
|
||||||
There are several things to notice here:
|
There are several things to notice here:
|
||||||
* The property descriptors are declared `static final`, which should generally be
|
* The property descriptors are declared `static final`, which should generally be
|
||||||
the case, as descriptors are immutable and can be shared between instances of the same rule;
|
the case, as descriptors are immutable and can be shared between instances of the same rule;
|
||||||
|
@ -132,7 +132,7 @@ The root element is `<test-data>`. It can contain one or more `<test-code>` and
|
|||||||
Each `<test-code>` element defines a single test case. `<code-fragment>` elements are used to share code snippets
|
Each `<test-code>` element defines a single test case. `<code-fragment>` elements are used to share code snippets
|
||||||
between different test cases.
|
between different test cases.
|
||||||
|
|
||||||
{%include note.html content="The XML schema is available at [rule-tests.xsd](https://github.com/pmd/pmd/blob/master/pmd-test-schema/src/main/resources/net/sourceforge/pmd/test/schema/rule-tests_1_0_0.xsd)." %}
|
{%include note.html content="The XML schema is available at [rule-tests.xsd](https://github.com/pmd/pmd/blob/main/pmd-test-schema/src/main/resources/net/sourceforge/pmd/test/schema/rule-tests_1_0_0.xsd)." %}
|
||||||
|
|
||||||
### `<test-code>` attributes
|
### `<test-code>` attributes
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ Example:
|
|||||||
HTML format.
|
HTML format.
|
||||||
|
|
||||||
This renderer provides two properties to render a link to the source where the violations
|
This renderer provides two properties to render a link to the source where the violations
|
||||||
have been found. The following example has been created with `-property linkPrefix=https://github.com/pmd/pmd/blob/master/ -property linePrefix=L -shortnames -d pmd`.
|
have been found. The following example has been created with `-property linkPrefix=https://github.com/pmd/pmd/blob/main/ -property linePrefix=L -shortnames -d pmd`.
|
||||||
If "linkPrefix" is not set, then "linePrefix" has no effect anyway: just the filename will
|
If "linkPrefix" is not set, then "linePrefix" has no effect anyway: just the filename will
|
||||||
be rendered, with no html link. Otherwise if "linePrefix" is not set, then the link will
|
be rendered, with no html link. Otherwise if "linePrefix" is not set, then the link will
|
||||||
not contain a line number.
|
not contain a line number.
|
||||||
@ -274,7 +274,7 @@ Vladimir Bossicard HTML format.
|
|||||||
|
|
||||||
XML format.
|
XML format.
|
||||||
|
|
||||||
This format is a XML document, that can be validated by a XSD schema. The schema is [report_2_0_0.xsd](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/resources/report_2_0_0.xsd).
|
This format is a XML document, that can be validated by a XSD schema. The schema is [report_2_0_0.xsd](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/resources/report_2_0_0.xsd).
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
@ -342,10 +342,10 @@ XML with a XSL transformation applied.
|
|||||||
|
|
||||||
PMD provides one built-in stylesheet, that is used by default, if no other
|
PMD provides one built-in stylesheet, that is used by default, if no other
|
||||||
stylesheet with the property "xsltFilename" is specified. It is called
|
stylesheet with the property "xsltFilename" is specified. It is called
|
||||||
[pmd-nicerhtml.xsl](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/resources/pmd-nicerhtml.xsl)
|
[pmd-nicerhtml.xsl](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/resources/pmd-nicerhtml.xsl)
|
||||||
and can be used for customization.
|
and can be used for customization.
|
||||||
|
|
||||||
There are many other stylesheets available online: <https://github.com/pmd/pmd/tree/master/pmd-core/etc/xslt>.
|
There are many other stylesheets available online: <https://github.com/pmd/pmd/tree/main/pmd-core/etc/xslt>.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
* [Example with pmd-nicerhtml.xsl](report-examples/pmd-report-pmd-nicerhtml.html)
|
* [Example with pmd-nicerhtml.xsl](report-examples/pmd-report-pmd-nicerhtml.html)
|
||||||
|
@ -91,7 +91,7 @@ With TCA you have PMD analysis out-of-the-box, and it is open source under the M
|
|||||||
<tr>
|
<tr>
|
||||||
<td><a href="#bluej">BlueJ</a></td>
|
<td><a href="#bluej">BlueJ</a></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td><a href="https://github.com/pmd/pmd-misc/tree/master/pmd-bluej/">pmd-bluej</a></td>
|
<td><a href="https://github.com/pmd/pmd-misc/tree/main/pmd-bluej/">pmd-bluej</a></td>
|
||||||
<td><a href="http://tomcopeland.blogs.com/">Tom Copeland</a></td>
|
<td><a href="http://tomcopeland.blogs.com/">Tom Copeland</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ With TCA you have PMD analysis out-of-the-box, and it is open source under the M
|
|||||||
<tr>
|
<tr>
|
||||||
<td><a href="#gel">Gel</a></td>
|
<td><a href="#gel">Gel</a></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td><a href="https://github.com/pmd/pmd-misc/tree/master/pmd-gel/">github: pmd/pmd-misc/pmd-gel</a></td>
|
<td><a href="https://github.com/pmd/pmd-misc/tree/main/pmd-gel/">github: pmd/pmd-misc/pmd-gel</a></td>
|
||||||
<td>Andrei Lumianski</td>
|
<td>Andrei Lumianski</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ With TCA you have PMD analysis out-of-the-box, and it is open source under the M
|
|||||||
<tr>
|
<tr>
|
||||||
<td><a href="#jbuilder">JBuilder</a></td>
|
<td><a href="#jbuilder">JBuilder</a></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td><a href="https://github.com/pmd/pmd-misc/tree/master/pmd-jbuilder/">github: pmd/pmd-misc/pmd-jbuilder</a></td>
|
<td><a href="https://github.com/pmd/pmd-misc/tree/main/pmd-jbuilder/">github: pmd/pmd-misc/pmd-jbuilder</a></td>
|
||||||
<td><a href="http://tomcopeland.blogs.com/">Tom Copeland</a></td>
|
<td><a href="http://tomcopeland.blogs.com/">Tom Copeland</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
@ -14,6 +14,30 @@ This is a {{ site.pmd.release_type }} release.
|
|||||||
|
|
||||||
### 🚀 New and noteworthy
|
### 🚀 New and noteworthy
|
||||||
|
|
||||||
|
#### New Git default branch - "main"
|
||||||
|
|
||||||
|
We are joining the Git community and updating "master" to "main". Using the term "master" for the main
|
||||||
|
development branch can be offensive to some people. Existing versions of Git have been always capable of
|
||||||
|
working with any branch name and since 2.28.0 (July 2020) the default initial branch is configurable
|
||||||
|
(`init.defaultBranch`). Since October 2020, the default branch for new repositories on GitHub
|
||||||
|
is "main". Finally, PMD will also use this new name for the main branch.
|
||||||
|
|
||||||
|
Why "main"? PMD uses a very simple branching model - pull requests with feature branches and one main development
|
||||||
|
branch, from which releases are created. That's why "main" is currently the best fitting name.
|
||||||
|
|
||||||
|
More information:
|
||||||
|
- <https://sfconservancy.org/news/2020/jun/23/gitbranchname/>
|
||||||
|
- <https://github.blog/changelog/2020-10-01-the-default-branch-for-newly-created-repositories-is-now-main/>
|
||||||
|
|
||||||
|
What changes?
|
||||||
|
- We change the default branch on GitHub, so that pull requests are automatically created against `main` from
|
||||||
|
now on.
|
||||||
|
- If you have already a local clone of PMD's repository, you'll need to rename the old master branch locally:
|
||||||
|
`git branch --move master main && git branch --set-upstream-to=origin`. More info:
|
||||||
|
<https://git-scm.com/book/en/v2/Git-Branching-Branch-Management#_changing_master>
|
||||||
|
- Some time after this release, we'll delete the old master branch on GitHub. Then only `main` can be used.
|
||||||
|
- This change is expanded to the other PMD repositories as well, e.g. pmd-designer and pmd-regression-tester.
|
||||||
|
|
||||||
### 🐛 Fixed Issues
|
### 🐛 Fixed Issues
|
||||||
* apex
|
* apex
|
||||||
* [#5138](https://github.com/pmd/pmd/issues/5138): \[apex] Various false-negatives since 7.3.0 when using triggers
|
* [#5138](https://github.com/pmd/pmd/issues/5138): \[apex] Various false-negatives since 7.3.0 when using triggers
|
||||||
|
@ -7635,7 +7635,7 @@ conduct.
|
|||||||
Please note that this project is released with a Contributor Code of Conduct.
|
Please note that this project is released with a Contributor Code of Conduct.
|
||||||
By participating in this project you agree to abide by its terms.
|
By participating in this project you agree to abide by its terms.
|
||||||
|
|
||||||
You can find the code of conduct in the file [code_of_conduct.md](https://github.com/pmd/pmd/blob/master/code_of_conduct.md)
|
You can find the code of conduct in the file [code_of_conduct.md](https://github.com/pmd/pmd/blob/main/code_of_conduct.md)
|
||||||
in our repository.
|
in our repository.
|
||||||
|
|
||||||
#### Performance improvements for XPath 2.0 rules
|
#### Performance improvements for XPath 2.0 rules
|
||||||
|
@ -3,20 +3,20 @@
|
|||||||
<th>#</th><th>File</th><th>Line</th><th>Problem</th></tr>
|
<th>#</th><th>File</th><th>Line</th><th>Problem</th></tr>
|
||||||
<tr bgcolor="lightgrey">
|
<tr bgcolor="lightgrey">
|
||||||
<td align="center">1</td>
|
<td align="center">1</td>
|
||||||
<td width="*%"><a href="https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/RuleContext.java#L124">pmd-core/src/main/java/net/sourceforge/pmd/RuleContext.java</a></td>
|
<td width="*%"><a href="https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/RuleContext.java#L124">pmd-core/src/main/java/net/sourceforge/pmd/RuleContext.java</a></td>
|
||||||
<td align="center" width="5%">124</td>
|
<td align="center" width="5%">124</td>
|
||||||
<td width="*"><a href="https://pmd.github.io/pmd-6.22.0/pmd_rules_java_bestpractices.html#guardlogstatement">Logger calls should be surrounded by log level guards.</a></td>
|
<td width="*"><a href="https://pmd.github.io/pmd-6.22.0/pmd_rules_java_bestpractices.html#guardlogstatement">Logger calls should be surrounded by log level guards.</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="center">2</td>
|
<td align="center">2</td>
|
||||||
<td width="*%"><a href="https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/Benchmarker.java#L58">pmd-core/src/main/java/net/sourceforge/pmd/benchmark/Benchmarker.java</a></td>
|
<td width="*%"><a href="https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/Benchmarker.java#L58">pmd-core/src/main/java/net/sourceforge/pmd/benchmark/Benchmarker.java</a></td>
|
||||||
<td align="center" width="5%">58</td>
|
<td align="center" width="5%">58</td>
|
||||||
<td width="*"><a href="https://pmd.github.io/pmd-6.22.0/pmd_rules_java_bestpractices.html#forloopcanbeforeach">This for loop can be replaced by a foreach loop</a></td>
|
<td width="*"><a href="https://pmd.github.io/pmd-6.22.0/pmd_rules_java_bestpractices.html#forloopcanbeforeach">This for loop can be replaced by a foreach loop</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table><hr/><center><h3>Processing errors</h3></center><table align="center" cellspacing="0" cellpadding="3"><tr>
|
</table><hr/><center><h3>Processing errors</h3></center><table align="center" cellspacing="0" cellpadding="3"><tr>
|
||||||
<th>File</th><th>Problem</th></tr>
|
<th>File</th><th>Problem</th></tr>
|
||||||
<tr bgcolor="lightgrey">
|
<tr bgcolor="lightgrey">
|
||||||
<td><a href="https://github.com/pmd/pmd/blob/master/pmd-core/src/test/resources/net/sourceforge/pmd/cpd/files/file_with_ISO-8859-1_encoding.java#">pmd-core/src/test/resources/net/sourceforge/pmd/cpd/files/file_with_ISO-8859-1_encoding.java</a></td>
|
<td><a href="https://github.com/pmd/pmd/blob/main/pmd-core/src/test/resources/net/sourceforge/pmd/cpd/files/file_with_ISO-8859-1_encoding.java#">pmd-core/src/test/resources/net/sourceforge/pmd/cpd/files/file_with_ISO-8859-1_encoding.java</a></td>
|
||||||
<td><pre>net.sourceforge.pmd.PMDException: Error while parsing pmd-core/src/test/resources/net/sourceforge/pmd/cpd/files/file_with_ISO-8859-1_encoding.java
|
<td><pre>net.sourceforge.pmd.PMDException: Error while parsing pmd-core/src/test/resources/net/sourceforge/pmd/cpd/files/file_with_ISO-8859-1_encoding.java
|
||||||
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCodeWithoutCache(SourceCodeProcessor.java:110)
|
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCodeWithoutCache(SourceCodeProcessor.java:110)
|
||||||
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:89)
|
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:89)
|
||||||
@ -52,7 +52,7 @@ Was expecting one of:
|
|||||||
</table><hr/><center><h3>Suppressed warnings</h3></center><table align="center" cellspacing="0" cellpadding="3"><tr>
|
</table><hr/><center><h3>Suppressed warnings</h3></center><table align="center" cellspacing="0" cellpadding="3"><tr>
|
||||||
<th>File</th><th>Line</th><th>Rule</th><th>NOPMD or Annotation</th><th>Reason</th></tr>
|
<th>File</th><th>Line</th><th>Rule</th><th>NOPMD or Annotation</th><th>Reason</th></tr>
|
||||||
<tr bgcolor="lightgrey">
|
<tr bgcolor="lightgrey">
|
||||||
<td align="left"><a href="https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java#L505">pmd-core/src/main/java/net/sourceforge/pmd/PMD.java</a></td>
|
<td align="left"><a href="https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java#L505">pmd-core/src/main/java/net/sourceforge/pmd/PMD.java</a></td>
|
||||||
<td align="center">505</td>
|
<td align="center">505</td>
|
||||||
<td align="center"><a href="https://pmd.github.io/pmd-6.22.0/pmd_rules_java_errorprone.html#closeresource">CloseResource</a></td>
|
<td align="center"><a href="https://pmd.github.io/pmd-6.22.0/pmd_rules_java_errorprone.html#closeresource">CloseResource</a></td>
|
||||||
<td align="center">Annotation</td>
|
<td align="center">Annotation</td>
|
||||||
@ -64,4 +64,4 @@ Was expecting one of:
|
|||||||
<td><a href="https://pmd.github.io/pmd-6.22.0/pmd_rules_java_design.html#loosepackagecoupling">LoosePackageCoupling</a></td>
|
<td><a href="https://pmd.github.io/pmd-6.22.0/pmd_rules_java_design.html#loosepackagecoupling">LoosePackageCoupling</a></td>
|
||||||
<td>No packages or classes specified</td>
|
<td>No packages or classes specified</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table></body></html>
|
</table></body></html>
|
||||||
|
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