Merge branch '7.0.x' into pmd7-language-lifecycle

This commit is contained in:
Clément Fournier 2022-11-24 20:06:49 +01:00
commit d3ffc1d212
No known key found for this signature in database
GPG Key ID: 4D8D42402E4F47E2
219 changed files with 8186 additions and 1779 deletions

View File

@ -492,7 +492,8 @@
"profile": "https://github.com/pzygielo",
"contributions": [
"code",
"bug"
"bug",
"doc"
]
},
{
@ -3269,7 +3270,8 @@
"profile": "https://github.com/jborgers",
"contributions": [
"bug",
"code"
"code",
"talk"
]
},
{
@ -6522,7 +6524,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/36415196?v=4",
"profile": "https://github.com/dykov",
"contributions": [
"code"
"code",
"bug"
]
},
{
@ -6540,7 +6543,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/178883?v=4",
"profile": "https://github.com/gredler",
"contributions": [
"code"
"code",
"bug"
]
},
{
@ -6559,7 +6563,8 @@
"profile": "https://github.com/JerritEic",
"contributions": [
"code",
"doc"
"doc",
"bug"
]
},
{
@ -6777,7 +6782,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/90252673?v=4",
"profile": "https://github.com/abyss638",
"contributions": [
"code"
"code",
"bug"
]
},
{
@ -6798,7 +6804,8 @@
"contributions": [
"doc"
]
},{
},
{
"login": "pacvz",
"name": "pacvz",
"avatar_url": "https://avatars.githubusercontent.com/u/35453365?v=4",
@ -6806,6 +6813,199 @@
"contributions": [
"code"
]
},
{
"login": "mohan-chinnappan-n",
"name": "mohan-chinnappan-n",
"avatar_url": "https://avatars.githubusercontent.com/u/5963194?v=4",
"profile": "https://mohan-chinnappan-n.github.io/about/cv.html",
"contributions": [
"code"
]
},
{
"login": "Suvashri",
"name": "Suvashri",
"avatar_url": "https://avatars.githubusercontent.com/u/112872981?v=4",
"profile": "https://github.com/Suvashri",
"contributions": [
"doc"
]
},
{
"login": "osiegmar",
"name": "Oliver Siegmar",
"avatar_url": "https://avatars.githubusercontent.com/u/1918869?v=4",
"profile": "https://github.com/osiegmar",
"contributions": [
"financial"
]
},
{
"login": "OlegAndreych",
"name": "Oleg Andreych",
"avatar_url": "https://avatars.githubusercontent.com/u/2041351?v=4",
"profile": "https://github.com/OlegAndreych",
"contributions": [
"code",
"bug"
]
},
{
"login": "lfalcantar",
"name": "Luis Alcantar",
"avatar_url": "https://avatars.githubusercontent.com/u/13026131?v=4",
"profile": "https://github.com/lfalcantar",
"contributions": [
"code"
]
},
{
"login": "LynnBroe",
"name": "Lynn",
"avatar_url": "https://avatars.githubusercontent.com/u/109954313?v=4",
"profile": "https://github.com/LynnBroe",
"contributions": [
"code",
"bug"
]
},
{
"login": "sashashura",
"name": "Alex",
"avatar_url": "https://avatars.githubusercontent.com/u/93376818?v=4",
"profile": "https://github.com/sashashura",
"contributions": [
"code"
]
},
{
"login": "koalalam",
"name": "koalalam",
"avatar_url": "https://avatars.githubusercontent.com/u/5452429?v=4",
"profile": "https://github.com/koalalam",
"contributions": [
"bug"
]
},
{
"login": "garydgregory",
"name": "Gary Gregory",
"avatar_url": "https://avatars.githubusercontent.com/u/1187639?v=4",
"profile": "https://github.com/garydgregory",
"contributions": [
"bug"
]
},
{
"login": "vanguard-1024",
"name": "Austin",
"avatar_url": "https://avatars.githubusercontent.com/u/87691060?v=4",
"profile": "https://github.com/vanguard-1024",
"contributions": [
"bug"
]
},
{
"login": "ewantempero",
"name": "Ewan Tempero",
"avatar_url": "https://avatars.githubusercontent.com/u/8744237?v=4",
"profile": "http://www.cs.auckland.ac.nz/~ewan",
"contributions": [
"bug"
]
},
{
"login": "cbfiddle",
"name": "cbfiddle",
"avatar_url": "https://avatars.githubusercontent.com/u/6628505?v=4",
"profile": "https://github.com/cbfiddle",
"contributions": [
"bug"
]
},
{
"login": "MartGit",
"name": "MartGit",
"avatar_url": "https://avatars.githubusercontent.com/u/1518723?v=4",
"profile": "https://github.com/MartGit",
"contributions": [
"bug"
]
},
{
"login": "Alexx-G",
"name": "Alex",
"avatar_url": "https://avatars.githubusercontent.com/u/3869268?v=4",
"profile": "https://github.com/Alexx-G",
"contributions": [
"bug"
]
},
{
"login": "tcopeland",
"name": "Tom Copeland",
"avatar_url": "https://avatars.githubusercontent.com/u/70536?v=4",
"profile": "https://thomasleecopeland.com/",
"contributions": [
"bug",
"code",
"doc"
]
},
{
"login": "yasarshaikh",
"name": "Yasar Shaikh",
"avatar_url": "https://avatars.githubusercontent.com/u/20971327?v=4",
"profile": "https://github.com/yasarshaikh",
"contributions": [
"code"
]
},
{
"login": "rnveach",
"name": "rnveach",
"avatar_url": "https://avatars.githubusercontent.com/u/5427943?v=4",
"profile": "https://github.com/rnveach",
"contributions": [
"bug"
]
},
{
"login": "tysonstewart",
"name": "Tyson Stewart",
"avatar_url": "https://avatars.githubusercontent.com/u/1292640?v=4",
"profile": "https://github.com/tysonstewart",
"contributions": [
"bug"
]
},
{
"login": "valfirst",
"name": "Valery Yatsynovich",
"avatar_url": "https://avatars.githubusercontent.com/u/5081226?v=4",
"profile": "https://github.com/valfirst",
"contributions": [
"doc"
]
},
{
"login": "jvwilge",
"name": "Jeroen van Wilgenburg",
"avatar_url": "https://avatars.githubusercontent.com/u/251901?v=4",
"profile": "https://vanwilgenburg.wordpress.com/",
"contributions": [
"doc"
]
},
{
"login": "Eldrick19",
"name": "Eldrick Wega",
"avatar_url": "https://avatars.githubusercontent.com/u/26189114?v=4",
"profile": "https://github.com/Eldrick19",
"contributions": [
"doc"
]
}
],
"contributorsPerLine": 7,

