forked from phoedos/pmd
Merge branch 'master' into issue-4794-java-22
This commit is contained in:
commit
93bf4d59cd
@ -7242,8 +7242,8 @@
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
"login": "eant60",
|
||||
"name": "eant60",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/41472980?v=4",
|
||||
@ -7351,6 +7351,34 @@
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "lbovet",
|
||||
"name": "Laurent Bovet",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/692124?v=4",
|
||||
"profile": "https://github.com/lbovet",
|
||||
"contributions": [
|
||||
"bug",
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "enexusde",
|
||||
"name": "Peter Rader",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/6880636?v=4",
|
||||
"profile": "http://www.e-nexus.de./",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "liqingjun123",
|
||||
"name": "liqingjun123",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/12873992?v=4",
|
||||
"profile": "https://github.com/liqingjun123",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
38
.ci/build.sh
38
.ci/build.sh
@ -136,13 +136,9 @@ function build() {
|
||||
pmd_ci_openjdk_setdefault 17
|
||||
# Note: Sonar also needs GITHUB_TOKEN (!)
|
||||
./mvnw \
|
||||
-Dmaven.javadoc.skip=true \
|
||||
-Dmaven.source.skip \
|
||||
-Dcheckstyle.skip \
|
||||
-Dpmd.skip \
|
||||
--show-version --errors --batch-mode \
|
||||
clean package \
|
||||
sonar:sonar -Dsonar.login="${SONAR_TOKEN}" -Psonar
|
||||
sonar:sonar -Dsonar.login="${SONAR_TOKEN}" -Psonar,fastSkip
|
||||
pmd_ci_log_success "New sonar results: https://sonarcloud.io/dashboard?id=net.sourceforge.pmd%3Apmd"
|
||||
pmd_ci_log_group_end
|
||||
|
||||
@ -151,15 +147,22 @@ function build() {
|
||||
export CI_NAME="github actions"
|
||||
export CI_BUILD_URL="${PMD_CI_JOB_URL}"
|
||||
export CI_BRANCH="${PMD_CI_BRANCH}"
|
||||
# first create jacoco report
|
||||
./mvnw \
|
||||
-Dmaven.javadoc.skip=true \
|
||||
-Dmaven.source.skip \
|
||||
-Dcheckstyle.skip \
|
||||
-Dpmd.skip \
|
||||
-DrepoToken="${COVERALLS_REPO_TOKEN}" \
|
||||
--show-version --errors --batch-mode \
|
||||
clean package jacoco:report \
|
||||
coveralls:report -Pcoveralls
|
||||
clean package \
|
||||
jacoco:report -Pcoveralls,fastSkip
|
||||
|
||||
# workaround, maybe https://github.com/jacoco/jacoco/issues/654
|
||||
sed -i 's$Comparisons.kt$ApexTreeBuilder.kt$g' pmd-apex/target/site/jacoco/jacoco.xml
|
||||
|
||||
# then create and send coveralls report
|
||||
# note: generate-sources is needed, so that antlr4 generated directories are on the compileSourceRoots
|
||||
./mvnw \
|
||||
--show-version --errors --batch-mode \
|
||||
generate-sources \
|
||||
coveralls:report -DrepoToken="${COVERALLS_REPO_TOKEN}" -Pcoveralls,fastSkip
|
||||
|
||||
pmd_ci_log_success "New coveralls result: https://coveralls.io/github/pmd/pmd"
|
||||
pmd_ci_log_group_end
|
||||
fi
|
||||
@ -167,11 +170,12 @@ function build() {
|
||||
|
||||
|
||||
#
|
||||
# Installs bundler, which is needed for doc generation and regression tester
|
||||
# Bundler should be already installed - it should be included in the ruby distribution.
|
||||
# Bundler is needed for doc generation and regression tester
|
||||
#
|
||||
function pmd_ci_build_setup_bundler() {
|
||||
pmd_ci_log_info "Installing bundler..."
|
||||
gem install bundler -v 2.4.22
|
||||
pmd_ci_log_info "Checking bundler version..."
|
||||
bundle --version
|
||||
}
|
||||
|
||||
#
|
||||
@ -210,8 +214,6 @@ function pmd_ci_deploy_build_artifacts() {
|
||||
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-bin.zip"
|
||||
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-src.zip"
|
||||
# Deploy SBOM
|
||||
cp pmd-dist/target/bom.xml "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.xml"
|
||||
cp pmd-dist/target/bom.json "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.json"
|
||||
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.xml"
|
||||
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.json"
|
||||
fi
|
||||
@ -229,8 +231,6 @@ function pmd_ci_deploy_build_artifacts() {
|
||||
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-bin.zip"
|
||||
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-src.zip"
|
||||
# Deploy SBOM
|
||||
cp pmd-dist/target/bom.xml "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.xml"
|
||||
cp pmd-dist/target/bom.json "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.json"
|
||||
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.xml"
|
||||
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.json"
|
||||
|
||||
|
@ -19,8 +19,9 @@ function regression_tester_setup_ci() {
|
||||
source .ci/files/public-env >/dev/null 2>&1
|
||||
rm .ci/files/public-env
|
||||
|
||||
if hash "bundler" 2>/dev/null; then
|
||||
if hash "bundle" 2>/dev/null; then
|
||||
pmd_ci_log_debug "Bundler is already installed"
|
||||
bundle --version
|
||||
else
|
||||
pmd_ci_log_info "Installing bundler..."
|
||||
gem install bundler
|
||||
|
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -52,10 +52,10 @@ jobs:
|
||||
key: v3-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
v3-${{ runner.os }}-
|
||||
- name: Set up Ruby 2.7
|
||||
- name: Set up Ruby 3.3
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.7
|
||||
ruby-version: 3.3
|
||||
- name: Setup Environment
|
||||
shell: bash
|
||||
run: |
|
||||
|
4
.github/workflows/troubleshooting.yml
vendored
4
.github/workflows/troubleshooting.yml
vendored
@ -27,10 +27,10 @@ jobs:
|
||||
key: v3-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
v3-${{ runner.os }}-
|
||||
- name: Set up Ruby 2.7
|
||||
- name: Set up Ruby 3.3
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.7
|
||||
ruby-version: 3.3
|
||||
- name: Setup Environment
|
||||
shell: bash
|
||||
run: |
|
||||
|
@ -6,7 +6,7 @@ require 'etc'
|
||||
|
||||
@logger = Logger.new(STDOUT)
|
||||
|
||||
def get_args(base_branch, autogen = TRUE, patch_config = './pmd/.ci/files/all-regression-rules.xml')
|
||||
def get_args(base_branch, autogen = true, patch_config = './pmd/.ci/files/all-regression-rules.xml')
|
||||
['--local-git-repo', './pmd',
|
||||
'--list-of-project', './pmd/.ci/files/project-list.xml',
|
||||
'--base-branch', base_branch,
|
||||
|
28
Gemfile.lock
28
Gemfile.lock
@ -10,10 +10,10 @@ GEM
|
||||
nap
|
||||
open4 (~> 1.3)
|
||||
colored2 (3.1.2)
|
||||
concurrent-ruby (1.2.2)
|
||||
concurrent-ruby (1.2.3)
|
||||
cork (0.3.0)
|
||||
colored2 (~> 3.1)
|
||||
danger (9.4.2)
|
||||
danger (9.4.3)
|
||||
claide (~> 1.0)
|
||||
claide-plugins (>= 0.9.2)
|
||||
colored2 (~> 3.1)
|
||||
@ -29,17 +29,16 @@ GEM
|
||||
differ (0.1.2)
|
||||
et-orbi (1.2.7)
|
||||
tzinfo
|
||||
faraday (2.7.12)
|
||||
base64
|
||||
faraday-net_http (>= 2.0, < 3.1)
|
||||
ruby2_keywords (>= 0.0.4)
|
||||
faraday-http-cache (2.5.0)
|
||||
faraday (2.9.0)
|
||||
faraday-net_http (>= 2.0, < 3.2)
|
||||
faraday-http-cache (2.5.1)
|
||||
faraday (>= 0.8)
|
||||
faraday-net_http (3.0.2)
|
||||
faraday-net_http (3.1.0)
|
||||
net-http
|
||||
fugit (1.9.0)
|
||||
et-orbi (~> 1, >= 1.2.7)
|
||||
raabro (~> 1.4)
|
||||
git (1.18.0)
|
||||
git (1.19.1)
|
||||
addressable (~> 2.8)
|
||||
rchardet (~> 1.8)
|
||||
kramdown (2.4.0)
|
||||
@ -50,11 +49,14 @@ GEM
|
||||
logger-colors (1.0.0)
|
||||
mini_portile2 (2.8.5)
|
||||
nap (1.1.0)
|
||||
net-http (0.4.1)
|
||||
uri
|
||||
no_proxy_fix (0.1.2)
|
||||
nokogiri (1.15.5)
|
||||
nokogiri (1.16.2)
|
||||
mini_portile2 (~> 2.8.2)
|
||||
racc (~> 1.4)
|
||||
octokit (8.0.0)
|
||||
octokit (8.1.0)
|
||||
base64
|
||||
faraday (>= 1, < 3)
|
||||
sawyer (~> 0.9)
|
||||
open4 (1.3.4)
|
||||
@ -71,7 +73,6 @@ GEM
|
||||
rchardet (1.8.0)
|
||||
rexml (3.2.6)
|
||||
rouge (4.2.0)
|
||||
ruby2_keywords (0.0.5)
|
||||
rufus-scheduler (3.9.1)
|
||||
fugit (~> 1.1, >= 1.1.6)
|
||||
safe_yaml (1.0.5)
|
||||
@ -84,6 +85,7 @@ GEM
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
unicode-display_width (2.5.0)
|
||||
uri (0.13.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
@ -96,4 +98,4 @@ DEPENDENCIES
|
||||
safe_yaml
|
||||
|
||||
BUNDLED WITH
|
||||
2.4.22
|
||||
2.5.3
|
||||
|
@ -17,6 +17,30 @@ if [ ! -f pom.xml ] || [ ! -d ../pmd.github.io ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Make sure, we have ruby and bundler available
|
||||
#
|
||||
set +e # don't stop for error "command not found" - it is handled
|
||||
ruby_version_full=$(ruby --version 2>&1)
|
||||
ruby_version=$(echo "${ruby_version_full}" | grep "ruby 3" | head -1 2>&1)
|
||||
if [ $? -eq 0 ] && [ -n "${ruby_version}" ]; then
|
||||
echo "Using ${ruby_version_full}"
|
||||
else
|
||||
echo "Wrong ruby version! Expected ruby 3"
|
||||
echo "${ruby_version_full}"
|
||||
exit 1
|
||||
fi
|
||||
bundler_version=$(bundler --version 2>&1)
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Using ${bundler_version}"
|
||||
else
|
||||
echo "Missing bundler!"
|
||||
echo "${bundler_version}"
|
||||
exit 1
|
||||
fi
|
||||
# abort the script on the first failing sub command
|
||||
set -e
|
||||
|
||||
CURRENT_BRANCH=
|
||||
|
||||
echo "-------------------------------------------"
|
||||
@ -257,7 +281,7 @@ echo "Then proceed with releasing pmd-designer..."
|
||||
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-ui/maven-metadata.xml>."
|
||||
echo "<https://repo.maven.apache.org/maven2/net/sourceforge/pmd/pmd-designer/maven-metadata.xml>."
|
||||
echo
|
||||
echo "Note: If there is no new pmd-designer release needed, you can directly proceed."
|
||||
read -r
|
||||
|
@ -1,7 +1,7 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activesupport (7.1.2)
|
||||
activesupport (7.1.3)
|
||||
base64
|
||||
bigdecimal
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
@ -14,14 +14,14 @@ GEM
|
||||
addressable (2.8.6)
|
||||
public_suffix (>= 2.0.2, < 6.0)
|
||||
base64 (0.2.0)
|
||||
bigdecimal (3.1.5)
|
||||
bigdecimal (3.1.6)
|
||||
coffee-script (2.4.1)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.11.1)
|
||||
coffee-script-source (1.12.2)
|
||||
colorator (1.1.0)
|
||||
commonmarker (0.23.10)
|
||||
concurrent-ruby (1.2.2)
|
||||
concurrent-ruby (1.2.3)
|
||||
connection_pool (2.4.1)
|
||||
dnsruby (1.70.0)
|
||||
simpleidn (~> 0.2.1)
|
||||
@ -34,24 +34,23 @@ GEM
|
||||
ffi (>= 1.15.0)
|
||||
eventmachine (1.2.7)
|
||||
execjs (2.9.1)
|
||||
faraday (2.7.12)
|
||||
base64
|
||||
faraday-net_http (>= 2.0, < 3.1)
|
||||
ruby2_keywords (>= 0.0.4)
|
||||
faraday-net_http (3.0.2)
|
||||
faraday (2.9.0)
|
||||
faraday-net_http (>= 2.0, < 3.2)
|
||||
faraday-net_http (3.1.0)
|
||||
net-http
|
||||
ffi (1.16.3)
|
||||
forwardable-extended (2.6.0)
|
||||
gemoji (3.0.1)
|
||||
github-pages (228)
|
||||
github-pages-health-check (= 1.17.9)
|
||||
jekyll (= 3.9.3)
|
||||
jekyll-avatar (= 0.7.0)
|
||||
jekyll-coffeescript (= 1.1.1)
|
||||
gemoji (4.1.0)
|
||||
github-pages (231)
|
||||
github-pages-health-check (= 1.18.2)
|
||||
jekyll (= 3.9.5)
|
||||
jekyll-avatar (= 0.8.0)
|
||||
jekyll-coffeescript (= 1.2.2)
|
||||
jekyll-commonmark-ghpages (= 0.4.0)
|
||||
jekyll-default-layout (= 0.1.4)
|
||||
jekyll-feed (= 0.15.1)
|
||||
jekyll-default-layout (= 0.1.5)
|
||||
jekyll-feed (= 0.17.0)
|
||||
jekyll-gist (= 1.5.0)
|
||||
jekyll-github-metadata (= 2.13.0)
|
||||
jekyll-github-metadata (= 2.16.1)
|
||||
jekyll-include-cache (= 0.2.1)
|
||||
jekyll-mentions (= 1.6.0)
|
||||
jekyll-optional-front-matter (= 0.3.2)
|
||||
@ -78,20 +77,20 @@ GEM
|
||||
jekyll-theme-tactile (= 0.2.0)
|
||||
jekyll-theme-time-machine (= 0.2.0)
|
||||
jekyll-titles-from-headings (= 0.5.3)
|
||||
jemoji (= 0.12.0)
|
||||
kramdown (= 2.3.2)
|
||||
jemoji (= 0.13.0)
|
||||
kramdown (= 2.4.0)
|
||||
kramdown-parser-gfm (= 1.1.0)
|
||||
liquid (= 4.0.4)
|
||||
mercenary (~> 0.3)
|
||||
minima (= 2.5.1)
|
||||
nokogiri (>= 1.13.6, < 2.0)
|
||||
rouge (= 3.26.0)
|
||||
rouge (= 3.30.0)
|
||||
terminal-table (~> 1.4)
|
||||
github-pages-health-check (1.17.9)
|
||||
github-pages-health-check (1.18.2)
|
||||
addressable (~> 2.3)
|
||||
dnsruby (~> 1.60)
|
||||
octokit (~> 4.0)
|
||||
public_suffix (>= 3.0, < 5.0)
|
||||
octokit (>= 4, < 8)
|
||||
public_suffix (>= 3.0, < 6.0)
|
||||
typhoeus (~> 1.3)
|
||||
html-pipeline (2.14.3)
|
||||
activesupport (>= 2)
|
||||
@ -99,7 +98,7 @@ GEM
|
||||
http_parser.rb (0.8.0)
|
||||
i18n (1.14.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jekyll (3.9.3)
|
||||
jekyll (3.9.5)
|
||||
addressable (~> 2.4)
|
||||
colorator (~> 1.0)
|
||||
em-websocket (~> 0.5)
|
||||
@ -112,11 +111,11 @@ GEM
|
||||
pathutil (~> 0.9)
|
||||
rouge (>= 1.7, < 4)
|
||||
safe_yaml (~> 1.0)
|
||||
jekyll-avatar (0.7.0)
|
||||
jekyll-avatar (0.8.0)
|
||||
jekyll (>= 3.0, < 5.0)
|
||||
jekyll-coffeescript (1.1.1)
|
||||
jekyll-coffeescript (1.2.2)
|
||||
coffee-script (~> 2.2)
|
||||
coffee-script-source (~> 1.11.1)
|
||||
coffee-script-source (~> 1.12)
|
||||
jekyll-commonmark (1.4.0)
|
||||
commonmarker (~> 0.22)
|
||||
jekyll-commonmark-ghpages (0.4.0)
|
||||
@ -124,15 +123,15 @@ GEM
|
||||
jekyll (~> 3.9.0)
|
||||
jekyll-commonmark (~> 1.4.0)
|
||||
rouge (>= 2.0, < 5.0)
|
||||
jekyll-default-layout (0.1.4)
|
||||
jekyll (~> 3.0)
|
||||
jekyll-feed (0.15.1)
|
||||
jekyll-default-layout (0.1.5)
|
||||
jekyll (>= 3.0, < 5.0)
|
||||
jekyll-feed (0.17.0)
|
||||
jekyll (>= 3.7, < 5.0)
|
||||
jekyll-gist (1.5.0)
|
||||
octokit (~> 4.2)
|
||||
jekyll-github-metadata (2.13.0)
|
||||
jekyll-github-metadata (2.16.1)
|
||||
jekyll (>= 3.4, < 5.0)
|
||||
octokit (~> 4.0, != 4.4.0)
|
||||
octokit (>= 4, < 7, != 4.4.0)
|
||||
jekyll-include-cache (0.2.1)
|
||||
jekyll (>= 3.7, < 5.0)
|
||||
jekyll-mentions (1.6.0)
|
||||
@ -203,11 +202,11 @@ GEM
|
||||
jekyll (>= 3.3, < 5.0)
|
||||
jekyll-watch (2.2.1)
|
||||
listen (~> 3.0)
|
||||
jemoji (0.12.0)
|
||||
gemoji (~> 3.0)
|
||||
jemoji (0.13.0)
|
||||
gemoji (>= 3, < 5)
|
||||
html-pipeline (~> 2.2)
|
||||
jekyll (>= 3.0, < 5.0)
|
||||
kramdown (2.3.2)
|
||||
kramdown (2.4.0)
|
||||
rexml
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
@ -221,9 +220,11 @@ GEM
|
||||
jekyll (>= 3.5, < 5.0)
|
||||
jekyll-feed (~> 0.9)
|
||||
jekyll-seo-tag (~> 2.1)
|
||||
minitest (5.20.0)
|
||||
minitest (5.22.2)
|
||||
mutex_m (0.2.0)
|
||||
nokogiri (1.15.5)
|
||||
net-http (0.4.1)
|
||||
uri
|
||||
nokogiri (1.16.2)
|
||||
mini_portile2 (~> 2.8.2)
|
||||
racc (~> 1.4)
|
||||
octokit (4.25.1)
|
||||
@ -231,13 +232,13 @@ GEM
|
||||
sawyer (~> 0.9)
|
||||
pathutil (0.16.2)
|
||||
forwardable-extended (~> 2.6)
|
||||
public_suffix (4.0.7)
|
||||
public_suffix (5.0.4)
|
||||
racc (1.7.3)
|
||||
rb-fsevent (0.11.2)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
rexml (3.2.6)
|
||||
rouge (3.26.0)
|
||||
rouge (3.30.0)
|
||||
ruby2_keywords (0.0.5)
|
||||
rubyzip (2.3.2)
|
||||
safe_yaml (1.0.5)
|
||||
@ -261,6 +262,7 @@ GEM
|
||||
unf_ext
|
||||
unf_ext (0.0.9.1)
|
||||
unicode-display_width (1.8.0)
|
||||
uri (0.13.0)
|
||||
webrick (1.8.1)
|
||||
|
||||
PLATFORMS
|
||||
@ -272,4 +274,4 @@ DEPENDENCIES
|
||||
webrick
|
||||
|
||||
BUNDLED WITH
|
||||
2.4.22
|
||||
2.5.3
|
||||
|
@ -252,7 +252,7 @@ This can be achieved with Rule Designer:
|
||||
* Fork and clone the [pmd/pmd-designer](https://github.com/pmd/pmd-designer) repository.
|
||||
* Add a syntax highlighter implementation to `net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting` (you could use Java as an example).
|
||||
* Register it in the `AvailableSyntaxHighlighters` enumeration.
|
||||
* Now build your implementation and place the `target/pmd-ui-<version>-SNAPSHOT.jar` to the `lib` directory inside your `pmd-bin-...` distribution (you have to delete old `pmd-ui-*.jar` from there).
|
||||
* Now build your implementation and place the `target/pmd-designer-<version>-SNAPSHOT.jar` to the `lib` directory inside your `pmd-bin-...` distribution (you have to delete old `pmd-designer-*.jar` from there).
|
||||
|
||||
## Optional features
|
||||
|
||||
|
@ -33,8 +33,10 @@ See [Apex language properties](pmd_languages_configuration.html#apex-language-pr
|
||||
|
||||
## Parser
|
||||
|
||||
We use Jorje, the Apex parsers that is shipped within the Apex Language Server. This is part of
|
||||
the [Salesforce Extensions for VS Code](https://github.com/forcedotcom/salesforcedx-vscode).
|
||||
Since PMD 7.0.0 we use the open source [apex-parser](https://github.com/apex-dev-tools/apex-parser),
|
||||
together with [Summit AST](https://github.com/google/summit-ast) which translates the ANTLR parse tree
|
||||
into an AST.
|
||||
|
||||
We take the binary from <https://github.com/forcedotcom/salesforcedx-vscode/tree/develop/packages/salesforcedx-vscode-apex/out>
|
||||
and provide it as a maven dependency (see [pmd-apex-jorje](https://github.com/pmd/pmd/tree/master/pmd-apex-jorje)).
|
||||
When PMD added Apex support with version 5.5.0, it utilized the Apex Jorje library to parse Apex source
|
||||
and generate an AST. This library is however a binary-blob provided as part of the
|
||||
[Salesforce Extensions for VS Code](https://github.com/forcedotcom/salesforcedx-vscode), and it is closed-source.
|
||||
|
@ -1,15 +1,13 @@
|
||||
---
|
||||
title: HTML support
|
||||
permalink: pmd_languages_html.html
|
||||
last_updated: September 2023 (7.0.0)
|
||||
tags: [languages, PmdCapableLanguage, CpdCapableLanguage, experimental]
|
||||
last_updated: February 2024 (7.0.0)
|
||||
tags: [languages, PmdCapableLanguage, CpdCapableLanguage]
|
||||
summary: "HTML-specific features and guidance"
|
||||
---
|
||||
|
||||
{% include language_info.html name='HTML' id='html' implementation='html::lang.html.HtmlLanguageModule' supports_pmd=true supports_cpd=true since='6.45.0' %}
|
||||
|
||||
{% include warning.html content="This language module is experimental and may change any time." %}
|
||||
|
||||
The HTML language module uses [jsoup](https://jsoup.org/) for parsing.
|
||||
|
||||
XPath rules are supported, but the DOM is not always a typical XML/XPath DOM.
|
||||
|
@ -1,17 +1,13 @@
|
||||
---
|
||||
title: Kotlin Support
|
||||
permalink: pmd_languages_kotlin.html
|
||||
last_updated: September 2023 (7.0.0)
|
||||
tags: [languages, PmdCapableLanguage, CpdCapableLanguage, experimental]
|
||||
last_updated: February 2024 (7.0.0)
|
||||
tags: [languages, PmdCapableLanguage, CpdCapableLanguage]
|
||||
summary: "Kotlin-specific features and guidance"
|
||||
---
|
||||
|
||||
[Kotlin](https://kotlinlang.org/) support in PMD is based on the official grammar from <https://github.com/Kotlin/kotlin-spec>.
|
||||
|
||||
{% include language_info.html name='Kotlin' id='kotlin' implementation='kotlin::lang.kotlin.JspLanguageModule' supports_pmd=true supports_cpd=true %}
|
||||
{% include language_info.html name='Kotlin' id='kotlin' implementation='kotlin::lang.kotlin.JspLanguageModule' supports_pmd=true supports_cpd=true since=7.0.0 %}
|
||||
|
||||
Java-based rules and XPath-based rules are supported.
|
||||
|
||||
{% include note.html content="Kotlin support has **experimental** stability level, meaning no compatibility should
|
||||
be expected between even incremental releases. Any functionality can be added, removed or changed without
|
||||
warning." %}
|
||||
|
@ -1,8 +1,8 @@
|
||||
---
|
||||
title: Visualforce Support
|
||||
permalink: pmd_languages_visualforce.html
|
||||
last_updated: September 2023
|
||||
tags: [languages, PmdCapableLanguage, CpdCapableLanguage, experimental]
|
||||
last_updated: February 2024 (7.0.0)
|
||||
tags: [languages, PmdCapableLanguage, CpdCapableLanguage]
|
||||
author: Andreas Dangel
|
||||
summary: "Visualforce-specific features and guidance"
|
||||
---
|
||||
@ -40,9 +40,6 @@ These env vars have changed from PMD 6 to PMD 7:
|
||||
* `PMD_VF_OBJECTSDIRECTORIES` ➡️ `PMD_VF_OBJECTS_DIRECTORIES`
|
||||
"%}
|
||||
|
||||
This feature is experimental, in particular, expect changes to the way the configuration is specified.
|
||||
We'll probably extend the CLI instead of relying on environment variables in a future version.
|
||||
|
||||
### Sample usage
|
||||
|
||||
```
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -63,7 +63,7 @@ However, this also adds additional tasks, and it takes time to write down and do
|
||||
|
||||
## Change History
|
||||
|
||||
2022-09-30: Status changed to "Accepted".
|
||||
2022-09-30: Status changed to "Accepted". ([#4072](https://github.com/pmd/pmd/pull/4072))
|
||||
|
||||
2022-09-06: Added section "Change History" to the template. Added "Last updated" to "Status" section.
|
||||
|
||||
|
@ -66,6 +66,6 @@ Maintaining a polyglot code base with multiple languages is likely to be more ch
|
||||
|
||||
## Change History
|
||||
|
||||
2022-09-30: Changed status to "Accepted".
|
||||
2022-09-30: Changed status to "Accepted". ([#4072](https://github.com/pmd/pmd/pull/4072))
|
||||
|
||||
2022-07-28: Proposed initial version.
|
||||
|
@ -5,8 +5,8 @@ permalink: pmd_projectdocs_decisions_adr_3.html
|
||||
sidebaractiveurl: /pmd_projectdocs_decisions.html
|
||||
adr: true
|
||||
# Proposed / Accepted / Deprecated / Superseded
|
||||
adr_status: "Proposed"
|
||||
last_updated: December 2023
|
||||
adr_status: "Accepted"
|
||||
last_updated: February 2024
|
||||
---
|
||||
|
||||
<!-- https://github.com/joelparkerhenderson/architecture-decision-record/blob/main/templates/decision-record-template-by-michael-nygard/index.md -->
|
||||
@ -184,4 +184,6 @@ Non-concrete AST classes (like base classes or common interfaces) should follow
|
||||
|
||||
## Change History
|
||||
|
||||
2024-02-01: Changed status to "Accepted". ([#4756](https://github.com/pmd/pmd/pull/4756))
|
||||
|
||||
2023-12-01: Proposed initial version.
|
||||
|
@ -4,7 +4,7 @@ short_title: Configuring rules
|
||||
keywords: [property, properties, message, priority]
|
||||
tags: [userdocs, getting_started]
|
||||
summary: "Learn how to configure your rules directly from the ruleset XML."
|
||||
last_updated: May 2023 (7.0.0)
|
||||
last_updated: February 2024 (7.0.0)
|
||||
permalink: pmd_userdocs_configuring_rules.html
|
||||
author: Hooper Bloob <hooperbloob@users.sourceforge.net>, Romain Pelisse <rpelisse@users.sourceforge.net>, Clément Fournier <clement.fournier76@gmail.com>
|
||||
---
|
||||
@ -43,7 +43,10 @@ will cause the rule to be ignored.
|
||||
|
||||
## Rule properties
|
||||
|
||||
Properties make it easy to customise the behaviour of a rule directly from the xml. They come in several types, which correspond to the type of their values. For example, NPathComplexity declares a property "reportLevel", with an integer value type, and which corresponds to the threshold above which a method will be reported. If you believe that its default value of 200 is too high, you could lower it to e.g. 150 in the following way:
|
||||
Properties make it easy to customise the behaviour of a rule directly from the xml. They come in several types,
|
||||
which correspond to the type of their values. For example, NPathComplexity declares a property "reportLevel",
|
||||
with an integer value type, and which corresponds to the threshold above which a method will be reported.
|
||||
If you believe that its default value of 200 is too high, you could lower it to e.g. 150 in the following way:
|
||||
|
||||
```xml
|
||||
<rule ref="category/java/design.xml/NPathComplexity">
|
||||
@ -55,7 +58,9 @@ Properties make it easy to customise the behaviour of a rule directly from the x
|
||||
</rule>
|
||||
```
|
||||
|
||||
Properties are assigned a value with a `property` element, which should mention the name of a property as an attribute. The value of the property can be specified either in the content of the element, like above, or in the `value` attribute, e.g.
|
||||
Properties are assigned a value with a `property` element, which should mention the name of a property as an
|
||||
attribute. The value of the property can be specified either in the content of the element, like above, or
|
||||
in the `value` attribute, e.g.
|
||||
|
||||
```xml
|
||||
<property name="reportLevel" value="150"/>
|
||||
@ -63,12 +68,17 @@ Properties are assigned a value with a `property` element, which should mention
|
||||
|
||||
All property assignments must be enclosed in a `properties` element, which is itself inside a `rule` element.
|
||||
|
||||
{%include tip.html content="The properties of a rule are documented with the rule, e.g. [here](pmd_rules_java_design.html#npathcomplexity) for NPathComplexity. Note that **assigning a value to a property that does not exist throws an error!**" %}
|
||||
{% capture tip_content %}
|
||||
The properties of a rule are documented with the rule, e.g. [here](pmd_rules_java_design.html#npathcomplexity)
|
||||
for NPathComplexity. Note that **assigning a value to a property that does not exist throws an error!**
|
||||
{% endcapture %}
|
||||
{%include tip.html content=tip_content %}
|
||||
|
||||
Some properties take multiple values (a list), in which case you can provide them all by delimiting them with a delimiter character. It is usually a pipe ('\|'), or a comma (',') for numeric properties, e.g.
|
||||
Some properties take multiple values (a list), in which case you can provide them all by delimiting them with
|
||||
a comma (','), e.g.
|
||||
```xml
|
||||
<property name="legalCollectionTypes"
|
||||
value="java.util.ArrayList|java.util.Vector|java.util.HashMap"/>
|
||||
value="java.util.ArrayList,java.util.Vector,java.util.HashMap"/>
|
||||
```
|
||||
|
||||
These properties are referred to as **multivalued properties** in this documentation.
|
||||
|
@ -3,7 +3,7 @@ title: The rule designer
|
||||
short_title: Rule designer
|
||||
tags: [extending, userdocs]
|
||||
summary: "Learn about the usage and features of the rule designer."
|
||||
last_updated: December 2023 (7.0.0)
|
||||
last_updated: February 2024 (7.0.0)
|
||||
permalink: pmd_userdocs_extending_designer_reference.html
|
||||
author: Clément Fournier <clement.fournier76@gmail.com>
|
||||
---
|
||||
@ -25,7 +25,7 @@ If the bin directory of your PMD distribution is on your shell's path, then you
|
||||
windows="pmd.bat designer" %}
|
||||
|
||||
|
||||
{% include note.html content="pmd-ui.jar is not a runnable jar, because it doesn't include any PMD language module, or PMD Core. " %}
|
||||
{% include note.html content="pmd-designer.jar is not a runnable jar, because it doesn't include any PMD language module, or PMD Core. " %}
|
||||
|
||||
|
||||
This is to allow easy updating, and let you choose the dependencies you're interested in.
|
||||
@ -36,7 +36,7 @@ standard PMD startup scripts, which setups the classpath with the available PMD
|
||||
### Updating
|
||||
|
||||
The latest version of the designer currently **works with PMD 7.0.0 and above**. You can simply replace
|
||||
pmd-ui-7.X.Y.jar with the [latest build](https://github.com/pmd/pmd-designer/releases) in the installation
|
||||
pmd-designer-7.X.Y.jar with the [latest build](https://github.com/pmd/pmd-designer/releases) in the installation
|
||||
folder of your PMD distribution, and run it normally. Note that updating may cause some persisted state
|
||||
to get lost, for example the code snippet.
|
||||
|
||||
|
@ -57,6 +57,25 @@ There are a couple of deprecated things in PMD 6, you might encounter:
|
||||
and the old rulesets like `basic.xml` have been deprecated and have been removed with PMD 7.
|
||||
It is about time to create a [custom ruleset](pmd_userdocs_making_rulesets.html).
|
||||
|
||||
## Approaching 7.0.0
|
||||
|
||||
After that, migrate to the release candidates, and fix any problems you encounter. Start with 7.0.0-rc1 via
|
||||
7.0.0-rc2, 7.0.0-rc3 and 7.0.0-rc4 until you finally use 7.0.0.
|
||||
|
||||
You might encounter additionally the following types of problems:
|
||||
|
||||
* If you use any programmatic API of PMD, first avoid any usage of deprecated or internal classes/methods. These
|
||||
are marked with one of these annotations: `@Deprecated`, `@DeprecatedUtil700`, `@InternalApi`.
|
||||
* Some of these classes are available until 7.0.0-rc4 but are finally removed with 7.0.0.
|
||||
* See [API changes](pmd_release_notes_pmd7.html#api-changes) for details.
|
||||
* Some rules have been removed, because they have been deprecated. See [Removed Rules](pmd_release_notes_pmd7.html#removed-rules).
|
||||
* Some rule properties have been removed or changed. See [Changed Rules](pmd_release_notes_pmd7.html#changed-rules).
|
||||
* The filenames of the assets of a release (the "binary distribution zip file") have changed,
|
||||
see [Release downloads](#release-downloads).
|
||||
* Some CLI options have been removed, because they have been deprecated. See [CLI Changes](#cli-changes) for details.
|
||||
* If you call CPD programmatically, the API has changed, see [New Programmatic API for CPD](pmd_release_notes_pmd7.html#new-programmatic-api-for-cpd).
|
||||
|
||||
The following topics describe well known migration challenges in more detail.
|
||||
|
||||
## Use cases
|
||||
|
||||
@ -205,7 +224,8 @@ Most notable changes:
|
||||
an error message such as `[main] ERROR net.sourceforge.pmd.cli.commands.internal.PmdCommand - No such file false`.
|
||||
* PMD tries to display a progress bar. If you don't want this (e.g. on a CI build server), you can disable this
|
||||
with `--no-progress`.
|
||||
* `--no-ruleset-compatibility` has been removed
|
||||
* `--no-ruleset-compatibility` has been removed without replacement.
|
||||
* `--stress` (or `-stress`) has been removed without replacement.
|
||||
|
||||
### Custom distribution packages
|
||||
|
||||
@ -443,14 +463,15 @@ Some nodes have already the image attribute (and others) deprecated. These depre
|
||||
|
||||
* {% jdoc java::lang.java.ast.ASTAnnotationTypeDeclaration %}: `@Image` ➡️ `@SimpleName`
|
||||
* {% jdoc java::lang.java.ast.ASTAnonymousClassDeclaration %}: `@Image` ➡️ `@SimpleName`
|
||||
* {% jdoc java::lang.java.ast.ASTClassOrInterfaceDeclaration %}: `@Image` ➡️ `@SimpleName`
|
||||
* {% jdoc java::lang.java.ast.ASTClassDeclaration %} (previously "ASTClassOrInterfaceDeclaration"): `@Image` ➡️ `@SimpleName`
|
||||
* {% jdoc java::lang.java.ast.ASTEnumDeclaration %}: `@Image` ➡️ `@SimpleName`
|
||||
* {% jdoc java::lang.java.ast.ASTFieldDeclaration %}: `@VariableName` ➡️ `VariableDeclaratorId/@Name`
|
||||
* {% jdoc java::lang.java.ast.ASTFieldDeclaration %}: `@VariableName` ➡️ `VariableId/@Name`
|
||||
* {% jdoc java::lang.java.ast.ASTMethodDeclaration %}: `@Image` ➡️ `@Name`
|
||||
* {% jdoc java::lang.java.ast.ASTMethodDeclaration %}: `@MethodName` ➡️ `@Name`
|
||||
* {% jdoc java::lang.java.ast.ASTRecordDeclaration %}: `@Image` ➡️ `@SimpleName`
|
||||
* {% jdoc java::lang.java.ast.ASTVariableDeclaratorId %}: `@Image` ➡️ `@Name`
|
||||
* {% jdoc java::lang.java.ast.ASTVariableDeclaratorId %}: `@VariableName` ➡️ `@Name`
|
||||
* {% jdoc java::lang.java.ast.ASTVariableDeclaratorId %}: `@Array` ➡️ `@ArrayType`
|
||||
* {% jdoc java::lang.java.ast.ASTVariableId %} (previously "ASTVariableDeclaratorId"): `@Image` ➡️ `@Name`
|
||||
* {% jdoc java::lang.java.ast.ASTVariableId %} (previously "ASTVariableDeclaratorId"): `@VariableName` ➡️ `@Name`
|
||||
* {% jdoc java::lang.java.ast.ASTVariableId %} (previously "ASTVariableDeclaratorId"): `@Array` ➡️ `@ArrayType`
|
||||
|
||||
#### JavaScript
|
||||
|
||||
@ -3278,6 +3299,24 @@ a = (((1)));
|
||||
|
||||
</details>
|
||||
|
||||
### Apex AST
|
||||
|
||||
PMD 7.0.0 switched the underlying parser for Apex code from Jorje to [Summit AST](https://github.com/google/summit-ast),
|
||||
which is based on an open source grammar for Apex: [apex-parser](https://github.com/nawforce/apex-parser).
|
||||
|
||||
The produced AST is mostly compatible, there are some unavoidable changes however:
|
||||
|
||||
* Node `Method` ({%jdoc apex::lang.apex.ast.ASTMethod %})
|
||||
* No attribute `@Synthetic` anymore. Unlike Jorje, Summit AST doesn't generate synthetic methods anymore, so
|
||||
this attribute would have been always false and is of no use. Therefore it has been removed completely.
|
||||
* There will be no methods anymore with the name `<clinit>`, `<init>`.
|
||||
* There is no node `BridgeMethodCreator` anymore. This was an artificially generated node by Jorje. Since the
|
||||
new parser doesn't generate synthetic methods anymore, this node is not needed anymore.
|
||||
* There is in general no attribute `@Namespace` anymore. The attribute has been removed, as it was never fully
|
||||
implemented. It always returned an empty string.
|
||||
* Node `ReferenceExpression` ({%jdoc apex::lang.apex.ast.ASTReferenceExpression %})
|
||||
* No attribute `@Context` anymore. It was not used and always returned `null`.
|
||||
|
||||
### Language versions
|
||||
|
||||
* Since all languages now have defined language versions, you could now write rules that apply only for specific
|
||||
@ -3322,31 +3361,7 @@ See the use case [I'm using only built-in rules](#im-using-only-built-in-rules)
|
||||
#### Maven
|
||||
|
||||
* Due to some changes in PMD's API, you can't simply pull in the new PMD 7 dependency.
|
||||
* However, there is now a compatibility module, that makes it possible to use PMD 7 with Maven. In addition to the PMD 7
|
||||
dependencies documented in [Upgrading PMD at Runtime](https://maven.apache.org/plugins/maven-pmd-plugin/examples/upgrading-PMD-at-runtime.html)
|
||||
you need to add additionally the following dependency (first available version is 7.0.0-rc4):
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.pmd</groupId>
|
||||
<artifactId>pmd-compat6</artifactId>
|
||||
<version>${pmdVersion}</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
It is important to add this dependency as the **first** in the list, so that maven-pmd-plugin sees the (old)
|
||||
compatible versions of some classes.
|
||||
|
||||
This module is available beginning with version 7.0.0-rc4 and will be there at least for the first
|
||||
final version PMD 7 (7.0.0). It's not decided yet, whether we will keep updating it, after PMD 7 is finally
|
||||
released.
|
||||
|
||||
Note: This compatibility module only works for the built-in rules, that are still available in PMD 7. E.g. you need
|
||||
to review your rulesets and look out for deprecated rules and such. See the use case
|
||||
[I'm using only built-in rules](#im-using-only-built-in-rules)
|
||||
|
||||
As PMD 7 revamped the Java module, if you have custom rules, you need to migrate these rules.
|
||||
See the use case [I'm using custom rules](#im-using-custom-rules).
|
||||
* See [Using PMD 7 with maven-pmd-plugin](pmd_userdocs_tools_maven.html#using-pmd-7-with-maven-pmd-plugin).
|
||||
|
||||
#### Gradle
|
||||
|
||||
@ -3359,3 +3374,13 @@ See the use case [I'm using custom rules](#im-using-custom-rules).
|
||||
```
|
||||
* Gradle 8.3 most likely will support PMD 7 out of the box.
|
||||
* See [Support for PMD 7.0](https://github.com/gradle/gradle/issues/24502)
|
||||
|
||||
### XML Report Format
|
||||
|
||||
The [XML Report format](pmd_userdocs_report_formats.html#xml) supports rendering [suppressed violations](pmd_userdocs_suppressing_warnings.html).
|
||||
|
||||
The content of the attribute `suppressiontype` is changed in PMD 7.0.0:
|
||||
* `nopmd` ➡️ `//nopmd`
|
||||
* `annotation` ➡️ `@suppresswarnings`
|
||||
* `xpath` - new value. Suppressed via property "violationSuppressXPath".
|
||||
* `regex` - new value. Suppressed via property "violationSuppressRegex".
|
||||
|
@ -327,7 +327,7 @@ Was expecting one of:
|
||||
... 10 more
|
||||
]]>
|
||||
</error>
|
||||
<suppressedviolation filename="/home/pmd/source/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java" suppressiontype="annotation" msg="Ensure that resources like this OutputStreamWriter object are closed after use" usermsg=""/>
|
||||
<suppressedviolation filename="/home/pmd/source/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java" suppressiontype="@suppresswarnings" msg="Ensure that resources like this OutputStreamWriter object are closed after use" usermsg=""/>
|
||||
<configerror rule="LoosePackageCoupling" msg="No packages or classes specified"/>
|
||||
</pmd>
|
||||
```
|
||||
|
@ -2,12 +2,12 @@
|
||||
title: Maven PMD Plugin
|
||||
tags: [userdocs, tools]
|
||||
permalink: pmd_userdocs_tools_maven.html
|
||||
last_updated: March 2020
|
||||
mpmd_version: 3.13.0
|
||||
last_updated: February 2024
|
||||
mpmd_version: 3.21.2
|
||||
author: >
|
||||
Miguel Griffa <mikkey@users.sourceforge.net>,
|
||||
Romain PELISSE <belaran@gmail.com>,
|
||||
Andreas Dangel <andreas.dangel@adangel.org>
|
||||
Andreas Dangel <andreas.dangel@pmd-code.org>
|
||||
---
|
||||
|
||||
## Maven 2 and 3
|
||||
@ -239,56 +239,51 @@ Maven plugin will use and benefit from the latest bugfixes and enhancements:
|
||||
</project>
|
||||
```
|
||||
|
||||
#### Using PMD 7 with maven-pmd-plugin
|
||||
|
||||
The Maven PMD plugin comes with a specific PMD version, which is documented on the
|
||||
[plugin project page](https://maven.apache.org/plugins/maven-pmd-plugin/index.html).
|
||||
This might not support PMD 7 out of the box.
|
||||
|
||||
Since PMD 7 is a major release which breaks compatibility in various ways, the solution described
|
||||
above in [Upgrading the PMD version at runtime](#upgrading-the-pmd-version-at-runtime) doesn't work
|
||||
directly.
|
||||
|
||||
In order to use PMD 7 with [maven-pmd-plugin](https://maven.apache.org/plugins/maven-pmd-plugin/) a new
|
||||
compatibility module has been created. This allows to use PMD 7 by simply adding one additional dependency:
|
||||
|
||||
1. Follow the guide [Upgrading PMD at Runtime](https://maven.apache.org/plugins/maven-pmd-plugin/examples/upgrading-PMD-at-runtime.html)
|
||||
2. Add additionally the following dependency:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.pmd</groupId>
|
||||
<artifactId>pmd-compat6</artifactId>
|
||||
<version>${pmdVersion}</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
It is important to add this dependency as the **first** in the list, so that maven-pmd-plugin sees the (old)
|
||||
compatible versions of some classes.
|
||||
|
||||
This module is available beginning with version 7.0.0-rc4 and will be there at least for the first
|
||||
final version PMD 7 (7.0.0). It's not decided yet, whether we will keep updating it, after PMD 7 is finally
|
||||
released.
|
||||
|
||||
Note: This compatibility module only works for the built-in rules, that are still available in PMD 7. E.g. you need
|
||||
to review your rulesets and look out for deprecated rules and such. See the use case
|
||||
[I'm using only built-in rules](pmd_userdocs_migrating_to_pmd7.html#im-using-only-built-in-rules)
|
||||
in the [Migration Guide for PMD 7](pmd_userdocs_migrating_to_pmd7.html).
|
||||
|
||||
As PMD 7 revamped the Java module, if you have custom rules, you need to migrate these rules.
|
||||
See the use case [I'm using custom rules](pmd_userdocs_migrating_to_pmd7.html#im-using-custom-rules)
|
||||
in the Migration Guide.
|
||||
|
||||
|
||||
|
||||
|
||||
### Reference
|
||||
|
||||
For more information, please see the well documented PMD plugin project page here:
|
||||
<http://maven.apache.org/plugins/maven-pmd-plugin/index.html>.
|
||||
Also, the bug tracker for this plugin is [here](https://issues.apache.org/jira/browse/MPMD).
|
||||
|
||||
|
||||
## Maven 1
|
||||
|
||||
{% include warning.html content="Apache Maven 1.x has reached its end of life, and is no longer supported. For more information, see the [announcement](http://maven.apache.org/maven-1.x-eol.html). Users are encouraged to migrate to the current version of Apache Maven." %}
|
||||
|
||||
This section is about the maven 1 PMD plugin.
|
||||
|
||||
### Running the pmd plugin
|
||||
|
||||
#### Generating a project report
|
||||
|
||||
To include the PMD report in the project reports section add the following line under
|
||||
the reports element in your project.xml:
|
||||
|
||||
<report>maven-pmd-plugin</report>
|
||||
|
||||
This will add an entry to the 'project reports' section with the PMD report.
|
||||
|
||||
#### Executing PMD manually
|
||||
|
||||
To run PMD on a Maven project without adding it as a report, simply run
|
||||
|
||||
maven pmd xdoc
|
||||
|
||||
The PMD plugin writes the report in XML which will then be formatted into more readable HTML.
|
||||
|
||||
### Customization
|
||||
|
||||
#### Changing rulesets
|
||||
|
||||
To specify a set of official, built-in rulesets to be used set them in the property
|
||||
<em>maven.pmd.rulesets</em>. You can include this setting in your project.properties file.
|
||||
|
||||
A clean strategy for customizing which rules to use for a project is to write a ruleset file.
|
||||
In this file you can define which rules to use, add custom rules, and
|
||||
customizing which rules to include/exclude from official rulesets. More information on
|
||||
writing a ruleset can be found [here](pmd_userdocs_making_rulesets.html).
|
||||
|
||||
Add to the root of your Maven project a pmd.xml file which contains the ruleset mentioned in
|
||||
the previous paragraph. Add the following property to your project now:
|
||||
|
||||
maven.pmd.rulesetfiles = ${basedir}/pmd.xml
|
||||
|
||||
### Reference
|
||||
|
||||
See the PMD plugin project page here:
|
||||
<http://maven.apache.org/maven-1.x/plugins/pmd/>
|
||||
Also, the bug tracker for this plugin is [MPMD](https://issues.apache.org/jira/browse/MPMD).
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -225,8 +225,8 @@ The following previously deprecated methods have been removed:
|
||||
* pmd-core
|
||||
* `net.sourceforge.pmd.properties.PropertyBuilder.GenericCollectionPropertyBuilder#delim(char)`
|
||||
* `net.sourceforge.pmd.properties.PropertySource#setProperty(...)`
|
||||
* `net.sourceforge.pmd.properties.PropertyTypeId#factoryFor(...)`
|
||||
* `net.sourceforge.pmd.properties.PropertyTypeId#typeIdFor(...)`
|
||||
* `net.sourceforge.pmd.properties.internal.PropertyTypeId#factoryFor(...)`
|
||||
* `net.sourceforge.pmd.properties.internal.PropertyTypeId#typeIdFor(...)`
|
||||
* `net.sourceforge.pmd.properties.PropertyDescriptor`: removed methods errorFor, type, isMultiValue,
|
||||
uiOrder, compareTo, isDefinedExternally, valueFrom, asDelimitedString
|
||||
|
||||
|
@ -176,15 +176,11 @@ Contributors: [Lucas Soncini](https://github.com/lsoncini) (@lsoncini),
|
||||
[Matías Fraga](https://github.com/matifraga) (@matifraga),
|
||||
[Tomás De Lucca](https://github.com/tomidelucca) (@tomidelucca)
|
||||
|
||||
### New: Kotlin support (experimental)
|
||||
### New: Kotlin support
|
||||
|
||||
PMD now supports Kotlin as an additional language for analyzing source code. It is based on
|
||||
the official kotlin Antlr grammar. Java-based rules and XPath-based rules are supported.
|
||||
|
||||
Kotlin support has **experimental** stability level, meaning no compatibility should
|
||||
be expected between even incremental releases. Any functionality can be added, removed or changed without
|
||||
warning.
|
||||
|
||||
We are shipping the following rules:
|
||||
|
||||
* {% rule kotlin/bestpractices/FunctionNameTooShort %} (`kotlin-bestpractices`) finds functions with a too
|
||||
@ -269,6 +265,11 @@ PMD supports Apache Velocity for a very long time, but the CPD integration never
|
||||
This is now done and CPD supports Apache Velocity Template language for detecting copy and paste.
|
||||
It is shipped in the module `pmd-vm`.
|
||||
|
||||
### Changed: HTML support
|
||||
|
||||
Support for HTML was introduced in PMD 6.55.0 as an experimental feature. With PMD 7.0.0 this
|
||||
is now considered stable.
|
||||
|
||||
### Changed: JavaScript support
|
||||
|
||||
The JS specific parser options have been removed. The parser now always retains comments and uses version ES6.
|
||||
@ -364,6 +365,12 @@ can be parsed now. PMD should now be able to parse Apex code up to version 59.0
|
||||
from all rules. These properties have been deprecated since PMD 6.13.0.
|
||||
See [issue #1648](https://github.com/pmd/pmd/issues/1648) for more details.
|
||||
|
||||
**Apex Codestyle**
|
||||
|
||||
* {% rule apex/codestyle/MethodNamingConventions %}: The deprecated rule property `skipTestMethodUnderscores` has
|
||||
been removed. It was actually deprecated since PMD 6.15.0, but was not mentioned in the release notes
|
||||
back then. Use the property `testPattern` instead to configure valid names for test methods.
|
||||
|
||||
**Java General changes**
|
||||
|
||||
* Violations reported on methods or classes previously reported the line range of the entire method
|
||||
@ -405,6 +412,8 @@ can be parsed now. PMD should now be able to parse Apex code up to version 59.0
|
||||
not necessary are allowed, if they separate expressions of different precedence.
|
||||
The other property `ignoreBalancing` (default: true) is similar, in that it allows parentheses that help
|
||||
reading and understanding the expressions.
|
||||
* {% rule java/codestyle/EmptyControlStatement %}: The rule has a new property to allow empty blocks when
|
||||
they contain a comment (`allowCommentedBlocks`).
|
||||
|
||||
**Java Design**
|
||||
|
||||
@ -432,6 +441,8 @@ can be parsed now. PMD should now be able to parse Apex code up to version 59.0
|
||||
See also [pull request #3757](https://github.com/pmd/pmd/pull/3757).
|
||||
* Elements in annotation types are now detected as well. This might lead to an increased number of violations
|
||||
for missing public method comments.
|
||||
* The deprecated property `headerCommentRequirement` has been removed. Use the property `classCommentRequirement`
|
||||
instead.
|
||||
* {% rule java/documentation/CommentSize %}: When determining the line-length of a comment, the leading comment
|
||||
prefix markers (e.g. `*` or `//`) are ignored and don't add up to the line-length.
|
||||
See also [pull request #4369](https://github.com/pmd/pmd/pull/4369).
|
||||
@ -445,6 +456,8 @@ can be parsed now. PMD should now be able to parse Apex code up to version 59.0
|
||||
special-cased anymore. Rename the exception parameter to `ignored` to ignore them.
|
||||
* {% rule java/errorprone/ImplicitSwitchFallThrough %}: Violations are now reported on the case statements
|
||||
rather than on the switch statements. This is more accurate but might result in more violations now.
|
||||
* {% rule java/errorprone/NonSerializableClass %}: The deprecated property `prefix` has been removed
|
||||
without replacement. In a serializable class all fields have to be serializable regardless of the name.
|
||||
|
||||
### Deprecated Rules
|
||||
|
||||
@ -467,78 +480,72 @@ The following previously deprecated rules have been finally removed:
|
||||
**Java**
|
||||
|
||||
* {% deleted_rule java/codestyle/AbstractNaming %} ➡️ use {% rule java/codestyle/ClassNamingConventions %}
|
||||
* AvoidFinalLocalVariable (java-codestyle) ➡️ not replaced
|
||||
* AvoidPrefixingMethodParameters (java-codestyle) ➡️ use {% rule "java/codestyle/FormalParameterNamingConventions" %}
|
||||
* AvoidUsingShortType (java-performance) ➡️ not replaced
|
||||
* BadComparison (java-errorprone) ➡️ use {% rule "java/errorprone/ComparisonWithNaN" %}
|
||||
* BeanMembersShouldSerialize (java-errorprone) ➡️ use {% rule java/errorprone/NonSerializableClass %}
|
||||
* BooleanInstantiation (java-performance) ➡️ use {% rule "java/codestyle/UnnecessaryBoxing" %}
|
||||
* {% deleted_rule java/codestyle/AvoidFinalLocalVariable %} ➡️ not replaced
|
||||
* {% deleted_rule java/codestyle/AvoidPrefixingMethodParameters %} ➡️ use {% rule "java/codestyle/FormalParameterNamingConventions" %}
|
||||
* {% deleted_rule java/performance/AvoidUsingShortType %} ➡️ not replaced
|
||||
* {% deleted_rule java/errorprone/BadComparison %} ➡️ use {% rule "java/errorprone/ComparisonWithNaN" %}
|
||||
* {% deleted_rule java/errorprone/BeanMembersShouldSerialize %} ➡️ use {% rule java/errorprone/NonSerializableClass %}
|
||||
* {% deleted_rule java/performance/BooleanInstantiation %} ➡️ use {% rule "java/codestyle/UnnecessaryBoxing" %}
|
||||
and {% rule "java/bestpractices/PrimitiveWrapperInstantiation" %}
|
||||
* ByteInstantiation (java-performance) ➡️ use {% rule "java/codestyle/UnnecessaryBoxing" %}
|
||||
* {% deleted_rule java/performance/ByteInstantiation %} ➡️ use {% rule "java/codestyle/UnnecessaryBoxing" %}
|
||||
and {% rule "java/bestpractices/PrimitiveWrapperInstantiation" %}
|
||||
* CloneThrowsCloneNotSupportedException (java-errorprone) ➡️ not replaced
|
||||
* DataflowAnomalyAnalysis (java-errorprone) ➡️ use {% rule java/bestpractices/UnusedAssignment %}
|
||||
* DefaultPackage (java-codestyle) ➡️ use {% rule "java/codestyle/CommentDefaultAccessModifier" %}
|
||||
* DoNotCallSystemExit (java-errorprone) ➡️ use {% rule "java/errorprone/DoNotTerminateVM" %}
|
||||
* DontImportJavaLang (java-codestyle) ➡️ use {% rule java/codestyle/UnnecessaryImport %}
|
||||
* DuplicateImports (java-codestyle) ➡️ use {% rule java/codestyle/UnnecessaryImport %}
|
||||
* EmptyFinallyBlock (java-errorprone) ➡️ use {% rule java/codestyle/EmptyControlStatement %}
|
||||
* EmptyIfStmt (java-errorprone) ➡️ use {% rule java/codestyle/EmptyControlStatement %}
|
||||
* EmptyInitializer (java-errorprone) ➡️ use {% rule java/codestyle/EmptyControlStatement %}
|
||||
* EmptyStatementBlock (java-errorprone) ➡️ use {% rule java/codestyle/EmptyControlStatement %}
|
||||
* EmptyStatementNotInLoop (java-errorprone) ➡️ use {% rule java/codestyle/UnnecessarySemicolon %}
|
||||
* EmptySwitchStatements (java-errorprone) ➡️ use {% rule java/codestyle/EmptyControlStatement %}
|
||||
* EmptySynchronizedBlock (java-errorprone) ➡️ use {% rule java/codestyle/EmptyControlStatement %}
|
||||
* EmptyTryBlock (java-errorprone) ➡️ use {% rule java/codestyle/EmptyControlStatement %}
|
||||
* EmptyWhileStmt (java-errorprone) ➡️ use {% rule java/codestyle/EmptyControlStatement %}
|
||||
* ExcessiveClassLength (java-design) ➡️ use {% rule java/design/NcssCount %}
|
||||
* ExcessiveMethodLength (java-design) ➡️ use {% rule java/design/NcssCount %}
|
||||
* ForLoopsMustUseBraces (java-codestyle) ➡️ use {% rule java/codestyle/ControlStatementBraces %}
|
||||
* IfElseStmtsMustUseBraces (java-codestyle) ➡️ use {% rule java/codestyle/ControlStatementBraces %}
|
||||
* IfStmtsMustUseBraces (java-codestyle) ➡️ use {% rule java/codestyle/ControlStatementBraces %}
|
||||
* ImportFromSamePackage (java-errorprone) ➡️ use {% rule java/codestyle/UnnecessaryImport %}
|
||||
* IntegerInstantiation (java-performance) ➡️ use {% rule java/codestyle/UnnecessaryBoxing %}
|
||||
* {% deleted_rule java/errorprone/CloneThrowsCloneNotSupportedException %} ➡️ not replaced
|
||||
* {% deleted_rule java/errorprone/DataflowAnomalyAnalysis %} ➡️ use {% rule java/bestpractices/UnusedAssignment %}
|
||||
* {% deleted_rule java/codestyle/DefaultPackage %} ➡️ use {% rule "java/codestyle/CommentDefaultAccessModifier" %}
|
||||
* {% deleted_rule java/errorprone/DoNotCallSystemExit %} ➡️ use {% rule "java/errorprone/DoNotTerminateVM" %}
|
||||
* {% deleted_rule java/codestyle/DontImportJavaLang %} ➡️ use {% rule java/codestyle/UnnecessaryImport %}
|
||||
* {% deleted_rule java/codestyle/DuplicateImports %} ➡️ use {% rule java/codestyle/UnnecessaryImport %}
|
||||
* {% deleted_rule java/errorprone/EmptyFinallyBlock %} ➡️ use {% rule java/codestyle/EmptyControlStatement %}
|
||||
* {% deleted_rule java/errorprone/EmptyIfStmt %} ➡️ use {% rule java/codestyle/EmptyControlStatement %}
|
||||
* {% deleted_rule java/errorprone/EmptyInitializer %} ➡️ use {% rule java/codestyle/EmptyControlStatement %}
|
||||
* {% deleted_rule java/errorprone/EmptyStatementBlock %} ➡️ use {% rule java/codestyle/EmptyControlStatement %}
|
||||
* {% deleted_rule java/errorprone/EmptyStatementNotInLoop %} ➡️ use {% rule java/codestyle/UnnecessarySemicolon %}
|
||||
* {% deleted_rule java/errorprone/EmptySwitchStatements %} ➡️ use {% rule java/codestyle/EmptyControlStatement %}
|
||||
* {% deleted_rule java/errorprone/EmptySynchronizedBlock %} ➡️ use {% rule java/codestyle/EmptyControlStatement %}
|
||||
* {% deleted_rule java/errorprone/EmptyTryBlock %} ➡️ use {% rule java/codestyle/EmptyControlStatement %}
|
||||
* {% deleted_rule java/errorprone/EmptyWhileStmt %} ➡️ use {% rule java/codestyle/EmptyControlStatement %}
|
||||
* {% deleted_rule java/design/ExcessiveClassLength %} ➡️ use {% rule java/design/NcssCount %}
|
||||
* {% deleted_rule java/design/ExcessiveMethodLength %} ➡️ use {% rule java/design/NcssCount %}
|
||||
* {% deleted_rule java/codestyle/ForLoopsMustUseBraces %} ➡️ use {% rule java/codestyle/ControlStatementBraces %}
|
||||
* {% deleted_rule java/codestyle/IfElseStmtsMustUseBraces %} ➡️ use {% rule java/codestyle/ControlStatementBraces %}
|
||||
* {% deleted_rule java/codestyle/IfStmtsMustUseBraces %} ➡️ use {% rule java/codestyle/ControlStatementBraces %}
|
||||
* {% deleted_rule java/errorprone/ImportFromSamePackage %} ➡️ use {% rule java/codestyle/UnnecessaryImport %}
|
||||
* {% deleted_rule java/performance/IntegerInstantiation %} ➡️ use {% rule java/codestyle/UnnecessaryBoxing %}
|
||||
and {% rule "java/bestpractices/PrimitiveWrapperInstantiation" %}
|
||||
* InvalidSlf4jMessageFormat (java-errorprone) ➡️ use {% rule "java/errorprone/InvalidLogMessageFormat" %}
|
||||
* LoggerIsNotStaticFinal (java-errorprone) ➡️ use {% rule java/errorprone/ProperLogger %}
|
||||
* LongInstantiation (java-performance) ➡️ use {% rule "java/codestyle/UnnecessaryBoxing" %}
|
||||
* {% deleted_rule java/errorprone/InvalidSlf4jMessageFormat %} ➡️ use {% rule "java/errorprone/InvalidLogMessageFormat" %}
|
||||
* {% deleted_rule java/errorprone/LoggerIsNotStaticFinal %} ➡️ use {% rule java/errorprone/ProperLogger %}
|
||||
* {% deleted_rule java/performance/LongInstantiation %} ➡️ use {% rule "java/codestyle/UnnecessaryBoxing" %}
|
||||
and {% rule "java/bestpractices/PrimitiveWrapperInstantiation" %}
|
||||
* MIsLeadingVariableName (java-codestyle) ➡️ use {% rule java/codestyle/FieldNamingConventions %},
|
||||
* {% deleted_rule java/codestyle/MIsLeadingVariableName %} ➡️ use {% rule java/codestyle/FieldNamingConventions %},
|
||||
{% rule java/codestyle/FormalParameterNamingConventions %},
|
||||
or {% rule java/codestyle/LocalVariableNamingConventions %}
|
||||
* MissingBreakInSwitch (java-errorprone) ➡️ use {% rule "java/errorprone/ImplicitSwitchFallThrough" %}
|
||||
* ModifiedCyclomaticComplexity (java-design) ➡️ use {% rule "java/design/CyclomaticComplexity" %}
|
||||
* NcssConstructorCount (java-design) ➡️ use {% rule java/design/NcssCount %}
|
||||
* NcssMethodCount (java-design) ➡️ use {% rule java/design/NcssCount %}
|
||||
* NcssTypeCount (java-design) ➡️ use {% rule java/design/NcssCount %}
|
||||
* PositionLiteralsFirstInCaseInsensitiveComparisons (java-bestpractices) ➡️
|
||||
* {% deleted_rule java/errorprone/MissingBreakInSwitch %} ➡️ use {% rule "java/errorprone/ImplicitSwitchFallThrough" %}
|
||||
* {% deleted_rule java/design/ModifiedCyclomaticComplexity %} ➡️ use {% rule "java/design/CyclomaticComplexity" %}
|
||||
* {% deleted_rule java/design/NcssConstructorCount %} ➡️ use {% rule java/design/NcssCount %}
|
||||
* {% deleted_rule java/design/NcssMethodCount %} ➡️ use {% rule java/design/NcssCount %}
|
||||
* {% deleted_rule java/design/NcssTypeCount %} ➡️ use {% rule java/design/NcssCount %}
|
||||
* {% deleted_rule java/bestpractices/PositionLiteralsFirstInCaseInsensitiveComparisons %} ➡️
|
||||
use {% rule "java/bestpractices/LiteralsFirstInComparisons" %}
|
||||
* PositionLiteralsFirstInComparisons (java-bestpractices) ➡️
|
||||
* {% deleted_rule java/bestpractices/PositionLiteralsFirstInComparisons %} ➡️
|
||||
use {% rule "java/bestpractices/LiteralsFirstInComparisons" %}
|
||||
* ReturnEmptyArrayRatherThanNull (java-errorprone) ➡️
|
||||
* {% deleted_rule java/errorprone/ReturnEmptyArrayRatherThanNull %} ➡️
|
||||
use {% rule "java/errorprone/ReturnEmptyCollectionRatherThanNull" %}
|
||||
* ShortInstantiation (java-performance) ➡️ use {% rule "java/codestyle/UnnecessaryBoxing" %}
|
||||
* {% deleted_rule java/performance/ShortInstantiation %} ➡️ use {% rule "java/codestyle/UnnecessaryBoxing" %}
|
||||
and {% rule "java/bestpractices/PrimitiveWrapperInstantiation" %}
|
||||
* SimplifyBooleanAssertion (java-design) ➡️ use {% rule "java/bestpractices/SimplifiableTestAssertion" %}
|
||||
* SimplifyStartsWith (java-performance) ➡️ not replaced
|
||||
* StdCyclomaticComplexity (java-design) ➡️ use {% rule "java/design/CyclomaticComplexity" %}
|
||||
* SuspiciousConstantFieldName (java-codestyle) ➡️ use {% rule java/codestyle/FieldNamingConventions %}
|
||||
* UnnecessaryWrapperObjectCreation (java-performance) ➡️ use the new rule {% rule "java/codestyle/UnnecessaryBoxing" %}
|
||||
* UnsynchronizedStaticDateFormatter (java-multithreading) ➡️
|
||||
use {% rule java/multithreading/UnsynchronizedStaticFormatter %}
|
||||
* UnusedImports (java-bestpractices) ➡️ use {% rule java/codestyle/UnnecessaryImport %}
|
||||
* UseAssertEqualsInsteadOfAssertTrue (java-bestpractices) ➡️
|
||||
use {% rule "java/bestpractices/SimplifiableTestAssertion" %}
|
||||
* UseAssertNullInsteadOfAssertEquals (java-bestpractices) ➡️
|
||||
use {% rule "java/bestpractices/SimplifiableTestAssertion" %}
|
||||
* UseAssertSameInsteadOfAssertEquals (java-bestpractices) ➡️
|
||||
use {% rule "java/bestpractices/SimplifiableTestAssertion" %}
|
||||
* UseAssertTrueInsteadOfAssertEquals (java-bestpractices) ➡️
|
||||
use {% rule "java/bestpractices/SimplifiableTestAssertion" %}
|
||||
* VariableNamingConventions (java-codestyle) ➡️ use {% rule java/codestyle/FieldNamingConventions %},
|
||||
{% rule java/codestyle/FormalParameterNamingConventions %},
|
||||
or {% rule java/codestyle/LocalVariableNamingConventions %}
|
||||
* WhileLoopsMustUseBraces (java-codestyle) ➡️ use {% rule "java/codestyle/ControlStatementBraces" %}
|
||||
* {% deleted_rule java/design/SimplifyBooleanAssertion %} ➡️ use {% rule "java/bestpractices/SimplifiableTestAssertion" %}
|
||||
* {% deleted_rule java/performance/SimplifyStartsWith %} ➡️ not replaced
|
||||
* {% deleted_rule java/design/StdCyclomaticComplexity %} ➡️ use {% rule "java/design/CyclomaticComplexity" %}
|
||||
* {% deleted_rule java/codestyle/SuspiciousConstantFieldName %} ➡️ use {% rule java/codestyle/FieldNamingConventions %}
|
||||
* {% deleted_rule java/performance/UnnecessaryWrapperObjectCreation %} ➡️ use the new rule {% rule "java/codestyle/UnnecessaryBoxing" %}
|
||||
* {% deleted_rule java/multithreading/UnsynchronizedStaticDateFormatter %} ➡️ use {% rule java/multithreading/UnsynchronizedStaticFormatter %}
|
||||
* {% deleted_rule java/bestpractices/UnusedImports %} ➡️ use {% rule java/codestyle/UnnecessaryImport %}
|
||||
* {% deleted_rule java/bestpractices/UseAssertEqualsInsteadOfAssertTrue %} ➡️ use {% rule "java/bestpractices/SimplifiableTestAssertion" %}
|
||||
* {% deleted_rule java/bestpractices/UseAssertNullInsteadOfAssertEquals %} ➡️ use {% rule "java/bestpractices/SimplifiableTestAssertion" %}
|
||||
* {% deleted_rule java/bestpractices/UseAssertSameInsteadOfAssertEquals %} ➡️ use {% rule "java/bestpractices/SimplifiableTestAssertion" %}
|
||||
* {% deleted_rule java/bestpractices/UseAssertTrueInsteadOfAssertEquals %} ➡️ use {% rule "java/bestpractices/SimplifiableTestAssertion" %}
|
||||
* {% deleted_rule java/codestyle/VariableNamingConventions %} ➡️ use {% rule java/codestyle/FieldNamingConventions %},
|
||||
{% rule java/codestyle/FormalParameterNamingConventions %}, or {% rule java/codestyle/LocalVariableNamingConventions %}
|
||||
* {% deleted_rule java/codestyle/WhileLoopsMustUseBraces %} ➡️ use {% rule "java/codestyle/ControlStatementBraces" %}
|
||||
|
||||
## 💥 Compatibility and Migration Notes
|
||||
|
||||
@ -553,7 +560,7 @@ The full detailed documentation of the changes are available in the
|
||||
* CLI changed: Custom scripts need to be updated (`run.sh pmd ...` ➡️ `pmd check ...`, `run.sh cpd ...`, `pmd cpd ...`).
|
||||
* Java module revamped: Custom rules need to be updated.
|
||||
* Removed rules: Custom rulesets need to be reviewed. See below for a list of new and removed rules.
|
||||
* XPath 1.0 support is removed, `violationSuppressXPath` now requires XPath 2.0 or 3.1: Custom rulesets need
|
||||
* XPath 1.0 and 2.0 support is removed, `violationSuppressXPath` now requires XPath 3.1: Custom rulesets need
|
||||
to be reviewed.
|
||||
* Custom rules using rulechains: Need to override {% jdoc core::lang.rule.AbstractRule#buildTargetSelector() %}
|
||||
using {% jdoc core::lang.rule.RuleTargetSelector#forTypes(java.lang.Class,java.lang.Class...) %}.
|
||||
@ -563,6 +570,7 @@ The full detailed documentation of the changes are available in the
|
||||
|
||||
The structure inside the ZIP files stay the same, e.g. we still provide inside the binary distribution
|
||||
ZIP file the base directory `pmd-bin-<version>`.
|
||||
* For maven-pmd-plugin usage, see [Using PMD 7 with maven-pmd-plugin](pmd_userdocs_tools_maven.html#using-pmd-7-with-maven-pmd-plugin).
|
||||
|
||||
### For integrators
|
||||
|
||||
@ -627,7 +635,7 @@ See [ADR 3 - API evolution principles](pmd_projectdocs_decisions_adr_3.html) and
|
||||
|
||||
### XPath 3.1 support
|
||||
|
||||
Support for XPath versions 1.0, 1.0-compatibility was removed, support for XPath 2.0 is deprecated. The default
|
||||
Support for XPath versions 1.0, 1.0-compatibility, 2.0 was removed. The default
|
||||
(and only) supported XPath version is now XPath 3.1. This version of the XPath language is mostly identical to
|
||||
XPath 2.0.
|
||||
|
||||
@ -837,8 +845,8 @@ The following previously deprecated methods have been removed:
|
||||
* pmd-core
|
||||
* `net.sourceforge.pmd.properties.PropertyBuilder.GenericCollectionPropertyBuilder#delim(char)`
|
||||
* `net.sourceforge.pmd.properties.PropertySource#setProperty(...)`
|
||||
* `net.sourceforge.pmd.properties.PropertyTypeId#factoryFor(...)`
|
||||
* `net.sourceforge.pmd.properties.PropertyTypeId#typeIdFor(...)`
|
||||
* `net.sourceforge.pmd.properties.internal.PropertyTypeId#factoryFor(...)`
|
||||
* `net.sourceforge.pmd.properties.internal.PropertyTypeId#typeIdFor(...)`
|
||||
* `net.sourceforge.pmd.properties.PropertyDescriptor`: removed methods errorFor, type, isMultiValue,
|
||||
uiOrder, compareTo, isDefinedExternally, valueFrom, asDelimitedString
|
||||
|
||||
@ -921,7 +929,7 @@ The following classes have been removed:
|
||||
##### Internal APIs
|
||||
|
||||
* {% jdoc core::cpd.Tokens %}
|
||||
* {% jdoc core::net.sourceforge.pmd.properties.PropertyTypeId %}
|
||||
* {% jdoc core::net.sourceforge.pmd.properties.internal.PropertyTypeId %}
|
||||
|
||||
##### Deprecated API
|
||||
|
||||
|
@ -203,11 +203,11 @@
|
||||
<fileset dir="${target-package-dir}" />
|
||||
</replaceregexp>
|
||||
|
||||
<replace token=".beginLine" value=".getBeginLine()">
|
||||
<replace token=".beginLine" value=".getReportLocation().getStartLine()">
|
||||
<fileset dir="${target-package-dir}" />
|
||||
</replace>
|
||||
|
||||
<replace token=".beginColumn" value=".getBeginColumn()">
|
||||
<replace token=".beginColumn" value=".getReportLocation().getStartColumn()">
|
||||
<fileset dir="${target-package-dir}" />
|
||||
</replace>
|
||||
|
||||
@ -283,7 +283,7 @@
|
||||
<!-- Use own LexException instead of JavaCC's TokenMgrError -->
|
||||
<replaceregexp>
|
||||
<regexp pattern='throw new TokenMgrError\(EOFSeen' />
|
||||
<substitution expression='throw new net.sourceforge.pmd.lang.ast.LexException(EOFSeen' />
|
||||
<substitution expression='throw net.sourceforge.pmd.lang.ast.InternalApiBridge.newLexException(EOFSeen' />
|
||||
<file name="${tokenmgr-file}" />
|
||||
</replaceregexp>
|
||||
|
||||
|
@ -15,6 +15,24 @@
|
||||
<name>PMD Ant Integration</name>
|
||||
<description>Apache Ant integration for PMD.</description>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- overrides the configuration from parent pom: we only have pmd-core yet -->
|
||||
<offlineLinks combine.self="override">
|
||||
<offlineLink>
|
||||
<location>${project.basedir}/../pmd-core/target/apidocs</location>
|
||||
<url>../../pmd-core/${project.version}</url>
|
||||
</offlineLink>
|
||||
</offlineLinks>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.pmd</groupId>
|
||||
|
@ -28,7 +28,6 @@ import net.sourceforge.pmd.cpd.CPDReport;
|
||||
import net.sourceforge.pmd.cpd.CPDReportRenderer;
|
||||
import net.sourceforge.pmd.cpd.CSVRenderer;
|
||||
import net.sourceforge.pmd.cpd.CpdAnalysis;
|
||||
import net.sourceforge.pmd.cpd.CpdLanguageProperties;
|
||||
import net.sourceforge.pmd.cpd.SimpleRenderer;
|
||||
import net.sourceforge.pmd.cpd.XMLRenderer;
|
||||
import net.sourceforge.pmd.lang.Language;
|
||||
@ -79,7 +78,7 @@ public class CPDTask extends Task {
|
||||
private boolean skipLexicalErrors;
|
||||
private boolean skipDuplicateFiles;
|
||||
private boolean skipBlocks = true;
|
||||
private String skipBlocksPattern = CpdLanguageProperties.DEFAULT_SKIP_BLOCKS_PATTERN;
|
||||
private String skipBlocksPattern;
|
||||
private File outputFile;
|
||||
private String encoding = System.getProperty("file.encoding");
|
||||
private List<FileSet> filesets = new ArrayList<>();
|
||||
|
@ -27,7 +27,6 @@ import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.types.Parameter;
|
||||
|
||||
import net.sourceforge.pmd.annotation.InternalApi;
|
||||
import net.sourceforge.pmd.internal.util.IOUtil;
|
||||
import net.sourceforge.pmd.lang.document.TextFile;
|
||||
import net.sourceforge.pmd.renderers.Renderer;
|
||||
@ -36,9 +35,22 @@ import net.sourceforge.pmd.reporting.FileAnalysisListener;
|
||||
import net.sourceforge.pmd.reporting.FileNameRenderer;
|
||||
import net.sourceforge.pmd.reporting.GlobalAnalysisListener;
|
||||
import net.sourceforge.pmd.reporting.ListenerInitializer;
|
||||
import net.sourceforge.pmd.reporting.Report;
|
||||
|
||||
@InternalApi
|
||||
/**
|
||||
* Part of PMD Ant task configuration. Setters of this class are interpreted by Ant as properties
|
||||
* settable in the XML. This is therefore published API.
|
||||
*
|
||||
* <p>This class is used to configure a specific {@link Renderer} for outputting the violations. This is called
|
||||
* a formatter in PMD Ant task configuration and might look like this:
|
||||
*
|
||||
* <pre>{@code
|
||||
* <pmd>
|
||||
* <formatter type="html" toFile="${build}/pmd_report.html"/>
|
||||
* </pmd>
|
||||
* }</pre>
|
||||
*
|
||||
* @see PMDTask#addFormatter(Formatter)
|
||||
*/
|
||||
public class Formatter {
|
||||
|
||||
private File toFile;
|
||||
@ -69,15 +81,7 @@ public class Formatter {
|
||||
this.parameters.add(parameter);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@InternalApi
|
||||
public Renderer getRenderer() {
|
||||
return renderer;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@InternalApi
|
||||
public void start(String baseDir) {
|
||||
private void start(String baseDir) {
|
||||
|
||||
Properties properties = createProperties();
|
||||
|
||||
@ -123,25 +127,7 @@ public class Formatter {
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@InternalApi
|
||||
public void end(Report errorReport) {
|
||||
try {
|
||||
renderer.renderFileReport(errorReport);
|
||||
renderer.end();
|
||||
if (toConsole) {
|
||||
writer.flush();
|
||||
} else {
|
||||
writer.close();
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
throw new BuildException(ioe.getMessage(), ioe);
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@InternalApi
|
||||
public boolean isNoOutputSupplied() {
|
||||
boolean isNoOutputSupplied() {
|
||||
return toFile == null && !toConsole;
|
||||
}
|
||||
|
||||
@ -262,12 +248,8 @@ public class Formatter {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@InternalApi
|
||||
public GlobalAnalysisListener newListener(Project project) throws IOException {
|
||||
GlobalAnalysisListener newListener(Project project) throws IOException {
|
||||
start(project.getBaseDir().toString());
|
||||
Renderer renderer = getRenderer();
|
||||
|
||||
return new GlobalAnalysisListener() {
|
||||
final GlobalAnalysisListener listener = renderer.newListener();
|
||||
|
||||
|
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