Merge branch 'master' into pmd/7.0.x

This commit is contained in:
Andreas Dangel
2018-10-28 19:39:32 +01:00
1129 changed files with 24640 additions and 4637 deletions

View File

@ -1,10 +1,10 @@
<!--
Please, prefix the PR title with the language it applies to within brackets, such as *[java]* or *[apex]*. If not specific to a language, you can use *[core]*
-->
Before submitting a PR, please check that:
- [ ] The PR is submitted against `master`. The PMD team will merge back to support branches as needed.
- [ ] `./mvnw test` passes.
- [ ] `./mvnw pmd:check` passes.
- [ ] `./mvnw checkstyle:check` passes. [Check this for more info](https://github.com/pmd/pmd/blob/master/CONTRIBUTING.md#code-style)
- [ ] `./mvnw clean verify` passes. This will [build](https://github.com/pmd/pmd/blob/master/BUILDING.md) and test PMD, execute PMD and checkstyle rules. [Check this for more info](https://github.com/pmd/pmd/blob/master/CONTRIBUTING.md#code-style)
**PR Description:**

3
.gitignore vendored
View File

@ -10,3 +10,6 @@ bin/
.idea
*.patch
*/src/site/site.xml
pmd-core/dependency-reduced-pom.xml
.bundle
vendor

View File

@ -1 +1 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip

View File

@ -1,5 +1,3 @@
dist: trusty
sudo: false
addons:
ssh_known_hosts:
- web.sourceforge.net
@ -10,27 +8,51 @@ env:
global:
- secure: KBEuB6U1p5RQXSYe157AwydFr/zpXQPA0IChVCgZV+X1mMyy9ZtrjH1J1AXuviseDDXDbaT25sRnsvpl82rfRw2xOkMGXHy4N95/ylTSr8DjHxTao71BhXsvFycNobFva5y2EGNWqDvpS8I2oSZo7Qk4la3yep3rcJQvcy6RDbbhpDTbL1QMFyadunIBm0WtqbunrMqtjSqaoPsXz8TiQuxHvX4vEXzVbaxV1QQt79Vi+daa6wAV3mRQAugnx+UffsC8JqMxgm06usWeJgCJzxgm8E7clZCLmf53B2TL8dK6bIYbqyvOY3uFxitsTG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ByaB61py/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
- bash .travis/setup-secrets.sh
- bash .travis/configure-maven.sh
# Install OracleJDK 10 - see https://sormuras.github.io/blog/2018-03-20-jdk-matrix.html
install: . ./install-jdk.sh -F 10 -L BCL
- rvm install 2.4.1
- rvm use 2.4.1
# Install OpenJDK 11 - see https://sormuras.github.io/blog/2018-03-20-jdk-matrix.html
install:
- . ./install-jdk.sh -F 11 -L GPL -W $HOME/jdk
- gem install bundler
- bundle install --with=release_notes_preprocessing --path=vendor/bundle
before_script: true
script: source .travis/build-$BUILD.sh
after_success: true
@ -48,7 +70,7 @@ deploy:
on:
tags: true
repo: pmd/pmd
condition: "${TRAVIS_SECURE_ENV_VARS} = true && ${BUILD} != sonar"
condition: "${TRAVIS_SECURE_ENV_VARS} = true && ${BUILD} != sonar && ${BUILD} != coveralls"
after_deploy: bash .travis/release.sh
notifications:
@ -67,7 +89,9 @@ notifications:
cache:
directories:
- "$HOME/.m2"
- vendor/bundle
- "$HOME/jdk"
- "$HOME/.rvm/"
# Secure Keys, that need to be set for snapshot builds
#
@ -79,7 +103,6 @@ cache:
# PMD_SF_USER - the sourceforge user, which is used to upload created binaries to sf files section. Note: an ssh key is
# required. See "before_install".
#
#
# Secure Keys, that need to be set for releases:
#
# PMD_SF_APIKEY - used to make the new release the default file in the files section. See https://sourceforge.net/auth/preferences/

18
.travis/all-java.xml Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0"?>
<ruleset name="All Java 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>
<rule ref="category/java/bestpractices.xml" />
<rule ref="category/java/codestyle.xml" />
<rule ref="category/java/design.xml" />
<rule ref="category/java/documentation.xml" />
<rule ref="category/java/errorprone.xml" />
<rule ref="category/java/multithreading.xml" />
<rule ref="category/java/performance.xml" />
<rule ref="category/java/security.xml" />
</ruleset>

View File

@ -1,10 +1,10 @@
#!/bin/bash
set -e
source .travis/common-functions.sh
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"

View File

@ -1,8 +1,8 @@
#!/bin/bash
set -e
source .travis/common-functions.sh
source .travis/logger.sh
source .travis/common-functions.sh
function push_docs() {
if git diff --quiet docs; then
@ -14,7 +14,11 @@ function push_docs() {
git config user.name "Travis CI (pmd-bot)"
git config user.email "andreas.dangel+pmd-bot@adangel.org"
git add -A docs
git commit -m "Update documentation"
MSG="Update documentation
TRAVIS_JOB_NUMBER=${TRAVIS_JOB_NUMBER}
TRAVIS_COMMIT_RANGE=${TRAVIS_COMMIT_RANGE}"
git commit -m "$MSG"
git push git@github.com:pmd/pmd.git HEAD:master
log_success "Successfully pushed docs update"
else
@ -23,16 +27,42 @@ function push_docs() {
fi
}
function upload_baseline() {
log_info "Generating and uploading baseline for pmdtester..."
cd ..
bundle config --local gemfile pmd/Gemfile
bundle exec pmdtester -m single -r ./pmd -p ${TRAVIS_BRANCH} -pc ./pmd/.travis/all-java.xml -l ./pmd/.travis/project-list.xml -f
cd target/reports
BRANCH_FILENAME="${TRAVIS_BRANCH/\//_}"
zip -q -r ${BRANCH_FILENAME}-baseline.zip ${BRANCH_FILENAME}/
rsync -avh ${BRANCH_FILENAME}-baseline.zip ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd-regression-tester/
if [ $? -ne 0 ]; then
log_error "Error while uploading ${BRANCH_FILENAME}-baseline.zip to sourceforge!"
log_error "Please upload manually: https://sourceforge.net/projects/pmd/files/pmd-regression-tester/"
else
log_success "Successfully uploaded ${BRANCH_FILENAME}-baseline.zip to sourceforge"
fi
}
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 ${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
(
set +e
log_info "Running danger"
bundle exec danger --verbose
)
elif travis_isPush; then
@ -63,12 +93,41 @@ elif travis_isPush; then
if [ $? -ne 0 ]; then
log_error "Error while uploading pmd-*-${VERSION}.zip to sourceforge!"
log_error "Please upload manually: https://sourceforge.net/projects/pmd/files/pmd/"
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/"
fi
}
# 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"
)
(
# disable fast fail, exit immediately, in this subshell
set +e
upload_baseline
true
)

View File

@ -1,10 +1,10 @@
#!/bin/bash
set -e
source .travis/common-functions.sh
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
@ -25,6 +25,8 @@ echo -e "\n\n"
log_info "Creating pmd-doc archive..."
mv _site pmd-doc-${VERSION}
zip -qr pmd-doc-${VERSION}.zip pmd-doc-${VERSION}/
log_success "Successfully created pmd-doc-${VERSION}.zip:"
ls -lh pmd-doc-${VERSION}.zip
(
# disable fast fail, exit immediately, in this subshell
@ -37,11 +39,13 @@ zip -qr pmd-doc-${VERSION}.zip pmd-doc-${VERSION}/
if [ $? -ne 0 ]; then
log_error "Couldn't upload pmd-doc-${VERSION}.zip!"
log_error "Please upload manually: https://sourceforge.net/projects/pmd/files/pmd/"
else
log_success "Successfully uploaded pmd-doc-${VERSION}.zip to sourceforge"
fi
fi
# rsync site to pmd.sourceforge.net/snapshot
if [[ "${VERSION}" == *-SNAPSHOT && "${TRAVIS_BRANCH}" == "master" ]]; then
if [[ "${VERSION}" == *-SNAPSHOT && "${TRAVIS_BRANCH}" == "master" ]] && has_docs_change; then
echo -e "\n\n"
log_info "Uploading snapshot site to pmd.sourceforge.net/snapshot..."
travis_wait rsync -ah --stats --delete pmd-doc-${VERSION}/ ${PMD_SF_USER}@web.sourceforge.net:/home/project-web/pmd/htdocs/snapshot/
@ -59,8 +63,9 @@ zip -qr pmd-doc-${VERSION}.zip pmd-doc-${VERSION}/
#
# Push the generated site to gh-pages branch
# only for snapshot builds from branch master
#
if [[ "${VERSION}" == *-SNAPSHOT && "${TRAVIS_BRANCH}" == "master" ]]; then
if [[ "${VERSION}" == *-SNAPSHOT && "${TRAVIS_BRANCH}" == "master" ]] && has_docs_change; then
echo -e "\n\n"
log_info "Pushing the new site to github pages..."
git clone --branch gh-pages --depth 1 git@github.com:pmd/pmd.git pmd-gh-pages
@ -73,10 +78,14 @@ if [[ "${VERSION}" == *-SNAPSHOT && "${TRAVIS_BRANCH}" == "master" ]]; then
git config user.name "Travis CI (pmd-bot)"
git config user.email "andreas.dangel+pmd-bot@adangel.org"
git add -A
git commit -q -m "Update documentation"
MSG="Update documentation
TRAVIS_JOB_NUMBER=${TRAVIS_JOB_NUMBER}
TRAVIS_COMMIT_RANGE=${TRAVIS_COMMIT_RANGE}"
git commit -q -m "$MSG"
git push git@github.com:pmd/pmd.git HEAD:gh-pages
)
log_success "Successfully pushed site to https://pmd.github.io/pmd/"
)
fi
popd

View File

@ -1,10 +1,10 @@
#!/bin/bash
set -e
source .travis/common-functions.sh
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..."

View File

@ -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
@ -26,3 +27,21 @@ function travis_isPush() {
return 1
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"
return 0
else
log_info "Checking for changes in docs/ (TRAVIS_COMMIT_RANGE=${TRAVIS_COMMIT_RANGE}): no changes"
return 1
fi
}

27
.travis/project-list.xml Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0"?>
<projectlist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="projectlist_1_0_0.xsd">
<description>Standard Projects</description>
<project>
<name>checkstyle</name>
<type>git</type>
<connection>https://github.com/checkstyle/checkstyle</connection>
<tag>checkstyle-8.10</tag>
</project>
<project>
<name>spring-framework</name>
<type>git</type>
<connection>https://github.com/spring-projects/spring-framework</connection>
<tag>v5.0.6.RELEASE</tag>
</project>
<!---<project>
<name>openjdk10</name>
<type>hg</type>
<connection>http://hg.openjdk.java.net/jdk10/jdk10/jdk</connection>
<webview-url>http://hg.openjdk.java.net/jdk10/jdk10/jdk/file/777356696811</webview-url>
</project> -->
</projectlist>

View File

@ -28,11 +28,13 @@ if [ "${BUILD}" = "deploy" ]; then
true
)
# 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)
# Assumes, the release has already been created by travis github releases provider
RELEASE_ID=$(curl -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" https://api.github.com/repos/pmd/pmd/releases/tags/pmd_releases/${RELEASE_VERSION}|jq ".id")
RELEASE_NAME="PMD ${RELEASE_VERSION} ($(date -u +%d-%B-%Y))"
RELEASE_BODY=$(tail -n +6 docs/pages/release_notes.md) # skips the first 6 lines - the heading 'PMD Release Notes'
RELEASE_BODY="$RENDERED_RELEASE_NOTES"
RELEASE_BODY="${RELEASE_BODY//'\'/\\\\}"
RELEASE_BODY="${RELEASE_BODY//$'\r'/}"
RELEASE_BODY="${RELEASE_BODY//$'\n'/\\r\\n}"
@ -48,13 +50,14 @@ log_info "Updating release at https://api.github.com/repos/pmd/pmd/releases/${RE
RESPONSE=$(curl -i -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" -H "Content-Type: application/json" --data "@release-edit-request.json" -X PATCH https://api.github.com/repos/pmd/pmd/releases/${RELEASE_ID})
if [[ "$RESPONSE" != *"HTTP/1.1 200"* ]]; then
log_error "Github Request failed!"
echo "Request:"
cat release-edit-request.json
echo
echo "Response:"
echo "$RESPONSE"
else
echo "Update OK"
log_success "Update OK"
fi
fi
@ -76,18 +79,30 @@ mkdir pmd.github.io
git remote add origin git@github.com:pmd/pmd.github.io.git
echo "latest/" > .git/info/sparse-checkout
git pull --depth=1 origin master
rsync -a ../docs/pmd-doc-${RELEASE_VERSION}/ pmd-${RELEASE_VERSION}/
log_info "Copying documentation from ../docs/pmd-doc-${RELEASE_VERSION}/ to pmd-${RELEASE_VERSION}/ ..."
rsync -ah --stats ../docs/pmd-doc-${RELEASE_VERSION}/ pmd-${RELEASE_VERSION}/
git status
echo "Executing: git add pmd-${RELEASE_VERSION}"
git add pmd-${RELEASE_VERSION}
echo "Executing: git commit..."
git commit -q -m "Added pmd-${RELEASE_VERSION}"
log_info "Copying pmd-${RELEASE_VERSION} to latest ..."
git rm -qr latest
cp -a pmd-${RELEASE_VERSION} latest
echo "Executing: git add latest"
git add latest
echo "Executing: git commit..."
git commit -q -m "Copying pmd-${RELEASE_VERSION} to latest"
log_info "Generating sitemap.xml"
../.travis/sitemap_generator.sh > sitemap.xml
echo "Executing: git add sitemap.xml"
git add sitemap.xml
echo "Executing: git commit..."
git commit -q -m "Generated sitemap.xml"
echo "Executing: git push origin master"
git push origin master
)
@ -101,7 +116,7 @@ mkdir pmd.github.io
log_info "Uploading the new release to pmd.sourceforge.net which serves as an archive..."
travis_wait rsync -ah --stats pmd-doc-${VERSION}/ ${PMD_SF_USER}@web.sourceforge.net:/home/project-web/pmd/htdocs/pmd-${RELEASE_VERSION}/
travis_wait rsync -ah --stats docs/pmd-doc-${RELEASE_VERSION}/ ${PMD_SF_USER}@web.sourceforge.net:/home/project-web/pmd/htdocs/pmd-${RELEASE_VERSION}/
if [ $? -ne 0 ]; then
log_error "Uploading documentation to pmd.sourceforge.net failed..."

43
.travis/render_release_notes.rb Executable file
View File

@ -0,0 +1,43 @@
#!/usr/bin/env ruby
# Renders the release notes for Github releases,
# and prints them to standard output
# Doesn't trim the header, which is done in shell
# Args:
# ARGV[0] : location of the file to render
require "liquid"
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
SafeYAML::OPTIONS[:default_mode] = :safe
# START OF THE SCRIPT
unless ARGV.length == 1 && File.exists?(ARGV[0])
print "\e[31m[ERROR] In #{$0}: The first arg must be a valid file name\e[0m"
exit 1
end
release_notes_file = ARGV[0]
liquid_env = {
# wrap the config under a "site." namespace because that's how jekyll does it
'site' => YAML.load_file("docs/_config.yml"),
# This signals the links in {% rule %} tags that they should be rendered as absolute
'is_release_notes_processor' => true
}
to_render = File.read(release_notes_file)
rendered = Liquid::Template.parse(to_render).render(liquid_env)
print(rendered)

View File

@ -6,7 +6,9 @@
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<pluginGroups>
<pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
</pluginGroups>
<servers>
<server>
<id>ossrh</id>

View File

@ -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:
@ -15,7 +16,7 @@ This will create the zip files in the directory `pmd-dist/target`:
That's all !
**Note:** While Java 9 is required for building, running PMD only requires Java 7 (or Java 8 for Apex).
**Note:** While Java 10 is required for building, running PMD only requires Java 7 (or Java 8 for Apex and the Designer).
## How to build the documentation?

52
Dangerfile Normal file
View File

@ -0,0 +1,52 @@
require 'pmdtester'
require 'time'
require 'logger'
@logger = Logger.new(STDOUT)
def run_pmdtester
Dir.chdir('..') do
argv = ['-r', './pmd', '-b', "#{ENV['TRAVIS_BRANCH']}", '-p', 'FETCH_HEAD', '-m', 'online', '-a']
begin
runner = PmdTester::Runner.new(argv)
@new_errors, @removed_errors, @new_violations, @removed_violations = runner.run
upload_report
rescue StandardError => e
warn("Running pmdtester failed, this message is mainly used to remind the maintainers of PMD.")
@logger.error "Running pmdtester failed: #{e.inspect}"
end
end
end
def upload_report
Dir.chdir('target/reports') do
tar_filename = "pr-#{ENV['TRAVIS_PULL_REQUEST']}-diff-report-#{Time.now.strftime("%Y-%m-%dT%H-%M-%SZ")}.tar"
unless Dir.exist?('diff/')
message("No java rules are changed!", sticky: true)
return
end
`tar -cf #{tar_filename} diff/`
report_url = `curl -u #{ENV['CHUNK_TOKEN']} -T #{tar_filename} chunk.io`
if $?.success?
@logger.info "Successfully uploaded #{tar_filename} to chunk.io"
# set value of sticky to true and the message is kept after new commits are submited to the PR
message("This changeset introduces #{@new_violations} new violations and #{@new_errors} new errors,\n" +
"removes #{@removed_violations} violations and #{@removed_errors} errors. [Full report](#{report_url.chomp}/diff/index.html)", sticky: true)
else
@logger.error "Error while uploading #{tar_filename} to chunk.io: #{report_url}"
warn("Uploading the diff report failed, this message is mainly used to remind the maintainers of PMD.")
end
end
end
# Perform regression testing
can_merge = github.pr_json['mergeable']
if can_merge
run_pmdtester
else
warn("This PR cannot be merged yet.", sticky: false)
end
# vim: syntax=ruby

14
Gemfile Normal file
View File

@ -0,0 +1,14 @@
source 'https://rubygems.org/'
gem 'pmdtester', :git => 'https://github.com/pmd/pmd-regression-tester.git'
gem 'danger', '~> 5.6', '>= 5.6'
# 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'
end
# vim: syntax=ruby

View File

@ -1,7 +1,8 @@
#!/bin/bash
set -e
# 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
@ -68,21 +69,31 @@ export CURRENT_BRANCH
RELEASE_RULESET="pmd-core/src/main/resources/rulesets/releases/${RELEASE_VERSION//\./}.xml"
echo "* Update version/release info in **docs/pages/release_notes.md**."
echo
echo " ## $(date -u +%d-%B-%Y) - ${RELEASE_VERSION}"
echo
echo "* Update date info in **docs/_config.yml**."
echo " date: $(date -u +%d-%B-%Y)"
echo
echo "* Ensure all the new rules are listed in a the proper file:"
echo "* Ensure all the new rules are listed in the proper file:"
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
# install bundles needed for rendering release notes
bundle install --with=release_notes_preprocessing --path vendor/bundle
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)
cat > ../pmd.github.io/${RELEASE_NOTES_POST} <<EOF
---
layout: post
title: PMD ${RELEASE_VERSION} released
---
${NEW_RELEASE_NOTES}
EOF
echo "Committing current changes (pmd)"
if [[ -e ${RELEASE_RULESET} ]]
@ -94,7 +105,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
)
@ -109,18 +120,6 @@ echo
echo "Tag has been pushed.... now check travis build: <https://travis-ci.org/pmd/pmd>"
echo
echo
echo "Submit news to SF on <https://sourceforge.net/p/pmd/news/> page. You can use"
echo "the following template:"
echo
cat <<EOF
PMD ${RELEASE_VERSION} released
* Downloads: https://github.com/pmd/pmd/releases/tag/pmd_releases%2F${RELEASE_VERSION}
* Documentation: https://pmd.github.io/pmd-${RELEASE_VERSION}/
And Copy-Paste the release notes
EOF
echo
echo "Press enter to continue..."
read
@ -128,7 +127,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:"
@ -140,7 +138,6 @@ read
# update release_notes_old
OLD_RELEASE_NOTES=$(tail -n +8 docs/pages/release_notes_old.md)
NEW_RELEASE_NOTES=$(tail -n +6 docs/pages/release_notes.md)
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
@ -154,18 +151,13 @@ permalink: pmd_release_notes.html
keywords: changelog, release notes
---
## ????? - ${DEVELOPMENT_VERSION}
## {{ site.pmd.date }} - {{ site.pmd.version }}
The PMD team is pleased to announce PMD ${DEVELOPMENT_VERSION%-SNAPSHOT}.
The PMD team is pleased to announce PMD {{ site.pmd.version }}.
This is a minor release.
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
@ -175,25 +167,28 @@ This is a minor release.
### External Contributions
{% endtocmaker %}
EOF
git commit -a -m "Prepare next development version"
git push origin ${CURRENT_BRANCH}
./mvwn -B release:clean
./mvnw -B release:clean
echo
echo
echo
echo "Verify the new release on github: <https://github.com/pmd/pmd/releases/tag/pmd_releases/${RELEASE_VERSION}>"
echo
echo "* Submit news to SF on <https://sourceforge.net/p/pmd/news/> page. Use same text as in the email below."
echo "* Send out an announcement mail to the mailing list:"
echo
echo "Send out an announcement mail to the mailing list:"
echo "To: PMD Developers List <pmd-devel@lists.sourceforge.net>"
echo "Subject: [ANNOUNCE] PMD ${RELEASE_VERSION} Released"
echo
echo "* Downloads: https://github.com/pmd/pmd/releases/tag/pmd_releases%2F${RELEASE_VERSION}"
echo "* Documentation: https://pmd.github.io/pmd-${RELEASE_VERSION}/"
echo
echo " And Copy-Paste the release notes"
echo "$NEW_RELEASE_NOTES"
echo
echo
echo
@ -203,4 +198,3 @@ echo "------------------------------------------"
echo

