Merge branch 'text-utils-simple' into text-utils-javacc

This commit is contained in:
Clément Fournier
2021-03-30 02:40:57 +02:00
808 changed files with 23361 additions and 12323 deletions

View File

@ -115,7 +115,7 @@ cd pmd
git init
git remote add origin https://github.com/pmd/pmd
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/${MAIN_BRANCH}:refs/remotes/origin/${MAIN_BRANCH}
git checkout --progress --force -B master refs/remotes/origin/${MAIN_BRANCH}
git checkout --progress --force -B ${MAIN_BRANCH} refs/remotes/origin/${MAIN_BRANCH}
.ci/check-environment.sh
@ -159,9 +159,11 @@ You'll be dropped into a bash. Use the following script, to setup and start the
```
export MAVEN_OPTS="-Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3"
export PMD_CI_BRANCH="master" # base branch
export PMD_CI_BRANCH="master" # base branch of the pull request
export PMD_CI_PULL_REQUEST_NUMBER=2913
unset PMD_CI_SECRET_PASSPHRASE
# these are used by danger
export GITHUB_EVENT_PATH=/workspaces/event.json
export GITHUB_REPOSITORY=pmd/pmd
@ -179,5 +181,5 @@ git checkout --progress --force refs/remotes/pull/${PMD_CI_PULL_REQUEST_NUMBER}/
.ci/check-environment.sh
.ci/build-pr.sh
.ci/build-pr-win-macos.sh
```

View File

@ -24,7 +24,7 @@ log_group_start "Downloading maven dependencies"
log_group_end
log_group_start "Building with maven"
./mvnw -e -V clean verify ${PMD_EXTRA_OPT}
./mvnw -e -V -B clean verify ${PMD_EXTRA_OPT}
log_group_end

View File

@ -123,7 +123,7 @@ function pmd_ci_build_run() {
log_info "This is a snapshot build"
fi
./mvnw clean deploy -P${mvn_profiles} -e -V -Djava8.home=${HOME}/openjdk8
./mvnw clean deploy -P${mvn_profiles} -e -B -V -Djava8.home=${HOME}/openjdk8
}
#
@ -183,12 +183,17 @@ function pmd_ci_build_and_upload_doc() {
pmd_code_removeJavadoc "${VERSION}-SNAPSHOT"
# updating github release text
rm -f .bundle/config
bundle config set --local path vendor/bundle
bundle config set --local with release_notes_preprocessing
bundle install
# renders, and skips the first 6 lines - the Jekyll front-matter
local rendered_release_notes=$(bundle exec .ci/render_release_notes.rb docs/pages/release_notes.md | tail -n +6)
local release_name="PMD ${VERSION} ($(date -u +%d-%B-%Y))"
gh_release_updateRelease "$GH_RELEASE" "$release_name" "$rendered_release_notes"
sourceforge_uploadReleaseNotes "${VERSION}" "${rendered_release_notes}"
# updates https://pmd.github.io/latest/ and https://pmd.github.io/pmd-${VERSION}
publish_release_documentation_github
sourceforge_rsyncSnapshotDocumentation "${VERSION}" "pmd-${VERSION}"
fi

File diff suppressed because it is too large Load Diff

View File

@ -32,6 +32,8 @@ mvn dependency:build-classpath -DincludeScope=test -Dmdep.outputFile=classpath.t
<connection>https://github.com/spring-projects/spring-framework</connection>
<tag>v5.0.6.RELEASE</tag>
<exclude-pattern>.*/build/generated-sources/.*</exclude-pattern>
<build-command><![CDATA[#!/usr/bin/env bash
if test -e classpath.txt; then
exit
@ -86,7 +88,7 @@ export PATH=$JAVA_HOME/bin:$PATH
EOF
) | patch
./gradlew build -x javadoc -x dokka -x asciidoctor -x test -x testNG -x api -x distZip
./gradlew build testClasses -x javadoc -x dokka -x asciidoctor -x test -x testNG -x api -x distZip
./gradlew createSquishClasspath -q > classpath.txt
]]></build-command>
<auxclasspath-command>cat classpath.txt</auxclasspath-command>

View File

@ -20,11 +20,23 @@ function maven_dependencies_resolve() {
dokka_version=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${dokka.version}' \
--non-recursive org.codehaus.mojo:exec-maven-plugin:3.0.0:exec)
./mvnw dependency:resolve
./mvnw dependency:get -DgroupId=org.jetbrains.dokka \
# build first the modules, that have dependencies between themselves
# first build pmd-lang-test, pmd-test and pmd-core - used by all modules
./mvnw clean install -pl pmd-core,pmd-test,pmd-lang-test -DskipTests -Dpmd.skip=true \
-B -Dcheckstyle.skip=true -Dmaven.javadoc.skip=true -Dmaven.source.skip=true
# then build dependencies for pmd-visualforce needs: pmd-apex->pmd-apex-jorje+pmd-test+pmd-core
./mvnw clean install -pl pmd-core,pmd-test,pmd-lang-test,pmd-apex-jorje,pmd-apex -DskipTests -Dpmd.skip=true \
-B -Dcheckstyle.skip=true -Dmaven.javadoc.skip=true -Dmaven.source.skip=true
# the resolve most other projects. The excluded projects depend on other projects in the reactor, which is not
# completely built yet, so these are excluded.
./mvnw dependency:resolve -pl '!pmd-dist,!pmd-doc,!pmd-scala' -Dsilent -B
./mvnw dependency:get -B -Dsilent \
-DgroupId=org.jetbrains.dokka \
-DartifactId=dokka-maven-plugin \
-Dversion=${dokka_version} \
-Dpackaging=jar \
-DremoteRepositories=jcenter::default::https://jcenter.bintray.com/
./mvnw dependency:resolve-plugins -DexcludeGroupIds=org.jetbrains.dokka -Psign
./mvnw dependency:resolve-plugins -B -Dsilent -DexcludeGroupIds=org.jetbrains.dokka -Psign
}

View File

