Compare commits

..
Author SHA1 Message Date
Andreas Dangel e1cc5d44b5 Prepare release pmd-eclipse-plugin 4.0.2.v20131031-1124 2013-10-31 12:35:23 +01:00
5414 changed files with 277706 additions and 343707 deletions

No files matched your search

-14
View File
@@ -1,14 +0,0 @@
* text=auto
*.java text
*.xml text
*.jjt text
*.jj text
*.g4 text
*.md text
*.sh text eol=lf
*.bat text eol=crlf
mvnw.cmd text eol=crlf
*.png -text
*.jpg -text
*.svgz -text
*.jar -text
-17
View File
@@ -1,17 +0,0 @@
Please, prefix the report title with the language it applies to within brackets, such as [java] or [apex].
If not specific to a language, you can use [core].
**Affects PMD Version:**
**Rule:**
**Description:**
**Code Sample demonstrating the issue:**
```
```
**Running PMD through:** *[CLI | Ant | Maven | Gradle | Designer | Other]*
-10
View File
@@ -1,10 +0,0 @@
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)
**PR Description:**
-12
View File
@@ -1,12 +0,0 @@
target/
bin/
.project
.classpath
.checkstyle
.pmd
.ruleset
.settings/
*.iml
.idea
*.patch
*/src/site/site.xml
BIN
View File
Binary file not shown.
-1
View File
@@ -1 +0,0 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
-88
View File
@@ -1,88 +0,0 @@
dist: trusty
sudo: false
addons:
ssh_known_hosts:
- web.sourceforge.net
language: java
env:
global:
- secure: KBEuB6U1p5RQXSYe157AwydFr/zpXQPA0IChVCgZV+X1mMyy9ZtrjH1J1AXuviseDDXDbaT25sRnsvpl82rfRw2xOkMGXHy4N95/ylTSr8DjHxTao71BhXsvFycNobFva5y2EGNWqDvpS8I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ILD=sonar
- BUILD=coveralls
matrix:
fast_finish: true
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
before_script: true
script: source .travis/build-$BUILD.sh
after_success: true
before_deploy: true
deploy:
provider: releases
api_key: ${GITHUB_OAUTH_TOKEN}
file_glob: true
file:
- pmd-dist/target/pmd-*.zip
- docs/pmd-doc-*.zip
skip_cleanup: true
on:
tags: true
repo: pmd/pmd
condition: "${TRAVIS_SECURE_ENV_VARS} = true && ${BUILD} != sonar"
after_deploy: bash .travis/release.sh
notifications:
email:
recipients:
- andreas.dangel@adangel.org
- pmd-commits@lists.sourceforge.net
on_success: always
on_failure: always
cache:
directories:
- "$HOME/.m2"
# Secure Keys, that need to be set for snapshot builds
#
# CI_DEPLOY_USERNAME - the user which can upload net.sourceforge.pmd:* to https://oss.sonatype.org/
# CI_DEPLOY_PASSWORD
#
# SONAR_TOKEN - the token used to update https://sonarqube.com/dashboard/?id=393826
#
# 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/
# under "Release API Key"
#
# CI_SIGN_KEYNAME
# CI_SIGN_PASSPHRASE
# add the encrypted GPG keyring file to repo (https://docs.travis-ci.com/user/encrypting-files/#Automated-Encryption), decrypt it and install it at the beginning of .travis-deploy.sh
#
# GITHUB_OAUTH_TOKEN - the token used to upload the binaries to github releases
#
-20
View File
@@ -1,20 +0,0 @@
#!/bin/bash
set -e
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)
echo "Building PMD Coveralls.io report ${VERSION} on branch ${TRAVIS_BRANCH}"
if ! travis_isPush; then
echo "Not proceeding, since this is not a push!"
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
./mvnw clean install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
./mvnw test jacoco:report coveralls:report -Pcoveralls -B -V
-59
View File
@@ -1,59 +0,0 @@
#!/bin/bash
set -e
source .travis/common-functions.sh
function push_docs() {
if git diff --quiet docs; then
echo "No changes in docs..."
else
echo "Found changes in docs..."
if [ "$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 docs
git commit -m "Update documentation"
git push git@github.com:pmd/pmd.git HEAD:master
else
echo "Not on master branch, won't commit+push"
fi
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)
echo "Building PMD ${VERSION} on branch ${TRAVIS_BRANCH}"
MVN_BUILD_FLAGS="-B -V"
if travis_isPullRequest; then
echo "This is a pull-request build"
./mvnw verify $MVN_BUILD_FLAGS
elif travis_isPush; then
if [[ "${VERSION}" != *-SNAPSHOT && "${TRAVIS_TAG}" != "" ]]; then
echo "This is a release build for tag ${TRAVIS_TAG}"
./mvnw deploy -Possrh,pmd-release $MVN_BUILD_FLAGS
elif [[ "${VERSION}" == *-SNAPSHOT ]]; then
echo "This is a snapshot build"
./mvnw deploy -Possrh $MVN_BUILD_FLAGS
push_docs
else
# other build. Can happen during release: the commit with a non snapshot version is built, but not from the tag.
echo "This is some other build, probably during release: commit with a non-snapshot version on branch master..."
./mvnw verify -Possrh $MVN_BUILD_FLAGS
# we stop here - no need to execute further steps
exit 0
fi
# Uploading pmd distribution to sourceforge
rsync -avh pmd-dist/target/pmd-*-${VERSION}.zip ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd/${VERSION}/
rsync -avh docs/pages/release_notes.md ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd/${VERSION}/ReadMe.md
else
echo "This is neither a pull request nor a push!"
exit 1
fi
-39
View File
@@ -1,39 +0,0 @@
#!/bin/bash
set -e
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)
echo "Building PMD Documentation ${VERSION} on branch ${TRAVIS_BRANCH}"
if ! travis_isPush; then
echo "Not building site, since this is not a push!"
exit 0
fi
pushd docs
# run jekyll
echo -e "\n\nBuilding documentation using jekyll...\n\n"
bundle install
bundle exec jekyll build
# create pmd-doc archive
echo -e "\n\nCreating pmd-doc archive...\n\n"
mv _site pmd-doc-${VERSION}
zip -qr pmd-doc-${VERSION}.zip pmd-doc-${VERSION}/
# Uploading pmd doc distribution to sourceforge
if [[ "${TRAVIS_TAG}" != "" || "${VERSION}" == *-SNAPSHOT ]]; then
echo -e "\n\nUploading pmd-doc archive to sourceforge...\n\n"
rsync -avh pmd-doc-${VERSION}.zip ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd/${VERSION}/
fi
# rsync site to pmd.sourceforge.net/snapshot
if [[ "${VERSION}" == *-SNAPSHOT && "${TRAVIS_BRANCH}" == "master" ]]; then
echo -e "\n\nUploading snapshot site...\n\n"
travis_wait rsync -ah --stats --delete pmd-doc-${VERSION}/ ${PMD_SF_USER}@web.sourceforge.net:/home/project-web/pmd/htdocs/snapshot/
fi
popd
-20
View File
@@ -1,20 +0,0 @@
#!/bin/bash
set -e
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)
echo "Building PMD Sonar ${VERSION} on branch ${TRAVIS_BRANCH}"
if ! travis_isPush; then
echo "Not updating sonar, since this is not a push!"
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
# Run the build, truncate output due to Travis log limits
./mvnw clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${SONAR_TOKEN} -B -V
-28
View File
@@ -1,28 +0,0 @@
#!/bin/bash
set -e
echo "TRAVIS_REPO_SLUG: ${TRAVIS_REPO_SLUG}"
echo "TRAVIS_PULL_REQUEST_SLUG: ${TRAVIS_PULL_REQUEST_SLUG}"
echo "TRAVIS_PULL_REQUEST_BRANCH: ${TRAVIS_PULL_REQUEST_BRANCH}"
echo "TRAVIS_PULL_REQUEST: ${TRAVIS_PULL_REQUEST}"
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}"
function travis_isPullRequest() {
if [ "${TRAVIS_REPO_SLUG}" != "pmd/pmd" ] || [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
return 0
else
return 1
fi
}
function travis_isPush() {
if [ "${TRAVIS_REPO_SLUG}" = "pmd/pmd" ] && [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_SECURE_ENV_VARS}" = "true" ]; then
return 0
else
return 1
fi
}
-6
View File
@@ -1,6 +0,0 @@
#!/bin/bash
set -e
echo "MAVEN_OPTS='-Xms1g -Xmx1g'" > ${HOME}/.mavenrc
mkdir -p ${HOME}/.m2
cp .travis/travis-settings.xml ${HOME}/.m2/settings.xml
-1
View File
@@ -1 +0,0 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8yHVLHYDsKui8tYg/sFvkDqcs97pEZz0BzK9HtBF4O+/It1drRYRdUAFfjoImfprpKSxkJCTglHixGRp24eNaZ6woWVJ4/bmiMkEqEZAjr1NZ3qw7zIruMJMSkCV+YTtmL4cYcZlvMRPzzOZOnFbV05oi79oy41MUFHYjolK9QxMFNsVNN5iyzFxM3HqSFozz+ylKbFBtDk6ZHZQNRL/Xl2V9DJ69fVzjG4OZfcWNGmmKHHARmsnJyUOMeeKpLjDOe1M6ZdI8HkXWac8yCr9JTETNZZwemZAcS/RKoKCDqfIUOzkZfIPmyaznfVetTGsMi7yQrJhAyjznuNGF4+3lfgTcmRF8wz5FCeUkdYTmy2wNSFi5HiLPfC5OgRtjKzC6yb8rbRjDx6XQ2ph15PKOaXwzk49TaMc0xJvoiGDMZaTU0iTm3Y1/QUtfLvo3/jGMbtUdV3soWpuBAV2JUI4aB5xdLX9iNmcrVzoUe3y9DWuuTX46eoCvpUNXv/DXKhQw1D7xd7J67db5qUck/Akiqi0JR+e0SoBJvZFtYwVNLGC2bIJ/s8SR8X5Zp+1+ypf3WYjIylxQTkO1r4NfI0Cd9qXg7nmUrHAU7Z6xtJmUK8ZWzSST4wul8WkRJURtODLxt5firtlKhyZ93t9Mjuk6mATIPxr/b3x20T+IH463kw== ssh key for pmd. used for travis accessing sourceforge and github.
-75
View File
@@ -1,75 +0,0 @@
#!/bin/bash
set -e
echo "BUILD: $BUILD"
RELEASE_VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec | tail -1)
echo "RELEASE_VERSION: $RELEASE_VERSION"
if [ "${BUILD}" = "deploy" ]; then
# Deploy to ossrh has already been done with the usual build. See build-deploy.sh
# The site has been built before, the files have already been uploaded to sourceforge.
# Since this is a release, making the binary the new default file...
curl -H "Accept: application/json" -X PUT -d "default=windows&default=mac&default=linux&default=bsd&default=solaris&default=others" \
-d "api_key=${PMD_SF_APIKEY}" https://sourceforge.net/projects/pmd/files/pmd/${RELEASE_VERSION}/pmd-bin-${RELEASE_VERSION}.zip
# 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="${RELEASE_BODY//'\'/\\\\}"
RELEASE_BODY="${RELEASE_BODY//$'\r'/}"
RELEASE_BODY="${RELEASE_BODY//$'\n'/\\r\\n}"
RELEASE_BODY="${RELEASE_BODY//'"'/\\\"}"
cat > release-edit-request.json <<EOF
{
"name": "$RELEASE_NAME",
"body": "$RELEASE_BODY"
}
EOF
echo "Updating release at https://api.github.com/repos/pmd/pmd/releases/${RELEASE_ID}..."
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
echo "Request:"
cat release-edit-request.json
echo
echo "Response:"
echo "$RESPONSE"
else
echo "Update OK"
fi
fi
if [ "${BUILD}" = "doc" ]; then
echo "Adding the new doc to pmd.github.io..."
# clone pmd.github.io. Note: This uses the ssh key setup earlier
# In order to speed things up, we use a sparse checkout - no need to checkout all directories here
mkdir pmd.github.io
(
cd pmd.github.io
git init
git config user.name "Travis CI (pmd-bot)"
git config user.email "andreas.dangel+pmd-bot@adangel.org"
git config core.sparsecheckout true
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}/
git add pmd-${RELEASE_VERSION}
git commit -q -m "Added pmd-${RELEASE_VERSION}"
git rm -qr latest
cp -a pmd-${RELEASE_VERSION} latest
git add latest
git commit -q -m "Copying pmd-${RELEASE_VERSION} to latest"
git push origin master
)
fi
Binary file not shown.
-24
View File
@@ -1,24 +0,0 @@
#!/bin/bash
set -e
if [ "${TRAVIS_REPO_SLUG}" != "pmd/pmd" ] || [ "${TRAVIS_PULL_REQUEST}" != "false" ] || [ "${TRAVIS_SECURE_ENV_VARS}" != "true" ] || [ "${encrypted_5630fbebf057_iv}" = "" ]; then
echo "Not setting up secrets:"
echo " TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG}"
echo " TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST}"
echo " TRAVIS_SECURE_ENV_VARS=${TRAVIS_SECURE_ENV_VARS}"
[ "${encrypted_5630fbebf057_iv}" = "" ] && echo " Variable encrypted_5630fbebf057_iv is not set"
exit 0
fi
echo "Setting up secrets..."
openssl aes-256-cbc -K ${encrypted_5630fbebf057_key} -iv ${encrypted_5630fbebf057_iv} -in .travis/secrets.tar.enc -out .travis/secrets.tar -d
pushd .travis && tar xfv secrets.tar && popd
mkdir -p "$HOME/.ssh"
chmod 700 "$HOME/.ssh"
mv .travis/id_rsa "$HOME/.ssh/id_rsa"
chmod 600 "$HOME/.ssh/id_rsa"
mkdir -p "$HOME/.gpg"
gpg --batch --import .travis/release-signing-key-82DE7BE82166E84E.gpg
rm .travis/secrets.tar
rm .travis/release-signing-key-82DE7BE82166E84E.gpg
-29
View File
@@ -1,29 +0,0 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers>
<server>
<id>ossrh</id>
<username>${env.CI_DEPLOY_USERNAME}</username>
<password>${env.CI_DEPLOY_PASSWORD}</password>
</server>
</servers>
<mirrors/>
<proxies/>
<profiles>
<profile>
<id>ossrh</id>
<properties>
<gpg.keyname>${env.CI_SIGN_KEYNAME}</gpg.keyname>
<gpg.passphrase>${env.CI_SIGN_PASSPHRASE}</gpg.passphrase>
</properties>
</profile>
</profiles>
<activeProfiles/>
</settings>
-28
View File
@@ -1,28 +0,0 @@
# 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 the [maven wrapper](https://github.com/takari/maven-wrapper), so you can simply build PMD as following:
* `./mvnw clean verify` (on Unix-like platform such as Linux and Mac OS X)
* `mvnw.cmd clean verify` (on Windows)
This will create the zip files in the directory `pmd-dist/target`:
cd pmd-dist/target
ls *.zip
That's all !
**Note:** While Java 9 is required for building, running PMD only requires Java 7 (or Java 8 for Apex).
## How to build the documentation?
cd docs
bundle install # once
bundle exec jekyll build
You'll find the built site in the directory `_site/`.
For more info, see [README in docs directory](docs/README.md).
-56
View File
@@ -1,56 +0,0 @@
# How to contribute to PMD
First off, thanks for taking the time to contribute!
## Pull requests
* Please create your pull request against the `master` branch. We will rebase/merge it to the maintenance
branches, if necessary.
* We are using [checkstyle](http://checkstyle.sourceforge.net/) to enforce a common code style.
The check is integrated into the default build - so, make sure, you can [build PMD](BUILDING.md) without errors.
See [code style](#code-style) for more info.
## Bug reports
We used to use Sourceforge for bug tracking, but we are in the process of moving to github issues.
* Old bugs are still available at <https://sourceforge.net/p/pmd/bugs/>.
* Please report new bugs at <https://github.com/pmd/pmd/issues>.
When filing a bug report, please provide as much information as possible, so that we can reproduce the issue:
* The name of the rule, that is buggy
* A code snippet, which triggers a false positive/negative or crash
* How do you execute PMD? (command line, ant, maven, gradle, other)
## Documentation
There is some documentation available under <https://pmd.github.io/pmd>. Feel free to create a bug report if
documentation is missing, incomplete or outdated. See [Bug reports](#bug-reports).
The documentation is generated as a Jekyll site, the source is available at: <https://github.com/pmd/pmd/tree/master/docs>. You can find build instructions there.
For more on contributing documentation check <https://pmd.github.io/pmd/pmd_devdocs_writing_documentation.html>
## Questions
There are various channels, on which you can ask questions:
* The mailing list: [pmd-devel](https://lists.sourceforge.net/lists/listinfo/pmd-devel)
* The discussion forums on sourceforge: <https://sourceforge.net/p/pmd/discussion/>
* On [StackOverflow](https://stackoverflow.com/questions/tagged/pmd): Make sure, to tag your question with "pmd".
## Code Style
PMD uses [checkstyle](http://checkstyle.sourceforge.net/) to enforce a common code style.
See [pmd-checkstyle-config.xml](https://github.com/pmd/build-tools/blob/master/config/src/main/resources/net/sourceforge/pmd/pmd-checkstyle-config.xml) for the configuration and
[the eclipse configuration files](https://github.com/pmd/build-tools/tree/master/config/eclipse) that can
be imported into a fresh workspace.
-405
View File
File diff suppressed because it is too large. Load diff
-12
View File
@@ -1,12 +0,0 @@
PMD
This product is licensed under a BSD-style license;
for more info see http://pmd.sourceforge.net/license.html or LICENSE
Part of this product (mostly the package net.sourceforge.pmd.lang.vm)
is licensed under the Apache License, Version 2.0;
for more info see http://www.apache.org/licenses/LICENSE-2.0 or LICENSE
Part of this product (part of pmd-scala)
is licensed under the GNU Lesser General Public License, Version 3 or later
for more info see http://www.gnu.org/licenses/lgpl.txt or LICENSE
+21 -21
View File
@@ -1,27 +1,27 @@
# PMD
[![PMD - Don't shoot the messenger][PMDLogo]][website]
[![Join the chat at https://gitter.im/pmd/pmd](https://badges.gitter.im/pmd/pmd.svg)](https://gitter.im/pmd/pmd?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/pmd/pmd.svg?branch=master)](https://travis-ci.org/pmd/pmd)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.sourceforge.pmd/pmd/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.sourceforge.pmd/pmd)
[![Coverage Status](https://coveralls.io/repos/github/pmd/pmd/badge.svg)](https://coveralls.io/github/pmd/pmd)
PMD
===
## About
About
-----
PMD is a source code analyzer. It finds common programming flaws like unused variables, empty catch blocks,
unnecessary object creation, and so forth. It supports Java, JavaScript, XML, XSL.
Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code in
Java, C, C++, C#, PHP, Ruby, Fortran, JavaScript.
**PMD** is a source code analyzer. It finds common programming flaws like unused variables, empty catch blocks,
unnecessary object creation, and so forth. It supports Java, JavaScript, Salesforce.com Apex and Visualforce, PLSQL, Apache Velocity,
XML, XSL.
Source
------
Our latest source of PMD can be found on [GitHub]. Fork us!
The current status of this repo can be seen at [BuildHive].
Additionally it includes **CPD**, the copy-paste-detector. CPD finds duplicated code in
Java, C, C++, C#, Groovy, PHP, Ruby, Fortran, JavaScript, PLSQL, Apache Velocity, Scala, Objective C,
Salesforce.com Apex, Perl, Swift, Matlab, Python.
News and Website
----------------
More information can be found on our [Website] and on [SourceForge].
## Source and Documentation
Our latest source of PMD can be found on [GitHub](https://github.com/pmd/pmd). Fork us!
* [How to build PMD](BUILDING.md)
* [How to contribute to PMD](CONTRIBUTING.md)
## News and Website
More information can be found on our [Website](https://pmd.github.io) and on [SourceForge](https://sourceforge.net/projects/pmd/).
[PMDLogo]: http://pmd.sourceforge.net/pmd_logo.png
[GitHub]: https://github.com/pmd/pmd
[BuildHive]: https://buildhive.cloudbees.com/job/pmd/
[Website]: http://pmd.sourceforge.net
[SourceForge]: https://sourceforge.net/projects/pmd/
@@ -0,0 +1,41 @@
package net.sourceforge.pmd.util.viewer;
import net.sourceforge.pmd.util.viewer.gui.MainFrame;
/**
* viewer's starter
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class Viewer {
/**
* starts the viewer
*
* @param args arguments
*/
public static void main(String[] args) {
new MainFrame();
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:41 tomcopeland
* Initial revision
*
* Revision 1.2 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.1 2003/09/22 05:21:54 bgr
* initial commit
*
*/
@@ -0,0 +1,147 @@
package net.sourceforge.pmd.util.viewer.gui;
import net.sourceforge.pmd.ast.Node;
import net.sourceforge.pmd.ast.SimpleNode;
import net.sourceforge.pmd.util.viewer.gui.menu.ASTNodePopupMenu;
import net.sourceforge.pmd.util.viewer.model.ASTModel;
import net.sourceforge.pmd.util.viewer.model.ViewerModel;
import net.sourceforge.pmd.util.viewer.model.ViewerModelEvent;
import net.sourceforge.pmd.util.viewer.model.ViewerModelListener;
import net.sourceforge.pmd.util.viewer.util.NLS;
import javax.swing.*;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import java.awt.BorderLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.LinkedList;
/**
* tree panel GUI
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class ASTPanel
extends JPanel
implements ViewerModelListener, TreeSelectionListener {
private ViewerModel model;
private JTree tree;
/**
* constructs the panel
*
* @param model model to attach the panel to
*/
public ASTPanel(ViewerModel model) {
this.model = model;
init();
}
private void init() {
model.addViewerModelListener(this);
setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), NLS.nls("AST.PANEL.TITLE")));
setLayout(new BorderLayout());
tree = new JTree((TreeNode) null);
tree.addTreeSelectionListener(this);
tree.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
if (e.isPopupTrigger()) {
TreePath path =
tree.getClosestPathForLocation(e.getX(), e.getY());
tree.setSelectionPath(path);
JPopupMenu menu =
new ASTNodePopupMenu(model, (SimpleNode) path.getLastPathComponent());
menu.show(tree, e.getX(), e.getY());
}
}
});
add(new JScrollPane(tree), BorderLayout.CENTER);
}
/**
* @see ViewerModelListener#viewerModelChanged(ViewerModelEvent)
*/
public void viewerModelChanged(ViewerModelEvent e) {
switch (e.getReason()) {
case ViewerModelEvent.CODE_RECOMPILED:
tree.setModel(new ASTModel(model.getRootNode()));
break;
case ViewerModelEvent.NODE_SELECTED:
if (e.getSource() != this) {
LinkedList list = new LinkedList();
for (
Node node = (Node) e.getParameter(); node != null;
node = node.jjtGetParent())
list.addFirst(node);
TreePath path = new TreePath(list.toArray());
tree.setSelectionPath(path);
tree.scrollPathToVisible(path);
}
break;
}
}
/**
* @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent)
*/
public void valueChanged(TreeSelectionEvent e) {
model.selectNode((SimpleNode) e.getNewLeadSelectionPath().getLastPathComponent(), this);
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.5 2005/02/16 15:46:05 mikkey
* javadoc fixes
*
* Revision 1.4 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.3 2004/04/15 18:21:58 tomcopeland
* Cleaned up imports with new version of IDEA; fixed some deprecated Ant junx
*
* Revision 1.2 2003/09/23 20:51:06 tomcopeland
* Cleaned up imports
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.3 2003/09/24 00:40:35 bgr
* evaluation results browsing added
*
* Revision 1.2 2003/09/23 07:52:16 bgr
* menus added
*
* Revision 1.1 2003/09/22 05:21:54 bgr
* initial commit
*
*/
@@ -0,0 +1,35 @@
package net.sourceforge.pmd.util.viewer.gui;
/**
* contains action command constants
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public interface ActionCommands {
String COMPILE_ACTION = "Compile";
String EVALUATE_ACTION = "Evaluate";
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.3 2004/12/22 20:52:12 tomcopeland
* Fixing some stuff PMD found
*
* Revision 1.2 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.1 2003/09/22 05:21:54 bgr
* initial commit
*
*/
@@ -0,0 +1,105 @@
package net.sourceforge.pmd.util.viewer.gui;
import net.sourceforge.pmd.ast.SimpleNode;
import net.sourceforge.pmd.util.viewer.model.ViewerModel;
import net.sourceforge.pmd.util.viewer.model.ViewerModelEvent;
import net.sourceforge.pmd.util.viewer.model.ViewerModelListener;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.BorderLayout;
import java.util.Vector;
/**
* A panel showing XPath expression evaluation results
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class EvaluationResultsPanel
extends JPanel
implements ViewerModelListener {
private ViewerModel model;
private JList list;
/**
* constructs the panel
*
* @param model model to refer to
*/
public EvaluationResultsPanel(ViewerModel model) {
super(new BorderLayout());
this.model = model;
init();
}
private void init() {
model.addViewerModelListener(this);
list = new JList();
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (list.getSelectedValue() != null) {
model.selectNode((SimpleNode) list.getSelectedValue(), EvaluationResultsPanel.this);
}
}
});
add(new JScrollPane(list), BorderLayout.CENTER);
}
/**
* @see ViewerModelListener#viewerModelChanged(ViewerModelEvent)
*/
public void viewerModelChanged(ViewerModelEvent e) {
switch (e.getReason()) {
case ViewerModelEvent.PATH_EXPRESSION_EVALUATED:
if (e.getSource() != this) {
list.setListData(new Vector(model.getLastEvaluationResults()));
}
break;
case ViewerModelEvent.CODE_RECOMPILED:
list.setListData(new Vector(0));
break;
}
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.5 2005/02/16 15:46:34 mikkey
* javadoc fixes
*
* Revision 1.4 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.3 2004/04/15 18:21:58 tomcopeland
* Cleaned up imports with new version of IDEA; fixed some deprecated Ant junx
*
* Revision 1.2 2003/09/23 20:51:06 tomcopeland
* Cleaned up imports
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.1 2003/09/24 00:40:35 bgr
* evaluation results browsing added
*
*/
@@ -0,0 +1,172 @@
package net.sourceforge.pmd.util.viewer.gui;
import net.sourceforge.pmd.ast.ParseException;
import net.sourceforge.pmd.util.viewer.model.ViewerModel;
import net.sourceforge.pmd.util.viewer.model.ViewerModelEvent;
import net.sourceforge.pmd.util.viewer.model.ViewerModelListener;
import net.sourceforge.pmd.util.viewer.util.NLS;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* viewer's main frame
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class MainFrame
extends JFrame
implements ActionListener, ActionCommands, ViewerModelListener {
private ViewerModel model;
private SourceCodePanel sourcePanel;
private ASTPanel astPanel;
private XPathPanel xPathPanel;
private JButton compileBtn;
private JButton evalBtn;
private JLabel statusLbl;
/**
* constructs and shows the frame
*/
public MainFrame() {
super(NLS.nls("MAIN.FRAME.TITLE"));
init();
}
private void init() {
model = new ViewerModel();
model.addViewerModelListener(this);
sourcePanel = new SourceCodePanel(model);
astPanel = new ASTPanel(model);
xPathPanel = new XPathPanel(model);
getContentPane().setLayout(new BorderLayout());
JSplitPane editingPane =
new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sourcePanel, astPanel);
editingPane.setResizeWeight(0.5d);
JPanel interactionsPane = new JPanel(new BorderLayout());
interactionsPane.add(xPathPanel, BorderLayout.SOUTH);
interactionsPane.add(editingPane, BorderLayout.CENTER);
getContentPane().add(interactionsPane, BorderLayout.CENTER);
compileBtn = new JButton(NLS.nls("MAIN.FRAME.COMPILE_BUTTON.TITLE"));
compileBtn.setActionCommand(COMPILE_ACTION);
compileBtn.addActionListener(this);
evalBtn = new JButton(NLS.nls("MAIN.FRAME.EVALUATE_BUTTON.TITLE"));
evalBtn.setActionCommand(EVALUATE_ACTION);
evalBtn.addActionListener(this);
evalBtn.setEnabled(false);
statusLbl = new JLabel();
statusLbl.setHorizontalAlignment(SwingConstants.RIGHT);
JPanel btnPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
btnPane.add(compileBtn);
btnPane.add(evalBtn);
btnPane.add(statusLbl);
getContentPane().add(btnPane, BorderLayout.SOUTH);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
pack();
setSize(800, 600);
setVisible(true);
}
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
long t0, t1;
if (command.equals(COMPILE_ACTION)) {
try {
t0 = System.currentTimeMillis();
model.commitSource(sourcePanel.getSourceCode());
t1 = System.currentTimeMillis();
setStatus(NLS.nls("MAIN.FRAME.COMPILATION.TOOK")+ " "+(t1-t0)+" ms");
} catch (ParseException exc) {
setStatus(NLS.nls("MAIN.FRAME.COMPILATION.PROBLEM")+ " "+exc.toString());
new ParseExceptionHandler(this, exc);
}
} else if (command.equals(EVALUATE_ACTION)) {
try {
t0 = System.currentTimeMillis();
model.evaluateXPathExpression(xPathPanel.getXPathExpression(), this);
t1 = System.currentTimeMillis();
setStatus(NLS.nls("MAIN.FRAME.EVALUATION.TOOK")+ " "+(t1-t0)+" ms");
} catch (Exception exc) {
setStatus(NLS.nls("MAIN.FRAME.EVALUATION.PROBLEM")+ " "+exc.toString());
new ParseExceptionHandler(this, exc);
}
}
}
/**
* Sets the status bar message
* @param string the new status, the empty string will be set if the value is <code>null</code>
*/
private void setStatus(String string) {
if (string == null)
string = "";
statusLbl.setText(string);
}
/**
* @see ViewerModelListener#viewerModelChanged(ViewerModelEvent)
*/
public void viewerModelChanged(ViewerModelEvent e) {
evalBtn.setEnabled(model.hasCompiledTree());
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.6 2005/02/16 15:47:01 mikkey
* javadoc fixes
*
* Revision 1.5 2004/12/13 14:46:11 tomcopeland
* Applied, thanks Miguel!
*
* Revision 1.4 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.3 2004/04/15 18:21:58 tomcopeland
* Cleaned up imports with new version of IDEA; fixed some deprecated Ant junx
*
* Revision 1.2 2003/09/23 20:51:06 tomcopeland
* Cleaned up imports
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.2 2003/09/24 00:40:35 bgr
* evaluation results browsing added
*
* Revision 1.1 2003/09/22 05:21:54 bgr
* initial commit
*
*/
@@ -0,0 +1,112 @@
package net.sourceforge.pmd.util.viewer.gui;
import net.sourceforge.pmd.util.viewer.util.NLS;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* handles parsing exceptions
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class ParseExceptionHandler
extends JDialog
implements ActionListener {
private Exception exc;
private JTextArea errorArea;
private JButton okBtn;
/**
* creates the dialog
*
* @param parent dialog's parent
* @param exc exception to be handled
*/
public ParseExceptionHandler(JFrame parent, Exception exc) {
super(parent, NLS.nls("COMPILE_ERROR.DIALOG.TITLE"), true);
this.exc = exc;
init();
}
private void init() {
errorArea = new JTextArea();
errorArea.setEditable(false);
errorArea.setText(exc.getMessage() + "\n");
getContentPane().setLayout(new BorderLayout());
JPanel messagePanel = new JPanel(new BorderLayout());
messagePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(),
BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
NLS.nls("COMPILE_ERROR.PANEL.TITLE"))));
messagePanel.add(new JScrollPane(errorArea), BorderLayout.CENTER);
getContentPane().add(messagePanel, BorderLayout.CENTER);
JPanel btnPane = new JPanel(new FlowLayout(FlowLayout.RIGHT));
okBtn = new JButton(NLS.nls("COMPILE_ERROR.OK_BUTTON.CAPTION"));
okBtn.addActionListener(this);
btnPane.add(okBtn);
getRootPane().setDefaultButton(okBtn);
getContentPane().add(btnPane, BorderLayout.SOUTH);
pack();
setLocationRelativeTo(getParent());
setVisible(true);
}
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent e) {
if (e.getSource() == okBtn) {
dispose();
}
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.4 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.3 2004/04/15 18:21:58 tomcopeland
* Cleaned up imports with new version of IDEA; fixed some deprecated Ant junx
*
* Revision 1.2 2003/09/23 20:51:06 tomcopeland
* Cleaned up imports
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.2 2003/09/24 00:40:35 bgr
* evaluation results browsing added
*
* Revision 1.1 2003/09/22 05:21:54 bgr
* initial commit
*
*/
@@ -0,0 +1,119 @@
package net.sourceforge.pmd.util.viewer.gui;
import net.sourceforge.pmd.ast.SimpleNode;
import net.sourceforge.pmd.util.viewer.model.ViewerModel;
import net.sourceforge.pmd.util.viewer.model.ViewerModelEvent;
import net.sourceforge.pmd.util.viewer.model.ViewerModelListener;
import net.sourceforge.pmd.util.viewer.util.NLS;
import javax.swing.*;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultHighlighter;
import java.awt.BorderLayout;
import java.awt.Color;
/**
* source code panel
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class SourceCodePanel
extends JPanel
implements ViewerModelListener {
private ViewerModel model;
private JTextArea sourceCodeArea;
public SourceCodePanel(ViewerModel model) {
this.model = model;
init();
}
private void init() {
model.addViewerModelListener(this);
setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), NLS.nls("SOURCE.PANEL.TITLE")));
setLayout(new BorderLayout());
sourceCodeArea = new JTextArea();
add(new JScrollPane(sourceCodeArea), BorderLayout.CENTER);
}
/**
* retrieves the string representation of the source code
*
* @return source code's string representation
*/
public String getSourceCode() {
return sourceCodeArea.getText();
}
/**
* @see ViewerModelListener#viewerModelChanged(ViewerModelEvent)
*/
public void viewerModelChanged(ViewerModelEvent e) {
if (e.getReason() == ViewerModelEvent.NODE_SELECTED) {
final SimpleNode node = (SimpleNode) e.getParameter();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
sourceCodeArea.getHighlighter().removeAllHighlights();
if (node == null) {
return;
}
int startOffset =
(sourceCodeArea.getLineStartOffset(node.getBeginLine() - 1) +
node.getBeginColumn()) - 1;
int end =
(sourceCodeArea.getLineStartOffset(node.getEndLine() - 1) +
node.getEndColumn());
sourceCodeArea.getHighlighter().addHighlight(startOffset, end,
new DefaultHighlighter.DefaultHighlightPainter(new Color(79, 237, 111)));
sourceCodeArea.moveCaretPosition(startOffset);
} catch (BadLocationException exc) {
throw new IllegalStateException(exc.getMessage());
}
}
});
}
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.5 2005/02/16 15:47:27 mikkey
* javadoc fixes
*
* Revision 1.4 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.3 2004/04/15 18:21:58 tomcopeland
* Cleaned up imports with new version of IDEA; fixed some deprecated Ant junx
*
* Revision 1.2 2003/09/23 20:51:06 tomcopeland
* Cleaned up imports
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.1 2003/09/22 05:21:54 bgr
* initial commit
*
*/
Loaded 30 of 5414 files, more files were not shown because too many files have changed in this diff. Show more