2
docs/.gitignore vendored
View File

@ -3,3 +3,5 @@ _site/
.jekyll-metadata
_pdf
.idea/
vendor/
.bundle/

View File

@ -13,10 +13,11 @@ GEM
execjs
coffee-script-source (1.11.1)
colorator (1.1.0)
commonmarker (0.17.9)
commonmarker (0.17.13)
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)
@ -24,31 +25,31 @@ GEM
ffi (>= 1.3.0)
eventmachine (1.2.7)
execjs (2.7.0)
faraday (0.15.2)
faraday (0.15.3)
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 (192)
activesupport (= 4.2.10)
github-pages-health-check (= 1.8.1)
jekyll (= 3.7.3)
jekyll-avatar (= 0.5.0)
jekyll (= 3.7.4)
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,13 +81,13 @@ 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)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jekyll (3.7.3)
jekyll (3.7.4)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
@ -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.12.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.6.0)
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

View File

@ -1,5 +1,8 @@
# PMD-New-Site
New Site For PMD Core Open Source Project
# PMD Documentation
The documentation is available at: <https://pmd.github.io/pmd/>
The documentation for the latest release is at: <https://pmd.github.io/latest/>
## Site Theme
@ -7,6 +10,14 @@ This site was built using the tomjohnson1492/documentation-theme-jekyll theme
A Jekyll-based theme designed for documentation and help systems. See the link for detailed instructions on setting up and configuring everything. http://idratherbewriting.com/documentation-theme-jekyll/
## Building using Script
bash build-docs.sh
This will run bundler to fetch and potentially update the ruby gems.
And then it will execute jekyll and build a offline site.
Open the file `_site/index.html` with your browser to see the site.
## Building using Bundler
bundle install # once
@ -14,6 +25,9 @@ A Jekyll-based theme designed for documentation and help systems. See the link f
Go to: http://localhost:4005/
This variant is useful to get constant updates: When you modify a file, jekyll will automatically rebuild
the site, so you just need to hit Refresh in the browser to see the update.
## Building using Docker
docker build --no-cache -t pmd-doc . # once