@ -32,81 +32,55 @@ function regression_tester_setup_ci() {
}
#
# Generate a new baseline and upload it to sourceforge
#
# Note: this function always succeeds, even if the upload fails.
# In that case, just a error logging is provided.
# Generate a new baseline and upload it to pmd-code.org
#
function regression_tester_uploadBaseline() {
log_debug "$FUNCNAME branch=${PMD_CI_BRANCH}"
local targetUrl="https://sourceforge.net/projects/pmd/files/pmd-regression-tester/"
local pmdcodeUrl="https://pmd-code.org/pmd-regression-tester/"
local baseline_branch="${PMD_CI_BRANCH:-$PMD_CI_TAG}"
log_debug "$FUNCNAME branch=${baseline_branch}"
local errexitstate="$(shopt -po errexit)"
set +e # disable errexit
(
# This handler is called if any command fails
function upload_failed() {
log_error "Error while uploading ${BRANCH_FILENAME}-baseline.zip to sourceforge!"
log_error "Please upload manually: ${targetUrl}"
}
# exit subshell after trap
set -e
trap upload_failed ERR
log_info "Generating and uploading baseline for pmdtester..."
cd ..
bundle config --local gemfile pmd/Gemfile
pmd/.ci/travis_wait "bundle exec pmdtester
--mode single
--local-git-repo ./pmd
--patch-branch ${PMD_CI_BRANCH}
--patch-config ./pmd/.ci/files/all-java.xml
--list-of-project ./pmd/.ci/files/project-list.xml --html-flag"
cd target/reports
BRANCH_FILENAME="${PMD_CI_BRANCH/\//_}"
zip -q -r ${BRANCH_FILENAME}-baseline.zip ${BRANCH_FILENAME}/
../../pmd/.ci/travis_wait "rsync -avh ${BRANCH_FILENAME}-baseline.zip ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd-regression-tester/"
log_success "Successfully uploaded ${BRANCH_FILENAME}-baseline.zip to ${targetUrl}"
)
# restore errexit state
eval "$errexitstate"
log_info "Generating and uploading baseline for pmdtester (${baseline_branch})..."
pushd ..
rm -f .bundle/config
bundle config set --local gemfile pmd/Gemfile
bundle exec pmdtester \
--mode single \
--local-git-repo ./pmd \
--patch-branch ${baseline_branch} \
--patch-config ./pmd/.ci/files/all-java.xml \
--list-of-project ./pmd/.ci/files/project-list.xml --html-flag \
--error-recovery
pushd target/reports
BRANCH_FILENAME="${baseline_branch/\//_}"
zip -q -r ${BRANCH_FILENAME}-baseline.zip ${BRANCH_FILENAME}/
# ssh-key for pmd-code.org is setup already by pmd_ci_setup_ssh
scp ${BRANCH_FILENAME}-baseline.zip pmd@pmd-code.org:/httpdocs/pmd-regression-tester/
log_success "Successfully uploaded ${BRANCH_FILENAME}-baseline.zip to ${pmdcodeUrl}"
popd
popd
}
#
# Execute danger, which executes pmd-regression-tester (via Dangerfile).
#
# Note: this function always succeeds, even if the danger fails.
# In that case, just a error logging is provided.
#
function regression_tester_executeDanger() {
log_debug "$FUNCNAME"
local errexitstate="$(shopt -po errexit)"
set +e # disable errexit
(
# This handler is called if any command fails
function danger_failed() {
log_error "Error while executing danger/pmd-regression-tester"
}
# Create a corresponding remote branch locally
if ! git show-ref --verify --quiet refs/heads/${PMD_CI_BRANCH}; then
git fetch --no-tags --depth=1 origin +refs/heads/${PMD_CI_BRANCH}:refs/remotes/origin/${PMD_CI_BRANCH}
git branch ${PMD_CI_BRANCH} origin/${PMD_CI_BRANCH}
log_debug "Created local branch ${PMD_CI_BRANCH}"
fi
# Fetch more commits of the PR for danger and regression tester
git fetch --no-tags --depth=50 origin +$(git rev-parse HEAD^2):
# Fetch more commits from master branch for regression tester
if [[ "${PMD_CI_BRANCH}" != "master" ]]; then
git fetch --no-tags --depth=50 origin +master:
git branch master origin/master
fi
# exit subshell after trap
set -e
trap danger_failed ERR
# Create a corresponding remote branch locally
if ! git show-ref --verify --quiet refs/heads/${PMD_CI_BRANCH}; then
git fetch --no-tags --depth=1 origin +refs/heads/${PMD_CI_BRANCH}:refs/remotes/origin/${PMD_CI_BRANCH}
git branch ${PMD_CI_BRANCH} origin/${PMD_CI_BRANCH}
log_debug "Created local branch ${PMD_CI_BRANCH}"
fi
# Fetch more commits of the PR for danger
git fetch --no-tags --depth=50 origin +$(git rev-parse HEAD^2):
log_info "Running danger on branch ${PMD_CI_BRANCH}"
bundle exec danger --verbose
log_success "Executing danger successfully"
)
# restore errexit state
eval "$errexitstate"
log_info "Running danger on branch ${PMD_CI_BRANCH}"
bundle exec danger --verbose
log_success "Executed danger successfully"
}

View File

@ -1,5 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Question
url: https://github.com/pmd/pmd/discussions?discussions_q=category%3AQ%26A
about: Feel free to ask any question about PMD and its usage
- name: PMD Designer Issues
url: https://github.com/pmd/pmd-designer/issues
about: Issues about the rule designer

View File

@ -1,14 +0,0 @@
---
name: Question
about: Feel free to ask any question about PMD and its usage
title: ''
labels: 'a:question'
assignees: ''
---
<!-- Have a look at https://github.com/pmd/pmd/issues?utf8=%E2%9C%93&q=label%3Aa%3Aquestion if there is already
a similar question -->
**Description:**

View File

@ -2,7 +2,7 @@
name: Rule violation
about: Let us know about a false positive/false negative
title: ''
labels: 'a:bug'
labels: 'a:false-positive, a:false-negative'
assignees: ''
---

View File

