forked from phoedos/pmd
Compare commits
1 Commits
main
...
dependabot
Author | SHA1 | Date | |
---|---|---|---|
|
b3dadc5fac |
@ -1929,8 +1929,7 @@
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1444125?v=4",
|
||||
"profile": "http://www.linkedin.com/in/chonton",
|
||||
"contributions": [
|
||||
"bug",
|
||||
"code"
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -7453,8 +7452,7 @@
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/16755668?v=4",
|
||||
"profile": "https://github.com/emouty",
|
||||
"contributions": [
|
||||
"code",
|
||||
"bug"
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -7517,7 +7515,6 @@
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/18402464?v=4",
|
||||
"profile": "https://github.com/mitchspano",
|
||||
"contributions": [
|
||||
"code",
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
@ -7738,161 +7735,6 @@
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "AB-xdev",
|
||||
"name": "Alex B",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/45384811?v=4",
|
||||
"profile": "https://xdev.software/",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "dschach",
|
||||
"name": "David Schach",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/636977?v=4",
|
||||
"profile": "https://github.com/dschach",
|
||||
"contributions": [
|
||||
"bug",
|
||||
"code",
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "vedantchokshi",
|
||||
"name": "Vedant Chokshi",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/22137048?v=4",
|
||||
"profile": "https://github.com/vedantchokshi",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "random1223",
|
||||
"name": "Tony",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/3987237?v=4",
|
||||
"profile": "https://codety.io/",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "imax-erik",
|
||||
"name": "imax-erik",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/62863607?v=4",
|
||||
"profile": "https://github.com/imax-erik",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "lukasgraef",
|
||||
"name": "Lukas Gräf",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/48957581?v=4",
|
||||
"profile": "https://github.com/lukasgraef",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "SaschaRiemer",
|
||||
"name": "Sascha Riemer",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/108794941?v=4",
|
||||
"profile": "https://github.com/SaschaRiemer",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "kratoon",
|
||||
"name": "Ondrej Kratochvil",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/26163421?v=4",
|
||||
"profile": "https://github.com/kratoon",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "mattr9124",
|
||||
"name": "Matthew Rossner",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/8940608?v=4",
|
||||
"profile": "https://github.com/mattr9124",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "thesunlover",
|
||||
"name": "Iskren Stanislavov",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/6734600?v=4",
|
||||
"profile": "https://interop.io/",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "gudzpoz",
|
||||
"name": "gudzpoz",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/14026120?v=4",
|
||||
"profile": "https://kyo.iroiro.party/",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "phansys",
|
||||
"name": "Javier Spagnoletti",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1231441?v=4",
|
||||
"profile": "https://github.com/phansys",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "Aryant-Tripathi",
|
||||
"name": "Aryant Tripathi",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/60316716?v=4",
|
||||
"profile": "https://github.com/Aryant-Tripathi",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "jdupak",
|
||||
"name": "Jakub Dupak",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/22683640?v=4",
|
||||
"profile": "https://github.com/jdupak",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "chenguangqi",
|
||||
"name": "天热吃西瓜",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/6231010?v=4",
|
||||
"profile": "http://chenguangqi.github.io/",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "wahajenius",
|
||||
"name": "Willem A. Hajenius",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/7836322?v=4",
|
||||
"profile": "https://github.com/wahajenius",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "VitaliiIevtushenko",
|
||||
"name": "Vitalii Yevtushenko",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/11145125?v=4",
|
||||
"profile": "https://github.com/VitaliiIevtushenko",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
@ -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 PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/main/scripts
|
||||
export PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/master/scripts
|
||||
|
||||
export PMD_CI_SECRET_PASSPHRASE="xyz"
|
||||
export PMD_CI_DEBUG=true
|
||||
|
||||
MAIN_BRANCH="main"
|
||||
MAIN_BRANCH="master"
|
||||
eval $(~/create-gh-actions-env.sh push pmd/pmd $MAIN_BRANCH)
|
||||
|
||||
cd /workspaces/pmd
|
||||
@ -108,7 +108,7 @@ $(~/create-gh-actions-env.sh push adangel/pmd $MAIN_BRANCH)
|
||||
|
||||
```
|
||||
export LANG=en_US.UTF-8
|
||||
export PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/main/scripts
|
||||
export PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/master/scripts
|
||||
|
||||
export PMD_CI_SECRET_PASSPHRASE="xyz"
|
||||
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
|
||||
#
|
||||
function pmd_ci_build_and_upload_doc() {
|
||||
# generate the site only for snapshots from main and for release builds for case a) (everything without cli/dist)
|
||||
# generate the site only for snapshots from master and for release builds for case a) (everything without cli/dist)
|
||||
# to avoid building it twice during a release...
|
||||
if pmd_ci_maven_isSnapshotBuild && [ "${PMD_CI_BRANCH}" = "main" ] || [ "${BUILD_CLI_DIST_ONLY}" = "false" ]; then
|
||||
if pmd_ci_maven_isSnapshotBuild && [ "${PMD_CI_BRANCH}" = "master" ] || [ "${BUILD_CLI_DIST_ONLY}" = "false" ]; then
|
||||
pmd_doc_generate_jekyll_site
|
||||
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}"
|
||||
fi
|
||||
|
||||
if pmd_ci_maven_isSnapshotBuild && [ "${PMD_CI_BRANCH}" = "main" ]; then
|
||||
# only for snapshot builds from branch main: https://docs.pmd-code.org/snapshot -> pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}
|
||||
if pmd_ci_maven_isSnapshotBuild && [ "${PMD_CI_BRANCH}" = "master" ]; then
|
||||
# only for snapshot builds from branch master: https://docs.pmd-code.org/snapshot -> pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}
|
||||
pmd_code_createSymlink "${PMD_CI_MAVEN_PROJECT_VERSION}" "snapshot"
|
||||
|
||||
# update github pages https://pmd.github.io/pmd/
|
||||
|
@ -4,7 +4,7 @@ function fetch_ci_scripts() {
|
||||
local inc_dir
|
||||
local inc_url
|
||||
inc_dir="$(dirname "$0")/inc"
|
||||
inc_url="${PMD_CI_SCRIPTS_URL:-https://raw.githubusercontent.com/pmd/build-tools/main/scripts}/inc"
|
||||
inc_url="${PMD_CI_SCRIPTS_URL:-https://raw.githubusercontent.com/pmd/build-tools/master/scripts}/inc"
|
||||
|
||||
mkdir -p "${inc_dir}"
|
||||
|
||||
|
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@ -4,6 +4,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
tags:
|
||||
- '**'
|
||||
pull_request:
|
||||
@ -59,7 +60,7 @@ jobs:
|
||||
run: |
|
||||
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
|
||||
echo "MAVEN_OPTS=-Daether.connector.http.connectionMaxTtl=180 -DautoReleaseAfterClose=true -DstagingProgressTimeoutMinutes=30" >> $GITHUB_ENV
|
||||
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/27/scripts" >> $GITHUB_ENV
|
||||
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/26/scripts" >> $GITHUB_ENV
|
||||
- name: Check Environment
|
||||
shell: bash
|
||||
run: |
|
||||
|
3
.github/workflows/git-repo-sync.yml
vendored
3
.github/workflows/git-repo-sync.yml
vendored
@ -4,6 +4,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
tags:
|
||||
- '**'
|
||||
workflow_dispatch:
|
||||
@ -23,7 +24,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
|
||||
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/27/scripts" >> $GITHUB_ENV
|
||||
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/26/scripts" >> $GITHUB_ENV
|
||||
- name: Sync
|
||||
run: .ci/git-repo-sync.sh
|
||||
shell: bash
|
||||
|
2
.github/workflows/troubleshooting.yml
vendored
2
.github/workflows/troubleshooting.yml
vendored
@ -36,7 +36,7 @@ jobs:
|
||||
run: |
|
||||
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
|
||||
echo "MAVEN_OPTS=-Daether.connector.http.connectionMaxTtl=180 -DstagingProgressTimeoutMinutes=30" >> $GITHUB_ENV
|
||||
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/27/scripts" >> $GITHUB_ENV
|
||||
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/26/scripts" >> $GITHUB_ENV
|
||||
- name: Check Environment
|
||||
shell: bash
|
||||
run: |
|
||||
|
@ -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).
|
||||
|
||||
| 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. |
|
||||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| 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. |
|
||||
| --- |
|
||||
|
||||
## Pull requests
|
||||
|
||||
* Please create your pull request against the `main` branch. We will rebase/merge it to the maintenance
|
||||
* Please create your pull request against the `master` branch. We will rebase/merge it to the maintenance
|
||||
branches, if necessary.
|
||||
|
||||
* 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
|
||||
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/main/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/master/docs>. You can find build instructions there.
|
||||
For more on contributing documentation check <https://docs.pmd-code.org/latest/pmd_devdocs_writing_documentation.html>
|
||||
|
||||
## 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.
|
||||
|
||||
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/main/eclipse) that can
|
||||
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
|
||||
[the eclipse configuration files](https://github.com/pmd/build-tools/tree/master/eclipse) that can
|
||||
be imported into a fresh workspace.
|
||||
|
||||
## Add yourself as contributor
|
||||
|
@ -39,9 +39,9 @@ def run_pmdtester
|
||||
FileUtils.mv 'target/reports/diff', 'target/diff1'
|
||||
message1 = create_message
|
||||
|
||||
# run against main branch (if the PR is not already against main)
|
||||
unless ENV['PMD_CI_BRANCH'] == 'main'
|
||||
@base_branch = 'main'
|
||||
# run against master branch (if the PR is not already against master)
|
||||
unless ENV['PMD_CI_BRANCH'] == 'master'
|
||||
@base_branch = 'master'
|
||||
@logger.info "\n\n--------------------------------------"
|
||||
@logger.info "Run against #{@base_branch}"
|
||||
@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/'
|
||||
|
||||
# bleeding edge from git
|
||||
#gem 'pmdtester', :git => 'https://github.com/pmd/pmd-regression-tester.git', branch: 'main'
|
||||
#gem 'pmdtester', :git => 'https://github.com/pmd/pmd-regression-tester.git', branch: 'master'
|
||||
|
||||
gem 'pmdtester'
|
||||
gem 'danger'
|
||||
|
28
Gemfile.lock
28
Gemfile.lock
@ -3,7 +3,6 @@ GEM
|
||||
specs:
|
||||
addressable (2.8.7)
|
||||
public_suffix (>= 2.0.2, < 7.0)
|
||||
base64 (0.2.0)
|
||||
bigdecimal (3.1.8)
|
||||
claide (1.1.0)
|
||||
claide-plugins (0.9.2)
|
||||
@ -14,8 +13,7 @@ GEM
|
||||
concurrent-ruby (1.3.4)
|
||||
cork (0.3.0)
|
||||
colored2 (~> 3.1)
|
||||
danger (9.5.1)
|
||||
base64 (~> 0.2)
|
||||
danger (9.5.0)
|
||||
claide (~> 1.0)
|
||||
claide-plugins (>= 0.9.2)
|
||||
colored2 (~> 3.1)
|
||||
@ -26,14 +24,12 @@ GEM
|
||||
kramdown (~> 2.3)
|
||||
kramdown-parser-gfm (~> 1.0)
|
||||
octokit (>= 4.0)
|
||||
pstore (~> 0.1)
|
||||
terminal-table (>= 1, < 4)
|
||||
differ (0.1.2)
|
||||
et-orbi (1.2.11)
|
||||
tzinfo
|
||||
faraday (2.12.0)
|
||||
faraday (2.11.0)
|
||||
faraday-net_http (>= 2.0, < 3.4)
|
||||
json
|
||||
logger
|
||||
faraday-http-cache (2.5.1)
|
||||
faraday (>= 0.8)
|
||||
@ -45,20 +41,19 @@ GEM
|
||||
git (1.19.1)
|
||||
addressable (~> 2.8)
|
||||
rchardet (~> 1.8)
|
||||
json (2.7.5)
|
||||
kramdown (2.4.0)
|
||||
rexml
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
liquid (5.5.1)
|
||||
logger (1.6.1)
|
||||
logger (1.6.0)
|
||||
logger-colors (1.0.0)
|
||||
nap (1.1.0)
|
||||
net-http (0.4.1)
|
||||
uri
|
||||
nokogiri (1.16.7-x86_64-linux)
|
||||
racc (~> 1.4)
|
||||
octokit (9.2.0)
|
||||
octokit (9.1.0)
|
||||
faraday (>= 1, < 3)
|
||||
sawyer (~> 0.9)
|
||||
open4 (1.3.4)
|
||||
@ -69,25 +64,26 @@ GEM
|
||||
nokogiri (~> 1.13)
|
||||
rufus-scheduler (~> 3.8)
|
||||
slop (~> 4.9)
|
||||
pstore (0.1.3)
|
||||
public_suffix (6.0.1)
|
||||
raabro (1.4.0)
|
||||
racc (1.8.1)
|
||||
rchardet (1.8.0)
|
||||
rexml (3.3.9)
|
||||
rouge (4.5.1)
|
||||
rufus-scheduler (3.9.2)
|
||||
fugit (~> 1.1, >= 1.11.1)
|
||||
rexml (3.3.6)
|
||||
strscan
|
||||
rouge (4.3.0)
|
||||
rufus-scheduler (3.9.1)
|
||||
fugit (~> 1.1, >= 1.1.6)
|
||||
safe_yaml (1.0.5)
|
||||
sawyer (0.9.2)
|
||||
addressable (>= 2.3.5)
|
||||
faraday (>= 0.17.3, < 3)
|
||||
slop (4.10.1)
|
||||
strscan (3.1.0)
|
||||
terminal-table (3.0.2)
|
||||
unicode-display_width (>= 1.1.1, < 3)
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
unicode-display_width (2.6.0)
|
||||
unicode-display_width (2.5.0)
|
||||
uri (0.13.1)
|
||||
|
||||
PLATFORMS
|
||||
@ -102,4 +98,4 @@ DEPENDENCIES
|
||||
safe_yaml
|
||||
|
||||
BUNDLED WITH
|
||||
2.5.22
|
||||
2.5.3
|
||||
|
@ -1,12 +1,12 @@
|
||||
# PMD - source code analyzer
|
||||
|
||||
![PMD Logo](https://raw.githubusercontent.com/pmd/pmd/main/docs/images/logo/pmd-logo-300px.png)
|
||||
![PMD Logo](https://raw.githubusercontent.com/pmd/pmd/pmd/7.0.x/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)
|
||||
[![Build Status](https://github.com/pmd/pmd/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/pmd/pmd/actions)
|
||||
[![Build Status](https://github.com/pmd/pmd/workflows/build/badge.svg?branch=master)](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)
|
||||
[![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?branch=main)](https://coveralls.io/github/pmd/pmd?branch=main)
|
||||
[![Coverage Status](https://coveralls.io/repos/github/pmd/pmd/badge.svg)](https://coveralls.io/github/pmd/pmd)
|
||||
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/ea550046a02344ec850553476c4aa2ca)](https://app.codacy.com/organizations/gh/pmd/dashboard)
|
||||
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md)
|
||||
[![Documentation (latest)](https://img.shields.io/badge/docs-latest-green)](https://docs.pmd-code.org/latest/)
|
||||
|
@ -11,11 +11,10 @@
|
||||
- root-node-name: name of the root node without prefix (eg "TopLevel"), will be made to implement RootNode
|
||||
|
||||
See AntlrGeneratedParserBase
|
||||
|
||||
-->
|
||||
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
|
||||
|
||||
<property name="target-package-dir" value="${antlr4.outputDirectory}/net/sourceforge/pmd/lang/${lang-id}/ast"/>
|
||||
<property name="stamp-file" value="${project.build.directory}/last-generated-timestamp" />
|
||||
|
||||
|
||||
<property name="lang-ast-package" value="net.sourceforge.pmd.lang.${lang-id}.ast" />
|
||||
@ -33,100 +32,14 @@
|
||||
<property name="base-visitor-file" value="${target-package-dir}/${base-visitor-name}.java"/>
|
||||
|
||||
<property name="listener-name" value="${lang-name}Listener"/>
|
||||
<property name="listener-file" value="${target-package-dir}/${listener-name}.java"/>
|
||||
<property name="listener-file" value="${target-package-dir}/${visitor-name}.java"/>
|
||||
|
||||
<property name="base-listener-name" value="${lang-name}BaseListener"/>
|
||||
<property name="base-listener-file" value="${target-package-dir}/${base-listener-name}.java"/>
|
||||
<property name="base-listener-file" value="${target-package-dir}/${base-visitor-name}.java"/>
|
||||
|
||||
<property name="node-itf-name" value="${lang-name}Node"/>
|
||||
<property name="base-class-name" value="Abstract${lang-name}Node"/>
|
||||
|
||||
<property name="lexer-name" value="${lang-name}Lexer"/>
|
||||
<property name="lexer-file" value="${target-package-dir}/${lexer-name}.java"/>
|
||||
|
||||
<target name="check-up-to-date"
|
||||
description="Checks the input files are up to date">
|
||||
|
||||
<uptodate property="processing-not-required" targetfile="${stamp-file}">
|
||||
<srcfiles dir="${target-package-dir}" includes="*.java" />
|
||||
<srcfiles file="${ant.file}" />
|
||||
</uptodate>
|
||||
<echo message="Up-to-date check: processing-not-required=${processing-not-required}" />
|
||||
</target>
|
||||
|
||||
<target name="update-stamp-file" unless="processing-not-required">
|
||||
<touch file="${stamp-file}" />
|
||||
</target>
|
||||
|
||||
<target name="annotate-classes" description="Adds the @Generated annotation to all classes"
|
||||
unless="processing-not-required">
|
||||
<if>
|
||||
<available file="${parser-file}"/>
|
||||
<then>
|
||||
<replace file="${parser-file}"
|
||||
token="public class ${parser-name}"
|
||||
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
|
||||
public class ${parser-name}'/>
|
||||
|
||||
<!-- Parse tree classes for each element -->
|
||||
<replace file="${parser-file}"
|
||||
token="public static class "
|
||||
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
|
||||
public static class '/>
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<if>
|
||||
<available file="${visitor-file}"/>
|
||||
<then>
|
||||
<replace file="${visitor-file}"
|
||||
token="public interface ${visitor-name}"
|
||||
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
|
||||
public interface ${visitor-name}'/>
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<if>
|
||||
<available file="${base-visitor-file}"/>
|
||||
<then>
|
||||
<replace file="${base-visitor-file}"
|
||||
token="public class ${base-visitor-name}"
|
||||
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
|
||||
public class ${base-visitor-name}'/>
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<if>
|
||||
<available file="${listener-file}"/>
|
||||
<then>
|
||||
<replace file="${listener-file}"
|
||||
token="public interface ${listener-name}"
|
||||
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
|
||||
public interface ${listener-name}'/>
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<if>
|
||||
<available file="${base-listener-file}"/>
|
||||
<then>
|
||||
<replace file="${base-listener-file}"
|
||||
token="public class ${base-listener-name}"
|
||||
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
|
||||
public class ${base-listener-name}'/>
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<if>
|
||||
<available file="${lexer-file}"/>
|
||||
<then>
|
||||
<replace file="${lexer-file}"
|
||||
token="public class ${lexer-name}"
|
||||
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
|
||||
public class ${lexer-name}'/>
|
||||
</then>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
<condition property="rename-parser">
|
||||
<and>
|
||||
<not>
|
||||
@ -159,9 +72,7 @@ public class ${lexer-name}'/>
|
||||
tofile="${parser-file}"/>
|
||||
</target>
|
||||
|
||||
<target name="cpd-language" depends="check-up-to-date, annotate-classes, cpd-language-processing, update-stamp-file"/>
|
||||
<target name="cpd-language-processing" description="Adapt Antlr sources for CPD-only languages"
|
||||
unless="processing-not-required">
|
||||
<target name="cpd-language" description="Adapt Antlr sources for CPD-only languages">
|
||||
<!-- We only need the Lexer file. -->
|
||||
<delete file="${parser-file}"/>
|
||||
<delete>
|
||||
@ -172,9 +83,7 @@ public class ${lexer-name}'/>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<target name="pmd-language" depends="check-up-to-date, rename-parser, annotate-classes, pmd-language-processing, update-stamp-file"/>
|
||||
<target name="pmd-language-processing" description="Adapt Antlr sources for PMD languages"
|
||||
unless="processing-not-required">
|
||||
<target name="pmd-language" description="Adapt Antlr sources for PMD languages" depends="rename-parser">
|
||||
|
||||
<!-- Adapt parser. -->
|
||||
<replace file="${parser-file}">
|
||||
|
@ -311,7 +311,7 @@ echo " <https://repo.maven.apache.org/maven2/net/sourceforge/pmd/pmd/maven-me
|
||||
echo
|
||||
echo
|
||||
echo "Then proceed with releasing pmd-designer..."
|
||||
echo "<https://github.com/pmd/pmd-designer/blob/main/releasing.md>"
|
||||
echo "<https://github.com/pmd/pmd-designer/blob/master/releasing.md>"
|
||||
echo
|
||||
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>."
|
||||
|
@ -1,9 +1,8 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activesupport (7.2.2)
|
||||
activesupport (7.2.1)
|
||||
base64
|
||||
benchmark (>= 0.3)
|
||||
bigdecimal
|
||||
concurrent-ruby (~> 1.0, >= 1.3.1)
|
||||
connection_pool (>= 2.2.5)
|
||||
@ -16,7 +15,6 @@ GEM
|
||||
addressable (2.8.7)
|
||||
public_suffix (>= 2.0.2, < 7.0)
|
||||
base64 (0.2.0)
|
||||
benchmark (0.3.0)
|
||||
bigdecimal (3.1.8)
|
||||
coffee-script (2.4.1)
|
||||
coffee-script-source
|
||||
@ -36,10 +34,9 @@ GEM
|
||||
ethon (0.16.0)
|
||||
ffi (>= 1.15.0)
|
||||
eventmachine (1.2.7)
|
||||
execjs (2.10.0)
|
||||
faraday (2.12.0)
|
||||
execjs (2.9.1)
|
||||
faraday (2.11.0)
|
||||
faraday-net_http (>= 2.0, < 3.4)
|
||||
json
|
||||
logger
|
||||
faraday-net_http (3.3.0)
|
||||
net-http
|
||||
@ -102,7 +99,7 @@ GEM
|
||||
activesupport (>= 2)
|
||||
nokogiri (>= 1.4)
|
||||
http_parser.rb (0.8.0)
|
||||
i18n (1.14.6)
|
||||
i18n (1.14.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jekyll (3.10.0)
|
||||
addressable (~> 2.4)
|
||||
@ -214,7 +211,6 @@ GEM
|
||||
gemoji (>= 3, < 5)
|
||||
html-pipeline (~> 2.2)
|
||||
jekyll (>= 3.0, < 5.0)
|
||||
json (2.7.5)
|
||||
kramdown (2.4.0)
|
||||
rexml
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
@ -223,7 +219,7 @@ GEM
|
||||
listen (3.9.0)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
logger (1.6.1)
|
||||
logger (1.6.0)
|
||||
mercenary (0.3.6)
|
||||
minima (2.5.1)
|
||||
jekyll (>= 3.5, < 5.0)
|
||||
@ -244,7 +240,8 @@ GEM
|
||||
rb-fsevent (0.11.2)
|
||||
rb-inotify (0.11.1)
|
||||
ffi (~> 1.0)
|
||||
rexml (3.3.9)
|
||||
rexml (3.3.6)
|
||||
strscan
|
||||
rouge (3.30.0)
|
||||
rubyzip (2.3.2)
|
||||
safe_yaml (1.0.5)
|
||||
@ -258,6 +255,7 @@ GEM
|
||||
faraday (>= 0.17.3, < 3)
|
||||
securerandom (0.3.1)
|
||||
simpleidn (0.2.3)
|
||||
strscan (3.1.0)
|
||||
terminal-table (1.8.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
typhoeus (1.4.1)
|
||||
@ -266,7 +264,7 @@ GEM
|
||||
concurrent-ruby (~> 1.0)
|
||||
unicode-display_width (1.8.0)
|
||||
uri (0.13.1)
|
||||
webrick (1.9.0)
|
||||
webrick (1.8.1)
|
||||
|
||||
PLATFORMS
|
||||
x86_64-linux
|
||||
@ -278,4 +276,4 @@ DEPENDENCIES
|
||||
webrick
|
||||
|
||||
BUNDLED WITH
|
||||
2.5.22
|
||||
2.5.3
|
||||
|
@ -1,9 +1,9 @@
|
||||
repository: pmd/pmd
|
||||
|
||||
pmd:
|
||||
version: 7.8.0-SNAPSHOT
|
||||
previous_version: 7.7.0
|
||||
date: 2024-11-29
|
||||
version: 7.5.0-SNAPSHOT
|
||||
previous_version: 7.4.0
|
||||
date: 2024-08-30
|
||||
# release types: major, minor, bugfix
|
||||
release_type: minor
|
||||
|
||||
@ -21,7 +21,7 @@ site_title: PMD Source Code Analyzer
|
||||
company_name: PMD Open Source Project
|
||||
# this appears in the footer
|
||||
|
||||
github_editme_path: pmd/pmd/blob/main/docs/
|
||||
github_editme_path: pmd/pmd/blob/master/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.
|
||||
|
||||
host: 127.0.0.1
|
||||
|
@ -260,9 +260,6 @@ entries:
|
||||
- title: Error Prone
|
||||
output: web, pdf
|
||||
url: /pmd_rules_ecmascript_errorprone.html
|
||||
- title: Performance
|
||||
output: web, pdf
|
||||
url: /pmd_rules_ecmascript_performance.html
|
||||
- title: null
|
||||
output: web, pdf
|
||||
subfolders:
|
||||
@ -524,7 +521,7 @@ entries:
|
||||
url: /pmd_devdocs_building.html
|
||||
output: web, pdf
|
||||
- title: Contributing
|
||||
external_url: https://github.com/pmd/pmd/blob/main/CONTRIBUTING.md
|
||||
external_url: https://github.com/pmd/pmd/blob/master/CONTRIBUTING.md
|
||||
output: web, pdf
|
||||
- title: Writing documentation
|
||||
url: /pmd_devdocs_writing_documentation.html
|
||||
|
@ -45,9 +45,9 @@ See also
|
||||
|
||||
## Git branches/tags policy
|
||||
|
||||
* Main development happens on the main branch (currently called `main`).
|
||||
* Main development happens on the main branch (currently called `master`).
|
||||
* PR and enhancements are done on the main branch.
|
||||
* Releases are usually done directly from the main branch, we don't create release branches.
|
||||
* Release 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`.
|
||||
* 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.
|
||||
|
@ -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!
|
||||
|
||||
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/main/BUILDING.md).
|
||||
Please have a look at [CONTRIBUTING.md](https://github.com/pmd/pmd/blob/master/CONTRIBUTING.md) and
|
||||
[BUILDING.md](https://github.com/pmd/pmd/blob/master/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
|
||||
* 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
|
||||
file is [Swift.g4](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/antlr4/net/sourceforge/pmd/lang/swift/ast/Swift.g4)
|
||||
file is [Swift.g4](https://github.com/pmd/pmd/blob/master/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`.
|
||||
* Configure the options "superClass" and "contextSuperClass". These are the base classes for the generated
|
||||
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
|
||||
* 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
|
||||
[`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/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftNode.java)
|
||||
[`AntlrNode`](https://github.com/pmd/pmd/blob/master/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)
|
||||
as an example.
|
||||
* Additionally, you need several base classes:
|
||||
* 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
|
||||
base class from pmd-core
|
||||
[`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/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftInnerNode.java).
|
||||
[`BaseAntlrInnerNode`](https://github.com/pmd/pmd/blob/master/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).
|
||||
Note that this language specific inner node is package-private, as it is only the base class for the concrete
|
||||
nodes generated by ANLTR.
|
||||
* 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".
|
||||
See [`SwiftRootNode`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftRootNode.java).
|
||||
See [`SwiftRootNode`](https://github.com/pmd/pmd/blob/master/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
|
||||
node generated by ANLTR.
|
||||
* a language specific terminal node.
|
||||
See [`SwiftTerminalNode`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftTerminalNode.java).
|
||||
See [`SwiftTerminalNode`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftTerminalNode.java).
|
||||
* a language specific error node.
|
||||
See [`SwiftErrorNode`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftErrorNode.java).
|
||||
See [`SwiftErrorNode`](https://github.com/pmd/pmd/blob/master/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.
|
||||
See [`SwiftNameDictionary'](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftNameDictionary.java).
|
||||
See [`SwiftNameDictionary'](https://github.com/pmd/pmd/blob/master/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`
|
||||
* Define a package private field `DICO` which creates a new instance of your language name dictionary using the
|
||||
vocabulary from the generated parser (`VOCABULARY`).
|
||||
* 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/main/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/master/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()`.
|
||||
* 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/main/antlr4-wrapper.xml)
|
||||
the generated code. The ant script is [`antlr4-wrapper.xml`](https://github.com/pmd/pmd/blob/master/antlr4-wrapper.xml)
|
||||
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
|
||||
class). Have a look at Swift's example: [`pmd-swift/pom.xml`](https://github.com/pmd/pmd/blob/main/pmd-swift/pom.xml).
|
||||
class). Have a look at Swift's example: [`pmd-swift/pom.xml`](https://github.com/pmd/pmd/blob/master/pmd-swift/pom.xml).
|
||||
* 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.
|
||||
|
||||
@ -115,31 +115,31 @@ definitely don't come for free. It is much effort and requires perseverance to i
|
||||
have the parser generated.
|
||||
* The generated code will be placed under `target/generated-sources/antlr4` and will not be committed to
|
||||
source control.
|
||||
* You should review [`pmd-swift/pom.xml`](https://github.com/pmd/pmd/blob/main/pmd-swift/pom.xml).
|
||||
* You should review [`pmd-swift/pom.xml`](https://github.com/pmd/pmd/blob/master/pmd-swift/pom.xml).
|
||||
|
||||
### 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/main/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/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/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/cpd/SwiftCpdLexer.java).
|
||||
[`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/main/pmd-core/src/main/java/net/sourceforge/pmd/cpd/impl/AntlrTokenFilter.java).
|
||||
[`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 CpdLexer for C# as an exmaple:
|
||||
[`CsCpdLexer`](https://github.com/pmd/pmd/blob/main/pmd-cs/src/main/java/net/sourceforge/pmd/lang/cs/cpd/CsCpdLexer.java).
|
||||
[`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.
|
||||
|
||||
### 6. Create a PMD parser “adapter”
|
||||
* Create your own parser, that adapts the ANLTR interface to PMD's parser interface.
|
||||
* 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)
|
||||
* 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)
|
||||
implementation that you need to extend to create your own adapter as we do with
|
||||
[`PmdSwiftParser`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/PmdSwiftParser.java).
|
||||
[`PmdSwiftParser`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/PmdSwiftParser.java).
|
||||
|
||||
### 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/main/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/master/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.
|
||||
* 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
|
||||
@ -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
|
||||
implementation.
|
||||
* 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/main/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/master/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/AstVisitor.java).
|
||||
* 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.
|
||||
See [`SwiftVisitorBase`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftVisitorBase.java)
|
||||
See [`SwiftVisitorBase`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftVisitorBase.java)
|
||||
as an example.
|
||||
|
||||
### 9. Make PMD recognize your language
|
||||
* Create your own subclass of `net.sourceforge.pmd.lang.impl.SimpleLanguageModuleBase`, see Swift as an example:
|
||||
[`SwiftLanguageModule`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftLanguageModule.java).
|
||||
[`SwiftLanguageModule`](https://github.com/pmd/pmd/blob/master/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.
|
||||
Use `addDefaultVersion` for defining the default version.
|
||||
* 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
|
||||
* You need to create your own abstract rule class in order to interface your language with PMD's generic rule
|
||||
execution.
|
||||
* 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.
|
||||
* 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.
|
||||
* The rule basically just extends
|
||||
[`AbstractVisitorRule`](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractVisitorRule.java)
|
||||
[`AbstractVisitorRule`](https://github.com/pmd/pmd/blob/master/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.
|
||||
In this case our `SwiftVisitor` is used.
|
||||
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.
|
||||
* To add a visitor rule:
|
||||
* 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/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/UnavailableFunctionRule.java)
|
||||
rule [UnavailableFunctionRule](https://github.com/pmd/pmd/blob/master/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
|
||||
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).
|
||||
@ -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).
|
||||
* Each rule has its own test class: Create a test class for your rule extending `PmdRuleTst`
|
||||
*(see
|
||||
[`UnavailableFunctionTest`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/test/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/UnavailableFunctionTest.java)
|
||||
[`UnavailableFunctionTest`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/test/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/UnavailableFunctionTest.java)
|
||||
for example)*
|
||||
* Create a category rule set for your language *(see
|
||||
[`pmd-swift/src/main/resources/bestpractices.xml`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/resources/category/swift/bestpractices.xml)
|
||||
[`pmd-swift/src/main/resources/bestpractices.xml`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/resources/category/swift/bestpractices.xml)
|
||||
for example)*
|
||||
* Place the test XML file with the test cases in the correct location
|
||||
* When executing the test class
|
||||
* this triggers the unit test to read the corresponding XML file with the rule test data
|
||||
*(see
|
||||
[`UnavailableFunction.xml`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/rule/bestpractices/xml/UnavailableFunction.xml)
|
||||
[`UnavailableFunction.xml`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/rule/bestpractices/xml/UnavailableFunction.xml)
|
||||
for example)*
|
||||
* 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
|
||||
|
@ -20,7 +20,7 @@ easy to implement the Tokenizer interface.
|
||||
|
||||
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/main/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/master/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
|
||||
other languages.
|
||||
- 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 %}.
|
||||
- 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/main/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/master/pmd-go/pom.xml)).
|
||||
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:
|
||||
@ -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
|
||||
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.
|
||||
- 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.
|
||||
- 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.
|
||||
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
|
||||
{%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.
|
||||
|
||||
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).
|
||||
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).
|
||||
|
||||
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 %}
|
||||
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/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).
|
||||
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
|
||||
|
@ -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**
|
||||
|
||||
`pmdtester -r YOUR_LOCAL_PMD_GIT_REPO_ROOT_DIR -b main -p YOUR_DEVELOPMENT_BRANCH`
|
||||
`pmdtester -r YOUR_LOCAL_PMD_GIT_REPO_ROOT_DIR -b master -p YOUR_DEVELOPMENT_BRANCH`
|
||||
|
||||
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/main/README.rdoc)
|
||||
For more documentation on pmdtester, see [README.rdoc](https://github.com/pmd/pmd-regression-tester/blob/master/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
|
||||
`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/main/pmd-java/src/main/resources/category/java).
|
||||
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).
|
||||
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
|
||||
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 implementation of these tags, see the [_plugins](https://github.com/pmd/pmd/tree/main/docs/_plugins) folder.
|
||||
For the implementation of these tags, see the [_plugins](https://github.com/pmd/pmd/tree/master/docs/_plugins) folder.
|
||||
|
||||
|
||||
## Building
|
||||
|
@ -2,7 +2,7 @@
|
||||
title: Java support
|
||||
permalink: pmd_languages_java.html
|
||||
author: Clément Fournier
|
||||
last_updated: July 2024 (7.5.0)
|
||||
last_updated: December 2023 (7.0.0)
|
||||
tags: [languages, PmdCapableLanguage, CpdCapableLanguage]
|
||||
summary: "Java-specific features and guidance"
|
||||
---
|
||||
@ -15,10 +15,9 @@ Usually the latest non-preview Java Version is the default version.
|
||||
|
||||
| Java Version | Alias | Supported by PMD since |
|
||||
|--------------|-------|------------------------|
|
||||
| 23-preview | | 7.5.0 |
|
||||
| 23 (default) | | 7.5.0 |
|
||||
| 22-preview | | 7.0.0 |
|
||||
| 22 | | 7.0.0 |
|
||||
| 22 (default) | | 7.0.0 |
|
||||
| 21-preview | | 7.0.0 |
|
||||
| 21 | | 7.0.0 |
|
||||
| 20 | | 6.55.0 |
|
||||
| 19 | | 6.48.0 |
|
||||
@ -199,4 +198,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 %}
|
||||
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
|
||||
[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).
|
||||
[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).
|
||||
|
@ -2,7 +2,7 @@
|
||||
title: Language configuration
|
||||
permalink: pmd_languages_configuration.html
|
||||
author: Clément Fournier
|
||||
last_updated: August 2024 (7.5.0)
|
||||
last_updated: February 2024 (7.0.0)
|
||||
tags: [languages]
|
||||
keywords: [pmd, cpd, options, command, auxclasspath, language, properties]
|
||||
summary: "Summary of language configuration options and properties"
|
||||
@ -98,11 +98,6 @@ The Java language can be configured with the following properties:
|
||||
|
||||
Environment variable: `PMD_JAVA_X_TYPE_INFERENCE_LOGGING`
|
||||
|
||||
- `xStrictTypeRes`: Whether to perform type resolution strictly at the start of execution or not (default: "true")
|
||||
|
||||
Since: 7.5.0
|
||||
Environment variable: `PMD_JAVA_X_STRICT_TYPE_RES`
|
||||
|
||||
## Apex language properties
|
||||
|
||||
- `rootDirectory`: With this property the root directory of the Salesforce metadata, where `sfdx-project.json`
|
||||
|
@ -18,15 +18,15 @@ It usually takes 15 minutes.
|
||||
## Contents
|
||||
|
||||
* Main page - aka "Landing page": <https://pmd.github.io>
|
||||
* 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/main/_includes)
|
||||
* Layout: [_layouts/default.html](https://github.com/pmd/pmd.github.io/blob/master/_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)
|
||||
* 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/main/_includes/home.html).
|
||||
e.g. in [_includes/home.html](https://github.com/pmd/pmd.github.io/blob/master/_includes/home.html).
|
||||
* 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/main/_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/master/_includes/news.html).
|
||||
* There is also a sub page "news" which lists all news.
|
||||
* 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/main/news.html)
|
||||
* Layout: [_layouts/news.html](https://github.com/pmd/pmd.github.io/blob/master/_layouts/news.html)
|
||||
* Page (which is pretty empty): [news.html](https://github.com/pmd/pmd.github.io/blob/master/news.html)
|
||||
|
||||
## Building the page locally
|
||||
|
||||
|
@ -5,7 +5,7 @@ last_updated: October 2021
|
||||
author: Andreas Dangel <andreas.dangel@adangel.org>
|
||||
---
|
||||
|
||||
## Example 1: Merging PR #123 into main
|
||||
## Example 1: Merging PR #123 into master
|
||||
|
||||
1. Review the pull request
|
||||
|
||||
@ -20,15 +20,15 @@ author: Andreas Dangel <andreas.dangel@adangel.org>
|
||||
|
||||
2. The actual merge commands:
|
||||
|
||||
We assume, that the PR has been created from the main branch. If this is not the case,
|
||||
We assume, that the PR has been created from the master branch. If this is not the case,
|
||||
then we'll either need to rebase or ask for rebasing before merging.
|
||||
|
||||
```
|
||||
git checkout main && git pull origin main # make sure, you have the latest code
|
||||
git checkout master && git pull origin master # 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"
|
||||
```
|
||||
|
||||
3. Update the [release notes](https://github.com/pmd/pmd/blob/main/docs/pages/release_notes.md):
|
||||
3. Update the [release notes](https://github.com/pmd/pmd/blob/master/docs/pages/release_notes.md):
|
||||
|
||||
* 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?
|
||||
@ -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
|
||||
the file `.all-contributorsrc` and `docs/pages/pmd/projectdocs/credits.md`.
|
||||
|
||||
5. Now merge the pull request into the main branch:
|
||||
5. Now merge the pull request into the master branch:
|
||||
|
||||
```
|
||||
git checkout main
|
||||
git merge --no-ff pr-123 -m "Full-title-of-the-pr (#123)
|
||||
git checkout master
|
||||
git merge --no-ff pr-123 -m "Merge pull request #123 from xyz:branch
|
||||
|
||||
Merge pull request #123 from xyz:branch" --log
|
||||
Full-title-of-the-pr #123" --log
|
||||
```
|
||||
|
||||
{%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`
|
||||
|
||||
{% 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 main." %}
|
||||
that the complete project can be build and is functioning on top of the current master." %}
|
||||
|
||||
{% 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." %}
|
||||
@ -83,7 +83,7 @@ author: Andreas Dangel <andreas.dangel@adangel.org>
|
||||
7. If the build was successful, you are ready to push:
|
||||
|
||||
```
|
||||
git push origin main
|
||||
git push origin master
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
We ask, to create every pull request against main, to make it easier to contribute.
|
||||
We ask, to create every pull request against master, 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.
|
||||
|
||||
### 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 rebase main --onto pmd/5.8.x
|
||||
git rebase master --onto pmd/5.8.x
|
||||
./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
|
||||
rebased onto the maintenance branch.
|
||||
|
||||
### Merging into main
|
||||
### Merging into master
|
||||
|
||||
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):
|
||||
@ -162,17 +162,17 @@ Therefore, we merge first into the next minor version maintenance branch (if exi
|
||||
git checkout pmd/5.9.x
|
||||
git merge pmd/5.8.x
|
||||
|
||||
After that, we merge the changes into the main branch:
|
||||
After that, we merge the changes into the master branch:
|
||||
|
||||
git checkout main
|
||||
git checkout master
|
||||
git merge pmd/5.9.x
|
||||
|
||||
{%include note.html content="This ensures, that every change on the maintenance branch eventually ends
|
||||
up in the main branch and therefore in any future version of PMD.<br>
|
||||
up in the master 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
|
||||
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
|
||||
eventually into main, with the risk of missing single commits in a maintenance branch, that have been
|
||||
eventually into master, with the risk of missing single commits in a maintenance branch, that have been
|
||||
done outside the temporary branch." %}
|
||||
|
||||
### 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
|
||||
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 main branch are "connected" and not separate.
|
||||
The downside is a more complex history - the maintenance branches and master 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`.
|
||||
|
||||
Check in all (version) changes to branch main or any other branch, from which the release takes place:
|
||||
Check in all (version) changes to branch master or any other branch, from which the release takes place:
|
||||
|
||||
$ git commit -a -m "Prepare pmd release <version>"
|
||||
$ 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
|
||||
```
|
||||
|
||||
Check in all (version, blog post) changes to branch main:
|
||||
Check in all (version, blog post) changes to branch master:
|
||||
|
||||
$ git commit -a -m "Prepare pmd release <version>"
|
||||
$ git push
|
||||
@ -259,7 +259,7 @@ Here is, what happens:
|
||||
under <https://pmd.sourceforge.io/archive.phtml>.
|
||||
|
||||
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/main/releasing.md>.
|
||||
can proceed with releasing pmd designer, see <https://github.com/pmd/pmd-designer/blob/master/releasing.md>.
|
||||
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
|
||||
@ -374,7 +374,7 @@ This is a {{ site.pmd.release_type }} release.
|
||||
Finally, commit and push the changes:
|
||||
|
||||
$ git commit -m "Prepare next development version"
|
||||
$ git push origin main
|
||||
$ git push origin master
|
||||
|
||||
|
||||
## Branches
|
||||
@ -382,7 +382,7 @@ Finally, commit and push the changes:
|
||||
### Merging
|
||||
|
||||
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 `main`.
|
||||
merged into the next "higher" branches, such as `pmd/5.5.x` and `master`.
|
||||
|
||||
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.
|
||||
@ -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,
|
||||
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 `main` branch and release from there. This way, the last release done, becomes
|
||||
from there. Then merge into the `master` 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.
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -159,7 +159,7 @@ The tool comes with a rather extensive help text, simply running with `--help`!
|
||||
description="Path to a file to which report output is written. The file is created if it does not exist. If this option is not specified, the report is rendered to standard output."
|
||||
%}
|
||||
{% include custom/cli_option_row.html options="--show-suppressed"
|
||||
description="Causes the suppressed rule violations to be added to the report if supported by the report format. See [PMD Report formats](pmd_userdocs_report_formats.html) for details."
|
||||
description="Causes the suppressed rule violations to be added to the report."
|
||||
%}
|
||||
{% include custom/cli_option_row.html options="--suppress-marker"
|
||||
option_arg="marker"
|
||||
|
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