View File

@ -1,8 +1,9 @@
repository: pmd/pmd
pmd:
version: 6.5.0
date: ?????
version: 6.10.0
date: ??-????-2018
release_type: minor
output: web
# this property is useful for conditional filtering of content that is separate from the PDF.
@ -28,10 +29,16 @@ host: 127.0.0.1
port: 4005
# the port where the preview is rendered. You can leave this as is unless you have other Jekyll builds using this same port that might cause conflicts. in that case, use another port such as 4006.
# these are the files and directories that jekyll will exclude from the build
exclude:
- .idea/
- .gitignore
# these are the files and directories that jekyll will exclude from the build
- vendor/
- Gemfile
- Gemfile.lock
- README.md
- Dockerfile
- build-docs.sh
feedback_subject_line: PMD Source Code Analyzer

View File

@ -325,6 +325,9 @@ entries:
- title: How PMD works
url: /pmd_devdocs_how_pmd_works.html
output: web, pdf
- title: Pmdtester
url: /pmd_devdocs_pmdtester.html
output: web, pdf
- title: null
output: web, pdf
subfolders:

View File

@ -6,15 +6,6 @@ $( document ).ready(function() {
$('#toc').toc({ minimumHeaders: 0, listType: 'ul', showSpeed: 0, headers: 'h2,h3,h4' });
/* this offset helps account for the space taken up by the floating toolbar. */
$('#toc').on('click', 'a', function() {
var target = $(this.getAttribute('href'))
, scroll_target = target.offset().top
$(window).scrollTop(scroll_target - 10);
return false
})
});
</script>