@ -6,7 +6,7 @@ jobs:
build:
runs-on: ${{ matrix.os }}
continue-on-error: false
timeout-minutes: 30
timeout-minutes: 60
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
@ -21,9 +21,9 @@ jobs:
~/.m2/repository
~/.cache
vendor/bundle
key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
key: pr-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-
pr-${{ runner.os }}-
- name: Set up Ruby 2.7
uses: actions/setup-ruby@v1
with:

View File

@ -22,9 +22,9 @@ jobs:
~/.m2/repository
~/.cache
vendor/bundle
key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
key: push-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-
push-${{ runner.os }}-
- name: Set up Ruby 2.7
uses: actions/setup-ruby@v1
with:
@ -36,7 +36,7 @@ jobs:
run: .ci/build.sh
shell: bash
env:
MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3
MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3 -DstagingProgressTimeoutMinutes=30
PMD_CI_SECRET_PASSPHRASE: ${{ secrets.PMD_CI_SECRET_PASSPHRASE }}
PMD_CI_JOB_URL: "https://github.com/pmd/pmd/runs/${{ github.run_id }}"
PMD_CI_PUSH_COMMIT_COMPARE: ${{ github.event.compare }}
@ -79,9 +79,9 @@ jobs:
~/.m2/repository
~/.cache
vendor/bundle
key: ${{ runner.os }}-coveralls-${{ hashFiles('**/pom.xml') }}
key: coveralls-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-coveralls-
coveralls-${{ runner.os }}-
- name: Check Environment
run: .ci/check-environment.sh
shell: bash
@ -104,9 +104,9 @@ jobs:
~/.m2/repository
~/.cache
vendor/bundle
key: ${{ runner.os }}-sonar-${{ hashFiles('**/pom.xml') }}
key: sonar-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-sonar-
sonar-${{ runner.os }}-
- name: Check Environment
run: .ci/check-environment.sh
shell: bash

View File

@ -10,6 +10,10 @@ jobs:
continue-on-error: false
steps:
- uses: actions/checkout@v2
- name: Set up Ruby 2.7
uses: actions/setup-ruby@v1
with:
ruby-version: 2.7
- name: Check Environment
run: .ci/check-environment.sh
shell: bash

View File

@ -19,9 +19,9 @@ jobs:
~/.m2/repository
~/.cache
vendor/bundle
key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
key: push-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-
push-${{ runner.os }}-
- name: Set up Ruby 2.7
uses: actions/setup-ruby@v1
with:

1
.gitignore vendored
View File

@ -14,6 +14,7 @@ bin/
pmd-core/dependency-reduced-pom.xml
.bundle
vendor
.DS_Store
# rule docs are generated
docs/pages/pmd/rules

View File

@ -45,7 +45,7 @@ There are various channels, on which you can ask questions:
* On [StackOverflow](https://stackoverflow.com/questions/tagged/pmd): Make sure, to tag your question with "pmd".
* Create a issue for your question at <https://github.com/pmd/pmd/issues>.
* Create a new discussion for your question at <https://github.com/pmd/pmd/discussions>.
* Ask your question on Gitter <https://gitter.im/pmd/pmd>.

View File

@ -14,6 +14,8 @@ def get_args(base_branch)
'--mode', 'online',
'--auto-gen-config',
'--keep-reports',
'--error-recovery',
'--baseline-download-url', 'https://pmd-code.org/pmd-regression-tester/',
# '--debug',
]
end
@ -21,10 +23,9 @@ end
def run_pmdtester
Dir.chdir('..') do
begin
@base_branch = ENV['TRAVIS_BRANCH']
@base_branch = ENV['PMD_CI_BRANCH']
@logger.info "Run against PR base #{@base_branch}"
runner = PmdTester::Runner.new(get_args(@base_branch))
@new_errors, @removed_errors, @new_violations, @removed_violations, @new_configerrors, @removed_configerrors = runner.run
@summary = PmdTester::Runner.new(get_args(@base_branch)).run
unless Dir.exist?('target/reports/diff')
message("No java rules are changed!", sticky: true)
@ -36,11 +37,11 @@ def run_pmdtester
message1 = create_message
# run against master branch (if the PR is not already against master)
unless ENV['TRAVIS_BRANCH'] == 'master'
unless ENV['PMD_CI_BRANCH'] == 'master'
@base_branch = 'master'
@logger.info "Run against #{@base_branch}"
runner = PmdTester::Runner.new(get_args(@base_branch))
@new_errors, @removed_errors, @new_violations, @removed_violations, @new_configerrors, @removed_configerrors = runner.run
@summary = PmdTester::Runner.new(get_args(@base_branch)).run
# move the generated report out of the way
FileUtils.mv 'target/reports/diff', 'target/diff2'
message2 = create_message
@ -69,11 +70,14 @@ end
def create_message
"Compared to #{@base_branch}:\n"\
"This changeset introduces "\
"#{@new_violations} new violations, #{@new_errors} new errors and "\
"#{@new_configerrors} new configuration errors,\n"\
"removes #{@removed_violations} violations, #{@removed_errors} errors and "\
"#{@removed_configerrors} configuration errors.\n"
"This changeset " \
"changes #{@summary[:violations][:changed]} violations,\n" \
"introduces #{@summary[:violations][:new]} new violations, " \
"#{@summary[:errors][:new]} new errors and " \
"#{@summary[:configerrors][:new]} new configuration errors,\n" \
"removes #{@summary[:violations][:removed]} violations, "\
"#{@summary[:errors][:removed]} errors and " \
"#{@summary[:configerrors][:removed]} configuration errors.\n"
end
def upload_report
@ -83,8 +87,9 @@ def upload_report
`tar -cf #{tar_filename} diff1/ diff2/`
report_url = `curl -u #{ENV['PMD_CI_CHUNK_TOKEN']} -T #{tar_filename} https://chunk.io`
if $?.success?
@logger.info "Successfully uploaded #{tar_filename} to chunk.io"
report_url.chomp
report_url.chomp!
@logger.info "Successfully uploaded #{tar_filename} to #{report_url}"
report_url
else
@logger.error "Error while uploading #{tar_filename} to chunk.io: #{report_url}"
warn("Uploading the diff report failed, this message is mainly used to remind the maintainers of PMD.")

