Merge branch '7.0.x' into violation-decorators

This commit is contained in:
Clément Fournier
2022-07-19 16:34:52 +02:00
708 changed files with 31126 additions and 16855 deletions

View File

@ -3267,7 +3267,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/24591067?v=4",
"profile": "https://github.com/jborgers",
"contributions": [
"bug"
"bug",
"code"
]
},
{
@ -3384,7 +3385,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/242337?v=4",
"profile": "https://github.com/jjlharrison",
"contributions": [
"bug"
"bug",
"code"
]
},
{
@ -6584,6 +6586,178 @@
"contributions": [
"code"
]
},
{
"login": "jasonqiu98",
"name": "Jason Qiu",
"avatar_url": "https://avatars.githubusercontent.com/u/26801257?v=4",
"profile": "https://github.com/jasonqiu98",
"contributions": [
"code",
"doc"
]
},
{
"login": "laoseth",
"name": "Seth Wilcox",
"avatar_url": "https://avatars.githubusercontent.com/u/16923065?v=4",
"profile": "https://github.com/laoseth",
"contributions": [
"code"
]
},
{
"login": "LiGaOg",
"name": "LiGaOg",
"avatar_url": "https://avatars.githubusercontent.com/u/72175888?v=4",
"profile": "https://github.com/LiGaOg",
"contributions": [
"code"
]
},
{
"login": "Scrsloota",
"name": "Scrsloota",
"avatar_url": "https://avatars.githubusercontent.com/u/91131546?v=4",
"profile": "https://github.com/Scrsloota",
"contributions": [
"code"
]
},
{
"login": "VoidxHoshi",
"name": "LaLucid",
"avatar_url": "https://avatars.githubusercontent.com/u/55886143?v=4",
"profile": "https://github.com/VoidxHoshi",
"contributions": [
"code"
]
},
{
"login": "naveensrinivasan",
"name": "Naveen",
"avatar_url": "https://avatars.githubusercontent.com/u/172697?v=4",
"profile": "https://naveensrinivasan.dev/",
"contributions": [
"code"
]
},
{
"login": "lukelukes",
"name": "lukelukes",
"avatar_url": "https://avatars.githubusercontent.com/u/45536418?v=4",
"profile": "https://github.com/lukelukes",
"contributions": [
"code"
]
},
{
"login": "vibhory2j",
"name": "Vibhor Goyal",
"avatar_url": "https://avatars.githubusercontent.com/u/15845016?v=4",
"profile": "https://github.com/vibhory2j",
"contributions": [
"bug"
]
},
{
"login": "Ramel0921",
"name": "Ramel0921",
"avatar_url": "https://avatars.githubusercontent.com/u/104978096?v=4",
"profile": "https://github.com/Ramel0921",
"contributions": [
"bug"
]
},
{
"login": "flyhard",
"name": "Per Abich",
"avatar_url": "https://avatars.githubusercontent.com/u/409466?v=4",
"profile": "https://github.com/flyhard",
"contributions": [
"code"
]
},
{
"login": "filipponova",
"name": "Filippo Nova",
"avatar_url": "https://avatars.githubusercontent.com/u/12506636?v=4",
"profile": "https://github.com/filipponova",
"contributions": [
"bug"
]
},
{
"login": "dalizi007",
"name": "dalizi007",
"avatar_url": "https://avatars.githubusercontent.com/u/90743616?v=4",
"profile": "https://github.com/dalizi007",
"contributions": [
"code"
]
},
{
"login": "shiomiyan",
"name": "shiomiyan",
"avatar_url": "https://avatars.githubusercontent.com/u/35842766?v=4",
"profile": "https://github.com/shiomiyan",
"contributions": [
"doc"
]
},
{
"login": "lgemeinhardt",
"name": "lgemeinhardt",
"avatar_url": "https://avatars.githubusercontent.com/u/1395165?v=4",
"profile": "https://github.com/lgemeinhardt",
"contributions": [
"bug"
]
},
{
"login": "HaelC",
"name": "Haoliang Chen",
"avatar_url": "https://avatars.githubusercontent.com/u/16898273?v=4",
"profile": "https://haelchan.me/",
"contributions": [
"bug"
]
},
{
"login": "FSchliephacke",
"name": "FSchliephacke",
"avatar_url": "https://avatars.githubusercontent.com/u/10260493?v=4",
"profile": "https://github.com/FSchliephacke",
"contributions": [
"bug"
]
},
{
"login": "stokpop",
"name": "Peter Paul Bakker",
"avatar_url": "https://avatars.githubusercontent.com/u/8797018?v=4",
"profile": "https://www.stokpop.nl/",
"contributions": [
"code"
]
},
{
"login": "ASBrouwers",
"name": "ASBrouwers",
"avatar_url": "https://avatars.githubusercontent.com/u/23551289?v=4",
"profile": "https://github.com/ASBrouwers",
"contributions": [
"code"
]
},
{
"login": "341816041",
"name": "茅延安",
"avatar_url": "https://avatars.githubusercontent.com/u/100549608?v=4",
"profile": "https://github.com/341816041",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,

View File

@ -245,12 +245,15 @@ ${rendered_release_notes}"
# Runs the dogfood ruleset with the currently built pmd against itself
#
function pmd_ci_dogfood() {
local mpmdVersion=()
./mvnw versions:set -DnewVersion="${PMD_CI_MAVEN_PROJECT_VERSION}-dogfood" -DgenerateBackupPoms=false
sed -i 's/<version>[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}.*<\/version>\( *<!-- pmd.dogfood.version -->\)/<version>'"${PMD_CI_MAVEN_PROJECT_VERSION}"'<\/version>\1/' pom.xml
if [ "${PMD_CI_MAVEN_PROJECT_VERSION}" = "7.0.0-SNAPSHOT" ]; then
sed -i 's/pmd-dogfood-config\.xml/pmd-dogfood-config7.xml/' pom.xml
mpmdVersion=(-Denforcer.skip=true -Dpmd.plugin.version=3.18.0-pmd7-SNAPSHOT)
fi
./mvnw verify --show-version --errors --batch-mode --no-transfer-progress "${PMD_MAVEN_EXTRA_OPTS[@]}" \
"${mpmdVersion[@]}" \
-DskipTests \
-Dmaven.javadoc.skip=true \
-Dmaven.source.skip=true \

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<projectlist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="projectlist_1_1_0.xsd">
xsi:noNamespaceSchemaLocation="projectlist_1_1_0.xsd">
<description>Standard Projects</description>
<project>
@ -40,6 +40,11 @@ mvn dependency:build-classpath -DincludeScope=test -Dmdep.outputFile=classpath.t
<exclude-pattern>.*/build/generated-sources/.*</exclude-pattern>
<build-command><![CDATA[#!/usr/bin/env bash
## Skip gradle execution
if test -e classpath.txt; then
exit
fi
set -e
# Make sure to use java11. This is already installed by build.sh
@ -129,11 +134,6 @@ index 6021fa574d..15d29ed699 100644
EOF
) | patch --strip=1
## Skip gradle execution
if test -e classpath.txt; then
exit
fi
./gradlew --console=plain --build-cache --no-daemon --max-workers=4 build testClasses -x test -x javadoc -x api -x asciidoctor -x asciidoctorPdf
./gradlew --console=plain --build-cache --no-daemon --max-workers=4 createSquishClasspath -q > classpath.txt
]]></build-command>
@ -151,23 +151,15 @@ fi
<project>
<name>Schedul-o-matic-9000</name>
<type>git</type>
<connection>https://github.com/pmd/Schedul-o-matic-9000</connection>
<!--
<connection>https://github.com/SalesforceLabs/Schedul-o-matic-9000</connection>
Note: using forked repo from pmd, as original repo doesn't have any useful tags/branches
-->
<tag>pmd-regression-test</tag>
<tag>6b1229ba43b38931fbbab5924bc9b9611d19a786</tag>
</project>
<project>
<name>fflib-apex-common</name>
<type>git</type>
<connection>https://github.com/pmd/fflib-apex-common</connection>
<!--
<connection>https://github.com/apex-enterprise-patterns/fflib-apex-common</connection>
Note: using forked repo from pmd, as original repo doesn't have any useful tags/branches
-->
<tag>pmd-regression-test</tag>
<tag>7e0891efb86d23de62811af56d87d0959082a322</tag>
</project>
<project>

View File

@ -27,7 +27,7 @@ function git_repo_sync() {
pmd_ci_log_group_start "Git Sync"
git remote add pmd-sf "${PMD_SF_USER}@git.code.sf.net:/p/pmd/code"
if [ -n "${PMD_CI_BRANCH}" ]; then
git push pmd-sf "${PMD_CI_BRANCH}:${PMD_CI_BRANCH}"
retry 5 git push pmd-sf "${PMD_CI_BRANCH}:${PMD_CI_BRANCH}"
pmd_ci_log_success "Successfully pushed ${PMD_CI_BRANCH} to sourceforge"
elif [ -n "${PMD_CI_TAG}" ]; then
git push pmd-sf tag "${PMD_CI_TAG}"
@ -39,6 +39,43 @@ function git_repo_sync() {
pmd_ci_log_group_end
}
#
# From: https://gist.github.com/sj26/88e1c6584397bb7c13bd11108a579746
#
# Retry a command up to a specific number of times until it exits successfully,
# with exponential back off.
#
# $ retry 5 echo Hello
# Hello
#
# $ retry 5 false
# Retry 1/5 exited 1, retrying in 1 seconds...
# Retry 2/5 exited 1, retrying in 2 seconds...
# Retry 3/5 exited 1, retrying in 4 seconds...
# Retry 4/5 exited 1, retrying in 8 seconds...
# Retry 5/5 exited 1, no more retries left.
#
function retry {
local retries=$1
shift
local count=0
until "$@"; do
exit=$?
wait=$((2 ** $count))
count=$(($count + 1))
if [ $count -lt $retries ]; then
echo "Retry $count/$retries exited $exit, retrying in $wait seconds..."
sleep $wait
else
echo "Retry $count/$retries exited $exit, no more retries left."
return $exit
fi
done
return 0
}
git_repo_sync
exit 0

View File

@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.m2/repository
@ -46,7 +46,7 @@ jobs:
run: |
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
echo "MAVEN_OPTS=-Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3 -DautoReleaseAfterClose=true -DstagingProgressTimeoutMinutes=30" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/17/scripts" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/18/scripts" >> $GITHUB_ENV
- name: Check Environment
shell: bash
run: |

View File

@ -22,7 +22,7 @@ jobs:
shell: bash
run: |
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/17/scripts" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/18/scripts" >> $GITHUB_ENV
- name: Sync
run: .ci/git-repo-sync.sh
shell: bash

View File

@ -2,6 +2,9 @@ name: troubleshooting
on: workflow_dispatch
permissions:
contents: read
jobs:
build:
runs-on: ${{ matrix.os }}
@ -13,7 +16,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.m2/repository
@ -33,7 +36,7 @@ jobs:
run: |
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
echo "MAVEN_OPTS=-Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3 -DstagingProgressTimeoutMinutes=30" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/17/scripts" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/18/scripts" >> $GITHUB_ENV
- name: Check Environment
shell: bash
run: |

View File

@ -14,5 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.5/apache-maven-3.8.5-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar

View File

@ -42,7 +42,7 @@ def run_pmdtester
@base_branch = 'master'
@logger.info "\n\n--------------------------------------"
@logger.info "Run against #{@base_branch}"
@summary = PmdTester::Runner.new(get_args(@base_branch)).run
@summary = PmdTester::Runner.new(get_args(@base_branch, FALSE, 'target/diff1/patch_config.xml')).run
# move the generated report out of the way
FileUtils.mv 'target/reports/diff', 'target/diff2'

View File

@ -12,7 +12,7 @@ GEM
concurrent-ruby (1.1.10)
cork (0.3.0)
colored2 (~> 3.1)
danger (8.5.0)
danger (8.6.1)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
@ -53,12 +53,12 @@ GEM
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
fugit (1.5.2)
et-orbi (~> 1.1, >= 1.1.8)
fugit (1.5.3)
et-orbi (~> 1, >= 1.2.7)
raabro (~> 1.4)
git (1.10.2)
git (1.11.0)
rchardet (~> 1.8)
kramdown (2.3.2)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
@ -68,21 +68,21 @@ GEM
multipart-post (2.1.1)
nap (1.1.0)
no_proxy_fix (0.1.2)
nokogiri (1.13.3)
nokogiri (1.13.6)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
octokit (4.22.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
open4 (1.3.4)
pmdtester (1.4.0)
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.6)
public_suffix (4.0.7)
raabro (1.4.0)
racc (1.6.0)
rchardet (1.8.0)
@ -95,7 +95,7 @@ GEM
sawyer (0.8.2)
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
slop (4.9.1)
slop (4.9.2)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
tzinfo (2.0.4)

View File

@ -8,7 +8,7 @@
- lang-name: matches the grammar name (eg "Swift")
- lang-terse-name: uncapitalized package name (eg "swift")
- node-prefix: prefix for generated AST nodes (eg "Sw")
- root-node-name: name of the root node (eg "TopLevel"), will be made to implement RootNode
- root-node-name: name of the root node without prefix (eg "TopLevel"), will be made to implement RootNode
See AntlrGeneratedParserBase
@ -31,9 +31,45 @@
<property name="base-visitor-name" value="${lang-name}BaseVisitor"/>
<property name="base-visitor-file" value="${target-package-dir}/${base-visitor-name}.java"/>
<property name="listener-name" value="${lang-name}Listener"/>
<property name="listener-file" value="${target-package-dir}/${visitor-name}.java"/>
<property name="base-listener-name" value="${lang-name}BaseListener"/>
<property name="base-listener-file" value="${target-package-dir}/${base-visitor-name}.java"/>
<property name="node-itf-name" value="${lang-name}Node"/>
<property name="base-class-name" value="Abstract${lang-name}Node"/>
<condition property="rename-parser">
<and>
<not>
<available file="${parser-file}"/>
</not>
<available file="${target-package-dir}/${lang-name}.java"/>
</and>
</condition>
<target name="rename-parser" description="Rename the parser to our conventional name if needed"
if="rename-parser">
<replace file="${target-package-dir}/${lang-name}.java">
<replacefilter token="class ${lang-name} "
value="class ${parser-name} "/>
<replacefilter token="public ${lang-name}(TokenStream input)"
value="public ${parser-name}(TokenStream input)"/>
</replace>
<replace dir="${target-package-dir}">
<include name="${lang-name}.java"/>
<include name="${visitor-name}.java"/>
<include name="${base-visitor-name}.java"/>
<include name="${listener-name}.java"/>
<include name="${base-listener-name}.java"/>
<replacefilter token="${lang-name}." value="${parser-name}."/>
</replace>
<move file="${target-package-dir}/${lang-name}.java"
tofile="${parser-file}"/>
</target>
<target name="cpd-language" description="Adapt Antlr sources for CPD-only languages">
<!-- We only need the Lexer file. -->
<delete file="${parser-file}"/>
@ -45,7 +81,7 @@
</delete>
</target>
<target name="pmd-language" description="Adapt Antlr sources for PMD languages">
<target name="pmd-language" description="Adapt Antlr sources for PMD languages" depends="rename-parser">
<!-- Adapt parser. -->
<replace file="${parser-file}">

View File

@ -72,6 +72,14 @@ export RELEASE_VERSION
export DEVELOPMENT_VERSION
export CURRENT_BRANCH
# check for SNAPSHOT version of pmd.build-tools.version
BUILD_TOOLS_VERSION=$(./mvnw org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=pmd.build-tools.version -q -DforceStdout)
BUILD_TOOLS_VERSION_RELEASE=${BUILD_TOOLS_VERSION%-SNAPSHOT}
if [ "${BUILD_TOOLS_VERSION}" != "${BUILD_TOOLS_VERSION_RELEASE}" ]; then
echo "Error: version pmd.build-tools.version is ${BUILD_TOOLS_VERSION} - snapshot is not allowed"
exit 1
fi
RELEASE_RULESET="pmd-core/src/main/resources/rulesets/releases/${RELEASE_VERSION//\./}.xml"
echo "* Update date info in **docs/_config.yml**."

View File

@ -1,7 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (6.0.4.7)
activesupport (6.0.5)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
@ -15,7 +15,7 @@ GEM
coffee-script-source (1.11.1)
colorator (1.1.0)
commonmarker (0.23.4)
concurrent-ruby (1.1.9)
concurrent-ruby (1.1.10)
dnsruby (1.61.9)
simpleidn (~> 0.1)
em-websocket (0.5.3)
@ -51,9 +51,9 @@ GEM
ffi (1.15.5)
forwardable-extended (2.6.0)
gemoji (3.0.1)
github-pages (225)
github-pages (226)
github-pages-health-check (= 1.17.9)
jekyll (= 3.9.0)
jekyll (= 3.9.2)
jekyll-avatar (= 0.7.0)
jekyll-coffeescript (= 1.1.1)
jekyll-commonmark-ghpages (= 0.2.0)
@ -88,12 +88,12 @@ GEM
jekyll-theme-time-machine (= 0.2.0)
jekyll-titles-from-headings (= 0.5.3)
jemoji (= 0.12.0)
kramdown (= 2.3.1)
kramdown (= 2.3.2)
kramdown-parser-gfm (= 1.1.0)
liquid (= 4.0.3)
mercenary (~> 0.3)
minima (= 2.5.1)
nokogiri (>= 1.12.5, < 2.0)
nokogiri (>= 1.13.4, < 2.0)
rouge (= 3.26.0)
terminal-table (~> 1.4)
github-pages-health-check (1.17.9)
@ -102,13 +102,13 @@ GEM
octokit (~> 4.0)
public_suffix (>= 3.0, < 5.0)
typhoeus (~> 1.3)
html-pipeline (2.14.0)
html-pipeline (2.14.1)
activesupport (>= 2)
nokogiri (>= 1.4)
http_parser.rb (0.8.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jekyll (3.9.0)
jekyll (3.9.2)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
@ -216,7 +216,7 @@ GEM
gemoji (~> 3.0)
html-pipeline (~> 2.2)
jekyll (>= 3.0, < 5.0)
kramdown (2.3.1)
kramdown (2.3.2)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
@ -232,7 +232,7 @@ GEM
jekyll-seo-tag (~> 2.1)
minitest (5.15.0)
multipart-post (2.1.1)
nokogiri (1.13.3)
nokogiri (1.13.6)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
octokit (4.22.0)
@ -240,7 +240,7 @@ GEM
sawyer (~> 0.8.0, >= 0.5.3)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.6)
public_suffix (4.0.7)
racc (1.6.0)
rb-fsevent (0.11.1)
rb-inotify (0.10.1)
@ -269,7 +269,7 @@ GEM
thread_safe (~> 0.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.8)
unf_ext (0.0.8.1)
unicode-display_width (1.8.0)
zeitwerk (2.5.4)

View File

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

View File

@ -175,6 +175,18 @@ entries:
- title: Error Prone
output: web, pdf
url: /pmd_rules_ecmascript_errorprone.html
- title: null
output: web, pdf
subfolders:
- title: HTML Rules
output: web, pdf
subfolderitems:
- title: Index
output: web, pdf
url: /pmd_rules_html.html
- title: Best Practices
output: web, pdf
url: /pmd_rules_html_bestpractices.html
- title: null
output: web, pdf
subfolders:
@ -232,6 +244,21 @@ entries:
- title: Security
output: web, pdf
url: /pmd_rules_jsp_security.html
- title: null
output: web, pdf
subfolders:
- title: Kotlin Rules
output: web, pdf
subfolderitems:
- title: Index
output: web, pdf
url: /pmd_rules_kotlin.html
- title: Best Practices
output: web, pdf
url: /pmd_rules_kotlin_bestpractices.html
- title: Error Prone
output: web, pdf
url: /pmd_rules_kotlin_errorprone.html
- title: null
output: web, pdf
subfolders:
@ -370,6 +397,9 @@ entries:
- title: JSP
url: /pmd_languages_jsp.html
output: web, pdf
- title: Kotlin
url: /pmd_languages_kotlin.html
output: web, pdf
- title: PLSQL
url: /pmd_languages_plsql.html
output: web, pdf
@ -379,6 +409,12 @@ entries:
- title: XML and XML dialects
url: /pmd_languages_xml.html
output: web, pdf
- title: HTML
url: /pmd_languages_html.html
output: web, pdf
- title: Gherkin
url: /pmd_languages_gherkin.html
output: web, pdf
- title: Developer Documentation
output: web, pdf
folderitems:

View File

@ -2,6 +2,7 @@
<ul id="mysidebar" class="nav">
<li class="sidebarTitle">{{sidebar[0].product}} {{sidebar[0].version | replace: '!PMD_VERSION!', site.pmd.version}}</li>
<div class="sidebarTitleDate">Release date: {{site.pmd.date}}</div>
{% for entry in sidebar %}
{% for folder in entry.folders %}
{% if folder.output contains "web" %}

View File

@ -122,3 +122,9 @@ pre {
border: 1px solid #cccccc;
border-radius: 4px;
}
div.sidebarTitleDate {
margin-top:2.5px;
margin-bottom:5px;
margin-left:5px;
}

View File

@ -97,7 +97,7 @@ li.sidebarTitle {
font-weight:normal;
font-size:130%;
color: #ED1951;
margin-bottom:10px;
margin-left: 5px;
margin-bottom:2.5px;
margin-left:5px;
}

View File

@ -84,7 +84,6 @@ li.sidebarTitle {
font-weight:normal;
font-size:130%;
color: #4d94ff;
margin-bottom:10px;
margin-left: 5px;
margin-bottom:2.5px;
margin-left:5px;
}

View File

@ -19,6 +19,15 @@ This is a {{ site.pmd.release_type }} release.
### New and noteworthy
#### CLI improvements
The PMD CLI 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.
#### 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,
@ -40,6 +49,26 @@ Given the full Antlr support, PMD now fully supports Swift. We are pleased to an
* {% rule "swift/bestpractices/UnavailableFunction" %} (`swift-bestpractices`) flags any function throwing a `fatalError` not marked as
`@available(*, unavailable)` to ensure no calls are actually performed in the codebase.
Contributors: [@lsoncini](https://github.com/lsoncini), [@matifraga](https://github.com/matifraga), [@tomidelucca](https://github.com/tomidelucca)
#### Kotlin support (experimental)
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 short name.
* {% rule kotlin/errorprone/OverrideBothEqualsAndHashcode %} (`kotlin-errorprone`) finds classes with only either `equals`
or `hashCode` overridden, but not both. This leads to unexpected behavior once instances of such classes
are used in collections (Lists, HashMaps, ...).
Contributors: [@jborgers](https://github.com/jborgers), [@stokpop](https://github.com/stokpop)
#### XPath 3.1 support
Support for XPath versions 1.0, 1.0-compatibility was removed, support for XPath 2.0 is deprecated. 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. Notable changes:
@ -152,13 +181,14 @@ The following previously deprecated rules have been finally removed:
### Fixed Issues
* miscellaneous
* 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
* apex-design
* cli
* [#3828](https://github.com/pmd/pmd/issues/3828): \[core] Progress reporting
* apex-design
* [#2667](https://github.com/pmd/pmd/issues/2667): \[apex] Integrate nawforce/ApexLink to build robust Unused rule
* java-bestpractices
* java-bestpractices
* [#342](https://github.com/pmd/pmd/issues/342): \[java] AccessorMethodGeneration: Name clash with another public field not properly handled
* [#755](https://github.com/pmd/pmd/issues/755): \[java] AccessorClassGeneration false positive for private constructors
* [#770](https://github.com/pmd/pmd/issues/770): \[java] UnusedPrivateMethod yields false positive for counter-variant arguments
@ -233,6 +263,8 @@ The following previously deprecated rules have been finally removed:
* java-performance
* [#1224](https://github.com/pmd/pmd/issues/1224): \[java] InefficientEmptyStringCheck false negative in anonymous class
* [#2712](https://github.com/pmd/pmd/issues/2712): \[java] SimplifyStartsWith false-positive with AssertJ
* kotlin
* [#419](https://github.com/pmd/pmd/issues/419): \[kotlin] Add support for Kotlin
### API Changes
@ -279,6 +311,7 @@ The metrics framework has been made simpler and more general.
* [#1881](https://github.com/pmd/pmd/pull/1881): \[doc] Add ANTLR documentation - [Matías Fraga](https://github.com/matifraga)
* [#1882](https://github.com/pmd/pmd/pull/1882): \[swift] UnavailableFunction Swift rule - [Tomás de Lucca](https://github.com/tomidelucca)
* [#2830](https://github.com/pmd/pmd/pull/2830): \[apex] Apexlink POC - [Kevin Jones](https://github.com/nawforce)
* [#3866](https://github.com/pmd/pmd/pull/3866): \[core] Add CLI Progress Bar - [@JerritEic](https://github.com/JerritEic)
{% endtocmaker %}

View File

@ -246,6 +246,55 @@ 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.47.0
No changes.
#### 6.46.0
##### Deprecated ruleset references
Ruleset references with the following formats are now deprecated and will produce a warning
when used on the CLI or in a ruleset XML file:
- `<lang-name>-<ruleset-name>`, eg `java-basic`, which resolves to `rulesets/java/basic.xml`
- the internal release number, eg `600`, which resolves to `rulesets/releases/600.xml`
Use the explicit forms of these references to be compatible with PMD 7.
##### Deprecated API
- {% jdoc core::RuleSetReferenceId#toString() %} is now deprecated. The format of this
method will remain the same until PMD 7. The deprecation is intended to steer users
away from relying on this format, as it may be changed in PMD 7.
- {% jdoc core::PMDConfiguration#getInputPaths() %} and
{% jdoc core::PMDConfiguration#setInputPaths(java.lang.String) %} are now deprecated.
A new set of methods have been added, which use lists and do not rely on comma splitting.
##### Internal API
Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0.
You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning.
- {% jdoc core::cpd.CPDCommandLineInterface %} has been internalized. In order to execute CPD either
{% jdoc !!core::cpd.CPD#run(java.lang.String...) %} or {% jdoc !!core::cpd.CPD#main(java.lang.String[]) %}
should be used.
- Several members of {% jdoc test::cli.BaseCPDCLITest %} have been deprecated with replacements.
- The methods {% jdoc !!core::ant.Formatter#start(java.lang.String) %},
{% jdoc !!core::ant.Formatter#end(net.sourceforge.pmd.Report) %}, {% jdoc !!core::ant.Formatter#getRenderer() %},
and {% jdoc !!core::ant.Formatter#isNoOutputSupplied() %} have been internalized.
#### 6.45.0
##### Experimental APIs
* Report has two new methods which allow limited mutations of a given report:
* {% jdoc !!core::Report#filterViolations(net.sourceforge.pmd.util.Predicate) %} creates a new report with
some violations removed with a given predicate based filter.
* {% jdoc !!core::Report#union(net.sourceforge.pmd.Report) %} can combine two reports into a single new Report.
* {% jdoc !!core::util.Predicate %} will be replaced in PMD7 with the standard Predicate interface from java8.
* The module `pmd-html` is entirely experimental right now. Anything in the package
`net.sourceforge.pmd.lang.html` should be used cautiously.
#### 6.44.0
##### Deprecated API
@ -1456,18 +1505,18 @@ large projects, with many duplications, it was causing `OutOfMemoryError`s (see
* The Java rules NcssConstructorCount (java-design), NcssMethodCount (java-design), and NcssTypeCount (java-design) have been
deprecated. They will be replaced by the new rule {% rule java/design/NcssCount %} in the category `design`.
* The Java rule `LooseCoupling` in ruleset `java-typeresolution` is deprecated. Use the rule with the same name from category `bestpractices` instead.
* The Java rule `LooseCoupling` in ruleset `java-typeresolution` is deprecated. Use the rule with the same name from category `bestpractices` instead.
* The Java rule `CloneMethodMustImplementCloneable` in ruleset `java-typeresolution` is deprecated. Use the rule with the same name from category `errorprone` instead.
* The Java rule `CloneMethodMustImplementCloneable` in ruleset `java-typeresolution` is deprecated. Use the rule with the same name from category `errorprone` instead.
* The Java rule `UnusedImports` in ruleset `java-typeresolution` is deprecated. Use the rule with
* The Java rule `UnusedImports` in ruleset `java-typeresolution` is deprecated. Use the rule with
the same name from category `bestpractices` instead.
* The Java rule `SignatureDeclareThrowsException` in ruleset `java-typeresolution` is deprecated. Use the rule with the same name from category `design` instead.
* The Java rule `SignatureDeclareThrowsException` in ruleset `java-typeresolution` is deprecated. Use the rule with the same name from category `design` instead.
* The Java rule `EmptyStaticInitializer` in ruleset `java-empty` is deprecated. Use the rule {% rule java/errorprone/EmptyInitializer %}, which covers both static and non-static empty initializers.`
* The Java rule `EmptyStaticInitializer` in ruleset `java-empty` is deprecated. Use the rule {% rule java/errorprone/EmptyInitializer %}, which covers both static and non-static empty initializers.`
* The Java rules `GuardDebugLogging` (ruleset `java-logging-jakarta-commons`) and `GuardLogStatementJavaUtil`
* The Java rules `GuardDebugLogging` (ruleset `java-logging-jakarta-commons`) and `GuardLogStatementJavaUtil`
(ruleset `java-logging-java`) have been deprecated. Use the rule {% rule java/bestpractices/GuardLogStatement %}, which covers all cases regardless of the logging framework.
* The Java rule "java/multithreading/UnsynchronizedStaticDateFormatter" has been deprecated and
@ -1478,20 +1527,20 @@ large projects, with many duplications, it was causing `OutOfMemoryError`s (see
and [`PositionLiteralsFirstInCaseInsensitiveComparisons`](https://pmd.github.io/pmd-6.29.0/pmd_rules_java_bestpractices.html#positionliteralsfirstincaseinsensitivecomparisons) (ruleset `java-bestpractices`)
have been deprecated in favor of the new rule {% rule "java/bestpractices/LiteralsFirstInComparisons" %}.
* The Java rule [`AvoidFinalLocalVariable`](https://pmd.github.io/pmd-6.16.0/pmd_rules_java_codestyle.html#avoidfinallocalvariable) (`java-codestyle`) has been deprecated
* The Java rule [`AvoidFinalLocalVariable`](https://pmd.github.io/pmd-6.16.0/pmd_rules_java_codestyle.html#avoidfinallocalvariable) (`java-codestyle`) has been deprecated
and will be removed with PMD 7.0.0. The rule is controversial and also contradicts other existing
rules such as [`LocalVariableCouldBeFinal`](https://pmd.github.io/pmd-6.16.0/pmd_rules_java_codestyle.html#localvariablecouldbefinal). If the goal is to avoid defining
constants in a scope smaller than the class, then the rule [`AvoidDuplicateLiterals`](https://pmd.github.io/pmd-6.16.0/pmd_rules_java_errorprone.html#avoidduplicateliterals)
should be used instead.
* The Apex rule [`VariableNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#variablenamingconventions) (`apex-codestyle`) has been deprecated and
* The Apex rule [`VariableNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#variablenamingconventions) (`apex-codestyle`) has been deprecated and
will be removed with PMD 7.0.0. The rule is replaced by the more general rules
[`FieldNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#fieldnamingconventions),
[`FormalParameterNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#formalparameternamingconventions),
[`LocalVariableNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#localvariablenamingconventions), and
[`PropertyNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#propertynamingconventions).
* The Java rule [`LoggerIsNotStaticFinal`](https://pmd.github.io/pmd-6.15.0/pmd_rules_java_errorprone.html#loggerisnotstaticfinal) (`java-errorprone`) has been deprecated
* The Java rule [`LoggerIsNotStaticFinal`](https://pmd.github.io/pmd-6.15.0/pmd_rules_java_errorprone.html#loggerisnotstaticfinal) (`java-errorprone`) has been deprecated
and will be removed with PMD 7.0.0. The rule is replaced by [`ProperLogger`](https://pmd.github.io/pmd-6.15.0/pmd_rules_java_errorprone.html#properlogger).
* The Java rule [`DataflowAnomalyAnalysis`](https://pmd.github.io/pmd-6.27.0/pmd_rules_java_errorprone.html#dataflowanomalyanalysis) (`java-errorprone`)
@ -1504,7 +1553,7 @@ large projects, with many duplications, it was causing `OutOfMemoryError`s (see
* The Java rule `CloneThrowsCloneNotSupportedException` (java-errorprone) has been deprecated without
replacement.
* The following Java rules are deprecated and removed from the quickstart ruleset,
* The following Java rules are deprecated and removed from the quickstart ruleset,
as the new rule {% rule java/bestpractices/SimplifiableTestAssertion %} merges
their functionality:
* `UseAssertEqualsInsteadOfAssertTrue` (java-bestpractices)
@ -1517,7 +1566,7 @@ large projects, with many duplications, it was causing `OutOfMemoryError`s (see
the quickstart ruleset, as the new rule {% rule java/errorprone/ReturnEmptyCollectionRatherThanNull %}
supersedes it.
* The following Java rules are deprecated and removed from the quickstart ruleset,
* The following Java rules are deprecated and removed from the quickstart ruleset,
as the new rule {% rule java/bestpractices/PrimitiveWrapperInstantiation %} merges
their functionality:
* java/performance/BooleanInstantiation
@ -1531,3 +1580,17 @@ large projects, with many duplications, it was causing `OutOfMemoryError`s (see
as it finds only contrived cases of creating a primitive wrapper and unboxing it explicitly
in the same expression. In PMD 7 this and more cases will be covered by a
new rule `UnnecessaryBoxing`.
* Since 6.46.0: The following Java rules are deprecated and removed from the quickstart ruleset, as the new rule
{% rule java/codestyle/EmptyControlStatement %} merges their functionality:
* {% rule java/errorprone/EmptyFinallyBlock %}
* {% rule java/errorprone/EmptyIfStmt %}
* {% rule java/errorprone/EmptyInitializer %}
* {% rule java/errorprone/EmptyStatementBlock %}
* {% rule java/errorprone/EmptySwitchStatements %}
* {% rule java/errorprone/EmptySynchronizedBlock %}
* {% rule java/errorprone/EmptyTryBlock %}
* {% rule java/errorprone/EmptyWhileStmt %}
* Since 6.46.0: The Java rule {% rule java/errorprone/EmptyStatementNotInLoop %} is deprecated and removed from the quickstart
ruleset. Use the new rule {% rule java/codestyle/UnnecessarySemicolon %} instead.

View File

@ -3,17 +3,54 @@ title: Adding PMD support for a new ANTLR grammar based language
short_title: Adding a new language with ANTLR
tags: [devdocs, extending]
summary: "How to add a new language to PMD using ANTLR grammar."
last_updated: July 21, 2019
last_updated: October 2021
sidebar: pmd_sidebar
permalink: pmd_devdocs_major_adding_new_language_antlr.html
folder: pmd/devdocs
# needs to be changed to branch master instead of pmd/7.0.x
#
# needs to be changed to branch master instead of pmd/7.0.x once pmd7 is released
# https://github.com/pmd/pmd/blob/pmd/7.0.x -> https://github.com/pmd/pmd/blob/master
#
---
{% include callout.html type="warning" content="
## 1. Start with a new sub-module.
**Before you start...**<br><br>
This is really a big contribution and can't be done with a drive by contribution. It requires dedicated passion
and long commitment to implement support for a new language.<br><br>
This step by step guide is just a small intro to get the basics started and it's also not necessarily up-to-date
or complete and you have to be able to fill in the blanks.<br><br>
Currently the Antlr integration has some basic limitations compared to JavaCC: The output of the
Antlr parser generator is not an abstract syntax tree (AST) but a parse tree. As such, a parse tree is
much more fine-grained than what a typical JavaCC grammar will produce. This means that the
parse tree is much deeper and contains nodes down to the different token types.<br><br>
The Antlr nodes themselves don't have any attributes because they are on the wrong abstraction level.
As they don't have attributes, there are no attributes that can be used in XPath based rules.<br><br>
In order to overcome these limitations, one would need to implement a post-processing step that transforms
a parse tree into an abstract syntax tree and introducing real nodes on a higher abstraction level. This
step is **not** described in this guide.<br><br>
After the basic support for a language is there, there are lots of missing features left. Typical features
that can greatly improve rule writing are: symbol table, type resolution, call/data flow analysis.<br><br>
Symbol table keeps track of variables and their usages. Type resolution tries to find the actual class type
of each used type, following along method calls (including overloaded and overwritten methods), allowing
to query sub types and type hierarchy. This requires additional configuration of an auxiliary classpath.
Call and data flow analysis keep track of the data as it is moving through different execution paths
a program has.<br><br>
These features are out of scope of this guide. Type resolution and data flow are features that
definitely don't come for free. It is much effort and requires perseverance to implement.<br><br>
" %}
## 1. Start with a new sub-module
* See pmd-swift for examples.
## 2. Implement an AST parser for your language
@ -24,7 +61,7 @@ folder: pmd/devdocs
## 3. Create AST node classes
* The individual AST nodes are generated, but you need to define the common interface for them.
* You need a need to define the supertype interface for all nodes of the language. For that, we provide
* You need to define the supertype interface for all nodes of the language. For that, we provide
[`AntlrNode`](https://github.com/pmd/pmd/blob/pmd/7.0.x/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrNode.java).
* See [`SwiftNode`](https://github.com/pmd/pmd/blob/pmd/7.0.x/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftNode.java)
as an example.
@ -52,7 +89,7 @@ folder: pmd/devdocs
## 4. Generate your parser
* Make sure, you have the property `<antlr4.visitor>true</antlr4.visitor>` in your `pom.xml` file.
* This is just a matter of building the language module. ANTLR is called via ant, and this step is added
to the phase `generate-sources`. So you can just call e.g. `./mvnw generate-source -pl pmd-swift` to
to the phase `generate-sources`. So you can just call e.g. `./mvnw generate-sources -pl pmd-swift` to
have the parser generated.
* The generated code will be placed under `target/generated-sources/antlr4` and will not be committed to
source control.

View File

@ -1,16 +1,40 @@
---
title: Adding PMD support for a new JAVACC grammar based language
short_title: Adding a new language with JAVACC
title: Adding PMD support for a new JavaCC grammar based language
short_title: Adding a new language with JavaCC
tags: [devdocs, extending]
summary: "How to add a new language to PMD using JAVACC grammar."
last_updated: October 5, 2019
summary: "How to add a new language to PMD using JavaCC grammar."
last_updated: October 2021
sidebar: pmd_sidebar
permalink: pmd_devdocs_major_adding_new_language_javacc.html
folder: pmd/devdocs
---
{% include callout.html type="warning" content="
## 1. Start with a new sub-module.
**Before you start...**<br><br>
This is really a big contribution and can't be done with a drive by contribution. It requires dedicated passion
and long commitment to implement support for a new language.<br><br>
This step by step guide is just a small intro to get the basics started and it's also not necessarily up-to-date
or complete and you have to be able to fill in the blanks.<br><br>
After the basic support for a language is there, there are lots of missing features left. Typical features
that can greatly improve rule writing are: symbol table, type resolution, call/data flow analysis.<br><br>
Symbol table keeps track of variables and their usages. Type resolution tries to find the actual class type
of each used type, following along method calls (including overloaded and overwritten methods), allowing
to query sub types and type hierarchy. This requires additional configuration of an auxiliary classpath.
Call and data flow analysis keep track of the data as it is moving through different execution paths
a program has.<br><br>
These features are out of scope of this guide. Type resolution and data flow are features that
definitely don't come for free. It is much effort and requires perseverance to implement.<br><br>
" %}
## 1. Start with a new sub-module
* See pmd-java or pmd-vm for examples.
## 2. Implement an AST parser for your language

View File

@ -0,0 +1,16 @@
---
title: Gherkin
permalink: pmd_languages_gherkin.html
---
The [Gherkin](https://cucumber.io/docs/gherkin/) language is used to define test cases for the
[Cucumber](https://cucumber.io/) testing tool for behavior-driven development.
The Gherkin syntax is designed to be non-technical, making it human-readable for a wide audience.
## Support in PMD
Starting from version 6.48.0, Gherkin support was added to CPD.
### Limitations
- Support for Gherkin only extends to CPD to detect code duplication in Cucumber test cases.
- While Gherkin keywords have been translated into various
languages, CPD currently supports only the English version of the Gherkin language.

View File

@ -0,0 +1,24 @@
---
title: Processing HTML files
permalink: pmd_languages_html.html
last_updated: April 2022 (6.45.0)
---
## The HTML language module
**Since:** 6.45.0
**Minimum Java Runtime:** Java 8
{% 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 2.0 rules are supported, but the DOM is not always a typical XML/XPath DOM.
In the Designer, text nodes appear as nodes with name "#text", but they can
be selected as usual using `text()`.
XML Namespaces are not supported. The local name of attributes include the prefix,
so that you have to select attributes by e.g. `//*[@*[local-name() = 'if:true']]`.
Only XPath 1.0 rules are not supported.

View File

@ -9,7 +9,43 @@ summary: "Java-specific features and guidance"
{% include warning.html content="WIP, todo for pmd 7" %}
### Type and symbol resolution
## Overview of supported Java language versions
Usually the latest non-preview Java Version is the default version.
| Java Version | Alias | Supported by PMD since |
|--------------|-------|------------------------|
| 19-preview | | 6.48.0 |
| 19 (default) | | 6.48.0 |
| 18-preview | | 6.44.0 |
| 18 | | 6.44.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. `19-preview`:
export PMD_JAVA_OPTS=--enable-preview
./run.sh pmd -language java -version 19-preview ...
Note: we only support preview language features for the latest two java versions.
## Type and symbol resolution
Java being a statically typed language, a Java program contains more information that just its syntax tree; for instance, every expression has a static type, and every method call is bound to a method overload statically (even if that overload is virtual). In PMD, much of this information is resolved from the AST by additional passes, which run after parsing, and before rules can inspect the tree.
@ -22,11 +58,11 @@ TODO describe
* why we need auxclasspath
* how disambiguation can fail
### Type and symbol APIs
## Type and symbol APIs
TODO describe APIs
### Metrics framework
## Metrics framework
In order to use code metrics in Java, use the metrics constants in {% jdoc java::lang.java.metrics.JavaMetrics %},
together with {% jdoc core::lang.metrics.MetricsUtil %}. For instance:

View File

@ -0,0 +1,14 @@
---
title: Kotlin Support
permalink: pmd_languages_kotlin.html
tags: [languages]
summary: "Kotlin-specific features and guidance"
---
Kotlin support in PMD is based on the official grammar from <https://github.com/Kotlin/kotlin-spec>.
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." %}

File diff suppressed because it is too large Load Diff

View File

@ -76,14 +76,14 @@ The tool comes with a rather extensive help text, simply running with `--help`!
%}
{% include custom/cli_option_row.html options="--file-list"
option_arg="filepath"
description="Path to file containing a comma delimited list of files to analyze.
description="Path to file containing a list of files to analyze, one path per line.
If this is given, then you don't need to provide `--dir`."
%}
{% include custom/cli_option_row.html options="--force-language"
option_arg="lang"
description="Force a language to be used for all input files, irrespective of
filenames. When using this option, the automatic language selection
by extension is disabled and all files are tried to be parsed with
file names. When using this option, the automatic language selection
by extension is disabled and PMD tries to parse all files with
the given language `&lt;lang&gt;`. Parsing errors are ignored and unparsable files
are skipped.
@ -92,9 +92,9 @@ The tool comes with a rather extensive help text, simply running with `--help`!
%}
{% include custom/cli_option_row.html options="--ignore-list"
option_arg="filepath"
description="Path to file containing a comma delimited list of files to ignore.
description="Path to file containing a list of files to ignore, one path per line.
This option can be combined with `--dir` and `--file-list`.
This ignore list takes precedence over any files in the filelist."
This ignore list takes precedence over any files in the file-list."
%}
{% include custom/cli_option_row.html options="--help,-h,-H"
description="Display help on usage."
@ -115,6 +115,9 @@ The tool comes with a rather extensive help text, simply running with `--help`!
description="Explicitly disables incremental analysis. This switch turns off suggestions to use Incremental Analysis,
and causes the `--cache` option to be discarded if it is provided."
%}
{% include custom/cli_option_row.html options="--no-progress"
description="Disable progress bar indicator of live analysis progress."
%}
{% include custom/cli_option_row.html options="--property,-P"
option_arg="name>=<value"
description="Specifies a property for the report renderer. The option can be specified several times."

View File

@ -112,9 +112,9 @@ Novice as much as advanced readers may want to [read on on Refactoring Guru](htt
languages="Java"
%}
{% include custom/cli_option_row.html options="--ignore-annotations"
description="Ignore language annotations when comparing text"
description="Ignore language annotations (Java) or attributes (C#) when comparing text"
default="false"
languages="Java"
languages="C#, Java"
%}
{% include custom/cli_option_row.html options="--ignore-literal-sequences"
description="Ignore sequences of literals (common e.g. in list initializers)"

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