Merge branch 'master' of github.com:pmd/pmd

This commit is contained in:
Clément Fournier committed 2020-03-21 20:04:49 +01:00
commit 17ddfd2a22
9 files changed
+178 -9

No files matched your search

@@ -1,20 +1,41 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
<!-- 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]. -->
<!-- NB: issues about the rule designer should be opened at https://github.com/pmd/pmd-designer/issues -->
**Affects PMD Version:**
**Rule:**
Make sure, to test with the latest PMD version.
**Description:**
A clear and concise description of what the bug is.
**Exception Stacktrace:**
```
# Copy-paste the stack trace here
```
**Code Sample demonstrating the issue:**
```
```
**Steps to reproduce:**
Please provide detailed steps for how we can reproduce the bug.
1. ... (e.g. if you're using maven: `mvn clean verify`)
2. ...
**Running PMD through:** *[CLI | Ant | Maven | Gradle | Designer | Other]*
<!-- If relevant, also include your JDK and OS information, e.g. for ClassNotFoundException, LinkageError, reflection failures, etc. -->
+8
View File
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: PMD Designer Issues
url: https://github.com/pmd/pmd-designer/issues
about: Issues about the rule designer
- name: PMD Eclipse Plugin Issues
url: https://github.com/pmd/pmd-eclipse-plugin/issues
about: Issues about the PMD Eclipse Plugin
+20
View File
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context about the feature request here.
+27
View File
@@ -0,0 +1,27 @@
---
name: New Rule
about: You have an idea for a new rule? Great!
title: ''
labels: new-rule
assignees: ''
---
<!-- Please, prefix the report title with the language it applies to within brackets, such as [java] or [apex] -->
**Proposed Rule Name:**
**Proposed Category:** One of [Best Practices | Code Style | Design | Documentation | Error Prone | Multithreading | Performance | Security]
**Description:**
**Code Sample:** This should include code, that should be flagged by the rule. If possible, the "correct" code
according to this new rule should also be demonstrated.
```
```
**Possible Properties:**
* Should this rule be customizable via properties?
+14
View File
@@ -0,0 +1,14 @@
---
name: Question
about: Feel free to ask any question about PMD and its usage
title: ''
labels: question
assignees: ''
---
<!-- Have a look at https://github.com/pmd/pmd/issues?utf8=%E2%9C%93&q=label%3Aa%3Aquestion if there is already
a similar question -->
**Description:**
+32
View File
@@ -0,0 +1,32 @@
---
name: Rule violation
about: Let us know about a false positive/false negative
title: ''
labels: bug
assignees: ''
---
<!-- Please, prefix the report title with the language it applies to within brackets, such as [java] or [apex] -->
**Affects PMD Version:**
**Rule:**
Please provide the rule name and a link to the rule documentation:
<https://pmd.github.io/latest/pmd_rules_XXX_XXX.html#XXX>
**Description:**
**Code Sample demonstrating the issue:**
```
```
**Expected outcome:**
* Does PMD report a violation, where there shouldn't be one? -> false-positive
* Is PMD missing to report a violation, where there should be one? -> false-negative
**Running PMD through:** *[CLI | Ant | Maven | Gradle | Designer | Other]*
+1 -1
View File
@@ -11,7 +11,7 @@ author: Tom Copeland <tom@infoether.org>
* March 2020 - [Helping Salesforce developers create readable and maintainable Apex code](https://gearset.com/blog/helping-sf-developers-create-readable-and-maintainable-apex-code)
* July 2019 - [Apex PMD | Static code analysis - Apex Hours](https://youtu.be/34PxAHtAavU)
* July 2019 - [Apex PMD \| Static code analysis - Apex Hours](https://youtu.be/34PxAHtAavU)
* June 2019 - [Pluralsight](https://www.pluralsight.com/authors/don-robins) Course about leveraging PMD usage for Salesforce by [Robert Sösemann](https://github.com/rsoesemann) (Apex Language Module Contributor) [Play by Play: Automated Code Analysis in Salesforce - a Tools Deep-Dive](https://www.pluralsight.com/courses/play-by-play-automated-code-analysis-in-salesforce)
+51 -5
View File
@@ -2,7 +2,8 @@
title: Maven PMD Plugin
tags: [userdocs, tools]
permalink: pmd_userdocs_tools_maven.html
last_updated: August 2017
last_updated: March 2020
mpmd_version: 3.13.0
author: >
Miguel Griffa <mikkey@users.sourceforge.net>,
Romain PELISSE <belaran@gmail.com>,
@@ -13,6 +14,36 @@ author: >
### Running the pmd plugin
#### Choosing the plugin version
When adding the maven-pmd-plugin to your pom.xml, you need to select a version. To figure out the
latest available version, have a look at the official [maven-pmd-plugin documentation](https://maven.apache.org/plugins/maven-pmd-plugin/).
As of {{ page.last_updated }}, the current plugin version is **{{ page.mpmd_version }}**.
The version of the plugin should be specified in `<build><pluginManagement/></build>` and if using the project
report additionally in `<reporting><plugins/></reporting>` elements. Here's an example for the pluginManagement
section:
```xml
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>{{ page.mpmd_version }}</version>
</plugin>
</plugins>
</pluginManagement>
</build>
```
When defining the version in the pluginManagment section, then it doesn't need to be specified in the normal plugins
section. However, it should additionally be specified in the reporting section.
More information, see [Guide to Configuring Plugin-ins](https://maven.apache.org/guides/mini/guide-configuring-plugins.html).
#### Generating a project report
To include the PMD report in the project reports section add the following lines under
@@ -26,6 +57,7 @@ the reports element in your pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>{{ page.mpmd_version }}</version>
</plugin>
</plugins>
</reporting>
@@ -58,8 +90,11 @@ PMD finds some violations. Therefore the `check` goal is used:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>{{ page.mpmd_version }}</version> <!-- or use version from pluginManagement -->
<configuration>
<failOnViolation>true</failOnViolation> <!-- this is actually true by default, but can be disabled -->
<!-- failOnViolation is actually true by default, but can be disabled -->
<failOnViolation>true</failOnViolation>
<!-- printFailingErrors is pretty useful -->
<printFailingErrors>true</printFailingErrors>
</configuration>
<executions>
@@ -87,11 +122,13 @@ you add `cpd-check` as a goal.
To specify a ruleset, simply edit the previous configuration:
``` xml
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>{{ page.mpmd_version }}</version>
<configuration>
<rulesets>
<ruleset>/rulesets/java/quickstart.xml</ruleset>
@@ -102,6 +139,7 @@ To specify a ruleset, simply edit the previous configuration:
</plugin>
</plugins>
</reporting>
```
The value of the 'ruleset' element can either be a relative address, an absolute address or even an url.
@@ -117,23 +155,30 @@ will be able to resolve those other ruleset references.
When using the Maven PMD plugin 3.8 or later along with PMD 5.6.0 or later, you can enable incremental analysis to
speed up PMD's execution while retaining the quality of the analysis. You can additionally customize where the cache is stored::
```xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>{{ page.mpmd_version }}</version> <!-- or use version from pluginManagement -->
<configuration>
<analysisCache>true</analysisCache> <!-- enable incremental analysis -->
<analysisCacheLocation>${project.build.directory}/pmd/pmd.cache</analysisCacheLocation> <!-- Optional: points to this location by default -->
<!-- enable incremental analysis -->
<analysisCache>true</analysisCache>
<!-- analysisCacheLocation: optional - points to the following location by default -->
<analysisCacheLocation>${project.build.directory}/pmd/pmd.cache</analysisCacheLocation>
</configuration>
</plugin>
```
#### Other configurations
The Maven PMD plugin allows you to configure CPD, targetJDK, and the use of XRef to link
the report to html source files, and the file encoding:
```xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>{{ page.mpmd_version }}</version> <!-- or use version from pluginManagement -->
<configuration>
<linkXRef>true</linkXRef>
<sourceEncoding>ISO-8859-1</sourceEncoding>
@@ -141,6 +186,7 @@ the report to html source files, and the file encoding:
<targetJdk>1.4</targetJdk>
</configuration>
</plugin>
```
#### Upgrading the PMD version at runtime
@@ -162,7 +208,7 @@ Maven plugin will use and benefit from the latest bugfixes and enhancements:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.8</version>
<version>{{ page.mpmd_version }}</version>
<dependencies>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
+1
View File
@@ -99,6 +99,7 @@ implementations, and their corresponding Parser if it exists (in the same packag
### External Contributions
* [#2312](https://github.com/pmd/pmd/pull/2312): \[apex] Update ApexCRUDViolation Rule - [Joshua S Arquilevich](https://github.com/jarquile)
* [#2314](https://github.com/pmd/pmd/pull/2314): \[doc] maven integration - Add version to plugin - [Pham Hai Trung](https://github.com/gpbp)
* [#2353](https://github.com/pmd/pmd/pull/2353): \[plsql] xmlforest with optional AS - [Piotr Szymanski](https://github.com/szyman23)
{% endtocmaker %}