View File

@ -1,9 +1,9 @@
source 'https://rubygems.org/'
# bleeding edge from git
gem 'pmdtester', :git => 'https://github.com/pmd/pmd-regression-tester.git'
#gem 'pmdtester', :git => 'https://github.com/pmd/pmd-regression-tester.git'
#gem 'pmdtester', '~> 1.0'
gem 'pmdtester', '~> 1'
gem 'danger', '~> 5.6', '>= 5.6'
# This group is only needed for rendering release notes

View File

@ -1,13 +1,3 @@
GIT
remote: https://github.com/pmd/pmd-regression-tester.git
revision: 6875868e8be772807498ab46411e44d163633d64
specs:
pmdtester (1.1.0.pre.SNAPSHOT)
differ (~> 0.1)
nokogiri (~> 1.8)
rufus-scheduler (~> 3.5)
slop (~> 4.6)
GEM
remote: https://rubygems.org/
specs:
@ -41,28 +31,38 @@ GEM
multipart-post (>= 1.2, < 3)
faraday-http-cache (1.3.1)
faraday (~> 0.8)
fugit (1.4.0)
fugit (1.4.2)
et-orbi (~> 1.1, >= 1.1.8)
raabro (~> 1.4)
git (1.7.0)
git (1.8.1)
rchardet (~> 1.8)
kramdown (1.17.0)
liquid (4.0.3)
mini_portile2 (2.4.0)
liquid (5.0.0)
logger-colors (1.0.0)
mini_portile2 (2.5.0)
multipart-post (2.1.1)
nap (1.1.0)
no_proxy_fix (0.1.2)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
octokit (4.19.0)
nokogiri (1.11.1)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
octokit (4.20.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
open4 (1.3.4)
pmdtester (1.1.1)
differ (~> 0.1)
liquid (>= 4.0)
logger-colors (~> 1.0)
nokogiri (>= 1.11.0.rc4)
rufus-scheduler (~> 3.5)
slop (~> 4.6)
public_suffix (4.0.6)
raabro (1.4.0)
racc (1.5.2)
rchardet (1.8.0)
rouge (3.24.0)
rufus-scheduler (3.6.0)
rouge (3.26.0)
rufus-scheduler (3.7.0)
fugit (~> 1.1, >= 1.1.6)
safe_yaml (1.0.5)
sawyer (0.8.2)
@ -71,7 +71,7 @@ GEM
slop (4.8.2)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
tzinfo (2.0.2)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unicode-display_width (1.7.0)
@ -81,7 +81,7 @@ PLATFORMS
DEPENDENCIES
danger (~> 5.6, >= 5.6)
liquid (>= 4.0.0)
pmdtester!
pmdtester (~> 1)
rouge (>= 1.7, < 4)
safe_yaml (>= 1.0)

View File

@ -3,7 +3,7 @@
![PMD Logo](https://raw.githubusercontent.com/pmd/pmd/pmd/7.0.x/docs/images/logo/pmd-logo-300px.png)
[![Join the chat at https://gitter.im/pmd/pmd](https://badges.gitter.im/pmd/pmd.svg)](https://gitter.im/pmd/pmd?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://github.com/pmd/pmd/workflows/.github/workflows/pushes.yml/badge.svg?branch=master)](https://github.com/pmd/pmd/actions)
[![Build Status](https://github.com/pmd/pmd/workflows/Pushes/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#net.sourceforge.pmd:pmd)
[![Coverage Status](https://coveralls.io/repos/github/pmd/pmd/badge.svg)](https://coveralls.io/github/pmd/pmd)
@ -22,10 +22,12 @@ Objective-C, Perl, PHP, PLSQL, Python, Ruby, Salesforce.com Apex, Scala, Swift,
## Support
* How do I? -- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/pmd).
* I got this error, why? -- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/pmd).
* How do I? -- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/pmd)
or on [discussions](https://github.com/pmd/pmd/discussions).
* I got this error, why? -- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/pmd)
or on [discussions](https://github.com/pmd/pmd/discussions).
* I got this error and I'm sure it's a bug -- file an [issue](https://github.com/pmd/pmd/issues).
* I have an idea/request/question -- file an [issue](https://github.com/pmd/pmd/issues).
* I have an idea/request/question -- create a new [discussion](https://github.com/pmd/pmd/discussions).
* I have a quick question -- ask on our [Gitter chat](https://gitter.im/pmd/pmd).
* Where's your documentation? -- <https://pmd.github.io/latest/>

View File

@ -24,8 +24,7 @@ echo "-------------------------------------------"
echo "Releasing PMD"
echo "-------------------------------------------"
# see also https://gist.github.com/pdunnavant/4743895
CURRENT_VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:3.0.0:exec)
CURRENT_VERSION=$(./mvnw org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout)
RELEASE_VERSION=${CURRENT_VERSION%-SNAPSHOT}
MAJOR=$(echo $RELEASE_VERSION | cut -d . -f 1)
MINOR=$(echo $RELEASE_VERSION | cut -d . -f 2)
@ -128,7 +127,7 @@ bundle install
export RELEASE_NOTES_POST="_posts/$(date -u +%Y-%m-%d)-PMD-${RELEASE_VERSION}.md"
echo "Generating ../pmd.github.io/${RELEASE_NOTES_POST}..."
NEW_RELEASE_NOTES=$(bundle exec .travis/render_release_notes.rb docs/pages/release_notes.md | tail -n +6)
NEW_RELEASE_NOTES=$(bundle exec .ci/render_release_notes.rb docs/pages/release_notes.md | tail -n +6)
cat > ../pmd.github.io/${RELEASE_NOTES_POST} <<EOF
---
layout: post
@ -163,7 +162,7 @@ git commit -a -m "Prepare pmd release ${RELEASE_VERSION}"
echo
echo "Tag has been pushed.... now check travis build: <https://travis-ci.com/pmd/pmd>"
echo "Tag has been pushed.... now check github actions: <https://github.com/pmd/pmd/actions>"
echo
echo
echo "Press enter to continue..."
@ -228,7 +227,7 @@ echo
echo
echo "Verify the new release on github: <https://github.com/pmd/pmd/releases/tag/pmd_releases/${RELEASE_VERSION}>"
echo
echo "* Wait until the new version is synced to maven central and appears in as latest version in"
echo "* Wait until the new version is synced to maven central and appears as latest version in"
echo " <https://repo.maven.apache.org/maven2/net/sourceforge/pmd/pmd/maven-metadata.xml>."
echo "* Submit news to SF on <https://sourceforge.net/p/pmd/news/> page. Use same text as in the email below."
echo "* Send out an announcement mail to the mailing list:"

View File

@ -1,7 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (6.0.3.2)
activesupport (6.0.3.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
@ -17,37 +17,40 @@ GEM
commonmarker (0.17.13)
ruby-enum (~> 0.5)
concurrent-ruby (1.1.7)
dnsruby (1.61.4)
dnsruby (1.61.5)
simpleidn (~> 0.1)
em-websocket (0.5.1)
em-websocket (0.5.2)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
ethon (0.12.0)
ffi (>= 1.3.0)
eventmachine (1.2.7)
execjs (2.7.0)
faraday (1.0.1)
faraday (1.3.0)
faraday-net_http (~> 1.0)
multipart-post (>= 1.2, < 3)
ffi (1.13.1)
ruby2_keywords
faraday-net_http (1.0.0)
ffi (1.14.2)
forwardable-extended (2.6.0)
gemoji (3.0.1)
github-pages (207)
github-pages (209)
github-pages-health-check (= 1.16.1)
jekyll (= 3.9.0)
jekyll-avatar (= 0.7.0)
jekyll-coffeescript (= 1.1.1)
jekyll-commonmark-ghpages (= 0.1.6)
jekyll-default-layout (= 0.1.4)
jekyll-feed (= 0.13.0)
jekyll-feed (= 0.15.1)
jekyll-gist (= 1.5.0)
jekyll-github-metadata (= 2.13.0)
jekyll-mentions (= 1.5.1)
jekyll-mentions (= 1.6.0)
jekyll-optional-front-matter (= 0.3.2)
jekyll-paginate (= 1.1.0)
jekyll-readme-index (= 0.3.0)
jekyll-redirect-from (= 0.15.0)
jekyll-redirect-from (= 0.16.0)
jekyll-relative-links (= 0.6.1)
jekyll-remote-theme (= 0.4.1)
jekyll-remote-theme (= 0.4.2)
jekyll-sass-converter (= 1.5.2)
jekyll-seo-tag (= 2.6.1)
jekyll-sitemap (= 1.4.0)
@ -55,7 +58,7 @@ GEM
jekyll-theme-architect (= 0.1.1)
jekyll-theme-cayman (= 0.1.1)
jekyll-theme-dinky (= 0.1.1)
jekyll-theme-hacker (= 0.1.1)
jekyll-theme-hacker (= 0.1.2)
jekyll-theme-leap-day (= 0.1.1)
jekyll-theme-merlot (= 0.1.1)
jekyll-theme-midnight (= 0.1.1)
@ -66,14 +69,14 @@ GEM
jekyll-theme-tactile (= 0.1.1)
jekyll-theme-time-machine (= 0.1.1)
jekyll-titles-from-headings (= 0.5.3)
jemoji (= 0.11.1)
jemoji (= 0.12.0)
kramdown (= 2.3.0)
kramdown-parser-gfm (= 1.1.0)
liquid (= 4.0.3)
mercenary (~> 0.3)
minima (= 2.5.1)
nokogiri (>= 1.10.4, < 2.0)
rouge (= 3.19.0)
rouge (= 3.23.0)
terminal-table (~> 1.4)
github-pages-health-check (1.16.1)
addressable (~> 2.3)
@ -114,14 +117,14 @@ GEM
rouge (>= 2.0, < 4.0)
jekyll-default-layout (0.1.4)
jekyll (~> 3.0)
jekyll-feed (0.13.0)
jekyll-feed (0.15.1)
jekyll (>= 3.7, < 5.0)
jekyll-gist (1.5.0)
octokit (~> 4.2)
jekyll-github-metadata (2.13.0)
jekyll (>= 3.4, < 5.0)
octokit (~> 4.0, != 4.4.0)
jekyll-mentions (1.5.1)
jekyll-mentions (1.6.0)
html-pipeline (~> 2.3)
jekyll (>= 3.7, < 5.0)
jekyll-optional-front-matter (0.3.2)
@ -129,14 +132,15 @@ GEM
jekyll-paginate (1.1.0)
jekyll-readme-index (0.3.0)
jekyll (>= 3.0, < 5.0)
jekyll-redirect-from (0.15.0)
jekyll-redirect-from (0.16.0)
jekyll (>= 3.3, < 5.0)
jekyll-relative-links (0.6.1)
jekyll (>= 3.3, < 5.0)
jekyll-remote-theme (0.4.1)
jekyll-remote-theme (0.4.2)
addressable (~> 2.0)
jekyll (>= 3.5, < 5.0)
rubyzip (>= 1.3.0)
jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0)
rubyzip (>= 1.3.0, < 3.0)
jekyll-sass-converter (1.5.2)
sass (~> 3.4)
jekyll-seo-tag (2.6.1)
@ -153,8 +157,8 @@ GEM
jekyll-theme-dinky (0.1.1)
jekyll (~> 3.5)
jekyll-seo-tag (~> 2.0)
jekyll-theme-hacker (0.1.1)
jekyll (~> 3.5)
jekyll-theme-hacker (0.1.2)
jekyll (> 3.5, < 5.0)
jekyll-seo-tag (~> 2.0)
jekyll-theme-leap-day (0.1.1)
jekyll (~> 3.5)
@ -188,7 +192,7 @@ GEM
jekyll (>= 3.3, < 5.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
jemoji (0.11.1)
jemoji (0.12.0)
gemoji (~> 3.0)
html-pipeline (~> 2.2)
jekyll (>= 3.0, < 5.0)
@ -197,32 +201,35 @@ GEM
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.2.1)
listen (3.4.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.3.6)
mini_portile2 (2.4.0)
mini_portile2 (2.5.0)
minima (2.5.1)
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
minitest (5.14.1)
minitest (5.14.3)
multipart-post (2.1.1)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
octokit (4.18.0)
nokogiri (1.11.1)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
octokit (4.20.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (3.1.1)
racc (1.5.2)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.4)
rouge (3.19.0)
rouge (3.23.0)
ruby-enum (0.8.0)
i18n
ruby2_keywords (0.0.2)
rubyzip (2.3.0)
safe_yaml (1.0.5)
sass (3.7.4)
@ -240,13 +247,13 @@ GEM
thread_safe (0.3.6)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (1.2.7)
tzinfo (1.2.9)
thread_safe (~> 0.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.7)
unicode-display_width (1.7.0)
zeitwerk (2.4.0)
zeitwerk (2.4.2)
PLATFORMS
ruby

View File

@ -2,8 +2,8 @@ repository: pmd/pmd
pmd:
version: 7.0.0-SNAPSHOT
previous_version: 6.29.0
date: ??-?????-2020
previous_version: 6.33.0
date: ??-?????-2021
release_type: major
# release types: major, minor, bugfix

View File

@ -364,6 +364,9 @@ entries:
- title: Apex code metrics
url: /pmd_apex_metrics_index.html
output: web, pdf
- title: PLSQL
url: /pmd_languages_plsql.html
output: web, pdf
- title: Developer Documentation
output: web, pdf
folderitems:

View File

@ -98,6 +98,8 @@ The following previously deprecated rules have been finally removed:
* LoggerIsNotStaticFinal (java-errorprone)
* MIsLeadingVariableName (java-codestyle)
* ModifiedCyclomaticComplexity (java-design)
* PositionLiteralsFirstInCaseInsensitiveComparisons (java-bestpractices)
* PositionLiteralsFirstInComparisons (java-bestpractices)
* StdCyclomaticComplexity (java-design)
* SuspiciousConstantFieldName (java-codestyle)
* UnsynchronizedStaticDateFormatter (java-multithreading)
@ -105,17 +107,57 @@ The following previously deprecated rules have been finally removed:
* VariableNamingConventions (java-codestyle)
* WhileLoopsMustUseBraces (java-codestyle)
#### Changed rules
##### Java
* {% rule "java/errorprone/EmptyCatchBlock" %}: `CloneNotSupportedException` and `InterruptedException` are not special-cased anymore. Rename the exception parameter to `ignored` to ignore them.
### Fixed Issues
* java-bestpractices
* core
* [#1451](https://github.com/pmd/pmd/issues/1451): \[core] RulesetFactoryCompatibility stores the whole ruleset file in memory as a string
* java-bestpractices
* [#342](https://github.com/pmd/pmd/issues/342): \[java] AccessorMethodGeneration: Name clash with another public field not properly handled
* [#755](https://github.com/pmd/pmd/issues/755): \[java] AccessorClassGeneration false positive for private constructors
* [#770](https://github.com/pmd/pmd/issues/770): \[java] UnusedPrivateMethod yields false positive for counter-variant arguments
* [#807](https://github.com/pmd/pmd/issues/807): \[java] AccessorMethodGeneration false positive with overloads
* [#833](https://github.com/pmd/pmd/issues/833): \[java] ForLoopCanBeForeach should consider iterating on this
* [#1189](https://github.com/pmd/pmd/issues/1189): \[java] UnusedPrivateMethod false positive from inner class via external class
* [#1212](https://github.com/pmd/pmd/issues/1212): \[java] Don't raise JUnitTestContainsTooManyAsserts on JUnit 5's assertAll
* [#1422](https://github.com/pmd/pmd/issues/1422): \[java] JUnitTestsShouldIncludeAssert false positive with inherited @Rule field
* [#1565](https://github.com/pmd/pmd/issues/1565): \[java] JUnitAssertionsShouldIncludeMessage false positive with AssertJ
* [#1969](https://github.com/pmd/pmd/issues/1969): \[java] MissingOverride false-positive triggered by package-private method overwritten in another package by extending class
* [#1998](https://github.com/pmd/pmd/issues/1998): \[java] AccessorClassGeneration false-negative: subclass calls private constructor
* [#2130](https://github.com/pmd/pmd/issues/2130): \[java] UnusedLocalVariable: false-negative with array
* [#2147](https://github.com/pmd/pmd/issues/2147): \[java] JUnitTestsShouldIncludeAssert - false positives with lambdas and static methods
* [#2542](https://github.com/pmd/pmd/issues/2542): \[java] UseCollectionIsEmpty can not detect the case `foo.bar().size()`
* [#2796](https://github.com/pmd/pmd/issue/2796): \[java] UnusedAssignment false positive with call chains
* [#2797](https://github.com/pmd/pmd/issues/2797): \[java] MissingOverride long-standing issues
* [#2806](https://github.com/pmd/pmd/issues/2806): \[java] SwitchStmtsShouldHaveDefault false-positive with Java 14 switch non-fallthrough branches
* [#2883](https://github.com/pmd/pmd/issues/2883): \[java] JUnitAssertionsShouldIncludeMessage false positive with method call
* [#2890](https://github.com/pmd/pmd/issues/2890): \[java] UnusedPrivateMethod false positive with generics
* java-codestyle
* [#1673](https://github.com/pmd/pmd/issues/1673): \[java] UselessParentheses false positive with conditional operator
* [#1790](https://github.com/pmd/pmd/issues/1790): \[java] UnnecessaryFullyQualifiedName false positive with enum constant
* [#1918](https://github.com/pmd/pmd/issues/1918): \[java] UselessParentheses false positive with boolean operators
* [#2299](https://github.com/pmd/pmd/issues/2299): \[java] UnnecessaryFullyQualifiedName false positive with similar package name
* [#2528](https://github.com/pmd/pmd/issues/2528): \[java] MethodNamingConventions - JUnit 5 method naming not support ParameterizedTest
* [#2739](https://github.com/pmd/pmd/issues/2739): \[java] UselessParentheses false positive for string concatenation
* java-errorprone
* [#1005](https://github.com/pmd/pmd/issues/1005): \[java] CloneMethodMustImplementCloneable triggers for interfaces
* [#2532](https://github.com/pmd/pmd/issues/2532): \[java] AvoidDecimalLiteralsInBigDecimalConstructor can not detect the case new BigDecimal(Expression)
* [#2716](https://github.com/pmd/pmd/issues/2716): \[java] CompareObjectsWithEqualsRule: False positive with Enums
* [#2880](https://github.com/pmd/pmd/issues/2880): \[java] CompareObjectsWithEquals - false negative with type res
* java-multithreading
* [#2537](https://github.com/pmd/pmd/issues/2537): \[java] DontCallThreadRun can't detect the case that call run() in `this.run()`
* [#2538](https://github.com/pmd/pmd/issues/2538): \[java] DontCallThreadRun can't detect the case that call run() in `foo.bar.run()`
* [#2577](https://github.com/pmd/pmd/issues/2577): \[java] UseNotifyAllInsteadOfNotify falsely detect a special case with argument: `foo.notify(bar)`
* java-performance
* [#1224](https://github.com/pmd/pmd/issues/1224): \[java] InefficientEmptyStringCheck false negative in anonymous class
* [#2712](https://github.com/pmd/pmd/issues/2712): \[java] SimplifyStartsWith false-positive with AssertJ
### API Changes

View File

@ -246,6 +246,93 @@ the breaking API changes will be performed in 7.0.0.
an API is tagged as `@Deprecated` or not in the latest minor release. During the development of 7.0.0,
we may decide to remove some APIs that were not tagged as deprecated, though we'll try to avoid it." %}
#### 6.33.0
No changes.
#### 6.32.0
##### Experimental APIs
* The experimental class `ASTTypeTestPattern` has been renamed to {% jdoc java::lang.java.ast.ASTTypePattern %}
in order to align the naming to the JLS.
* The experimental class `ASTRecordConstructorDeclaration` has been renamed to {% jdoc java::lang.java.ast.ASTCompactConstructorDeclaration %}
in order to align the naming to the JLS.
* The AST types and APIs around Pattern Matching and Records are not experimental anymore:
* {% jdoc !!java::lang.java.ast.ASTVariableDeclaratorId#isPatternBinding() %}
* {% jdoc java::lang.java.ast.ASTPattern %}
* {% jdoc java::lang.java.ast.ASTTypePattern %}
* {% jdoc java::lang.java.ast.ASTRecordDeclaration %}
* {% jdoc java::lang.java.ast.ASTRecordComponentList %}
* {% jdoc java::lang.java.ast.ASTRecordComponent %}
* {% jdoc java::lang.java.ast.ASTRecordBody %}
* {% jdoc java::lang.java.ast.ASTCompactConstructorDeclaration %}
##### Internal API
Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0.
You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning.
* The protected or public member of the Java rule {% jdoc java::lang.java.rule.bestpractices.AvoidUsingHardCodedIPRule %}
are deprecated and considered to be internal API. They will be removed with PMD 7.
#### 6.31.0
##### Deprecated API
* {% jdoc xml::lang.xml.rule.AbstractDomXmlRule %}
* {% jdoc xml::lang.wsdl.rule.AbstractWsdlRule %}
* A few methods of {% jdoc xml::lang.xml.rule.AbstractXmlRule %}
##### Experimental APIs
* The method {% jdoc !!core::lang.ast.GenericToken#getKind() %} has been added as experimental. This
unifies the token interface for both JavaCC and Antlr. The already existing method
{% jdoc !!core::cpd.token.AntlrToken#getKind() %} is therefore experimental as well. The
returned constant depends on the actual language and might change whenever the grammar
of the language is changed.
#### 6.30.0
##### Deprecated API
###### Around RuleSet parsing
* {% jdoc core::RuleSetFactory %} and {% jdoc core::RulesetsFactoryUtils %} have been deprecated in favor of {% jdoc core::RuleSetLoader %}. This is easier to configure, and more maintainable than the multiple overloads of `RulesetsFactoryUtils`.
* Some static creation methods have been added to {% jdoc core::RuleSet %} for simple cases, eg {% jdoc core::RuleSet#forSingleRule(core::Rule) %}. These replace some counterparts in {% jdoc core::RuleSetFactory %}
* Since {% jdoc core::RuleSets %} is also deprecated, many APIs that require a RuleSets instance now are deprecated, and have a counterpart that expects a `List<RuleSet>`.
* {% jdoc core::RuleSetReferenceId %}, {% jdoc core::RuleSetReference %}, {% jdoc core::RuleSetFactoryCompatibility %} are deprecated. They are most likely not relevant outside of the implementation of pmd-core.
###### Around the `PMD` class
Many classes around PMD's entry point ({% jdoc core::PMD %}) have been deprecated as internal, including:
* The contents of the packages {% jdoc_package core::cli %}, {% jdoc_package core::processor %}
* {% jdoc core::SourceCodeProcessor %}
* The constructors of {% jdoc core::PMD %} (the class will be made a utility class)
###### Miscellaneous
* {% jdoc !!java::lang.java.ast.ASTPackageDeclaration#getPackageNameImage() %},
{% jdoc !!java::lang.java.ast.ASTTypeParameter#getParameterName() %}
and the corresponding XPath attributes. In both cases they're replaced with a new method `getName`,
the attribute is `@Name`.
* {% jdoc !!java::lang.java.ast.ASTClassOrInterfaceBody#isAnonymousInnerClass() %},
and {% jdoc !!java::lang.java.ast.ASTClassOrInterfaceBody#isEnumChild() %},
refs [#905](https://github.com/pmd/pmd/issues/905)
##### Internal API
Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0.
You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning.
* {% jdoc !!javascript::lang.ecmascript.Ecmascript3Handler %}
* {% jdoc !!javascript::lang.ecmascript.Ecmascript3Parser %}
* {% jdoc !!javascript::lang.ecmascript.ast.EcmascriptParser#parserOptions %}
* {% jdoc !!javascript::lang.ecmascript.ast.EcmascriptParser#getSuppressMap() %}
* {% jdoc !!core::lang.rule.ParametricRuleViolation %}
* {% jdoc !!core::lang.ParserOptions#suppressMarker %}
* {% jdoc !!modelica::lang.modelica.rule.ModelicaRuleViolationFactory %}
#### 6.29.0
No changes.
@ -1192,8 +1279,8 @@ large projects, with many duplications, it was causing `OutOfMemoryError`s (see
will be removed with PMD 7.0.0. The rule is replaced by the more general
{% rule "java/multithreading/UnsynchronizedStaticFormatter" %}.
* The two Java rules {% rule "java/bestpractices/PositionLiteralsFirstInComparisons" %}
and {% rule "java/bestpractices/PositionLiteralsFirstInCaseInsensitiveComparisons" %} (ruleset `java-bestpractices`)
* The two Java rules [`PositionLiteralsFirstInComparisons`](https://pmd.github.io/pmd-6.29.0/pmd_rules_java_bestpractices.html#positionliteralsfirstincomparisons)
and [`PositionLiteralsFirstInCaseInsensitiveComparisons`](https://pmd.github.io/pmd-6.29.0/pmd_rules_java_bestpractices.html#positionliteralsfirstincaseinsensitivecomparisons) (ruleset `java-bestpractices`)
have been deprecated in favor of the new rule {% rule "java/bestpractices/LiteralsFirstInComparisons" %}.
* The Java rule [`AvoidFinalLocalVariable`](https://pmd.github.io/pmd-6.16.0/pmd_rules_java_codestyle.html#avoidfinallocalvariable) (`java-codestyle`) has been deprecated

View File

@ -1,8 +1,8 @@
---
title: Getting Help
permalink: pmd_about_help.html
author: Andreas Dangel <andreas.dangel@adangel.org>
last_updated: September 2017
author: Andreas Dangel <andreas.dangel@pmd-code.org>
last_updated: January 2021
---
There are numerous ways of getting help:
@ -13,7 +13,7 @@ There are numerous ways of getting help:
* If you found a bug, please create a new [github issue](https://github.com/pmd/pmd/issues).
* You can also ask questions in our [sourceforge forum](https://sourceforge.net/p/pmd/discussion/).
* You can also ask questions on [github discussions](https://github.com/pmd/pmd/discussions).
* Or you can join the [Mailing List](https://lists.sourceforge.net/lists/listinfo/pmd-devel) or browse
through the archives ([archive1](http://java-pmd.30631.n5.nabble.com/), [archive2](http://web.archive.org/web/20160715035623/http://blog.gmane.org:80/gmane.comp.java.audit.pmd.devel)).

View File

@ -12,7 +12,7 @@ author: Tom Copeland, Xavier Le Vourch <xlv@users.sourceforge.net>
* JDK 11 or higher
{% include note.html content="While Java 11 is required for building, running PMD only requires Java 7 (or Java 8 for Apex and the Designer)." %}
{% include note.html content="While Java 11 is required for building, running PMD only requires Java 7 (or Java 8 for Apex, Scala, Visualforce, and the Designer)." %}
Youll need to either check out the source code or download the latest source release. Assuming youve got the latest source release, unzip it to a directory:

View File

@ -0,0 +1,49 @@
---
title: PLSQL
permalink: pmd_languages_plsql.html
last_updated: March 2021 (6.33.0)
---
## Parsing Exclusions
The grammar for PLSQL used in PMD has several bugs and might not parse all DDL scripts
without errors. However, it should be best practice to call PMD for _every_ DDL script.
Thus, we introduce the following workaround to cope with the situation.
We introduce two special comments `PMD-EXCLUDE-BEGIN` and `PMD-EXCLUDE-END`
which cause PMD to treat the source in between these comments more or less
like a multi-line comment, or in other words, just not try to parse them.
It is good practice to include a reason for excluding inside the
`-- PMD-EXCUDE-BEGIN` comment separated by a colon.
The `PMD-EXCLUDE-BEGIN` and `PMD-EXLUDE-END` comment lines must not contain
other statements, e.g. `do_xy(); -- PMD-EXCLUDE-BEGIN` is invalid.
Example:
```
begin
do_something();
-- PMD-EXCLUDE-BEGIN: PMD does not like dbms_lob.trim (clash with TrimExpression)
dbms_lob.trim(the_blob, 1000);
-- PMD-EXCLUDE-END
do_something_else();
end;
```
The existence of exclusions can be detected with the attributes
`ExcludedRangesCount` and `ExcludedLinesCount` of the top-level ASTInput node.
If nothing is excluded, both values are 0 (zero).
Otherwise, `ExcludedRangesCount` contains the number of excluded line-ranges
and `ExcludedLinesCount` is the total number of excluded lines.
A future version of PMD might pass the line excluded line ranges,
source fragments and the corresponding reason comments
as child nodes of the top-level ASTInput node.
In order to keep track where such parse exclusions are used, you could create
a custom XPath rule with the following expression:
/Input[@ExcludedRangesCount > 0]
This will find all files with at least one excluded range.

View File

@ -26,6 +26,8 @@ author: Tom Copeland <tom@infoether.org>
### PMD in general and other Language Modules
* February 2021 - Artem Krosheninnikov's talk about Quality Assurance Automation: [Artem Krosheninnikov, Wrike - How static analysis can help in QAA processes](https://www.youtube.com/watch?v=L42zH5ne074)
* May 2019 - [Code quality assurance with PMD An extensible static code analyser for Java and other languages](https://www.datarespons.com/code-quality-assurance-with-pmd/)
* February 2012 - Romain Pelisse's lightning talk at FOSDEM 2012 about "PMD5: What can it do for you?".

Some files were not shown because too many files have changed in this diff Show More