Merge branch 'text-utils-javacc' into text-utils-comments
This commit is contained in:
@ -6566,6 +6566,24 @@
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "MetaBF",
|
||||
"name": "MetaBF",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/101029254?v=4",
|
||||
"profile": "https://github.com/MetaBF",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "btjiong",
|
||||
"name": "Bailey Tjiong",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/15816011?v=4",
|
||||
"profile": "https://github.com/btjiong",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
@ -1,10 +1,19 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<ruleset name="All Java Rules"
|
||||
<ruleset name="All Regression Rules"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||
<description>Every java rule in PMD which is used for the regression tests with pmdtester</description>
|
||||
<description>Every apex and java rule in PMD which is used for the regression tests with pmdtester</description>
|
||||
|
||||
<rule ref="category/apex/bestpractices.xml" />
|
||||
<rule ref="category/apex/codestyle.xml" />
|
||||
<rule ref="category/apex/design.xml" />
|
||||
<rule ref="category/apex/documentation.xml" />
|
||||
<rule ref="category/apex/errorprone.xml" />
|
||||
<rule ref="category/apex/multithreading.xml" />
|
||||
<rule ref="category/apex/performance.xml" />
|
||||
<rule ref="category/apex/security.xml" />
|
||||
|
||||
<rule ref="category/java/bestpractices.xml" />
|
||||
<rule ref="category/java/codestyle.xml" />
|
@ -40,10 +40,6 @@ mvn dependency:build-classpath -DincludeScope=test -Dmdep.outputFile=classpath.t
|
||||
<exclude-pattern>.*/build/generated-sources/.*</exclude-pattern>
|
||||
|
||||
<build-command><![CDATA[#!/usr/bin/env bash
|
||||
if test -e classpath.txt; then
|
||||
exit
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
# Make sure to use java11. This is already installed by build.sh
|
||||
@ -133,6 +129,11 @@ 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>
|
||||
@ -146,4 +147,34 @@ EOF
|
||||
<tag>jdk-11+28</tag>
|
||||
<src-subpath>src/java.base</src-subpath>
|
||||
</project>
|
||||
|
||||
<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>
|
||||
</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>
|
||||
</project>
|
||||
|
||||
<project>
|
||||
<name>apex-link</name>
|
||||
<type>git</type>
|
||||
<connection>https://github.com/nawforce/apex-link</connection>
|
||||
<tag>v2.3.0</tag>
|
||||
<src-subpath>samples</src-subpath>
|
||||
</project>
|
||||
</projectlist>
|
||||
|
@ -48,7 +48,7 @@ function regression_tester_uploadBaseline() {
|
||||
--mode single \
|
||||
--local-git-repo ./pmd \
|
||||
--patch-branch "${baseline_branch}" \
|
||||
--patch-config ./pmd/.ci/files/all-java.xml \
|
||||
--patch-config ./pmd/.ci/files/all-regression-rules.xml \
|
||||
--list-of-project ./pmd/.ci/files/project-list.xml --html-flag \
|
||||
--error-recovery
|
||||
pushd target/reports || { echo "Directory 'target/reports' doesn't exist"; exit 1; }
|
||||
|
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
||||
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
||||
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- uses: actions/cache@v2
|
||||
@ -34,9 +34,9 @@ jobs:
|
||||
~/.cache
|
||||
~/work/pmd/target/repositories
|
||||
vendor/bundle
|
||||
key: v2-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
|
||||
key: v3-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
v2-${{ runner.os }}-
|
||||
v3-${{ runner.os }}-
|
||||
- name: Set up Ruby 2.7
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
|
2
.github/workflows/git-repo-sync.yml
vendored
2
.github/workflows/git-repo-sync.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: false
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 100
|
||||
- name: Setup Environment
|
||||
|
6
.github/workflows/troubleshooting.yml
vendored
6
.github/workflows/troubleshooting.yml
vendored
@ -12,7 +12,7 @@ jobs:
|
||||
os: [ ubuntu-latest ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
@ -21,9 +21,9 @@ jobs:
|
||||
~/.cache
|
||||
~/work/pmd/target/repositories
|
||||
vendor/bundle
|
||||
key: v2-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
|
||||
key: v3-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
v2-${{ runner.os }}-
|
||||
v3-${{ runner.os }}-
|
||||
- name: Set up Ruby 2.7
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
|
2
.mvn/wrapper/maven-wrapper.properties
vendored
2
.mvn/wrapper/maven-wrapper.properties
vendored
@ -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.4/apache-maven-3.8.4-bin.zip
|
||||
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
|
||||
|
@ -5,14 +5,14 @@ require 'fileutils'
|
||||
|
||||
@logger = Logger.new(STDOUT)
|
||||
|
||||
def get_args(base_branch, autogen = TRUE, patch_config = './pmd/.ci/files/all-java.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,
|
||||
'--patch-branch', 'HEAD',
|
||||
'--patch-config', patch_config,
|
||||
'--mode', 'online',
|
||||
# autogen ? '--auto-gen-config' : '--filter-with-patch-config',
|
||||
autogen ? '--auto-gen-config' : '--filter-with-patch-config',
|
||||
'--keep-reports',
|
||||
'--error-recovery',
|
||||
'--baseline-download-url', 'https://pmd-code.org/pmd-regression-tester/',
|
||||
@ -29,7 +29,7 @@ def run_pmdtester
|
||||
@summary = PmdTester::Runner.new(get_args(@base_branch)).run
|
||||
|
||||
unless Dir.exist?('target/reports/diff')
|
||||
message("No java rules are changed!", sticky: true)
|
||||
message("No regression tested rules have been changed.", sticky: true)
|
||||
return
|
||||
end
|
||||
|
||||
@ -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, FALSE, 'target/diff1/patch_config.xml')).run
|
||||
@summary = PmdTester::Runner.new(get_args(@base_branch)).run
|
||||
|
||||
# move the generated report out of the way
|
||||
FileUtils.mv 'target/reports/diff', 'target/diff2'
|
||||
|
6
Gemfile
6
Gemfile
@ -10,9 +10,9 @@ gem 'danger'
|
||||
# this happens during release (.ci/build.sh and do-release.sh)
|
||||
# but also during regular builds (.ci/build.sh)
|
||||
group :release_notes_preprocessing do
|
||||
gem 'liquid', '>=4.0.0'
|
||||
gem 'safe_yaml', '>=1.0'
|
||||
gem 'rouge', '>= 1.7', '< 4'
|
||||
gem 'liquid'
|
||||
gem 'safe_yaml'
|
||||
gem 'rouge'
|
||||
end
|
||||
|
||||
# vim: syntax=ruby
|
||||
|
24
Gemfile.lock
24
Gemfile.lock
@ -9,10 +9,10 @@ GEM
|
||||
nap
|
||||
open4 (~> 1.3)
|
||||
colored2 (3.1.2)
|
||||
concurrent-ruby (1.1.9)
|
||||
concurrent-ruby (1.1.10)
|
||||
cork (0.3.0)
|
||||
colored2 (~> 3.1)
|
||||
danger (8.4.3)
|
||||
danger (8.5.0)
|
||||
claide (~> 1.0)
|
||||
claide-plugins (>= 0.9.2)
|
||||
colored2 (~> 3.1)
|
||||
@ -26,7 +26,7 @@ GEM
|
||||
octokit (~> 4.7)
|
||||
terminal-table (>= 1, < 4)
|
||||
differ (0.1.2)
|
||||
et-orbi (1.2.6)
|
||||
et-orbi (1.2.7)
|
||||
tzinfo
|
||||
faraday (1.10.0)
|
||||
faraday-em_http (~> 1.0)
|
||||
@ -58,11 +58,11 @@ GEM
|
||||
raabro (~> 1.4)
|
||||
git (1.10.2)
|
||||
rchardet (~> 1.8)
|
||||
kramdown (2.3.1)
|
||||
kramdown (2.3.2)
|
||||
rexml
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
liquid (5.1.0)
|
||||
liquid (5.3.0)
|
||||
logger-colors (1.0.0)
|
||||
mini_portile2 (2.8.0)
|
||||
multipart-post (2.1.1)
|
||||
@ -75,12 +75,12 @@ GEM
|
||||
faraday (>= 0.9)
|
||||
sawyer (~> 0.8.0, >= 0.5.3)
|
||||
open4 (1.3.4)
|
||||
pmdtester (1.3.0)
|
||||
pmdtester (1.4.0)
|
||||
differ (~> 0.1)
|
||||
liquid (>= 4.0)
|
||||
liquid (~> 5.2)
|
||||
logger-colors (~> 1.0)
|
||||
nokogiri (>= 1.11.0.rc4)
|
||||
rufus-scheduler (~> 3.5)
|
||||
nokogiri (~> 1.13)
|
||||
rufus-scheduler (~> 3.8)
|
||||
slop (~> 4.6)
|
||||
public_suffix (4.0.6)
|
||||
raabro (1.4.0)
|
||||
@ -107,10 +107,10 @@ PLATFORMS
|
||||
|
||||
DEPENDENCIES
|
||||
danger
|
||||
liquid (>= 4.0.0)
|
||||
liquid
|
||||
pmdtester
|
||||
rouge (>= 1.7, < 4)
|
||||
safe_yaml (>= 1.0)
|
||||
rouge
|
||||
safe_yaml
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
||||
|
@ -1,7 +1,7 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activesupport (6.0.4.6)
|
||||
activesupport (6.0.4.7)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
@ -14,8 +14,7 @@ GEM
|
||||
execjs
|
||||
coffee-script-source (1.11.1)
|
||||
colorator (1.1.0)
|
||||
commonmarker (0.17.13)
|
||||
ruby-enum (~> 0.5)
|
||||
commonmarker (0.23.4)
|
||||
concurrent-ruby (1.1.9)
|
||||
dnsruby (1.61.9)
|
||||
simpleidn (~> 0.1)
|
||||
@ -52,12 +51,12 @@ GEM
|
||||
ffi (1.15.5)
|
||||
forwardable-extended (2.6.0)
|
||||
gemoji (3.0.1)
|
||||
github-pages (223)
|
||||
github-pages (225)
|
||||
github-pages-health-check (= 1.17.9)
|
||||
jekyll (= 3.9.0)
|
||||
jekyll-avatar (= 0.7.0)
|
||||
jekyll-coffeescript (= 1.1.1)
|
||||
jekyll-commonmark-ghpages (= 0.1.6)
|
||||
jekyll-commonmark-ghpages (= 0.2.0)
|
||||
jekyll-default-layout (= 0.1.4)
|
||||
jekyll-feed (= 0.15.1)
|
||||
jekyll-gist (= 1.5.0)
|
||||
@ -71,7 +70,7 @@ GEM
|
||||
jekyll-relative-links (= 0.6.1)
|
||||
jekyll-remote-theme (= 0.4.3)
|
||||
jekyll-sass-converter (= 1.5.2)
|
||||
jekyll-seo-tag (= 2.7.1)
|
||||
jekyll-seo-tag (= 2.8.0)
|
||||
jekyll-sitemap (= 1.4.0)
|
||||
jekyll-swiss (= 1.0.0)
|
||||
jekyll-theme-architect (= 0.2.0)
|
||||
@ -127,12 +126,12 @@ GEM
|
||||
jekyll-coffeescript (1.1.1)
|
||||
coffee-script (~> 2.2)
|
||||
coffee-script-source (~> 1.11.1)
|
||||
jekyll-commonmark (1.3.1)
|
||||
commonmarker (~> 0.14)
|
||||
jekyll (>= 3.7, < 5.0)
|
||||
jekyll-commonmark-ghpages (0.1.6)
|
||||
commonmarker (~> 0.17.6)
|
||||
jekyll-commonmark (~> 1.2)
|
||||
jekyll-commonmark (1.4.0)
|
||||
commonmarker (~> 0.22)
|
||||
jekyll-commonmark-ghpages (0.2.0)
|
||||
commonmarker (~> 0.23.4)
|
||||
jekyll (~> 3.9.0)
|
||||
jekyll-commonmark (~> 1.4.0)
|
||||
rouge (>= 2.0, < 4.0)
|
||||
jekyll-default-layout (0.1.4)
|
||||
jekyll (~> 3.0)
|
||||
@ -164,7 +163,7 @@ GEM
|
||||
rubyzip (>= 1.3.0, < 3.0)
|
||||
jekyll-sass-converter (1.5.2)
|
||||
sass (~> 3.4)
|
||||
jekyll-seo-tag (2.7.1)
|
||||
jekyll-seo-tag (2.8.0)
|
||||
jekyll (>= 3.8, < 5.0)
|
||||
jekyll-sitemap (1.4.0)
|
||||
jekyll (>= 3.7, < 5.0)
|
||||
@ -248,8 +247,6 @@ GEM
|
||||
ffi (~> 1.0)
|
||||
rexml (3.2.5)
|
||||
rouge (3.26.0)
|
||||
ruby-enum (0.9.0)
|
||||
i18n
|
||||
ruby2_keywords (0.0.5)
|
||||
rubyzip (2.3.2)
|
||||
safe_yaml (1.0.5)
|
||||
|
@ -2,7 +2,7 @@ repository: pmd/pmd
|
||||
|
||||
pmd:
|
||||
version: 7.0.0-SNAPSHOT
|
||||
previous_version: 6.43.0
|
||||
previous_version: 6.44.0
|
||||
date: ??-?????-2022
|
||||
release_type: major
|
||||
|
||||
|
@ -355,9 +355,18 @@ entries:
|
||||
- title: Apex
|
||||
url: /pmd_languages_apex.html
|
||||
output: web, pdf
|
||||
- title: Java
|
||||
url: /pmd_languages_java.html
|
||||
- title: null
|
||||
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
|
||||
@ -367,6 +376,9 @@ entries:
|
||||
- title: Visualforce
|
||||
url: /pmd_languages_visualforce.html
|
||||
output: web, pdf
|
||||
- title: XML and XML dialects
|
||||
url: /pmd_languages_xml.html
|
||||
output: web, pdf
|
||||
- title: Developer Documentation
|
||||
output: web, pdf
|
||||
folderitems:
|
||||
|
@ -7,24 +7,92 @@ aliases:
|
||||
type: "xs:string"
|
||||
description: "The qualified name of a Java class, possibly with pairs of brackets to indicate an array type.
|
||||
Can also be a primitive type name."
|
||||
- &node_param
|
||||
name: element
|
||||
type: "xs:element"
|
||||
description: "Any element node"
|
||||
- &needs_typenode "The context node must be a {% jdoc jast::TypeNode %}"
|
||||
- &coord_fun_note |
|
||||
The function is not context-dependent, but takes a node as its first parameter.
|
||||
- &needs_node_ctx "The requires the context node to be an element"
|
||||
|
||||
langs:
|
||||
- name: "Any language"
|
||||
- name: "All languages"
|
||||
ns: "pmd"
|
||||
header: "Functions available to all languages are in the namespace `pmd`."
|
||||
funs:
|
||||
- name: fileName
|
||||
returnType: "xs:string"
|
||||
shortDescription: "Returns the current filename"
|
||||
description: "Returns the current simple filename without path but including the extension.
|
||||
This can be used to write rules that check filename naming conventions.
|
||||
|
||||
<p>This function is available since PMD 6.38.0.</p>"
|
||||
notes: "The function can be called on any node."
|
||||
shortDescription: "Returns the simple name of the current file"
|
||||
description: |
|
||||
Returns the current simple file name, without path but including the extension.
|
||||
This can be used to write rules that check file naming conventions.
|
||||
|
||||
since: 6.38.0
|
||||
notes: *needs_node_ctx
|
||||
examples:
|
||||
- code: "//b[pmd:fileName() = 'Foo.xml']"
|
||||
outcome: "Matches any `<b>` tags in files called `Foo.xml`."
|
||||
|
||||
- name: startLine
|
||||
returnType: "xs:int"
|
||||
parameters:
|
||||
- *node_param
|
||||
shortDescription: "Returns the start line of the given node"
|
||||
description: |
|
||||
Returns the line where the node starts in the source file.
|
||||
Line numbers are 1-based.
|
||||
|
||||
since: 6.44.0
|
||||
notes: *coord_fun_note
|
||||
examples:
|
||||
- code: "//b[pmd:startLine(.) > 5]"
|
||||
outcome: "Matches any `<b>` node which starts after the fifth line."
|
||||
|
||||
- name: endLine
|
||||
returnType: "xs:int"
|
||||
parameters:
|
||||
- *node_param
|
||||
shortDescription: "Returns the end line of the given node"
|
||||
description: |
|
||||
Returns the line where the node ends in the source file.
|
||||
Line numbers are 1-based.
|
||||
|
||||
since: 6.44.0
|
||||
notes: *coord_fun_note
|
||||
examples:
|
||||
- code: "//b[pmd:endLine(.) == pmd:startLine(.)]"
|
||||
outcome: "Matches any `<b>` node which doesn't span more than one line."
|
||||
|
||||
- name: startColumn
|
||||
returnType: "xs:int"
|
||||
parameters:
|
||||
- *node_param
|
||||
shortDescription: "Returns the start column of the given node (inclusive)"
|
||||
description: |
|
||||
Returns the column number where the node starts in the source file.
|
||||
Column numbers are 1-based. The start column is inclusive.
|
||||
|
||||
since: 6.44.0
|
||||
notes: *coord_fun_note
|
||||
examples:
|
||||
- code: "//b[pmd:startColumn(.) = 1]"
|
||||
outcome: "Matches any `<b>` node which starts on the first column of a line"
|
||||
|
||||
- name: endColumn
|
||||
returnType: "xs:int"
|
||||
parameters:
|
||||
- *node_param
|
||||
shortDescription: "Returns the end column of the given node (exclusive)"
|
||||
description: |
|
||||
Returns the column number where the node ends in the source file.
|
||||
Column numbers are 1-based. The end column is exclusive.
|
||||
|
||||
since: 6.44.0
|
||||
notes: *coord_fun_note
|
||||
examples:
|
||||
- code: "//b[pmd:startLine(.) = pmd:endLine(.) and pmd:endColumn(.) - pmd:startColumn(.) = 1]"
|
||||
outcome: "Matches any `<b>` node which spans exactly one character"
|
||||
|
||||
- name: "Java"
|
||||
ns: "pmd-java"
|
||||
|
@ -4,7 +4,11 @@
|
||||
|
||||
### {{ lang.name }}
|
||||
|
||||
{% if lang.header %}
|
||||
{{ lang.header | render_markdown }}
|
||||
{% else %}
|
||||
{{ lang.name }} functions are in the namespace `{{ lang.ns }}`.
|
||||
{% endif %}
|
||||
|
||||
<div class="table-responsive">
|
||||
<table width="100%">
|
||||
@ -50,6 +54,10 @@
|
||||
|
||||
<dl>
|
||||
<dd>{{ fun.description | render_markdown }}</dd>
|
||||
{% if fun.since %}
|
||||
<dt>Since</dt>
|
||||
<dd>PMD {{ fun.since }}</dd>
|
||||
{% endif %}
|
||||
<dt>Remarks</dt>
|
||||
<dd>{{ fun.notes | render_markdown }}</dd>
|
||||
|
||||
|
@ -1,12 +1,30 @@
|
||||
<footer>
|
||||
<div class="row">
|
||||
<div class="col-lg-12 footer">
|
||||
<p class="float-right"><img src="{{ "images/logo/pmd-logo-70px.png" }}" alt="PMD logo"/></p>
|
||||
<p>
|
||||
©{{ site.time | date: "%Y" }} {{site.company_name}}. All rights reserved. <br />
|
||||
{% if page.last_updated %}<span>Page last updated:</span> {{page.last_updated}}<br/>{% endif %}
|
||||
Site last generated: {{ site.time | date: "%b %-d, %Y" }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% if site.github_editme_path and page.editmepath != false %}
|
||||
<hr />
|
||||
<div>
|
||||
This documentation is written in markdown. <br />
|
||||
If there is something missing or can be improved, edit this page on
|
||||
github and create a PR:
|
||||
<a
|
||||
target="_blank"
|
||||
href="https://github.com/{{site.github_editme_path}}{{editmepath}}"
|
||||
role="button"
|
||||
><i class="fa fa-github fa-lg"></i> Edit on GitHub</a
|
||||
>
|
||||
</div>
|
||||
{% endif %}
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-lg-12 footer">
|
||||
©{{ site.time | date: "%Y" }} {{site.company_name}}. All rights
|
||||
reserved. <br />
|
||||
{% if page.last_updated %}<span>Page last updated:</span>
|
||||
{{page.last_updated}}<br />{% endif %} Site last generated: {{
|
||||
site.time | date: "%b %-d, %Y" }} <br />
|
||||
<p>
|
||||
<img src="{{ "images/logo/pmd-logo-70px.png" }}" alt="PMD
|
||||
logo"/>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
23
docs/_includes/header.html
Normal file
23
docs/_includes/header.html
Normal file
@ -0,0 +1,23 @@
|
||||
<header>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<a href="./" role="button"
|
||||
><i class="fa fa-home fa-lg"></i
|
||||
></a>
|
||||
» {{page.title}} {% if site.github_editme_path %} {% assign
|
||||
editmepath = page.path %} {% if page.editmepath %} {% assign
|
||||
editmepath = page.editmepath %} {% endif %}{% unless page.editmepath
|
||||
== false %}
|
||||
<a
|
||||
target="_blank"
|
||||
href="https://github.com/{{site.github_editme_path}}{{editmepath}}"
|
||||
class="float-right"
|
||||
role="button"
|
||||
><i class="fa fa-github fa-lg"></i> Edit on GitHub</a
|
||||
>
|
||||
{% endunless %} {% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
</header>
|
@ -1,5 +0,0 @@
|
||||
{% comment %}
|
||||
Note: The content of the div-element is filled by javascript. See customscripts.js.
|
||||
{% endcomment %}
|
||||
|
||||
<div id="toc"></div>
|
@ -36,7 +36,7 @@
|
||||
{% unless page.toc == false %}
|
||||
<!-- Sticky TOC column -->
|
||||
<div class="toc-col">
|
||||
{% include toc.html %}
|
||||
<div id="toc"></div>
|
||||
</div>
|
||||
{% endunless %}
|
||||
<!-- /.toc-container-wrapper -->
|
||||
|
@ -2,31 +2,19 @@
|
||||
layout: default
|
||||
---
|
||||
|
||||
{% include header.html %}
|
||||
|
||||
<div class="post-header">
|
||||
<h1 class="post-title-main">{{ page.title }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="post-content">
|
||||
<div class="post-content" {% if site.github_editme_path and page.editmepath != false %}data-github-edit-url="https://github.com/{{site.github_editme_path}}{{editmepath}}"{% endif %}>
|
||||
|
||||
{% if page.summary %}
|
||||
<div class="summary">{{page.summary}}</div>
|
||||
{% endif %}
|
||||
|
||||
<div id="inline-toc"><!-- empty, move TOC here when screen size too small --></div>
|
||||
|
||||
|
||||
{% if site.github_editme_path %}
|
||||
|
||||
{% assign editmepath = page.path %}
|
||||
{% if page.editmepath %}
|
||||
{% assign editmepath = page.editmepath %}
|
||||
{% endif %}
|
||||
{% unless page.editmepath == false %}
|
||||
<a target="_blank" href="https://github.com/{{site.github_editme_path}}{{editmepath}}" class="btn btn-outline-secondary githubEditButton" role="button"><i class="fab fa-github fa-lg"></i> Edit me</a>
|
||||
{% endunless %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{{content}}
|
||||
|
||||
<div class="tags">
|
||||
@ -43,6 +31,5 @@ layout: default
|
||||
|
||||
</div>
|
||||
|
||||
{{site.data.alerts.hr_shaded}}
|
||||
|
||||
{% include footer.html %}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -28,6 +28,10 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
header {
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
details {
|
||||
border-radius: 3px;
|
||||
background: #EEE;
|
||||
|
@ -1,14 +1,21 @@
|
||||
|
||||
// Detect small devices and move the TOC in line
|
||||
function moveToc(){
|
||||
if(window.innerWidth < 1350){
|
||||
$( "#toc" ).detach().appendTo("#inline-toc").removeClass("position-fixed");
|
||||
$( '#toc' ).detach().appendTo('#inline-toc').removeClass('position-fixed');
|
||||
} else {
|
||||
$( "#toc" ).detach().appendTo(".toc-col").addClass("position-fixed");
|
||||
$( '#toc' ).detach().appendTo('.toc-col').addClass('position-fixed');
|
||||
}
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
$(document).ready(function () {
|
||||
// This handles the automatic toc. Use ## for subheads to auto-generate the on-page minitoc.
|
||||
// If you use html tags, you must supply an ID for the heading element in order for it to appear in the minitoc.
|
||||
$('#toc').toc({
|
||||
minimumHeaders: 0,
|
||||
listType: 'ul',
|
||||
showSpeed: 0,
|
||||
headers: 'h2,h3,h4',
|
||||
});
|
||||
|
||||
$('#mysidebar').height($(".nav").height());
|
||||
|
||||
@ -18,18 +25,31 @@ $( document ).ready(function() {
|
||||
var h = $(window).height();
|
||||
//console.log (h);
|
||||
if (h > 600) {
|
||||
$( "#mysidebar" ).attr("class", "nav position-fixed");
|
||||
$( '#mysidebar' ).attr('class', 'nav position-fixed');
|
||||
}
|
||||
|
||||
// activate tooltips. although this is a bootstrap js function, it must be activated this way in your theme.
|
||||
$('[data-toggle="tooltip"]').tooltip({
|
||||
placement : 'top'
|
||||
placement: 'top',
|
||||
});
|
||||
|
||||
/**
|
||||
* AnchorJS
|
||||
*/
|
||||
anchors.add('h2,h3,h4,h5');
|
||||
|
||||
// Add an "Edit on GitHub" button to each header (except h1)
|
||||
let url = $('div.post-content').data('githubEditUrl');
|
||||
if ( url !== undefined ) {
|
||||
$('div.post-content')
|
||||
.find(':header:not(h1)')
|
||||
.append(
|
||||
' <a class="edit-header" target="_blank" href=' +
|
||||
url +
|
||||
' role="button">✏️️</a>'
|
||||
);
|
||||
}
|
||||
|
||||
// Check if TOC needs to be moved on page load
|
||||
moveToc();
|
||||
|
||||
@ -37,10 +57,10 @@ $( document ).ready(function() {
|
||||
// when you're viewing a page.
|
||||
// Note: the class needs to be added before navgoco is initialized. Navgoco uses then this information
|
||||
// to expand the menus.
|
||||
$("li.active").parents('li').toggleClass("active");
|
||||
$( 'li.active' ).parents('li').toggleClass('active');
|
||||
|
||||
// Initialize navgoco with default options
|
||||
$("#mysidebar").navgoco({
|
||||
$( '#mysidebar' ).navgoco({
|
||||
caretHtml: '',
|
||||
accordion: true,
|
||||
openClass: 'active',
|
||||
@ -51,10 +71,6 @@ $( document ).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
// This handles the automatic toc. Use ## for subheads to auto-generate the on-page minitoc.
|
||||
// If you use html tags, you must supply an ID for the heading element in order for it to appear in the minitoc.
|
||||
$('#toc').toc({ minimumHeaders: 0, listType: 'ul', showSpeed: 0, headers: 'h2,h3,h4' });
|
||||
|
||||
// Initialize jekyll search in topnav.
|
||||
SimpleJekyllSearch.init({
|
||||
searchInput: document.getElementById('search-input'),
|
||||
@ -85,4 +101,6 @@ $( document ).ready(function() {
|
||||
});
|
||||
|
||||
// Check if TOC needs to be moved on window resizing
|
||||
$(window).resize(function () {moveToc();});
|
||||
$(window).resize(function () {
|
||||
moveToc();
|
||||
});
|
||||
|
@ -5,38 +5,38 @@
|
||||
$('a[data-toggle="pill"], a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
|
||||
var tabId, json, parentId, tabsState;
|
||||
|
||||
tabsState = localStorage.getItem("tabs-state");
|
||||
tabsState = localStorage.getItem('tabs-state');
|
||||
json = JSON.parse(tabsState || "{}");
|
||||
parentId = $(e.target).parents("ul.nav.nav-pills, ul.nav.nav-tabs").attr("id");
|
||||
parentId = $(e.target).parents('ul.nav.nav-pills, ul.nav.nav-tabs').attr('id');
|
||||
tabId = $(e.target).attr('id');
|
||||
json[parentId] = tabId;
|
||||
|
||||
return localStorage.setItem("tabs-state", JSON.stringify(json));
|
||||
return localStorage.setItem('tabs-state', JSON.stringify(json));
|
||||
});
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
var json, tabsState;
|
||||
tabsState = localStorage.getItem("tabs-state");
|
||||
json = JSON.parse(tabsState || "{}");
|
||||
tabsState = localStorage.getItem('tabs-state');
|
||||
json = JSON.parse(tabsState || '{}');
|
||||
|
||||
$.each(json, function(containerId, tabId) {
|
||||
if (containerId && containerId !== "undefined" && tabId && tabId !== "undefined"
|
||||
if (containerId && containerId !== 'undefined' && tabId && tabId !== 'undefined'
|
||||
&& tabId.indexOf('#') !== 0) {
|
||||
$("#" + tabId).tab('show');
|
||||
$('#' + tabId).tab('show');
|
||||
}
|
||||
});
|
||||
|
||||
$("ul.nav.nav-pills, ul.nav.nav-tabs").each(function() {
|
||||
$('ul.nav.nav-pills, ul.nav.nav-tabs').each(function() {
|
||||
var $this = $(this);
|
||||
if (!json[$this.attr("id")]) {
|
||||
return $this.find("a[data-toggle=tab]:first, a[data-toggle=pill]:first").tab("show");
|
||||
if (!json[$this.attr('id')]) {
|
||||
return $this.find('a[data-toggle=tab]:first, a[data-toggle=pill]:first').tab('show');
|
||||
}
|
||||
});
|
||||
|
||||
// cleanup "undefined" entries
|
||||
delete json['undefined'];
|
||||
localStorage.setItem("tabs-state", JSON.stringify(json));
|
||||
localStorage.setItem('tabs-state', JSON.stringify(json));
|
||||
|
||||
registerTabEvent();
|
||||
});
|
||||
|
@ -246,6 +246,42 @@ 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.44.0
|
||||
|
||||
##### Deprecated API
|
||||
|
||||
* Several members of {% jdoc core::PMD %} have been newly deprecated, including:
|
||||
- `PMD#EOL`: use `System#lineSeparator()`
|
||||
- `PMD#SUPPRESS_MARKER`: use {% jdoc core::PMDConfiguration#DEFAULT_SUPPRESS_MARKER %}
|
||||
- `PMD#processFiles`: use the new programmatic API
|
||||
- `PMD#getApplicableFiles`: is internal
|
||||
* {% jdoc !!core::PMDConfiguration#prependClasspath(java.lang.String) %} is deprecated
|
||||
in favour of {% jdoc core::PMDConfiguration#prependAuxClasspath(java.lang.String) %}.
|
||||
* {% jdoc !!core::PMDConfiguration#setRuleSets(java.lang.String) %} and
|
||||
{% jdoc core::PMDConfiguration#getRuleSets() %} are deprecated. Use instead
|
||||
{% jdoc core::PMDConfiguration#setRuleSets(java.util.List) %},
|
||||
{% jdoc core::PMDConfiguration#addRuleSet(java.lang.String) %},
|
||||
and {% jdoc core::PMDConfiguration#getRuleSetPaths() %}.
|
||||
* Several members of {% jdoc test::cli.BaseCLITest %} have been deprecated with replacements.
|
||||
* Several members of {% jdoc core::cli.PMDCommandLineInterface %} have been explicitly deprecated.
|
||||
The whole class however was deprecated long ago already with 6.30.0. It is internal API and should
|
||||
not be used.
|
||||
|
||||
* In modelica, the rule classes {% jdoc modelica::lang.modelica.rule.AmbiguousResolutionRule %}
|
||||
and {% jdoc modelica::lang.modelica.rule.ConnectUsingNonConnector %} have been deprecated,
|
||||
since they didn't comply to the usual rule class naming conventions yet.
|
||||
The replacements are in the subpackage `bestpractices`.
|
||||
|
||||
##### Experimental APIs
|
||||
|
||||
* Together with the new programmatic API the interface
|
||||
{% jdoc core::lang.document.TextFile %} has been added as *experimental*. It intends
|
||||
to replace {% jdoc core::util.datasource.DataSource %} and {% jdoc core::cpd.SourceCode %} in the long term.
|
||||
|
||||
This interface will change in PMD 7 to support read/write operations
|
||||
and other things. You don't need to use it in PMD 6, as {% jdoc core::lang.document.FileCollector %}
|
||||
decouples you from this. A file collector is available through {% jdoc !!core::PmdAnalysis#files() %}.
|
||||
|
||||
#### 6.43.0
|
||||
|
||||
##### Deprecated API
|
||||
|
@ -84,9 +84,6 @@ Now the source and binary distribution zip files can be found in the folder `pmd
|
||||
|
||||
**Notes:**
|
||||
|
||||
* The rules that have already been written are specified in the `src/main/resources/rulesets/` directories of
|
||||
the specific languages, e.g. `pmd-java/src/main/resources/rulesets`.
|
||||
They’re also in the jar file that’s included with both the source and binary distributions.
|
||||
|
||||
A paucity of detail, I’m sure you’d agree. If you think this document can be improved,
|
||||
please post [here](http://sourceforge.net/p/pmd/discussion/188192) and let me know how. Thanks!
|
||||
- The rules that have already been written are specified in the `src/main/resources/category/` directories of
|
||||
the specific languages, e.g. `pmd-java/src/main/resources/category`.
|
||||
They’re also in the jar file that’s included with both the source and binary distributions.
|
||||
|
39
docs/pages/pmd/languages/java_versions.md
Normal file
39
docs/pages/pmd/languages/java_versions.md
Normal file
@ -0,0 +1,39 @@
|
||||
---
|
||||
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.
|
75
docs/pages/pmd/languages/xml.md
Normal file
75
docs/pages/pmd/languages/xml.md
Normal file
@ -0,0 +1,75 @@
|
||||
---
|
||||
title: Processing XML files
|
||||
permalink: pmd_languages_xml.html
|
||||
last_updated: March 2022 (6.44.0)
|
||||
---
|
||||
|
||||
## The XML language module
|
||||
|
||||
PMD has an XML language module which exposes the [DOM](https://de.wikipedia.org/wiki/Document_Object_Model)
|
||||
of an XML document as an AST. Different flavours of XML are represented by separate
|
||||
language instances, which all use the same parser under the hood. The following
|
||||
table lists the languages currently provided by the `pmd-xml` maven module.
|
||||
|
||||
| Language ID | Description |
|
||||
|-------------|-----------------------------------|
|
||||
| xml | Generic XML language |
|
||||
| pom | Maven Project Object Model (POM) |
|
||||
| wsdl | Web Services Description Language |
|
||||
| xsl | Extensible Stylesheet Language |
|
||||
|
||||
Each of those languages has a separate rule index, and may provide domain-specific
|
||||
[XPath functions](pmd_userdocs_extending_writing_xpath_rules.html#pmd-extension-functions).
|
||||
At their core they use the same parsing facilities though.
|
||||
|
||||
### File attribution
|
||||
|
||||
Any file ending with `.xml` is associated with the `xml` language. Other XML flavours
|
||||
use more specific extensions, like `.xsl`.
|
||||
|
||||
Some XML-based file formats do not conventionally use a `.xml` extension. To associate
|
||||
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
|
||||
```
|
||||
Please refer to [PMD CLI reference](pmd_userdocs_cli_reference.html#analyze-other-xml-formats)
|
||||
for more examples.
|
||||
|
||||
|
||||
### XPath rules in XML
|
||||
|
||||
While other languages use {% jdoc core::lang.rule.XPathRule %} to create XPath rules,
|
||||
the use of this class is not recommended for XML languages. Instead, since 6.44.0, you
|
||||
are advised to use {% jdoc xml::lang.xml.rule.DomXPathRule %}. This rule class interprets
|
||||
XPath queries exactly as regular XPath, while `XPathRule` works on a wrapper for the
|
||||
DOM which is inconsistent with the XPath spec. Since `DomXPathRule` conforms to the
|
||||
XPath spec, you can
|
||||
- test XML queries in any stock XPath testing tool, or use resources like StackOverflow
|
||||
to help you write XPath queries.
|
||||
- match XML comments and processing instructions
|
||||
- use standard XPath functions like `text()` or `fn:string`
|
||||
|
||||
{% include note.html content="The Rule Designer only works with `XPathRule`, and the tree it prints is inconsistent with the DOM representation used by `DomXPathRule`. You can use an online free XPath testing tool to test your query instead." %}
|
||||
|
||||
Here's an example declaration of a `DomXPathRule`:
|
||||
```xml
|
||||
<rule name="MyXPathRule"
|
||||
language="xml"
|
||||
message="A message"
|
||||
class="net.sourceforge.pmd.lang.xml.rule.DomXPathRule">
|
||||
|
||||
<properties>
|
||||
<property name="xpath">
|
||||
<value><![CDATA[
|
||||
/a/b/c[@attr = "5"]
|
||||
]]></value>
|
||||
</property>
|
||||
<!-- Note: the property "version" is unsupported. -->
|
||||
</properties>
|
||||
</rule>
|
||||
```
|
||||
The most important change is the `class` attribute, which doesn't point to `XPathRule`
|
||||
but to `DomXPathRule`. Please see the Javadoc for {% jdoc xml::lang.xml.rule.DomXPathRule %}
|
||||
for more info about the differences with `XPathRule`.
|
||||
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user