View File

@ -42,17 +42,20 @@ function build() {
./mvnw clean install --show-version --errors --batch-mode --no-transfer-progress "${PMD_MAVEN_EXTRA_OPTS[@]}"
pmd_ci_log_group_end
# Danger is executed only on the linux runner
if [ "$(pmd_ci_utils_get_os)" = "linux" ]; then
pmd_ci_log_group_start "Executing danger"
regression_tester_setup_ci
regression_tester_executeDanger
pmd_ci_log_group_end
# Execute danger and dogfood only for pull requests in our own repository
if [[ "${PMD_CI_IS_FORK}" = "false" && -n "${PMD_CI_PULL_REQUEST_NUMBER}" ]]; then
# Danger is executed only on the linux runner
if [ "$(pmd_ci_utils_get_os)" = "linux" ]; then
pmd_ci_log_group_start "Executing danger"
regression_tester_setup_ci
regression_tester_executeDanger
pmd_ci_log_group_end
# also run dogfood for PRs (only on linux)
pmd_ci_log_group_start "Executing PMD dogfood test with ${PMD_CI_MAVEN_PROJECT_VERSION}"
pmd_ci_dogfood
pmd_ci_log_group_end
# also run dogfood for PRs (only on linux)
pmd_ci_log_group_start "Executing PMD dogfood test with ${PMD_CI_MAVEN_PROJECT_VERSION}"
pmd_ci_dogfood
pmd_ci_log_group_end
fi
fi
exit 0

View File

@ -169,4 +169,12 @@ EOF
<tag>v2.3.0</tag>
<src-subpath>samples</src-subpath>
</project>
<project>
<name>java-regression-tests</name>
<type>git</type>
<connection>https://github.com/pmd/java-regression-tests</connection>
<tag>main</tag>
<auxclasspath-command>realpath java-regression-tests-*.jar</auxclasspath-command>
</project>
</projectlist>

View File

@ -19,7 +19,7 @@ Please provide the rule name and a link to the rule documentation:
**Code Sample demonstrating the issue:**
```
```java
```

View File

@ -19,7 +19,7 @@ Please provide the rule name and a link to the rule documentation:
**Code Sample demonstrating the issue:**
```
```java
```

View File

@ -17,7 +17,7 @@ assignees: ''
**Code Sample:** This should include code, that should be flagged by the rule. If possible, the "correct" code
according to this new rule should also be demonstrated.
```
```java
```

View File

@ -25,7 +25,7 @@ A clear and concise description of what the bug is.
**Code Sample demonstrating the issue:**
```
```java
```

View File

@ -15,9 +15,17 @@ on:
- cron: '0 4 1 * *'
workflow_dispatch:
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
build:
runs-on: ${{ matrix.os }}
permissions:
# read to fetch code (actions/checkout)
# write to push code to gh-pages, create releases
# note: forked repositories will have maximum read access
contents: write
continue-on-error: false
strategy:
matrix:

View File

@ -10,6 +10,9 @@ on:
- '**'
workflow_dispatch:
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
build:
runs-on: ubuntu-latest

1
.gitignore vendored
View File

@ -21,3 +21,4 @@ node_modules
# rule docs are generated
docs/pages/pmd/rules
.history/*

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', branch: 'master'
gem 'pmdtester', :git => 'https://github.com/pmd/pmd-regression-tester.git', branch: 'master'
gem 'pmdtester'
#gem 'pmdtester'
gem 'danger'
# This group is only needed for rendering release notes (docs/render_release_notes.rb)

View File

@ -1,8 +1,21 @@
GIT
remote: https://github.com/pmd/pmd-regression-tester.git
revision: 3b26e7fc28203f5ea4f1cb840d990ad7f28b5491
branch: master
specs:
pmdtester (1.5.2.pre.SNAPSHOT)
differ (~> 0.1)
liquid (~> 5.2)
logger-colors (~> 1.0)
nokogiri (~> 1.13)
rufus-scheduler (~> 3.8)
slop (~> 4.6)
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
claide (1.1.0)
claide-plugins (0.9.2)
cork
@ -12,7 +25,7 @@ GEM
concurrent-ruby (1.1.10)
cork (0.3.0)
colored2 (~> 3.1)
danger (8.6.1)
danger (9.0.0)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
@ -23,12 +36,12 @@ GEM
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.0)
no_proxy_fix
octokit (~> 4.7)
octokit (~> 5.0)
terminal-table (>= 1, < 4)
differ (0.1.2)
et-orbi (1.2.7)
tzinfo
faraday (1.10.0)
faraday (1.10.2)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
@ -43,7 +56,7 @@ GEM
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-http-cache (2.4.0)
faraday-http-cache (2.4.1)
faraday (>= 0.8)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
@ -53,41 +66,35 @@ GEM
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
fugit (1.5.3)
fugit (1.7.1)
et-orbi (~> 1, >= 1.2.7)
raabro (~> 1.4)
git (1.11.0)
git (1.12.0)
addressable (~> 2.8)
rchardet (~> 1.8)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (5.3.0)
liquid (5.4.0)
logger-colors (1.0.0)
mini_portile2 (2.8.0)
multipart-post (2.2.3)
nap (1.1.0)
no_proxy_fix (0.1.2)
nokogiri (1.13.7)
nokogiri (1.13.9)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
octokit (4.25.1)
octokit (5.6.1)
faraday (>= 1, < 3)
sawyer (~> 0.9)
open4 (1.3.4)
pmdtester (1.5.1)
differ (~> 0.1)
liquid (~> 5.2)
logger-colors (~> 1.0)
nokogiri (~> 1.13)
rufus-scheduler (~> 3.8)
slop (~> 4.6)
public_suffix (4.0.7)
public_suffix (5.0.0)
raabro (1.4.0)
racc (1.6.0)
rchardet (1.8.0)
rexml (3.2.5)
rouge (3.29.0)
rouge (4.0.0)
ruby2_keywords (0.0.5)
rufus-scheduler (3.8.2)
fugit (~> 1.1, >= 1.1.6)
@ -95,12 +102,12 @@ GEM
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
slop (4.9.2)
slop (4.9.3)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
unicode-display_width (2.2.0)
unicode-display_width (2.3.0)
PLATFORMS
ruby
@ -108,7 +115,7 @@ PLATFORMS
DEPENDENCIES
danger
liquid
pmdtester
pmdtester!
rouge
safe_yaml

View File

@ -17,7 +17,8 @@ It uses JavaCC and Antlr to parse source files into abstract syntax trees (AST)
Rules can be written in Java or using a XPath query.
It supports Java, JavaScript, Salesforce.com Apex and Visualforce,
Modelica, PLSQL, Apache Velocity, XML, XSL, Scala.
Modelica, PLSQL, Apache Velocity, XML, XSL.
Scala is supported, but there are currently no Scala rules available.
Additionally it includes **CPD**, the copy-paste-detector. CPD finds duplicated code in
C/C++, C#, Dart, Fortran, Go, Groovy, Java, JavaScript, JSP, Kotlin, Lua, Matlab, Modelica,

View File

@ -116,7 +116,7 @@ echo "* Days since last release: $(( ( $(date +%s) - $(git log --max-count=1 --f
)
TEMP_RELEASE_NOTES=$(cat docs/pages/release_notes.md)
TEMP_RELEASE_NOTES=${TEMP_RELEASE_NOTES/\{\% endtocmaker \%\}/$STATS$'\n'$'\n'\{\% endtocmaker \%\}$'\n'}
TEMP_RELEASE_NOTES=${TEMP_RELEASE_NOTES/\{\% endtocmaker \%\}/${STATS//\&/\\\&}$'\n'$'\n'\{\% endtocmaker \%\}$'\n'}
echo "${TEMP_RELEASE_NOTES}" > docs/pages/release_notes.md
echo

View File

@ -1,20 +1,20 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (6.0.5.1)
activesupport (6.0.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.11.1)
colorator (1.1.0)
commonmarker (0.23.5)
commonmarker (0.23.6)
concurrent-ruby (1.1.10)
dnsruby (1.61.9)
simpleidn (~> 0.1)
@ -25,10 +25,10 @@ GEM
ffi (>= 1.15.0)
eventmachine (1.2.7)
execjs (2.8.1)
faraday (2.3.0)
faraday-net_http (~> 2.0)
faraday (2.6.0)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (2.0.3)
faraday-net_http (3.0.1)
ffi (1.15.5)
forwardable-extended (2.6.0)
gemoji (3.0.1)
@ -83,7 +83,7 @@ GEM
octokit (~> 4.0)
public_suffix (>= 3.0, < 5.0)
typhoeus (~> 1.3)
html-pipeline (2.14.2)
html-pipeline (2.14.3)
activesupport (>= 2)
nokogiri (>= 1.4)
http_parser.rb (0.8.0)
@ -211,8 +211,8 @@ GEM
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
minitest (5.16.2)
nokogiri (1.13.7)
minitest (5.16.3)
nokogiri (1.13.9)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
octokit (4.25.1)
@ -222,7 +222,7 @@ GEM
forwardable-extended (~> 2.6)
public_suffix (4.0.7)
racc (1.6.0)
rb-fsevent (0.11.1)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.5)
@ -251,7 +251,7 @@ GEM
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (1.8.0)
zeitwerk (2.6.0)
zeitwerk (2.6.1)
PLATFORMS
ruby

View File

@ -2,7 +2,7 @@ repository: pmd/pmd
pmd:
version: 7.0.0-SNAPSHOT
previous_version: 6.49.0
previous_version: 6.51.0
date: ??-?????-2022
release_type: major

View File

@ -23,7 +23,7 @@ entries:
output: web, pdf
type: homepage
- title: Release notes
url: /pmd_release_notes.html
url: /pmd_release_notes7.html
output: web, pdf
- title: PMD 7.0.0 development
url: /pmd_next_major_development.html
@ -58,6 +58,9 @@ entries:
- title: PMD Report formats
url: /pmd_userdocs_report_formats.html
output: web, pdf
- title: 3rd party rulesets
output: web, pdf
url: /pmd_userdocs_3rdpartyrulesets.html
- title: null
output: web, pdf
subfolders:
@ -316,6 +319,15 @@ entries:
- title: Security
output: web, pdf
url: /pmd_rules_vf_security.html
- title: null
output: web, pdf
subfolders:
- title: Scala Rules
output: web, pdf
subfolderitems:
- title: Index
output: web, pdf
url: /pmd_rules_scala.html
- title: null
output: web, pdf
subfolders:
@ -349,6 +361,15 @@ entries:
- title: Error Prone
output: web, pdf
url: /pmd_rules_vm_errorprone.html
- title: null
output: web, pdf
subfolders:
- title: WSDL Rules
output: web, pdf
subfolderitems:
- title: Index
output: web, pdf
url: /pmd_rules_wsdl.html
- title: null
output: web, pdf
subfolders:
@ -382,18 +403,9 @@ entries:
- title: Apex
url: /pmd_languages_apex.html
output: web, pdf
- title: null
- title: Java
url: /pmd_languages_java.html
output: web, pdf
subfolders:
- title: Java
output: web, pdf
subfolderitems:
- title: Java Support
url: /pmd_languages_java.html
output: web, pdf
- title: Java Versions
url: /pmd_languages_java_versions.html
output: web, pdf
- title: JSP
url: /pmd_languages_jsp.html
output: web, pdf
@ -502,6 +514,9 @@ entries:
- title: Old release notes
url: /pmd_release_notes_old.html
output: web, pdf
- title: Decisions
url: /pmd_projectdocs_decisions.html
output: web, pdf
- title: null
output: web, pdf
subfolders:

View File

@ -0,0 +1,54 @@
{% assign linux_cmd_blob = '' %}
{% assign linux_split_cmds = include.linux | newline_to_br | strip_newlines | split: '<br />' %}
{% assign raw_output = false %}
{% for linux_raw_cmd in linux_split_cmds %}
{% assign linux_cmd = linux_raw_cmd | strip | split: ' ' | first %}
{% assign linux_tail = linux_raw_cmd | strip | remove_first: linux_cmd %}
{% if linux_cmd == nil %}
{% assign raw_output = true %}
{% endif %}
{% if raw_output %}
{% capture linux_cmd_blob %}{{linux_cmd_blob}}{{linux_cmd}}{{linux_tail}}
{% endcapture %}
{% else %}
{% capture linux_cmd_blob %}{{linux_cmd_blob}}<span class="gp">~ $ </span><span class="s2">{{linux_cmd}}</span>{{linux_tail}}
{% endcapture %}
{% endif %}
{% endfor %}
{% assign windows_cmd_blob = '' %}
{% assign windows_split_cmds = include.windows | newline_to_br | strip_newlines | split: '<br />' %}
{% assign raw_output = false %}
{% for windows_raw_cmd in windows_split_cmds %}
{% assign windows_cmd = windows_raw_cmd | strip | split: ' ' | first %}
{% assign windows_tail = windows_raw_cmd | strip | remove_first: windows_cmd %}
{% if windows_cmd == nil %}
{% assign raw_output = true %}
{% endif %}
{% if raw_output == true %}
{% capture windows_cmd_blob %}{{windows_cmd_blob}}{{windows_cmd}}{{windows_tail}}
{% endcapture %}
{% else %}
{% capture windows_cmd_blob %}{{windows_cmd_blob}}<span class="gp">C:\&gt; </span><span class="s2">{{windows_cmd}}</span>{{windows_tail}}
{% endcapture %}
{% endif %}
{% endfor %}
<div class="text-left">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link active" id="linux-tab-{{include.id}}" data-toggle="tab" href="#linux-{{include.id}}" role="tab" aria-controls="linux" aria-selected="true">Linux / macOS</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="windows-tab-{{include.id}}" data-toggle="tab" href="#windows-{{include.id}}" role="tab" aria-controls="windows" aria-selected="false">Windows</a>
</li>
</ul>
<div class="tab-content border">
<div class="tab-pane fade show active" id="linux-{{include.id}}" role="tabpanel" aria-labelledby="linux-tab">
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">{{linux_cmd_blob}}</code></pre></figure>
</div>
<div class="tab-pane fade" id="windows-{{include.id}}" role="tabpanel" aria-labelledby="windows-tab">
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">{{windows_cmd_blob}}</code></pre></figure>
</div>
</div>
</div>

View File

@ -99,7 +99,7 @@ class JDocNamespaceDeclaration < Liquid::Tag
private
JDOC_NAMESPACE_MAP = "jdoc_nspaces"
RESERVED_NSPACES = ['apex', 'core', 'cpp', 'cs', 'dart', 'dist', 'doc', 'fortran', 'go', 'groovy', 'java',
RESERVED_NSPACES = ['ant', 'apex', 'core', 'cpp', 'cs', 'dart', 'dist', 'doc', 'fortran', 'go', 'groovy', 'java',
'javascript', 'jsp',
'kotlin', 'lua', 'matlab', 'objectivec', 'perl', 'php', 'plsql', 'python', 'ruby', 'scala', 'swift',
'test', 'test-schema', 'ui',

View File

@ -7,7 +7,7 @@ summary: >
Welcome to the documentation site for PMD and CPD! <br/><br/>
last_updated: August 2017
last_updated: October 2022
author: Jeff Jensen <jjensen@apache.org>, Andreas Dangel <andreas.dangel@adangel.org>,
Clément Fournier <clement.fournier76@gmail.com>
@ -26,7 +26,7 @@ additional_js:
**PMD** is a static source code analyzer. It finds common programming flaws like
unused variables, empty catch blocks, unnecessary object creation, and
so forth. It's mainly concerned with **Java and Apex**, but **supports six other
so forth. It's mainly concerned with **Java and Apex**, but **supports 14 other
languages**.
PMD features many **built-in checks** (in PMD lingo, *rules*), which are documented

View File

@ -1,6 +1,6 @@
---
title: PMD Release Notes
permalink: pmd_release_notes.html
permalink: pmd_release_notes7.html
keywords: changelog, release notes
---
@ -19,15 +19,71 @@ This is a {{ site.pmd.release_type }} release.
### New and noteworthy
#### CLI improvements
#### Revamped Command Line Interface
The PMD CLI has been enhanced with a progress bar, which interactively displays the
PMD now ships with a unified Command Line Interface for both Linux/Unix and Windows. Instead of having a collection of scripts
for the different utilities shipped with PMD, a single script `pmd` (`pmd.bat` for Windows) can now launch all
utilities using subcommands, e.g. `pmd check`, `pmd designer`. All commands and options are thoroughly documented in the help,
with full color support where available. Moreover, efforts were made to provide consistency in the usage of all PMD utilities.
```shell
$ Usage: pmd [-hV] [COMMAND]
-h, --help Show this help message and exit.
-V, --version Print version information and exit.
Commands:
check The PMD standard source code analyzer
cpd Copy/Paste Detector - find duplicate code
designer The PMD visual rule designer
cpd-gui GUI for the Copy/Paste Detector
Warning: May not support the full CPD feature set
ast-dump Experimental: dumps the AST of parsing source code
Exit Codes:
0 Succesful analysis, no violations found
1 An unexpected error occurred during execution
2 Usage error, please refer to the command help
4 Successful analysis, at least 1 violation found
```
For instance, where you previously would have run
```shell
run.sh pmd -d src -R ruleset.xml
```
you should now use
```shell
pmd check -d src -R ruleset.xml
```
or even better, omit using `-d` / `--dir` and simply pass the sources at the end of the parameter list
```shell
pmd check -R ruleset.xml src
```
Multiple source directories can passed, such as:
```shell
pmd check -R ruleset.xml src/main/java src/test/java
```
And the exact same applies to CPD:
```shell
pmd cpd --minimum-tokens 100 src/main/java
```
Additionally, the CLI for the `check` command has been enhanced with a progress bar, which interactively displays the
current progress of the analysis.
TODO screenshot (take it right before releasing, because other changes to the CLI will occur until then)
This can be disabled with the `--no-progress` flag.
Finally, we now provide a completion script for Bash/Zsh to further help daily usage.
This script can be found under `shell/pmd-completion.sh` in the binary distribution.
To use it, edit your `~/.bashrc` / `~/.zshrc` file and add the following line:
```
source *path_to_pmd*/shell/pmd-completion.sh
```
#### Full Antlr support
Languages backed by an Antlr grammar are now fully supported. This means, it's now possible not only to use Antlr grammars for CPD,
@ -184,6 +240,8 @@ The following previously deprecated rules have been finally removed:
* miscellaneous
* [#896](https://github.com/pmd/pmd/issues/896): \[all] Use slf4j
* [#1451](https://github.com/pmd/pmd/issues/1451): \[core] RulesetFactoryCompatibility stores the whole ruleset file in memory as a string
* ant
* [#4080](https://github.com/pmd/pmd/issues/4080): \[ant] Split off Ant integration into a new submodule
* core
* [#4035](https://github.com/pmd/pmd/issues/4035): \[core] ConcurrentModificationException in DefaultRuleViolationFactory
* cli
@ -284,6 +342,11 @@ The following previously deprecated rules have been finally removed:
`net.sourceforge.pmd.lang.rule.xpath`, `net.sourceforge.pmd.lang.rule`, and various language-specific packages
(which were made internal).
* The implementation of the Ant integration has been moved from the module `pmd-core` to a new module `pmd-ant`.
This involves classes in package {% jdoc_package ant::ant %}. The ant CPDTask class `net.sourceforge.pmd.cpd.CPDTask`
has been moved into the same package {% jdoc_package ant::ant %}. You'll need to update your taskdef entries in your
build.xml files with the FQCN {% jdoc !!ant::ant.CPDTask %} if you use it anywhere.
#### Metrics framework
The metrics framework has been made simpler and more general.

View File

@ -246,6 +246,16 @@ 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.51.0
No changes.
#### 6.50.0
##### CPD CLI
* CPD now supports the `--ignore-literal-sequences` argument when analyzing Lua code.
#### 6.49.0
##### Deprecated API

View File

@ -9,37 +9,50 @@ permalink: pmd_devdocs_experimental_ast_dump.html
## Command line usage
```shell
$ run.sh ast-dump --help
Usage: ast-dump [options]
Options:
--encoding, -e
Encoding of the source file.
Default: UTF-8
--file
The file to dump
--format, -f
The output format.
Default: xml
--help, -h
Display usage.
--language, -l
Specify the language to use.
Default: java
--read-stdin, -i
Read source from standard input
Default: false
-P
Properties for the renderer.
Syntax: -Pkey=value
Default: {}
Available languages: apex ecmascript java jsp modelica plsql pom scala text vf vm wsdl xml xsl
Available formats: xml XML format with the same structure as the one used in XPath
+ Properties
+ singleQuoteAttributes Use single quotes to delimit attribute values (default true)
+ lineSeparator Line separator to use. The default is platform-specific. (default \n)
+ renderProlog True to output a prolog (default true)
+ renderCommonAttributes True to render attributes like BeginLine, EndLine, etc. (default false)
$ pmd ast-dump --help
Usage: pmd ast-dump [-Dhi] [-e=<encoding>] [-f=<format>] [--file=<file>]
[-l=<language>] [-P=<String=String>]...
Experimental: dumps the AST of parsing source code
-D, -v, --debug, --verbose
Debug mode.
-e, --encoding=<encoding>
Specifies the character set encoding of the source
code files
-f, --format=<format> The output format.
Valid values: xml, text
--file=<file> The file to parse and dump.
-h, --help Show this help message and exit.
-i, --read-stdin Read source from standard input.
-l, --language=<language>
The source code language.
Valid values: apex, ecmascript, html, java, jsp,
kotlin, modelica, plsql, pom, scala, swift, vf, vm,
wsdl, xml, xsl
-P=<String=String> Key-value pair defining a property for the report
format.
Supported values for each report format:
xml:
singleQuoteAttributes - Use single quotes to
delimit attribute values
Default: true
lineSeparator - Line separator to use. The default
is platform-specific. The values 'CR', 'CRLF',
'LF', '\r', '\r\n' and '\n' can be used to
represent a carriage return, line feed and their
combination more easily.
Default: \n
renderProlog - True to output a prolog
Default: true
renderCommonAttributes - True to render attributes
like BeginLine, EndLine, etc.
Default: false
text:
onlyAsciiChars - Use only ASCII characters in the
structure
Default: false
maxLevel - Max level on which to recurse. Negative
means unbounded
Default: -1
```
## Example
@ -50,12 +63,7 @@ public class Foo {
int a;
}
$ run.sh ast-dump --format xml --language java --file Foo.java > Foo.xml
-------------------------------------------------------------------------------
This command line utility is experimental. It might change at any time without
prior notice.
-------------------------------------------------------------------------------
$ pmd ast-dump --format xml --language java --file Foo.java > Foo.xml
$ cat Foo.xml
<?xml version='1.0' encoding='UTF-8' ?>
<CompilationUnit Image='' PackageName='' declarationsAreInDefaultPackage='true'>

View File

@ -41,7 +41,7 @@ In order to analyze a project with PMD that uses preview language features, you'
it via the environment variable `PMD_JAVA_OPTS` and select the new language version, e.g. `19-preview`:
export PMD_JAVA_OPTS=--enable-preview
./run.sh pmd -language java -version 19-preview ...
pmd check --use-version java-19-preview ...
Note: we only support preview language features for the latest two java versions.

View File

@ -1,39 +0,0 @@
---
title: Supported Java Versions
permalink: pmd_languages_java_versions.html
---
## Overview of supported Java language versions
Usually the latest non-preview Java Version is the default version.
Java Version |Alias | Supported by PMD since |
-------------|------|------------------------|
18-preview | | 6.44.0 |
18 (default) | | 6.44.0 |
17-preview | | 6.37.0 |
17 | | 6.37.0 |
16 | | 6.32.0 |
15 | | 6.27.0 |
14 | | 6.22.0 |
13 | | 6.18.0 |
12 | | 6.13.0 |
11 | | 6.6.0 |
10 | 1.10 | 6.4.0 |
9 | 1.9 | 6.0.0 |
8 | 1.8 | 5.1.0 |
7 | 1.7 | 5.0.0 |
6 | 1.6 | 3.9 |
5 | 1.5 | 3.0 |
1.4 | | 1.2.2 |
1.3 | | 1.0.0 |
## Using Java preview features
In order to analyze a project with PMD that uses preview language features, you'll need to enable
it via the environment variable `PMD_JAVA_OPTS` and select the new language version, e.g. `18-preview`:
export PMD_JAVA_OPTS=--enable-preview
./run.sh pmd -language java -version 18-preview ...
Note: we only support preview language features for the latest two java versions.

View File

@ -31,7 +31,7 @@ We'll probably extend the CLI instead of relying on environment variables in a f
```
PMD_VF_APEXDIRECTORIES=../classes \
PMD_VF_OBJECTSDIRECTORIES=../objects \
run.sh pmd -d $GITHUB_WORKSPACE/force-app/main/default/pages \
pmd check -d $GITHUB_WORKSPACE/force-app/main/default/pages \
-R category/vf/security.xml/VfUnescapeEl -f text
```

View File

@ -31,7 +31,7 @@ Some XML-based file formats do not conventionally use a `.xml` extension. To ass
these files with the XML language, you need to use the `--force-language xml` command-line
arguments, for instance:
```
$ ./run.sh pmd -d /home/me/src/xml-file.ext -f text -R ruleset.xml --force-language xml
$ pmd check -d /home/me/src/xml-file.ext -f text -R ruleset.xml --force-language xml
```
Please refer to [PMD CLI reference](pmd_userdocs_cli_reference.html#analyze-other-xml-formats)
for more examples.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
---
title: Architecture Decisions
sidebar: pmd_sidebar
permalink: pmd_projectdocs_decisions.html
last_updated: July 2022
---
<ul>
{% for page in site.pages %}
{% if page.adr == true and page.adr_status != "" %}
<li><a href="{{ page.permalink }}">{{ page.title }}</a> ({{ page.adr_status }})</li>
{% endif %}
{% endfor %}
</ul>

View File

@ -0,0 +1,70 @@
---
title: ADR 1 - Use architecture decision records
sidebar: pmd_sidebar
permalink: pmd_projectdocs_decisions_adr_1.html
sidebaractiveurl: /pmd_projectdocs_decisions.html
adr: true
# Proposed / Accepted / Deprecated / Superseded
adr_status: "Accepted"
last_updated: September 2022
---
# Context
PMD has grown over 20 years as an open-source project. Along the way many decisions have been made, but they are not
explicitly documented. PMD is also developed by many individuals and the original developers might
not even be around anymore.
Without having documentation records about decisions it is hard for new developers to understand the reasons
of past decisions. This might lead to either ignore these past (unknown) decisions and change it without
fully understanding its consequences. This could create new issues down the road, e.g. a decision supporting
a requirement that is not tested.
On the other hand, accepting the past decisions without challenging it might slow down the project and
possible innovations. It could lead to a situation where the developers are afraid to change anything
in order to not break the system.
Past decisions have been made within context and the context can change. Therefore, past decisions can still be
valid today, or they don't apply anymore. In that case, the decision should be revisited.
See also the blog post [Documenting Architecture Decisions](https://cognitect.com/blog/2011/11/15/documenting-architecture-decisions)
by Michael Nygard.
There are many templates around to choose from. <https://github.com/joelparkerhenderson/architecture-decision-record>
gives a nice summary. The page <https://adr.github.io/> gives a good overview on ADR and for adr-related tooling.
# Decision
We will document the decisions we make as a project as a collection of "Architecture Decision Records".
In order to keep it simple, we will use only a simple template proposed by Michael Nygard.
The documents are stored together with the source code and are part of the generated documentation site.
A new ADR should be proposed with a pull request to open the discussion.
The initial status of the new ADR is "Proposed". When maintainer consensus is reached during the PR
review, then the status is changed to "Accepted" when the PR is merged.
A new entry in the "Change History" section should be added, when the PR is merged.
In order to propose a change to an existing ADR a new pull request should be opened which modifies the ADR.
The change can be to amend the ADR or to challenge it and maybe deprecate it. A new entry in the
"Change History" section should be added to summary the change. When maintainer consensus is reached
during the PR review, then the PR can be merged and the ADR is updated.
# Status
{{ page.adr_status }} (Last updated: {{ page.last_updated }})
# Consequences
Explicitly documenting decisions has the benefit that new developers joining the projects know about the decisions
and can read the context and consequences of the decisions. This will likely also improve the overall quality
as the decisions need to be formulated and written down. Everybody is on the same page.
However, this also adds additional tasks, and it takes time to write down and document the decisions.
# Change History
2022-09-30: Status changed to "Accepted".
2022-09-06: Added section "Change History" to the template. Added "Last updated" to "Status" section.
2022-07-28: Proposed initial version.

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