forked from phoedos/pmd
Merge branch 'master' of github.com:pmd/pmd into HEAD
This commit is contained in:
+32
-13
@@ -1,5 +1,3 @@
|
||||
dist: trusty
|
||||
sudo: false
|
||||
addons:
|
||||
ssh_known_hosts:
|
||||
- web.sourceforge.net
|
||||
@@ -10,20 +8,39 @@ env:
|
||||
global:
|
||||
- secure: KBEuB6U1p5RQXSYe157AwydFr/zpXQPA0IChVCgZV+X1mMyy9ZtrjH1J1AXuviseDDXDbaT25sRnsvpl82rfRw2xOkMGXHy4N95/ylTSr8DjHxTao71BhXsvFycNobFva5y2EGNWqDvpS8I2oSZo7Qk4la3yep3rcJQvcy6RDbbhpDTbL1QMFyadunIBm0WtqbunrMqtjSqaoPsXz8TiQuxHvX4vEXzVbaxV1QQt79Vi+daa6wAV3mRQAugnx+UffsC8JqMxgm06usWeJgCJzxgm8E7clZCLmf53B2TL8dK6bIYbqyvOY3uFxitsTG0d8Z0GOJwXBgZNgbniTRO8ZJSty5eZP8LBybbjVLSL25DNTWtCjADUL/uySnXIEidlMt2N/3QmH7zrGAfAk/tIwKpdRca2GLLydeXf6PSkiahnPEkIY/QupcsOLELhdifpdOjb8QW1OenA+vUbNM9dccLwKnX6Fj9cu4VQG601AcYDr2eyhq8WYkr3wYdw/6KdUa3hmplowTBs+qguppP+eOSgGuEsy38KLtqnvm6WlHy6tcLmcVYKG3DmR1b7TWXsOXC6/VMH8BHBkvsF1QdRg9+Cgx07vX3Hw7roPiYzmaO9Ajs20ATsUfRskMuWCTeTSK5pN8X27veRCZlhFjeKQMDdmfVwzpAfRgKsl3TEn1I=
|
||||
- secure: U1DfAv6acUUWe+dao/ZSDUX64JRadNJY16rITsdrM4ZNAJSuXpEY3p/LWcYjN7D49YmyutbXH9+L3KKQUQGrGXj9QTarfYvd8ZsKt4FK8yv7AFy+RQNIbAjNEHBzHx15p+srMheTaetl7aLwY0qhF+D/RtGapxHKyY4dBHrb0lp8VGyiCiL7Aop8GGskosi1mtirPBp/BStPZ2bEyxG0QzU5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UILD=sonar
|
||||
- BUILD=coveralls
|
||||
- secure: "VezxV+VdmbmtrQYT8AZIyg41WBROxuxpumerkcubADF7V4wV6lwx9Rd2G6yAr0VuHCNUUhS4m+gPFIsuiQbAhyupiEkwhzUYqk1tF+LITlLLPegLypjiLmhJMwGUNuDSSsih1Icmg9FzrP4VyzgGn9pBjoG9QYj1civBZeGwg++e/XDYlHMXrpd/UEfMKVB71JwB0tle4fKJZSvblIqP62yvbBaKHx6A4+ZWzJV5Vps0DoIeNtKCNmNNloKZVHfjbsvqSjnMYUJzkOzyPkM822q41N/D+3IAufO16+jH/W0vAZeN0e4GXiN5W+CVkr2Gbh0FwkVQcI3bekaOIn45XLUMLKdf+JsWDPKz9RraHelR9YxL5GoJ7ntwvmucxw0p8EVyJ/xLk/pBCP8iHq0Jb8//js25XHgxzzAWI37MErPAAGgTKZAVdAN0mGXbe63tWmwaBlEbK8h2A8di6abW5x6YHTkTo2BRlHUSTU8dE3VqTnpSkne5n1SlEa4g1Bci3J45M0/pLmHV6yCxCM5BrVXS5ByaB61py/umSbpmdIBFV6TM1MaKK3lAucQrR+8To/vCbm8XqPyujJdOR+ENIuuDgEU/Yh5Hv5SAODekUYaCp4pjfGzFADHQWVNDxIOXrwBN4OfSiAvRc1x6HXndOmNI4QtOxheuCRFFthq8VZI="
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- name: "linux - mvn deploy"
|
||||
os: linux
|
||||
dist: trusty
|
||||
sudo: false
|
||||
env: BUILD=deploy
|
||||
- name: "linux - build documentation"
|
||||
os: linux
|
||||
dist: trusty
|
||||
sudo: false
|
||||
env: BUILD=doc
|
||||
- name: "linux - run sonar"
|
||||
os: linux
|
||||
dist: trusty
|
||||
sudo: false
|
||||
env: BUILD=sonar
|
||||
- name: "linux - run coveralls"
|
||||
os: linux
|
||||
dist: trusty
|
||||
sudo: false
|
||||
env: BUILD=coveralls
|
||||
- name: "macosx - mvn verify"
|
||||
os: osx
|
||||
env: BUILD=deploy
|
||||
|
||||
before_install:
|
||||
- wget https://github.com/sormuras/bach/raw/master/install-jdk.sh
|
||||
@@ -31,10 +48,11 @@ before_install:
|
||||
- bash .travis/configure-maven.sh
|
||||
- rvm install 2.4.1
|
||||
- rvm use 2.4.1
|
||||
# Install OracleJDK 10 - see https://sormuras.github.io/blog/2018-03-20-jdk-matrix.html
|
||||
# Install OpenJDK 11 - see https://sormuras.github.io/blog/2018-03-20-jdk-matrix.html
|
||||
install:
|
||||
- . ./install-jdk.sh -F 10 -L BCL
|
||||
- bundle install --without=release_notes_preprocessing
|
||||
- . ./install-jdk.sh -F 11 -L GPL -W $HOME/jdk
|
||||
- gem install bundler
|
||||
- bundle install --with=release_notes_preprocessing
|
||||
before_script: true
|
||||
script: source .travis/build-$BUILD.sh
|
||||
after_success: true
|
||||
@@ -72,7 +90,8 @@ cache:
|
||||
directories:
|
||||
- "$HOME/.m2"
|
||||
- vendor/bundle
|
||||
|
||||
- "$HOME/jdk"
|
||||
- "$HOME/.rvm/"
|
||||
|
||||
# Secure Keys, that need to be set for snapshot builds
|
||||
#
|
||||
|
||||
@@ -4,7 +4,7 @@ set -e
|
||||
source .travis/logger.sh
|
||||
source .travis/common-functions.sh
|
||||
|
||||
VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec | tail -1)
|
||||
VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec)
|
||||
log_info "Building PMD Coveralls.io report ${VERSION} on branch ${TRAVIS_BRANCH}"
|
||||
|
||||
if ! travis_isPush; then
|
||||
@@ -12,17 +12,12 @@ if ! travis_isPush; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#
|
||||
# for java9: enable all modules.
|
||||
# coveralls plugin seems to need java.xml.bind module
|
||||
echo "MAVEN_OPTS='-Xms1g -Xmx1g --add-modules java.se.ee'" > ${HOME}/.mavenrc
|
||||
|
||||
(
|
||||
# disable fast fail, exit immediately, in this subshell
|
||||
set +e
|
||||
|
||||
./mvnw clean install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
|
||||
./mvnw test jacoco:report coveralls:report -Pcoveralls -B -V
|
||||
./mvnw package jacoco:report coveralls:report -Pcoveralls -B -V
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
log_error "Error creating coveralls report"
|
||||
|
||||
+32
-5
@@ -48,7 +48,12 @@ log_info "Building PMD ${VERSION} on branch ${TRAVIS_BRANCH}"
|
||||
|
||||
MVN_BUILD_FLAGS="-B -V"
|
||||
|
||||
if travis_isPullRequest; then
|
||||
if travis_isOSX; then
|
||||
|
||||
log_info "The build is running on OSX"
|
||||
./mvnw verify $MVN_BUILD_FLAGS
|
||||
|
||||
elif travis_isPullRequest; then
|
||||
|
||||
log_info "This is a pull-request build"
|
||||
./mvnw verify $MVN_BUILD_FLAGS
|
||||
@@ -90,13 +95,35 @@ elif travis_isPush; then
|
||||
else
|
||||
log_success "Successfully uploaded pmd-*-${VERSION}.zip to sourceforge"
|
||||
fi
|
||||
rsync -avh docs/pages/release_notes.md ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd/${VERSION}/ReadMe.md
|
||||
if [ $? -ne 0 ]; then
|
||||
|
||||
)
|
||||
|
||||
( # UPLOAD RELEASE NOTES TO SOURCEFORGE
|
||||
|
||||
# This handler is called if any command fails
|
||||
function release_notes_fail() {
|
||||
log_error "Error while uploading release_notes.md as ReadMe.md to sourceforge!"
|
||||
log_error "Please upload manually: https://sourceforge.net/projects/pmd/files/pmd/"
|
||||
else
|
||||
}
|
||||
|
||||
# exit subshell after trap
|
||||
set -e
|
||||
trap release_notes_fail ERR
|
||||
|
||||
RELEASE_NOTES_TMP=$(mktemp -t)
|
||||
|
||||
.travis/render_release_notes.rb docs/pages/release_notes.md | tail -n +6 > "$RELEASE_NOTES_TMP"
|
||||
|
||||
rsync -avh "$RELEASE_NOTES_TMP" ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd/${VERSION}/ReadMe.md
|
||||
|
||||
log_success "Successfully uploaded release_notes.md as ReadMe.md to sourceforge"
|
||||
fi
|
||||
|
||||
)
|
||||
|
||||
|
||||
(
|
||||
# disable fast fail, exit immediately, in this subshell
|
||||
set +e
|
||||
|
||||
upload_baseline
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ set -e
|
||||
source .travis/logger.sh
|
||||
source .travis/common-functions.sh
|
||||
|
||||
VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec | tail -1)
|
||||
VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec)
|
||||
log_info "Building PMD Documentation ${VERSION} on branch ${TRAVIS_BRANCH}"
|
||||
|
||||
if ! travis_isPush; then
|
||||
|
||||
@@ -4,7 +4,7 @@ set -e
|
||||
source .travis/logger.sh
|
||||
source .travis/common-functions.sh
|
||||
|
||||
VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec | tail -1)
|
||||
VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec)
|
||||
log_info "Building PMD Sonar ${VERSION} on branch ${TRAVIS_BRANCH}"
|
||||
|
||||
if ! travis_isPush; then
|
||||
@@ -12,17 +12,17 @@ if ! travis_isPush; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#
|
||||
# for java9: enable all modules.
|
||||
# sonar plugin seems to need java.xml.bind module
|
||||
echo "MAVEN_OPTS='-Xms1g -Xmx1g --add-modules java.se.ee'" > ${HOME}/.mavenrc
|
||||
|
||||
(
|
||||
# for sonar, we need to use java10, until sonarjava 5.8.0 is released (Sept. 2018)
|
||||
JAVA_HOME=$(bash ./install-jdk.sh -F 10 -L GPL -W $HOME/jdk --emit-java-home | tail --lines 1)
|
||||
export JAVA_HOME
|
||||
export PATH=${JAVA_HOME}/bin:$PATH
|
||||
|
||||
# disable fast fail, exit immediately, in this subshell
|
||||
set +e
|
||||
|
||||
# Run the build
|
||||
./mvnw clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${SONAR_TOKEN} -B -V
|
||||
./mvnw clean package sonar:sonar -Dsonar.login=${SONAR_TOKEN} -Psonar -B -V
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
log_error "Error updating sonar..."
|
||||
|
||||
@@ -10,6 +10,7 @@ echo "TRAVIS_SECURE_ENV_VARS: ${TRAVIS_SECURE_ENV_VARS}"
|
||||
echo "TRAVIS_BRANCH: ${TRAVIS_BRANCH}"
|
||||
echo "TRAVIS_TAG: ${TRAVIS_TAG}"
|
||||
echo "TRAVIS_ALLOW_FAILURE: ${TRAVIS_ALLOW_FAILURE}"
|
||||
echo "TRAVIS_OS_NAME: ${TRAVIS_OS_NAME}"
|
||||
|
||||
function travis_isPullRequest() {
|
||||
if [ "${TRAVIS_REPO_SLUG}" != "pmd/pmd" ] || [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
|
||||
@@ -27,6 +28,14 @@ function travis_isPush() {
|
||||
fi
|
||||
}
|
||||
|
||||
function travis_isOSX() {
|
||||
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function has_docs_change() {
|
||||
if [[ $(git diff --name-only ${TRAVIS_COMMIT_RANGE}) = *"docs/"* ]]; then
|
||||
log_info "Checking for changes in docs/ (TRAVIS_COMMIT_RANGE=${TRAVIS_COMMIT_RANGE}): changes found"
|
||||
|
||||
@@ -28,9 +28,6 @@ if [ "${BUILD}" = "deploy" ]; then
|
||||
true
|
||||
)
|
||||
|
||||
# install the gems required for rendering the release notes
|
||||
bundle install --with=release_notes_preprocessing
|
||||
|
||||
# renders, and skips the first 6 lines - the Jekyll front-matter
|
||||
RENDERED_RELEASE_NOTES=$(bundle exec .travis/render_release_notes.rb docs/pages/release_notes.md | tail -n +6)
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ require "safe_yaml"
|
||||
|
||||
# include some custom liquid extensions
|
||||
require_relative "../docs/_plugins/rule_tag"
|
||||
require_relative "../docs/_plugins/tocmaker_block"
|
||||
require_relative "../docs/_plugins/custom_filters"
|
||||
|
||||
# explicitly setting safe mode to get rid of the warning
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
<interactiveMode/>
|
||||
<usePluginRegistry/>
|
||||
<offline/>
|
||||
<pluginGroups/>
|
||||
<pluginGroups>
|
||||
<pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
|
||||
</pluginGroups>
|
||||
<servers>
|
||||
<server>
|
||||
<id>ossrh</id>
|
||||
|
||||
+3
-2
@@ -1,7 +1,8 @@
|
||||
# How to build PMD
|
||||
|
||||
PMD uses [Maven](https://maven.apache.org/) and requires [Java 9](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
|
||||
for building.
|
||||
PMD uses [Maven](https://maven.apache.org/) and requires at least Java 10 for building.
|
||||
You can get Java 10 from [Oracle](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
|
||||
or from the [OpenJDK Project](http://jdk.java.net).
|
||||
|
||||
PMD uses the [maven wrapper](https://github.com/takari/maven-wrapper), so you can simply build PMD as following:
|
||||
|
||||
|
||||
@@ -3,7 +3,9 @@ source 'https://rubygems.org/'
|
||||
gem 'pmdtester', '~> 1.0.0.pre.beta3'
|
||||
gem 'danger', '~> 5.6', '>= 5.6'
|
||||
|
||||
# This group is only needed during release (via .travis/release.sh and do-release.sh)
|
||||
# This group is only needed for rendering release notes
|
||||
# this happens during release (.travis/release.sh and do-release.sh)
|
||||
# but also during regular builds (.travis/build-deploy.sh)
|
||||
group :release_notes_preprocessing do
|
||||
gem 'liquid', '>=4.0.0'
|
||||
gem 'safe_yaml', '>=1.0'
|
||||
|
||||
+14
-17
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Make sure, everything is English...
|
||||
export LANG=C.UTF8
|
||||
export LANG=C.UTF-8
|
||||
|
||||
# verify the current directory
|
||||
if [ ! -f pom.xml -o ! -d ../pmd.github.io ]; then
|
||||
@@ -62,15 +62,19 @@ echo "Press enter to continue..."
|
||||
read
|
||||
|
||||
|
||||
# install bundles needed for rendering release notes
|
||||
bundle install with=release_notes_preprocessing --path vendor/bundle
|
||||
|
||||
|
||||
export RELEASE_VERSION
|
||||
export DEVELOPMENT_VERSION
|
||||
export CURRENT_BRANCH
|
||||
|
||||
|
||||
# install bundles needed for rendering release notes
|
||||
bundle install --with=release_notes_preprocessing --path vendor/bundle
|
||||
|
||||
RELEASE_RULESET="pmd-core/src/main/resources/rulesets/releases/${RELEASE_VERSION//\./}.xml"
|
||||
export RELEASE_NOTES_POST="_posts/$(date -u +%Y-%m-%d)-PMD-${RELEASE_VERSION}.md"
|
||||
echo "Generating ../pmd.github.io/${RELEASE_NOTES_POST}..."
|
||||
NEW_RELEASE_NOTES=$(bundle exec .travis/render_release_notes.rb docs/pages/release_notes.md | tail -n +6)
|
||||
echo "${NEW_RELEASE_NOTES}" > ../pmd.github.io/${RELEASE_NOTES_POST}
|
||||
|
||||
echo "* Update date info in **docs/_config.yml**."
|
||||
echo " date: $(date -u +%d-%B-%Y)"
|
||||
@@ -80,8 +84,6 @@ echo " ${RELEASE_RULESET}"
|
||||
echo
|
||||
echo "* Update **../pmd.github.io/_config.yml** to mention the new release"
|
||||
echo
|
||||
echo "* Add **../pmd.github.io/_posts/$(date -u +%Y-%m-%d)-PMD-${RELEASE_VERSION}.md"
|
||||
echo
|
||||
echo "Press enter to continue..."
|
||||
read
|
||||
echo "Committing current changes (pmd)"
|
||||
@@ -95,7 +97,7 @@ git commit -a -m "Prepare pmd release ${RELEASE_VERSION}"
|
||||
(
|
||||
echo "Committing current changes (pmd.github.io)"
|
||||
cd ../pmd.github.io
|
||||
git add _posts/$(date -u +%Y-%m-%d)-PMD-${RELEASE_VERSION}.md
|
||||
git add ${RELEASE_NOTES_POST}
|
||||
git commit -a -m "Prepare pmd release ${RELEASE_VERSION}"
|
||||
git push
|
||||
)
|
||||
@@ -117,7 +119,6 @@ echo
|
||||
echo "Check the milestone on github:"
|
||||
echo "<https://github.com/pmd/pmd/milestones>"
|
||||
echo " --> move any open issues to the next milestone, close the current milestone"
|
||||
echo " --> Maybe there are some milestones on sourceforge, too: <https://sourceforge.net/p/pmd/bugs/milestones>."
|
||||
echo
|
||||
echo
|
||||
echo "Prepare Next development version:"
|
||||
@@ -129,7 +130,6 @@ read
|
||||
|
||||
# update release_notes_old
|
||||
OLD_RELEASE_NOTES=$(tail -n +8 docs/pages/release_notes_old.md)
|
||||
NEW_RELEASE_NOTES=$(bundle exec .travis/render_release_notes.rb docs/pages/release_notes.md | tail -n +6)
|
||||
echo "$(head -n 7 docs/pages/release_notes_old.md)" > docs/pages/release_notes_old.md
|
||||
echo "$NEW_RELEASE_NOTES" >> docs/pages/release_notes_old.md
|
||||
echo >> docs/pages/release_notes_old.md
|
||||
@@ -143,18 +143,13 @@ permalink: pmd_release_notes.html
|
||||
keywords: changelog, release notes
|
||||
---
|
||||
|
||||
## {{ site.pmd.date }} - {{ site.pmd.version | append_unless: is_release_version, "-SNAPSHOT" }}
|
||||
## {{ site.pmd.date }} - {{ site.pmd.version }}
|
||||
|
||||
The PMD team is pleased to announce PMD {{ site.pmd.version }}.
|
||||
|
||||
This is a {{ site.pmd.release_type }} release.
|
||||
|
||||
### Table Of Contents
|
||||
|
||||
* [New and noteworthy](#new-and-noteworthy)
|
||||
* [Fixed Issues](#fixed-issues)
|
||||
* [API Changes](#api-changes)
|
||||
* [External Contributions](#external-contributions)
|
||||
{% tocmaker is_release_notes_processor %}
|
||||
|
||||
### New and noteworthy
|
||||
|
||||
@@ -164,6 +159,8 @@ This is a {{ site.pmd.release_type }} release.
|
||||
|
||||
### External Contributions
|
||||
|
||||
{% endtocmaker %}
|
||||
|
||||
EOF
|
||||
|
||||
git commit -a -m "Prepare next development version"
|
||||
|
||||
+27
-28
@@ -13,10 +13,11 @@ GEM
|
||||
execjs
|
||||
coffee-script-source (1.11.1)
|
||||
colorator (1.1.0)
|
||||
commonmarker (0.17.9)
|
||||
commonmarker (0.17.11)
|
||||
ruby-enum (~> 0.5)
|
||||
concurrent-ruby (1.0.5)
|
||||
dnsruby (1.60.2)
|
||||
dnsruby (1.61.2)
|
||||
addressable (~> 2.5)
|
||||
em-websocket (0.5.1)
|
||||
eventmachine (>= 0.12.9)
|
||||
http_parser.rb (~> 0.6.0)
|
||||
@@ -26,29 +27,29 @@ GEM
|
||||
execjs (2.7.0)
|
||||
faraday (0.15.2)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
ffi (1.9.23)
|
||||
ffi (1.9.25)
|
||||
forwardable-extended (2.6.0)
|
||||
gemoji (3.0.0)
|
||||
github-pages (186)
|
||||
github-pages (191)
|
||||
activesupport (= 4.2.10)
|
||||
github-pages-health-check (= 1.8.1)
|
||||
jekyll (= 3.7.3)
|
||||
jekyll-avatar (= 0.5.0)
|
||||
jekyll-avatar (= 0.6.0)
|
||||
jekyll-coffeescript (= 1.1.1)
|
||||
jekyll-commonmark-ghpages (= 0.1.5)
|
||||
jekyll-default-layout (= 0.1.4)
|
||||
jekyll-feed (= 0.9.3)
|
||||
jekyll-feed (= 0.10.0)
|
||||
jekyll-gist (= 1.5.0)
|
||||
jekyll-github-metadata (= 2.9.4)
|
||||
jekyll-mentions (= 1.3.0)
|
||||
jekyll-mentions (= 1.4.1)
|
||||
jekyll-optional-front-matter (= 0.3.0)
|
||||
jekyll-paginate (= 1.1.0)
|
||||
jekyll-readme-index (= 0.2.0)
|
||||
jekyll-redirect-from (= 0.13.0)
|
||||
jekyll-redirect-from (= 0.14.0)
|
||||
jekyll-relative-links (= 0.5.3)
|
||||
jekyll-remote-theme (= 0.3.1)
|
||||
jekyll-sass-converter (= 1.5.2)
|
||||
jekyll-seo-tag (= 2.4.0)
|
||||
jekyll-seo-tag (= 2.5.0)
|
||||
jekyll-sitemap (= 1.2.0)
|
||||
jekyll-swiss (= 0.4.0)
|
||||
jekyll-theme-architect (= 0.1.1)
|
||||
@@ -65,12 +66,12 @@ GEM
|
||||
jekyll-theme-tactile (= 0.1.1)
|
||||
jekyll-theme-time-machine (= 0.1.1)
|
||||
jekyll-titles-from-headings (= 0.5.1)
|
||||
jemoji (= 0.9.0)
|
||||
kramdown (= 1.16.2)
|
||||
jemoji (= 0.10.1)
|
||||
kramdown (= 1.17.0)
|
||||
liquid (= 4.0.0)
|
||||
listen (= 3.1.5)
|
||||
mercenary (~> 0.3)
|
||||
minima (= 2.4.1)
|
||||
minima (= 2.5.0)
|
||||
nokogiri (>= 1.8.2, < 2.0)
|
||||
rouge (= 2.2.1)
|
||||
terminal-table (~> 1.4)
|
||||
@@ -80,7 +81,7 @@ GEM
|
||||
octokit (~> 4.0)
|
||||
public_suffix (~> 2.0)
|
||||
typhoeus (~> 1.3)
|
||||
html-pipeline (2.8.0)
|
||||
html-pipeline (2.8.4)
|
||||
activesupport (>= 2)
|
||||
nokogiri (>= 1.4)
|
||||
http_parser.rb (0.6.0)
|
||||
@@ -99,7 +100,7 @@ GEM
|
||||
pathutil (~> 0.9)
|
||||
rouge (>= 1.7, < 4)
|
||||
safe_yaml (~> 1.0)
|
||||
jekyll-avatar (0.5.0)
|
||||
jekyll-avatar (0.6.0)
|
||||
jekyll (~> 3.0)
|
||||
jekyll-coffeescript (1.1.1)
|
||||
coffee-script (~> 2.2)
|
||||
@@ -113,15 +114,14 @@ GEM
|
||||
rouge (~> 2)
|
||||
jekyll-default-layout (0.1.4)
|
||||
jekyll (~> 3.0)
|
||||
jekyll-feed (0.9.3)
|
||||
jekyll-feed (0.10.0)
|
||||
jekyll (~> 3.3)
|
||||
jekyll-gist (1.5.0)
|
||||
octokit (~> 4.2)
|
||||
jekyll-github-metadata (2.9.4)
|
||||
jekyll (~> 3.1)
|
||||
octokit (~> 4.0, != 4.4.0)
|
||||
jekyll-mentions (1.3.0)
|
||||
activesupport (~> 4.0)
|
||||
jekyll-mentions (1.4.1)
|
||||
html-pipeline (~> 2.3)
|
||||
jekyll (~> 3.0)
|
||||
jekyll-optional-front-matter (0.3.0)
|
||||
@@ -129,7 +129,7 @@ GEM
|
||||
jekyll-paginate (1.1.0)
|
||||
jekyll-readme-index (0.2.0)
|
||||
jekyll (~> 3.0)
|
||||
jekyll-redirect-from (0.13.0)
|
||||
jekyll-redirect-from (0.14.0)
|
||||
jekyll (~> 3.3)
|
||||
jekyll-relative-links (0.5.3)
|
||||
jekyll (~> 3.3)
|
||||
@@ -138,7 +138,7 @@ GEM
|
||||
rubyzip (>= 1.2.1, < 3.0)
|
||||
jekyll-sass-converter (1.5.2)
|
||||
sass (~> 3.4)
|
||||
jekyll-seo-tag (2.4.0)
|
||||
jekyll-seo-tag (2.5.0)
|
||||
jekyll (~> 3.3)
|
||||
jekyll-sitemap (1.2.0)
|
||||
jekyll (~> 3.3)
|
||||
@@ -187,12 +187,11 @@ GEM
|
||||
jekyll (~> 3.3)
|
||||
jekyll-watch (2.0.0)
|
||||
listen (~> 3.0)
|
||||
jemoji (0.9.0)
|
||||
activesupport (~> 4.0, >= 4.2.9)
|
||||
jemoji (0.10.1)
|
||||
gemoji (~> 3.0)
|
||||
html-pipeline (~> 2.2)
|
||||
jekyll (~> 3.0)
|
||||
kramdown (1.16.2)
|
||||
kramdown (1.17.0)
|
||||
liquid (4.0.0)
|
||||
listen (3.1.5)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
@@ -200,15 +199,15 @@ GEM
|
||||
ruby_dep (~> 1.2)
|
||||
mercenary (0.3.6)
|
||||
mini_portile2 (2.3.0)
|
||||
minima (2.4.1)
|
||||
minima (2.5.0)
|
||||
jekyll (~> 3.5)
|
||||
jekyll-feed (~> 0.9)
|
||||
jekyll-seo-tag (~> 2.1)
|
||||
minitest (5.11.3)
|
||||
multipart-post (2.0.0)
|
||||
nokogiri (1.8.2)
|
||||
nokogiri (1.8.4)
|
||||
mini_portile2 (~> 2.3.0)
|
||||
octokit (4.9.0)
|
||||
octokit (4.11.0)
|
||||
sawyer (~> 0.8.0, >= 0.5.3)
|
||||
pathutil (0.16.1)
|
||||
forwardable-extended (~> 2.6)
|
||||
@@ -220,9 +219,9 @@ GEM
|
||||
ruby-enum (0.7.2)
|
||||
i18n
|
||||
ruby_dep (1.5.0)
|
||||
rubyzip (1.2.1)
|
||||
rubyzip (1.2.2)
|
||||
safe_yaml (1.0.4)
|
||||
sass (3.5.6)
|
||||
sass (3.5.7)
|
||||
sass-listen (~> 4.0.0)
|
||||
sass-listen (4.0.0)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
@@ -237,7 +236,7 @@ GEM
|
||||
ethon (>= 0.9.0)
|
||||
tzinfo (1.2.5)
|
||||
thread_safe (~> 0.1)
|
||||
unicode-display_width (1.3.3)
|
||||
unicode-display_width (1.4.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
repository: pmd/pmd
|
||||
|
||||
pmd:
|
||||
version: 6.7.0
|
||||
date: 2018-??-??
|
||||
version: 6.8.0
|
||||
date: ??-??-2018
|
||||
release_type: minor
|
||||
|
||||
output: web
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
# Generates a table of contents based on markdown headers in the body
|
||||
#
|
||||
# The block has 2 optional args:
|
||||
# * A variable name. If provided, the toc will only be generated if the var is true
|
||||
# * An integer, describing the maximum depth at which headers are added to the toc
|
||||
|
||||
class TocMakerBlock < Liquid::Block
|
||||
|
||||
def initialize(tag_name, arg, tokens)
|
||||
super
|
||||
|
||||
condition, depth = arg.split
|
||||
|
||||
@max_depth = depth.to_s.empty? ? 100 : depth.to_i
|
||||
@condition_var = condition.strip unless condition.to_s.empty?
|
||||
|
||||
@body = tokens
|
||||
end
|
||||
|
||||
def to_internal_link(header)
|
||||
url = header.downcase.gsub(/\s+/, "-")
|
||||
|
||||
"[#{header}](##{url})"
|
||||
end
|
||||
|
||||
def render(context)
|
||||
|
||||
contents = @body.render(context)
|
||||
|
||||
if @condition_var && !context[@condition_var]
|
||||
# If the condition is false, the toc is not generated
|
||||
return contents
|
||||
end
|
||||
|
||||
headers = contents.lines.map {|l|
|
||||
if /^(#+)\s+(\S.*)$/ =~ l
|
||||
[$1.length, $2]
|
||||
end
|
||||
}.compact
|
||||
|
||||
min_indent = headers.map {|t| t[0]}.min
|
||||
|
||||
headers = headers.map {|t|
|
||||
actual_depth = t[0] - min_indent
|
||||
if actual_depth < @max_depth then
|
||||
|
||||
indent = " " * actual_depth
|
||||
|
||||
"#{indent}* #{to_internal_link(t[1])}"
|
||||
end
|
||||
}.compact
|
||||
|
||||
headers.unshift("### Table Of Contents\n")
|
||||
|
||||
headers.join("\n") + contents
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Liquid::Template.register_tag('tocmaker', TocMakerBlock)
|
||||
@@ -10,10 +10,9 @@ author: Tom Copeland, Xavier Le Vourch <xlv@users.sourceforge.net>
|
||||
|
||||
# Compiling PMD
|
||||
|
||||
* JDK 9 or higher
|
||||
* [Apache Maven](http://maven.apache.org) 3 or later.
|
||||
* JDK 10 or higher
|
||||
|
||||
{% include note.html content="While Java 9 is required for building, running PMD only requires Java 7 (or Java 8 for Apex)." %}
|
||||
{% include note.html content="While Java 10 is required for building, running PMD only requires Java 7 (or Java 8 for Apex and the Designer)." %}
|
||||
|
||||
You’ll need to either check out the source code or download the latest source release. Assuming you’ve got the latest source release, unzip it to a directory:
|
||||
|
||||
|
||||
@@ -145,18 +145,13 @@ permalink: pmd_release_notes.html
|
||||
keywords: changelog, release notes
|
||||
---
|
||||
|
||||
## {{ site.pmd.date }} - {{ site.pmd.version | append_unless: is_release_version, "-SNAPSHOT" }}
|
||||
## {{ site.pmd.date }} - {{ site.pmd.version }}
|
||||
|
||||
The PMD team is pleased to announce PMD {{ site.pmd.version }}.
|
||||
|
||||
This is a {{ site.pmd.release_type }} release.
|
||||
|
||||
### Table Of Contents
|
||||
|
||||
* [New and noteworthy](#new-and-noteworthy)
|
||||
* [Fixed Issues](#fixed-issues)
|
||||
* [API Changes](#api-changes)
|
||||
* [External Contributions](#external-contributions)
|
||||
{% tocmaker %}
|
||||
|
||||
### New and noteworthy
|
||||
|
||||
@@ -166,6 +161,8 @@ This is a {{ site.pmd.release_type }} release.
|
||||
|
||||
### External Contributions
|
||||
|
||||
{% endtocmaker %}
|
||||
|
||||
```
|
||||
{%endraw%}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ folder: pmd/rules
|
||||
* [IfElseStmtsMustUseBraces](pmd_rules_apex_codestyle.html#ifelsestmtsmustusebraces): Avoid using if..else statements without using surrounding braces. If the code formattingor indent...
|
||||
* [IfStmtsMustUseBraces](pmd_rules_apex_codestyle.html#ifstmtsmustusebraces): Avoid using if statements without using braces to surround the code block. If the codeformatting ...
|
||||
* [MethodNamingConventions](pmd_rules_apex_codestyle.html#methodnamingconventions): Method names should always begin with a lower case character, and should not contain underscores.
|
||||
* [OneDeclarationPerLine](pmd_rules_apex_codestyle.html#onedeclarationperline): Apex allows the use of several variables declaration of the same type on one line. However, itcan...
|
||||
* [VariableNamingConventions](pmd_rules_apex_codestyle.html#variablenamingconventions): A variable naming conventions rule - customize this to your liking. Currently, itchecks for fina...
|
||||
* [WhileLoopsMustUseBraces](pmd_rules_apex_codestyle.html#whileloopsmustusebraces): Avoid using 'while' statements without using braces to surround the code block. If the codeformat...
|
||||
|
||||
@@ -112,7 +113,7 @@ folder: pmd/rules
|
||||
|
||||
It contains the following rules:
|
||||
|
||||
[ApexBadCrypto](pmd_rules_apex_security.html#apexbadcrypto), [ApexCRUDViolation](pmd_rules_apex_security.html#apexcrudviolation), [ApexCSRF](pmd_rules_apex_security.html#apexcsrf), [ApexDangerousMethods](pmd_rules_apex_security.html#apexdangerousmethods), [ApexInsecureEndpoint](pmd_rules_apex_security.html#apexinsecureendpoint), [ApexOpenRedirect](pmd_rules_apex_security.html#apexopenredirect), [ApexSharingViolations](pmd_rules_apex_security.html#apexsharingviolations), [ApexSOQLInjection](pmd_rules_apex_security.html#apexsoqlinjection), [ApexSuggestUsingNamedCred](pmd_rules_apex_security.html#apexsuggestusingnamedcred), [ApexUnitTestClassShouldHaveAsserts](pmd_rules_apex_bestpractices.html#apexunittestclassshouldhaveasserts), [ApexUnitTestShouldNotUseSeeAllDataTrue](pmd_rules_apex_bestpractices.html#apexunittestshouldnotuseseealldatatrue), [ApexXSSFromEscapeFalse](pmd_rules_apex_security.html#apexxssfromescapefalse), [ApexXSSFromURLParam](pmd_rules_apex_security.html#apexxssfromurlparam), [AvoidDeeplyNestedIfStmts](pmd_rules_apex_design.html#avoiddeeplynestedifstmts), [AvoidDirectAccessTriggerMap](pmd_rules_apex_errorprone.html#avoiddirectaccesstriggermap), [AvoidDmlStatementsInLoops](pmd_rules_apex_performance.html#avoiddmlstatementsinloops), [AvoidGlobalModifier](pmd_rules_apex_bestpractices.html#avoidglobalmodifier), [AvoidHardcodingId](pmd_rules_apex_errorprone.html#avoidhardcodingid), [AvoidLogicInTrigger](pmd_rules_apex_bestpractices.html#avoidlogicintrigger), [AvoidNonExistentAnnotations](pmd_rules_apex_errorprone.html#avoidnonexistentannotations), [AvoidSoqlInLoops](pmd_rules_apex_performance.html#avoidsoqlinloops), [AvoidSoslInLoops](pmd_rules_apex_performance.html#avoidsoslinloops), [ClassNamingConventions](pmd_rules_apex_codestyle.html#classnamingconventions), [CyclomaticComplexity](pmd_rules_apex_design.html#cyclomaticcomplexity), [EmptyCatchBlock](pmd_rules_apex_errorprone.html#emptycatchblock), [EmptyIfStmt](pmd_rules_apex_errorprone.html#emptyifstmt), [EmptyStatementBlock](pmd_rules_apex_errorprone.html#emptystatementblock), [EmptyTryOrFinallyBlock](pmd_rules_apex_errorprone.html#emptytryorfinallyblock), [EmptyWhileStmt](pmd_rules_apex_errorprone.html#emptywhilestmt), [ExcessiveClassLength](pmd_rules_apex_design.html#excessiveclasslength), [ExcessiveParameterList](pmd_rules_apex_design.html#excessiveparameterlist), [ExcessivePublicCount](pmd_rules_apex_design.html#excessivepubliccount), [ForLoopsMustUseBraces](pmd_rules_apex_codestyle.html#forloopsmustusebraces), [IfElseStmtsMustUseBraces](pmd_rules_apex_codestyle.html#ifelsestmtsmustusebraces), [IfStmtsMustUseBraces](pmd_rules_apex_codestyle.html#ifstmtsmustusebraces), [MethodNamingConventions](pmd_rules_apex_codestyle.html#methodnamingconventions), [MethodWithSameNameAsEnclosingClass](pmd_rules_apex_errorprone.html#methodwithsamenameasenclosingclass), [NcssConstructorCount](pmd_rules_apex_design.html#ncssconstructorcount), [NcssMethodCount](pmd_rules_apex_design.html#ncssmethodcount), [NcssTypeCount](pmd_rules_apex_design.html#ncsstypecount), [StdCyclomaticComplexity](pmd_rules_apex_design.html#stdcyclomaticcomplexity), [TooManyFields](pmd_rules_apex_design.html#toomanyfields), [VariableNamingConventions](pmd_rules_apex_codestyle.html#variablenamingconventions), [WhileLoopsMustUseBraces](pmd_rules_apex_codestyle.html#whileloopsmustusebraces)
|
||||
[ApexBadCrypto](pmd_rules_apex_security.html#apexbadcrypto), [ApexCRUDViolation](pmd_rules_apex_security.html#apexcrudviolation), [ApexCSRF](pmd_rules_apex_security.html#apexcsrf), [ApexDangerousMethods](pmd_rules_apex_security.html#apexdangerousmethods), [ApexInsecureEndpoint](pmd_rules_apex_security.html#apexinsecureendpoint), [ApexOpenRedirect](pmd_rules_apex_security.html#apexopenredirect), [ApexSharingViolations](pmd_rules_apex_security.html#apexsharingviolations), [ApexSOQLInjection](pmd_rules_apex_security.html#apexsoqlinjection), [ApexSuggestUsingNamedCred](pmd_rules_apex_security.html#apexsuggestusingnamedcred), [ApexUnitTestClassShouldHaveAsserts](pmd_rules_apex_bestpractices.html#apexunittestclassshouldhaveasserts), [ApexUnitTestShouldNotUseSeeAllDataTrue](pmd_rules_apex_bestpractices.html#apexunittestshouldnotuseseealldatatrue), [ApexXSSFromEscapeFalse](pmd_rules_apex_security.html#apexxssfromescapefalse), [ApexXSSFromURLParam](pmd_rules_apex_security.html#apexxssfromurlparam), [AvoidDeeplyNestedIfStmts](pmd_rules_apex_design.html#avoiddeeplynestedifstmts), [AvoidDirectAccessTriggerMap](pmd_rules_apex_errorprone.html#avoiddirectaccesstriggermap), [AvoidDmlStatementsInLoops](pmd_rules_apex_performance.html#avoiddmlstatementsinloops), [AvoidGlobalModifier](pmd_rules_apex_bestpractices.html#avoidglobalmodifier), [AvoidHardcodingId](pmd_rules_apex_errorprone.html#avoidhardcodingid), [AvoidLogicInTrigger](pmd_rules_apex_bestpractices.html#avoidlogicintrigger), [AvoidNonExistentAnnotations](pmd_rules_apex_errorprone.html#avoidnonexistentannotations), [AvoidSoqlInLoops](pmd_rules_apex_performance.html#avoidsoqlinloops), [AvoidSoslInLoops](pmd_rules_apex_performance.html#avoidsoslinloops), [ClassNamingConventions](pmd_rules_apex_codestyle.html#classnamingconventions), [CyclomaticComplexity](pmd_rules_apex_design.html#cyclomaticcomplexity), [EmptyCatchBlock](pmd_rules_apex_errorprone.html#emptycatchblock), [EmptyIfStmt](pmd_rules_apex_errorprone.html#emptyifstmt), [EmptyStatementBlock](pmd_rules_apex_errorprone.html#emptystatementblock), [EmptyTryOrFinallyBlock](pmd_rules_apex_errorprone.html#emptytryorfinallyblock), [EmptyWhileStmt](pmd_rules_apex_errorprone.html#emptywhilestmt), [ExcessiveClassLength](pmd_rules_apex_design.html#excessiveclasslength), [ExcessiveParameterList](pmd_rules_apex_design.html#excessiveparameterlist), [ExcessivePublicCount](pmd_rules_apex_design.html#excessivepubliccount), [ForLoopsMustUseBraces](pmd_rules_apex_codestyle.html#forloopsmustusebraces), [IfElseStmtsMustUseBraces](pmd_rules_apex_codestyle.html#ifelsestmtsmustusebraces), [IfStmtsMustUseBraces](pmd_rules_apex_codestyle.html#ifstmtsmustusebraces), [MethodNamingConventions](pmd_rules_apex_codestyle.html#methodnamingconventions), [MethodWithSameNameAsEnclosingClass](pmd_rules_apex_errorprone.html#methodwithsamenameasenclosingclass), [NcssConstructorCount](pmd_rules_apex_design.html#ncssconstructorcount), [NcssMethodCount](pmd_rules_apex_design.html#ncssmethodcount), [NcssTypeCount](pmd_rules_apex_design.html#ncsstypecount), [OneDeclarationPerLine](pmd_rules_apex_codestyle.html#onedeclarationperline), [StdCyclomaticComplexity](pmd_rules_apex_design.html#stdcyclomaticcomplexity), [TooManyFields](pmd_rules_apex_design.html#toomanyfields), [VariableNamingConventions](pmd_rules_apex_codestyle.html#variablenamingconventions), [WhileLoopsMustUseBraces](pmd_rules_apex_codestyle.html#whileloopsmustusebraces)
|
||||
|
||||
* Empty Code (`rulesets/apex/empty.xml`):
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ permalink: pmd_rules_apex_codestyle.html
|
||||
folder: pmd/rules/apex
|
||||
sidebaractiveurl: /pmd_rules_apex.html
|
||||
editmepath: ../pmd-apex/src/main/resources/category/apex/codestyle.xml
|
||||
keywords: Code Style, ClassNamingConventions, IfElseStmtsMustUseBraces, IfStmtsMustUseBraces, ForLoopsMustUseBraces, MethodNamingConventions, VariableNamingConventions, WhileLoopsMustUseBraces
|
||||
keywords: Code Style, ClassNamingConventions, IfElseStmtsMustUseBraces, IfStmtsMustUseBraces, ForLoopsMustUseBraces, MethodNamingConventions, OneDeclarationPerLine, VariableNamingConventions, WhileLoopsMustUseBraces
|
||||
language: Apex
|
||||
---
|
||||
## ClassNamingConventions
|
||||
@@ -192,6 +192,52 @@ public class Foo {
|
||||
<rule ref="category/apex/codestyle.xml/MethodNamingConventions" />
|
||||
```
|
||||
|
||||
## OneDeclarationPerLine
|
||||
|
||||
**Since:** PMD 6.7.0
|
||||
|
||||
**Priority:** High (1)
|
||||
|
||||
Apex allows the use of several variables declaration of the same type on one line. However, it
|
||||
can lead to quite messy code. This rule looks for several declarations on the same line.
|
||||
|
||||
**This rule is defined by the following XPath expression:**
|
||||
``` xpath
|
||||
//VariableDeclarationStatements
|
||||
[count(VariableDeclaration) > 1]
|
||||
[$strictMode or count(distinct-values(VariableDeclaration/@BeginLine)) != count(VariableDeclaration)]
|
||||
|
|
||||
//FieldDeclarationStatements
|
||||
[count(FieldDeclaration) > 1]
|
||||
[$strictMode or count(distinct-values(FieldDeclaration/VariableExpression/@BeginLine)) != count(FieldDeclaration/VariableExpression)]
|
||||
```
|
||||
|
||||
**Example(s):**
|
||||
|
||||
``` java
|
||||
Integer a, b; // not recommended
|
||||
|
||||
Integer a,
|
||||
b; // ok by default, can be flagged setting the strictMode property
|
||||
|
||||
Integer a; // preferred approach
|
||||
Integer b;
|
||||
```
|
||||
|
||||
**This rule has the following properties:**
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|cc_categories|Style|Code Climate Categories|yes. Delimiter is '\|'.|
|
||||
|cc_remediation_points_multiplier|1|Code Climate Remediation Points multiplier|no|
|
||||
|cc_block_highlighting|false|Code Climate Block Highlighting|no|
|
||||
|strictMode|false|If true, mark combined declaration even if the declarations are on separate lines.|no|
|
||||
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
<rule ref="category/apex/codestyle.xml/OneDeclarationPerLine" />
|
||||
```
|
||||
|
||||
## VariableNamingConventions
|
||||
|
||||
**Since:** PMD 5.5.0
|
||||
|
||||
@@ -63,7 +63,7 @@ folder: pmd/rules
|
||||
* [AtLeastOneConstructor](pmd_rules_java_codestyle.html#atleastoneconstructor): Each non-static class should declare at least one constructor.Classes with solely static members ...
|
||||
* [AvoidDollarSigns](pmd_rules_java_codestyle.html#avoiddollarsigns): Avoid using dollar signs in variable/method/class/interface names.
|
||||
* [AvoidFinalLocalVariable](pmd_rules_java_codestyle.html#avoidfinallocalvariable): Avoid using final local variables, turn them into fields.
|
||||
* [AvoidPrefixingMethodParameters](pmd_rules_java_codestyle.html#avoidprefixingmethodparameters): Prefixing parameters by 'in' or 'out' pollutes the name of the parameters and reduces code readab...
|
||||
* [AvoidPrefixingMethodParameters](pmd_rules_java_codestyle.html#avoidprefixingmethodparameters): <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Prefixing parameters by 'in' or 'out' pollutes the name of the parameters and reduces code readab...
|
||||
* [AvoidProtectedFieldInFinalClass](pmd_rules_java_codestyle.html#avoidprotectedfieldinfinalclass): Do not use protected fields in final classes since they cannot be subclassed.Clarify your intent ...
|
||||
* [AvoidProtectedMethodInFinalClassNotExtending](pmd_rules_java_codestyle.html#avoidprotectedmethodinfinalclassnotextending): Do not use protected methods in most final classes since they cannot be subclassed. This shouldon...
|
||||
* [AvoidUsingNativeCode](pmd_rules_java_codestyle.html#avoidusingnativecode): Unnecessary reliance on Java Native Interface (JNI) calls directly reduces application portabilit...
|
||||
@@ -96,7 +96,7 @@ folder: pmd/rules
|
||||
* [MDBAndSessionBeanNamingConvention](pmd_rules_java_codestyle.html#mdbandsessionbeannamingconvention): The EJB Specification states that any MessageDrivenBean or SessionBean should be suffixed by 'Bean'.
|
||||
* [MethodArgumentCouldBeFinal](pmd_rules_java_codestyle.html#methodargumentcouldbefinal): A method argument that is never re-assigned within the method can be declared final.
|
||||
* [MethodNamingConventions](pmd_rules_java_codestyle.html#methodnamingconventions): Configurable naming conventions for method declarations. This rule reports method decl...
|
||||
* [MIsLeadingVariableName](pmd_rules_java_codestyle.html#misleadingvariablename): Detects when a non-field has a name starting with 'm_'. This usually denotes a field and could b...
|
||||
* [MIsLeadingVariableName](pmd_rules_java_codestyle.html#misleadingvariablename): <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Detects when a non-field has a name starting with 'm_'. This usually denotes a field and could b...
|
||||
* [NoPackage](pmd_rules_java_codestyle.html#nopackage): Detects when a class or interface does not have a package definition.
|
||||
* [OnlyOneReturn](pmd_rules_java_codestyle.html#onlyonereturn): A method should have only one exit point, and that should be the last statement in the method.
|
||||
* [PackageCase](pmd_rules_java_codestyle.html#packagecase): Detects when a package definition contains uppercase characters.
|
||||
@@ -106,7 +106,7 @@ folder: pmd/rules
|
||||
* [ShortClassName](pmd_rules_java_codestyle.html#shortclassname): Short Classnames with fewer than e.g. five characters are not recommended.
|
||||
* [ShortMethodName](pmd_rules_java_codestyle.html#shortmethodname): Method names that are very short are not helpful to the reader.
|
||||
* [ShortVariable](pmd_rules_java_codestyle.html#shortvariable): Fields, local variables, or parameter names that are very short are not helpful to the reader.
|
||||
* [SuspiciousConstantFieldName](pmd_rules_java_codestyle.html#suspiciousconstantfieldname): Field names using all uppercase characters - Sun's Java naming conventions indicating constants -...
|
||||
* [SuspiciousConstantFieldName](pmd_rules_java_codestyle.html#suspiciousconstantfieldname): <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Field names using all uppercase characters - Sun's Java naming conventions indicating constants -...
|
||||
* [TooManyStaticImports](pmd_rules_java_codestyle.html#toomanystaticimports): If you overuse the static import feature, it can make your program unreadable and unmaintainable,...
|
||||
* [UnnecessaryAnnotationValueElement](pmd_rules_java_codestyle.html#unnecessaryannotationvalueelement): Avoid the use of value in annotations when it's the only element.
|
||||
* [UnnecessaryConstructor](pmd_rules_java_codestyle.html#unnecessaryconstructor): This rule detects when a constructor is not necessary; i.e., when there is only one constructor a...
|
||||
@@ -116,7 +116,7 @@ folder: pmd/rules
|
||||
* [UnnecessaryReturn](pmd_rules_java_codestyle.html#unnecessaryreturn): Avoid the use of unnecessary return statements.
|
||||
* [UselessParentheses](pmd_rules_java_codestyle.html#uselessparentheses): Useless parentheses should be removed.
|
||||
* [UselessQualifiedThis](pmd_rules_java_codestyle.html#uselessqualifiedthis): Look for qualified this usages in the same class.
|
||||
* [VariableNamingConventions](pmd_rules_java_codestyle.html#variablenamingconventions): A variable naming conventions rule - customize this to your liking. Currently, itchecks for fina...
|
||||
* [VariableNamingConventions](pmd_rules_java_codestyle.html#variablenamingconventions): <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> A variable naming conventions rule - customize this to your liking. Currently, itchecks for fina...
|
||||
* [WhileLoopsMustUseBraces](pmd_rules_java_codestyle.html#whileloopsmustusebraces): <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Avoid using 'while' statements without using braces to surround the code block. If the code forma...
|
||||
|
||||
## Design
|
||||
|
||||
@@ -250,7 +250,6 @@ public class Foo {
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|checkAddressTypes|IPv4 \| IPv6 \| IPv4 mapped IPv6|Check for IP address types.|yes. Delimiter is '\|'.|
|
||||
|pattern|^"[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"$|Regular Expression|no|
|
||||
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
@@ -874,6 +873,10 @@ can lead to quite messy code. This rule looks for several declarations on the sa
|
||||
//LocalVariableDeclaration
|
||||
[count(VariableDeclarator) > 1]
|
||||
[$strictMode or count(distinct-values(VariableDeclarator/@BeginLine)) != count(VariableDeclarator)]
|
||||
|
|
||||
//FieldDeclaration
|
||||
[count(VariableDeclarator) > 1]
|
||||
[$strictMode or count(distinct-values(VariableDeclarator/@BeginLine)) != count(VariableDeclarator)]
|
||||
```
|
||||
|
||||
**Example(s):**
|
||||
|
||||
@@ -141,6 +141,8 @@ public class MyClass {
|
||||
|
||||
## AvoidPrefixingMethodParameters
|
||||
|
||||
<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f;">Deprecated</span>
|
||||
|
||||
**Since:** PMD 5.0
|
||||
|
||||
**Priority:** Medium Low (4)
|
||||
@@ -802,6 +804,7 @@ class Foo {
|
||||
|finalFieldPattern|[a-z][a-zA-Z0-9]*|Regex which applies to final field names|no|
|
||||
|staticFieldPattern|[a-z][a-zA-Z0-9]*|Regex which applies to static field names|no|
|
||||
|defaultFieldPattern|[a-z][a-zA-Z0-9]*|Regex which applies to field names|no|
|
||||
|exclusions|serialVersionUID|Names of fields to whitelist.|yes. Delimiter is '\|'.|
|
||||
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
@@ -1138,15 +1141,16 @@ public class LinguisticNaming {
|
||||
|
||||
|Name|Default Value|Description|Multivalued|
|
||||
|----|-------------|-----------|-----------|
|
||||
|booleanFieldPrefixes|is \| has \| can \| have \| will \| should|the prefixes of fields and variables that indicate boolean|yes. Delimiter is '\|'.|
|
||||
|checkVariables|true|Check local variable names and types for inconsistent naming|no|
|
||||
|checkFields|true|Check field names and types for inconsistent naming|no|
|
||||
|booleanMethodPrefixes|is \| has \| can \| have \| will \| should|the prefixes of methods that return boolean|yes. Delimiter is '\|'.|
|
||||
|checkPrefixedTransformMethods|true|Check return type of methods whose names start with 'to'|no|
|
||||
|checkTransformMethods|false|Check return type of methods which contain 'To' in their name|no|
|
||||
|checkSetters|true|Check return type of setters|no|
|
||||
|checkGetters|true|Check return type of getters|no|
|
||||
|checkBooleanMethod|true|Check method names and types for inconsistent naming|no|
|
||||
|booleanFieldPrefixes|is \| has \| can \| have \| will \| should|The prefixes of fields and variables that indicate boolean.|yes. Delimiter is '\|'.|
|
||||
|checkVariables|true|Check local variable names and types for inconsistent naming.|no|
|
||||
|checkFields|true|Check field names and types for inconsistent naming.|no|
|
||||
|transformMethodNames|to \| as|The prefixes and infixes that indicate a transform method.|yes. Delimiter is '\|'.|
|
||||
|booleanMethodPrefixes|is \| has \| can \| have \| will \| should|The prefixes of methods that return boolean.|yes. Delimiter is '\|'.|
|
||||
|checkPrefixedTransformMethods|true|Check return type of methods whose names start with the configured prefix (see transformMethodNames property).|no|
|
||||
|checkTransformMethods|false|Check return type of methods which contain the configured infix in their name (see transformMethodNames property).|no|
|
||||
|checkSetters|true|Check return type of setters.|no|
|
||||
|checkGetters|true|Check return type of getters.|no|
|
||||
|checkBooleanMethod|true|Check method names and types for inconsistent naming.|no|
|
||||
|
||||
**Use this rule by referencing it:**
|
||||
``` xml
|
||||
@@ -1444,6 +1448,8 @@ public class Foo {
|
||||
|
||||
## MIsLeadingVariableName
|
||||
|
||||
<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f;">Deprecated</span>
|
||||
|
||||
**Since:** PMD 3.4
|
||||
|
||||
**Priority:** Medium (3)
|
||||
@@ -1781,6 +1787,8 @@ public class Something {
|
||||
|
||||
## SuspiciousConstantFieldName
|
||||
|
||||
<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f;">Deprecated</span>
|
||||
|
||||
**Since:** PMD 2.0
|
||||
|
||||
**Priority:** Medium (3)
|
||||
@@ -2194,6 +2202,8 @@ public class Foo {
|
||||
|
||||
## VariableNamingConventions
|
||||
|
||||
<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f;">Deprecated</span>
|
||||
|
||||
**Since:** PMD 1.2
|
||||
|
||||
**Priority:** High (1)
|
||||
|
||||
@@ -17,6 +17,9 @@ sidebar: pmd_sidebar
|
||||
* For Windows: [Winzip](http://winzip.com) or the free [7-zip](http://www.7-zip.org/)
|
||||
* For Linux / Unix: [InfoZip](http://www.info-zip.org/pub/infozip/)
|
||||
|
||||
{% include note.html content="For executing the Designer (./run.sh designer) using [OpenJDK](http://jdk.java.net) or Java 11, you need additionally [OpenJFX](http://jdk.java.net). Download it, extract it and set the environment variable JAVAFX_HOME." %}
|
||||
|
||||
|
||||
### Installation
|
||||
|
||||
PMD is distributed as a zip archive, which includes both [PMD](#running-pmd-via-command-line) and [CPD](/pmd_userdocs_cpd.html).
|
||||
|
||||
+52
-52
@@ -4,76 +4,76 @@ permalink: pmd_release_notes.html
|
||||
keywords: changelog, release notes
|
||||
---
|
||||
|
||||
## {{ site.pmd.date }} - {{ site.pmd.version | append_unless: is_release_version, "-SNAPSHOT" }}
|
||||
## {{ site.pmd.date }} - {{ site.pmd.version }}
|
||||
|
||||
The PMD team is pleased to announce PMD {{ site.pmd.version }}.
|
||||
|
||||
This is a {{ site.pmd.release_type }} release.
|
||||
|
||||
### Table Of Contents
|
||||
|
||||
* [New and noteworthy](#new-and-noteworthy)
|
||||
* [New Rules](#new-rules)
|
||||
* [Fixed Issues](#fixed-issues)
|
||||
* [API Changes](#api-changes)
|
||||
* [External Contributions](#external-contributions)
|
||||
{% tocmaker %}
|
||||
|
||||
### New and noteworthy
|
||||
|
||||
#### New Rules
|
||||
#### Drawing a line between private and public API
|
||||
|
||||
* The new Java rule {% rule java/codestyle/LinguisticNaming %} (`java-codestyle`)
|
||||
detects cases, when a method name indicates it returns a boolean (such as `isSmall()`) but it doesn't.
|
||||
Besides method names, the rule also checks field and variable names. It also checks, that getters return
|
||||
something but setters won't. The rule has several properties with which it can be customized.
|
||||
Until now, all released public members and types were implicitly considered part
|
||||
of PMD's public API, including inheritance-specific members (protected members, abstract methods).
|
||||
We have maintained those APIs with the goal to preserve full binary compatibility between minor releases,
|
||||
only breaking those APIs infrequently, for major releases.
|
||||
|
||||
* The new PL/SQL rule {% rule plsql/codestyle/ForLoopNaming %} (`plsql-codestyle`)
|
||||
enforces a naming convention for "for loops". Both "cursor for loops" and "index for loops" are covered.
|
||||
The rule can be customized via patterns. By default, short variable names are reported.
|
||||
|
||||
* The new Java rule {% rule java/codestyle/FieldNamingConventions %} (`java-codestyle`)
|
||||
detects field names that don't comply to a given convention. It defaults to standard Java convention of using camelCase,
|
||||
but can be configured with ease for e.g. constants or static fields.
|
||||
In order to allow PMD to move forward at a faster pace, this implicit contract will
|
||||
be invalidated with PMD 7.0.0. We now introduce more fine-grained distinctions between
|
||||
the type of compatibility support we guarantee for our libraries, and ways to make
|
||||
them explicit to clients of PMD.
|
||||
|
||||
##### `.internal` packages and `@InternalApi` annotation
|
||||
|
||||
*Internal API* is meant for use *only* by the main PMD codebase. Internal types and methods
|
||||
may be modified in any way, or even removed, at any time.
|
||||
|
||||
Any API in a package that contains an `.internal` segment is considered internal.
|
||||
The `@InternalApi` annotation will be used for APIs that have to live outside of
|
||||
these packages, e.g. methods of a public type that shouldn't be used outside of PMD (again,
|
||||
these can be removed anytime).
|
||||
|
||||
##### `@ReservedSubclassing`
|
||||
|
||||
Types marked with the `@ReservedSubclassing` annotation are only meant to be subclassed
|
||||
by classes within PMD. As such, we may add new abstract methods, or remove protected methods,
|
||||
at any time. All published public members remain supported. The annotation is *not* inherited, which
|
||||
means a reserved interface doesn't prevent its implementors to be subclassed.
|
||||
|
||||
##### `@Experimental`
|
||||
|
||||
|
||||
APIs marked with the `@Experimental` annotation at the class or method level are subject to change.
|
||||
They can be modified in any way, or even removed, at any time. You should not use or rely
|
||||
on them in any production code. They are purely to allow broad testing and feedback.
|
||||
|
||||
##### `@Deprecated`
|
||||
|
||||
APIs marked with the `@Deprecated` annotation at the class or method level will remain supported
|
||||
until the next major release but it is recommended to stop using them.
|
||||
|
||||
|
||||
##### The transition
|
||||
|
||||
*All currently supported APIs will remain so until 7.0.0*. All APIs that are to be moved to
|
||||
`.internal` packages or hidden will be tagged `@InternalApi` before that major release, and
|
||||
the breaking API changes will be performed in 7.0.0.
|
||||
|
||||
### Fixed Issues
|
||||
|
||||
* core
|
||||
* [#1191](https://github.com/pmd/pmd/issues/1191): \[core] Test Framework: Sort violations by line/column
|
||||
* [#1283](https://github.com/pmd/pmd/issues/1283): \[core] Deprecate ReportTree
|
||||
* [#1288](https://github.com/pmd/pmd/issues/1288): \[core] No supported build listeners found with Gradle
|
||||
* [#1300](https://github.com/pmd/pmd/issues/1300): \[core] PMD stops processing file completely, if one rule in a rule chain fails
|
||||
* java-bestpractices
|
||||
* [#940](https://github.com/pmd/pmd/issues/940): \[java] JUnit 4 false positives for JUnit 5 tests
|
||||
* [#1267](https://github.com/pmd/pmd/pull/1267): \[java] MissingOverrideRule: Avoid NoClassDefFoundError with incomplete classpath
|
||||
* java-codestyle
|
||||
* [#1255](https://github.com/pmd/pmd/issues/1255): \[java] UnnecessaryFullyQualifiedName false positive: static method on shadowed implicitly imported class
|
||||
* [#1258](https://github.com/pmd/pmd/issues/1285): \[java] False positive "UselessParentheses" for parentheses that contain assignment
|
||||
* java-errorprone
|
||||
* [#1078](https://github.com/pmd/pmd/issues/1078): \[java] MissingSerialVersionUID rule does not seem to catch inherited classes
|
||||
* [#1329](https://github.com/pmd/pmd/issues/1329): \[java] FieldNamingConventions: false positive in serializable class with serialVersionUID
|
||||
* [#1334](https://github.com/pmd/pmd/issues/1334): \[java] LinguisticNaming should support AtomicBooleans
|
||||
* java-performance
|
||||
* [#1298](https://github.com/pmd/pmd/issues/1298): \[java] RedundantFieldInitializer - NumberFormatException with Long
|
||||
* jsp
|
||||
* [#1274](https://github.com/pmd/pmd/issues/1274): \[jsp] Support EL in tag attributes
|
||||
* [#1276](https://github.com/pmd/pmd/issues/1276): \[jsp] add support for jspf and tag extensions
|
||||
* plsql
|
||||
* [#681](https://github.com/pmd/pmd/issues/681): \[plsql] Parse error with Cursor For Loop
|
||||
* [#1325](https://github.com/pmd/pmd/issues/1325): \[java] False positive in ConsecutiveLiteralAppends
|
||||
|
||||
### API Changes
|
||||
|
||||
* All classes in the package `net.sourceforge.pmd.lang.dfa.report` have been deprecated and will be removed
|
||||
with PMD 7.0.0. This includes the class `net.sourceforge.pmd.lang.dfa.report.ReportTree`. The reason is,
|
||||
that this class is very specific to Java and not suitable for other languages. It has only been used for
|
||||
`YAHTMLRenderer`, which has been rewritten to work without these classes.
|
||||
|
||||
### External Contributions
|
||||
|
||||
* [#109](https://github.com/pmd/pmd/pull/109): \[java] Add two linguistics rules under naming - [Arda Aslan](https://github.com/ardaasln)
|
||||
* [#1254](https://github.com/pmd/pmd/pull/1254): \[ci] \[GSoC] Integrating the danger and pmdtester to travis CI - [BBG](https://github.com/djydewang)
|
||||
* [#1258](https://github.com/pmd/pmd/pull/1258): \[java] Use typeof in MissingSerialVersionUID - [krichter722](https://github.com/krichter722)
|
||||
* [#1264](https://github.com/pmd/pmd/pull/1264): \[cpp] Fix NullPointerException in CPPTokenizer:99 - [Rafael Cortês](https://github.com/mrfyda)
|
||||
* [#1277](https://github.com/pmd/pmd/pull/1277): \[jsp] #1276 add support for jspf and tag extensions - [Jordi Llach](https://github.com/jordillachmrf)
|
||||
* [#1275](https://github.com/pmd/pmd/pull/1275): \[jsp] Issue #1274 - Support EL in tag attributes - [Jordi Llach](https://github.com/jordillachmrf)
|
||||
* [#1278](https://github.com/pmd/pmd/pull/1278): \[ci] \[GSoC] Use pmdtester 1.0.0.pre.beta3 - [BBG](https://github.com/djydewang)
|
||||
* [#1289](https://github.com/pmd/pmd/pull/1289): \[java] UselessParentheses: Fix false positive with assignments - [cobratbq](https://github.com/cobratbq)
|
||||
* [#1290](https://github.com/pmd/pmd/pull/1290): \[docs] \[GSoC] Create the documentation about pmdtester - [BBG](https://github.com/djydewang)
|
||||
* [#1256](https://github.com/pmd/pmd/pull/1256): \[java] #940 Avoid JUnit 4 false positives for JUnit 5 tests - [Alex Shesterov](https://github.com/vovkss)
|
||||
{% endtocmaker %}
|
||||
|
||||
|
||||
@@ -6,6 +6,110 @@ permalink: pmd_release_notes_old.html
|
||||
Previous versions of PMD can be downloaded here:
|
||||
http://sourceforge.net/projects/pmd/files/pmd/
|
||||
|
||||
## 02-September-2018 - 6.7.0
|
||||
|
||||
The PMD team is pleased to announce PMD 6.7.0.
|
||||
|
||||
This is a minor release.
|
||||
|
||||
### Table Of Contents
|
||||
|
||||
* [New and noteworthy](#new-and-noteworthy)
|
||||
* [Modified Rules](#modified-rules)
|
||||
* [New Rules](#new-rules)
|
||||
* [Deprecated Rules](#deprecated-rules)
|
||||
* [Fixed Issues](#fixed-issues)
|
||||
* [API Changes](#api-changes)
|
||||
* [External Contributions](#external-contributions)
|
||||
|
||||
### New and noteworthy
|
||||
|
||||
#### Modified Rules
|
||||
|
||||
* The Java rule {% rule java/bestpractices/OneDeclarationPerLine %} (`java-bestpractices`) has been revamped to
|
||||
consider not only local variable declarations, but field declarations too.
|
||||
|
||||
#### New Rules
|
||||
|
||||
* The new Java rule {% rule java/codestyle/LinguisticNaming %} (`java-codestyle`)
|
||||
detects cases, when a method name indicates it returns a boolean (such as `isSmall()`) but it doesn't.
|
||||
Besides method names, the rule also checks field and variable names. It also checks, that getters return
|
||||
something but setters won't. The rule has several properties with which it can be customized.
|
||||
|
||||
* The new PL/SQL rule {% rule plsql/codestyle/ForLoopNaming %} (`plsql-codestyle`)
|
||||
enforces a naming convention for "for loops". Both "cursor for loops" and "index for loops" are covered.
|
||||
The rule can be customized via patterns. By default, short variable names are reported.
|
||||
|
||||
* The new Java rule {% rule java/codestyle/FieldNamingConventions %} (`java-codestyle`)
|
||||
detects field names that don't comply to a given convention. It defaults to standard Java convention of using camelCase,
|
||||
but can be configured with ease for e.g. constants or static fields.
|
||||
|
||||
* The new Apex rule {% rule apex/codestyle/OneDeclarationPerLine %} (`apex-codestyle`) enforces declaring a
|
||||
single field / variable per line; or per statement if the `strictMode` property is set.
|
||||
It's an Apex equivalent of the already existing Java rule of the same name.
|
||||
|
||||
#### Deprecated Rules
|
||||
|
||||
* The Java rules {% rule java/codestyle/VariableNamingConventions %}, {% rule java/codestyle/MIsLeadingVariableName %},
|
||||
{% rule java/codestyle/SuspiciousConstantFieldName %}, and {% rule java/codestyle/AvoidPrefixingMethodParameters %} are
|
||||
now deprecated, and will be removed with version 7.0.0. They are replaced by the more general
|
||||
{% rule java/codestyle/FieldNamingConventions %}, {% rule java/codestyle/FormalParameterNamingConventions %}, and
|
||||
{% rule java/codestyle/LocalVariableNamingConventions %}.
|
||||
|
||||
### Fixed Issues
|
||||
|
||||
* core
|
||||
* [#1191](https://github.com/pmd/pmd/issues/1191): \[core] Test Framework: Sort violations by line/column
|
||||
* [#1283](https://github.com/pmd/pmd/issues/1283): \[core] Deprecate ReportTree
|
||||
* [#1288](https://github.com/pmd/pmd/issues/1288): \[core] No supported build listeners found with Gradle
|
||||
* [#1300](https://github.com/pmd/pmd/issues/1300): \[core] PMD stops processing file completely, if one rule in a rule chain fails
|
||||
* [#1317](https://github.com/pmd/pmd/issues/1317): \[ci] Coveralls hasn't built the project since June 25th
|
||||
* java-bestpractices
|
||||
* [#940](https://github.com/pmd/pmd/issues/940): \[java] JUnit 4 false positives for JUnit 5 tests
|
||||
* [#1267](https://github.com/pmd/pmd/pull/1267): \[java] MissingOverrideRule: Avoid NoClassDefFoundError with incomplete classpath
|
||||
* [#1323](https://github.com/pmd/pmd/issues/1323): \[java] AvoidUsingHardCodedIP ignores match pattern
|
||||
* [#1327](https://github.com/pmd/pmd/pull/1327): \[java] AvoidUsingHardCodedIP false positive for ":bee"
|
||||
* java-codestyle
|
||||
* [#1255](https://github.com/pmd/pmd/issues/1255): \[java] UnnecessaryFullyQualifiedName false positive: static method on shadowed implicitly imported class
|
||||
* [#1258](https://github.com/pmd/pmd/issues/1285): \[java] False positive "UselessParentheses" for parentheses that contain assignment
|
||||
* java-errorprone
|
||||
* [#1078](https://github.com/pmd/pmd/issues/1078): \[java] MissingSerialVersionUID rule does not seem to catch inherited classes
|
||||
* java-performance
|
||||
* [#1291](https://github.com/pmd/pmd/issues/1291): \[java] InvalidSlf4jMessageFormat false positive: too many arguments with string concatenation operator
|
||||
* [#1298](https://github.com/pmd/pmd/issues/1298): \[java] RedundantFieldInitializer - NumberFormatException with Long
|
||||
* jsp
|
||||
* [#1274](https://github.com/pmd/pmd/issues/1274): \[jsp] Support EL in tag attributes
|
||||
* [#1276](https://github.com/pmd/pmd/issues/1276): \[jsp] add support for jspf and tag extensions
|
||||
* plsql
|
||||
* [#681](https://github.com/pmd/pmd/issues/681): \[plsql] Parse error with Cursor For Loop
|
||||
|
||||
### API Changes
|
||||
|
||||
* All classes in the package `net.sourceforge.pmd.lang.dfa.report` have been deprecated and will be removed
|
||||
with PMD 7.0.0. This includes the class `net.sourceforge.pmd.lang.dfa.report.ReportTree`. The reason is,
|
||||
that this class is very specific to Java and not suitable for other languages. It has only been used for
|
||||
`YAHTMLRenderer`, which has been rewritten to work without these classes.
|
||||
|
||||
* The nodes RUNSIGNEDSHIFT and RSIGNEDSHIFT are deprecated and will be removed from the AST with PMD 7.0.0.
|
||||
These represented the operator of ShiftExpression in two cases out of three, but they're not needed and
|
||||
make ShiftExpression inconsistent. The operator of a ShiftExpression is now accessible through
|
||||
ShiftExpression#getOperator.
|
||||
|
||||
### External Contributions
|
||||
|
||||
* [#109](https://github.com/pmd/pmd/pull/109): \[java] Add two linguistics rules under naming - [Arda Aslan](https://github.com/ardaasln)
|
||||
* [#1254](https://github.com/pmd/pmd/pull/1254): \[ci] \[GSoC] Integrating the danger and pmdtester to travis CI - [BBG](https://github.com/djydewang)
|
||||
* [#1258](https://github.com/pmd/pmd/pull/1258): \[java] Use typeof in MissingSerialVersionUID - [krichter722](https://github.com/krichter722)
|
||||
* [#1264](https://github.com/pmd/pmd/pull/1264): \[cpp] Fix NullPointerException in CPPTokenizer:99 - [Rafael Cortês](https://github.com/mrfyda)
|
||||
* [#1277](https://github.com/pmd/pmd/pull/1277): \[jsp] #1276 add support for jspf and tag extensions - [Jordi Llach](https://github.com/jordillachmrf)
|
||||
* [#1275](https://github.com/pmd/pmd/pull/1275): \[jsp] Issue #1274 - Support EL in tag attributes - [Jordi Llach](https://github.com/jordillachmrf)
|
||||
* [#1278](https://github.com/pmd/pmd/pull/1278): \[ci] \[GSoC] Use pmdtester 1.0.0.pre.beta3 - [BBG](https://github.com/djydewang)
|
||||
* [#1289](https://github.com/pmd/pmd/pull/1289): \[java] UselessParentheses: Fix false positive with assignments - [cobratbq](https://github.com/cobratbq)
|
||||
* [#1290](https://github.com/pmd/pmd/pull/1290): \[docs] \[GSoC] Create the documentation about pmdtester - [BBG](https://github.com/djydewang)
|
||||
* [#1256](https://github.com/pmd/pmd/pull/1256): \[java] #940 Avoid JUnit 4 false positives for JUnit 5 tests - [Alex Shesterov](https://github.com/vovkss)
|
||||
* [#1315](https://github.com/pmd/pmd/pull/1315): \[apex] Add OneDeclarationPerStatement rule - [Jeff Hube](https://github.com/jeffhube)
|
||||
|
||||
|
||||
## 29-July-2018 - 6.6.0
|
||||
|
||||
The PMD team is pleased to announce PMD 6.6.0.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>net.sourceforge.pmd</groupId>
|
||||
<artifactId>pmd</artifactId>
|
||||
<version>6.7.0-SNAPSHOT</version>
|
||||
<version>6.8.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>net.sourceforge.pmd</groupId>
|
||||
<artifactId>pmd</artifactId>
|
||||
<version>6.7.0-SNAPSHOT</version>
|
||||
<version>6.8.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -149,6 +149,47 @@ public class Foo {
|
||||
</example>
|
||||
</rule>
|
||||
|
||||
<rule name="OneDeclarationPerLine"
|
||||
since="6.7.0"
|
||||
message="Use one statement for each line, it enhances code readability."
|
||||
class="net.sourceforge.pmd.lang.apex.rule.ApexXPathRule"
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_apex_codestyle.html#onedeclarationperline">
|
||||
<description>
|
||||
Apex allows the use of several variables declaration of the same type on one line. However, it
|
||||
can lead to quite messy code. This rule looks for several declarations on the same line.
|
||||
</description>
|
||||
<priority>1</priority>
|
||||
<properties>
|
||||
<property name="xpath">
|
||||
<value>
|
||||
<![CDATA[
|
||||
//VariableDeclarationStatements
|
||||
[count(VariableDeclaration) > 1]
|
||||
[$strictMode or count(distinct-values(VariableDeclaration/@BeginLine)) != count(VariableDeclaration)]
|
||||
|
|
||||
//FieldDeclarationStatements
|
||||
[count(FieldDeclaration) > 1]
|
||||
[$strictMode or count(distinct-values(FieldDeclaration/VariableExpression/@BeginLine)) != count(FieldDeclaration/VariableExpression)]
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
<property name="version" value="2.0"/>
|
||||
<property name="strictMode" type="Boolean" value="false"
|
||||
description="If true, mark combined declaration even if the declarations are on separate lines."/>
|
||||
</properties>
|
||||
<example>
|
||||
<![CDATA[
|
||||
Integer a, b; // not recommended
|
||||
|
||||
Integer a,
|
||||
b; // ok by default, can be flagged setting the strictMode property
|
||||
|
||||
Integer a; // preferred approach
|
||||
Integer b;
|
||||
]]>
|
||||
</example>
|
||||
</rule>
|
||||
|
||||
<rule name="VariableNamingConventions"
|
||||
since="5.5.0"
|
||||
message="{0} variable {1} should begin with {2}"
|
||||
|
||||
@@ -419,4 +419,15 @@
|
||||
<property name="cc_block_highlighting" value="false" />
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- STYLE -->
|
||||
<rule ref="category/apex/codestyle.xml/OneDeclarationPerLine">
|
||||
<priority>3</priority>
|
||||
<properties>
|
||||
<!-- relevant for Code Climate output only -->
|
||||
<property name="cc_categories" value="Style" />
|
||||
<property name="cc_remediation_points_multiplier" value="5" />
|
||||
<property name="cc_block_highlighting" value="false" />
|
||||
</properties>
|
||||
</rule>
|
||||
</ruleset>
|
||||
|
||||
+1
@@ -17,6 +17,7 @@ public class CodeStyleRulesTest extends SimpleAggregatorTst {
|
||||
addRule(RULESET, "IfElseStmtsMustUseBraces");
|
||||
addRule(RULESET, "IfStmtsMustUseBraces");
|
||||
addRule(RULESET, "MethodNamingConventions");
|
||||
addRule(RULESET, "OneDeclarationPerLine");
|
||||
addRule(RULESET, "VariableNamingConventions");
|
||||
addRule(RULESET, "WhileLoopsMustUseBraces");
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user