View File

@ -68,6 +68,19 @@ module CustomFilters
end
end
# Append the suffix only if the condition argument is truthy
def append_if(str, condition, suffix)
if condition
str + suffix
else
str
end
end
def append_unless(str, condition, suffix)
append_if(str, !condition, suffix)
end
def render_markdown(input)
if input
res = input

73
docs/_plugins/rule_tag.rb Normal file
View File

@ -0,0 +1,73 @@
# Tag to reference a rule
#
# Usage:
# {% rule "java/codestyle/LinguisticNaming" %} works from anywhere
# If inside the doc page of a ruleset/category, the language and
# category segment can be dropped, they're taken to be the same.
#
# That means rule descriptions can also reference rules e.g. by simply
# saying {% rule AvoidFinalLocalVars %} if they're in the same category
# This could allow deprecated rule notices to link to the replacement rule
class RuleTag < Liquid::Tag
def initialize(tag_name, rule_ref, tokens)
super
if %r!(?:(?:(\w+)/)?(\w+)/)?(\w+)! =~ rule_ref
@lang_name = $1
@category_name = $2
@rule_name = $3
else
fail "Invalid rule reference format"
end
end
def render(context)
if /pmd_rules_(\w+)_(\w+)\.html/ =~ context["page.permalink"]
# If we're in a page describing a ruleset,
# omitted language or category are taken to be that of this page
@lang_name = @lang_name || $1
@category_name = @category_name || $2
end
unless @category_name
fail "no category for rule reference, and no implicit category name available"
end
unless @lang_name
fail "no language for rule reference, and no implicit language name available"
end
url_prefix = ""
# This is passed from the release notes processing script
# When generating links for the release notes, the links should be absolute
if context["is_release_notes_processor"]
url_prefix = "https://pmd.github.io/pmd-#{context["site.pmd.version"]}/"
end
markup_link(@rule_name, url_prefix + relativelink(@lang_name, @category_name, @rule_name))
end
private
def relativelink(lang, cat, rname)
"pmd_rules_#{lang}_#{cat}.html##{rname.downcase}"
end
def markup_link(rname, link)
"[`#{rname}`](#{link})"
end
end
Liquid::Template.register_tag('rule', RuleTag)

View File

@ -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)

3
docs/build-docs.sh Normal file
View File

@ -0,0 +1,3 @@
bundle install --path vendor/bundle
bundle update
bundle exec jekyll build

View File

@ -79,8 +79,8 @@ h4[id],
h5[id],
h6[id],
dt[id]{
padding-top: 60px;
margin-top: -40px
padding-top: 20px;
margin-top: 0px
}
body h1 {margin-top:40px;}

View File

@ -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)." %}
Youll need to either check out the source code or download the latest source release. Assuming youve got the latest source release, unzip it to a directory:

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