@@ -26,7 +26,7 @@ additional_js:
**PMD** is a static source code analyzer. It finds common programming flaws like
unused variables, empty catch blocks, unnecessary object creation, and
-so forth. It's mainly concerned with **Java and Apex**, but **supports six other
+so forth. It's mainly concerned with **Java and Apex**, but **supports 12 other
languages**.
PMD features many **built-in checks** (in PMD lingo, *rules*), which are documented
diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md
index 7d929e1385..e3d930a4c7 100644
--- a/docs/pages/pmd/projectdocs/credits.md
+++ b/docs/pages/pmd/projectdocs/credits.md
@@ -429,7 +429,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
 Lukebray 🐛 |
-  Lynn 💻 |
+  Lynn 💻 🐛 |
 Lyor Goldstein 🐛 |
 MCMicS 🐛 |
 Macarse 🐛 |
@@ -701,291 +701,295 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
 Thunderforge 💻 🐛 |
 Tim van der Lippe 🐛 |
 Tobias Weimer 💻 🐛 |
+  Tom Copeland 🐛 💻 📖 |
 Tom Daly 🐛 |
 Tomer Figenblat 🐛 |
 Tomi De Lucca 💻 🐛 |
-  Torsten Kleiber 🐛 |
+  Torsten Kleiber 🐛 |
 TrackerSB 🐛 |
+  Tyson Stewart 🐛 |
 Ullrich Hafner 🐛 |
 Utku Cuhadaroglu 💻 🐛 |
 Valentin Brandl 🐛 |
 Valeria 🐛 |
-  Vasily Anisimov 🐛 |
-  Vibhor Goyal 🐛 |
+  Vasily Anisimov 🐛 |
+  Vibhor Goyal 🐛 |
 Vickenty Fesunov 🐛 |
 Victor Noël 🐛 |
 Vincent Galloy 💻 |
 Vincent HUYNH 🐛 |
 Vincent Maurin 🐛 |
-  Vincent Privat 🐛 |
-  Vishhwas 🐛 |
+  Vincent Privat 🐛 |
+  Vishhwas 🐛 |
 Vitaly 🐛 |
 Vitaly Polonetsky 🐛 |
 Vojtech Polivka 🐛 |
 Vsevolod Zholobov 🐛 |
 Vyom Yadav 💻 |
-  Wang Shidong 🐛 |
-  Waqas Ahmed 🐛 |
+  Wang Shidong 🐛 |
+  Waqas Ahmed 🐛 |
 Wayne J. Earl 🐛 |
 Wchenghui 🐛 |
 Will Winder 🐛 |
 William Brockhus 💻 🐛 |
 Wilson Kurniawan 🐛 |
-  Wim Deblauwe 🐛 |
-  Woongsik Choi 🐛 |
+  Wim Deblauwe 🐛 |
+  Woongsik Choi 🐛 |
 XenoAmess 💻 🐛 |
 Yang 💻 |
 YaroslavTER 🐛 |
+  Yasar Shaikh 💻 |
 Young Chan 💻 🐛 |
+
+
 YuJin Kim 🐛 |
 Yuri Dolzhenko 🐛 |
 Yurii Dubinka 🐛 |
-
-
 Zoltan Farkas 🐛 |
 Zustin 🐛 |
 aaronhurst-google 🐛 💻 |
 alexmodis 🐛 |
+
+
 andreoss 🐛 |
 andrey81inmd 💻 🐛 |
 anicoara 🐛 |
-
-
 arunprasathav 🐛 |
 asiercamara 🐛 |
 astillich-igniti 💻 |
 avesolovksyy 🐛 |
+
+
 avishvat 🐛 |
 avivmu 🐛 |
 axelbarfod1 🐛 |
-
-
 b-3-n 🐛 |
 balbhadra9 🐛 |
 base23de 🐛 |
 bergander 🐛 |
+
+
 berkam 💻 🐛 |
 breizh31 🐛 |
 caesarkim 🐛 |
-
-
 carolyujing 🐛 |
 cbfiddle 🐛 |
 cesares-basilico 🐛 |
 chrite 🐛 |
+
+
 cobratbq 🐛 |
 coladict 🐛 |
 cosmoJFH 🐛 |
-
-
 cristalp 🐛 |
 crunsk 🐛 |
 cwholmes 🐛 |
 cyberjj999 🐛 |
+
+
 cyw3 🐛 |
 d1ss0nanz 🐛 |
 dalizi007 💻 |
-
-
 danbrycefairsailcom 🐛 |
 dariansanity 🐛 |
 darrenmiliband 🐛 |
 davidburstrom 🐛 |
+
+
 dbirkman-paloalto 🐛 |
 deepak-patra 🐛 |
 dependabot[bot] 💻 🐛 |
-
-
 dinesh150 🐛 |
 diziaq 🐛 |
 dreaminpast123 🐛 |
 duanyanan 🐛 |
+
+
 dutt-sanjay 🐛 |
 dylanleung 🐛 |
 dzeigler 🐛 |
-
-
 ekkirala 🐛 |
 emersonmoura 🐛 |
 fairy 🐛 |
 filiprafalowicz 💻 |
+
+
 foxmason 🐛 |
 frankegabor 🐛 |
 frankl 🐛 |
-
-
 freafrea 🐛 |
 fsapatin 🐛 |
 gracia19 🐛 |
 guo fei 🐛 |
+
+
 gurmsc5 🐛 |
 gwilymatgearset 💻 🐛 |
 haigsn 🐛 |
-
-
 hemanshu070 🐛 |
 henrik242 🐛 |
 hongpuwu 🐛 |
 hvbtup 💻 🐛 |
+
+
 igniti GmbH 🐛 |
 ilovezfs 🐛 |
 itaigilo 🐛 |
-
-
 jakivey32 🐛 |
 jbennett2091 🐛 |
 jcamerin 🐛 |
 jkeener1 🐛 |
+
+
 jmetertea 🐛 |
 johnra2 💻 |
 josemanuelrolon 💻 🐛 |
-
-
 kabroxiko 💻 🐛 |
 karwer 🐛 |
 kaulonline 🐛 |
 kdaemonv 🐛 |
+
+
 kenji21 💻 🐛 |
 kfranic 🐛 |
 khalidkh 🐛 |
-
-
 koalalam 🐛 |
 krzyk 🐛 |
 lasselindqvist 🐛 |
 lgemeinhardt 🐛 |
+
+
 lihuaib 🐛 |
 lonelyma1021 🐛 |
 lpeddy 🐛 |
-
-
 lujiefsi 💻 |
 lukelukes 💻 |
 lyriccoder 🐛 |
 marcelmore 🐛 |
+
+
 matchbox 🐛 |
 matthiaskraaz 🐛 |
 meandonlyme 🐛 |
-
-
 mikesive 🐛 |
 milossesic 🐛 |
 mohan-chinnappan-n 💻 |
 mriddell95 🐛 |
+
+
 mrlzh 🐛 |
 msloan 🐛 |
 mucharlaravalika 🐛 |
-
-
 mvenneman 🐛 |
 nareshl119 🐛 |
 nicolas-harraudeau-sonarsource 🐛 |
 noerremark 🐛 |
+
+
 novsirion 🐛 |
 oggboy 🐛 |
 oinume 🐛 |
-
-
 orimarko 💻 🐛 |
 pacvz 💻 |
 pallavi agarwal 🐛 |
 parksungrin 🐛 |
+
+
 patpatpat123 🐛 |
 patriksevallius 🐛 |
 pbrajesh1 🐛 |
-
-
 phoenix384 🐛 |
 piotrszymanski-sc 💻 |
 plan3d 🐛 |
 poojasix 🐛 |
+
+
 prabhushrikant 🐛 |
 pujitha8783 🐛 |
 r-r-a-j 🐛 |
-
-
 raghujayjunk 🐛 |
 rajeshveera 🐛 |
 rajeswarreddy88 🐛 |
 recdevs 🐛 |
+
+
 reudismam 💻 🐛 |
 rijkt 🐛 |
 rillig-tk 🐛 |
-
-
 rmohan20 💻 🐛 |
+  rnveach 🐛 |
 rxmicro 🐛 |
 ryan-gustafson 💻 🐛 |
+
+
 sabi0 🐛 |
 scais 🐛 |
 sebbASF 🐛 |
 sergeygorbaty 💻 |
-
-
 shilko2013 🐛 |
 shiomiyan 📖 |
 simeonKondr 🐛 |
+
+
 snajberk 🐛 |
 sniperrifle2004 🐛 |
 snuyanzin 🐛 💻 |
 sratz 🐛 |
-
-
 stonio 🐛 |
 sturton 💻 🐛 |
 sudharmohan 🐛 |
+
+
 suruchidawar 🐛 |
 svenfinitiv 🐛 |
 tashiscool 🐛 |
 test-git-hook 🐛 |
-
-
 testation21 💻 🐛 |
 thanosa 🐛 |
 tiandiyixian 🐛 |
+
+
 tobwoerk 🐛 |
 tprouvot 🐛 💻 |
 trentchilders 🐛 |
 triandicAnt 🐛 |
-
-
 trishul14 🐛 |
 tsui 🐛 |
 winhkey 🐛 |
+
+
 witherspore 🐛 |
 wjljack 🐛 |
 wuchiuwong 🐛 |
 xingsong 🐛 |
-
-
 xioayuge 🐛 |
 xnYi9wRezm 💻 🐛 |
 xuanuy 🐛 |
+
+
 xyf0921 🐛 |
 yalechen-cyw3 🐛 |
 yasuharu-sato 🐛 |
 zenglian 🐛 |
-
-
 zgrzyt93 💻 🐛 |
 zh3ng 🐛 |
 zt_soft 🐛 |
+
+
 ztt79 🐛 |
 zzzzfeng 🐛 |
 Árpád Magosányi 🐛 |
 任贵杰 🐛 |
-
-
 茅延安 💻 |
@@ -1001,13 +1005,19 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
These are collected contributors before we moved to github.
+### Founders
+
+According to the book [PMD Applied](https://pmdapplied.thomasleecopeland.com/) the following people are the founders of PMD:
+
+* [Tom Copeland](https://thomasleecopeland.com/) ([@tcopeland](https://github.com/tcopeland)) - PMD core, lead developer, JDeveloper plugin, initial Gel plugin,
+ initial jEdit plugin, IDEAJ integration, BlueJ extension
+* David Dixon-Peugh - PMD core, much of the early work on the grammar, initial Emacs plugin
+* [David Craine](http://dcraine.blogspot.com/) - JBuilder plugin
+
### Committers
-* David Dixon-Peugh - PMD core, much of the early work on the grammar, initial Emacs plugin
* Philippe Herlin - Eclipse plugin, fixed bugs in RuleSetFactory
* Nascif Abousalh Neto - Emacs plugin
-* [Tom Copeland](https://thomasleecopeland.com/) - PMD core, lead developer, JDeveloper plugin, initial Gel plugin,
- initial jEdit plugin, IDEAJ integration, BlueJ extension
* Jiger Patel - jEdit plugin
* Alan Ezust - jEdit plugin
* Ole-Martin Mork - NetBeans plugin
@@ -1036,7 +1046,6 @@ These are collected contributors before we moved to github.
* Gunnlaugur Thor Briem - NetBeans plugin, Maven build script fixes, bug report on JavaCC parser's use
of java.lang.Error
-* [David Craine](http://dcraine.blogspot.com/) - JBuilder plugin
* Tom Burke - Eclipse plugin
* Alex Chaffee - various bugfixes and features
* Siegfried Goeschl - original Maven plugin, various bugfixes and features
diff --git a/docs/pages/pmd/projectdocs/decisions.md b/docs/pages/pmd/projectdocs/decisions.md
index af0258c29c..b8f813bad7 100644
--- a/docs/pages/pmd/projectdocs/decisions.md
+++ b/docs/pages/pmd/projectdocs/decisions.md
@@ -8,7 +8,7 @@ last_updated: July 2022
{% for page in site.pages %}
{% if page.adr == true and page.adr_status != "" %}
- - {{ page.title }} ({{ page.adr_status }})
+ - {{ page.title }} ({{ page.adr_status }})
{% endif %}
{% endfor %}
diff --git a/docs/pages/pmd/projectdocs/trivia/news.md b/docs/pages/pmd/projectdocs/trivia/news.md
index 2cf8db566d..fc31bbf8cd 100644
--- a/docs/pages/pmd/projectdocs/trivia/news.md
+++ b/docs/pages/pmd/projectdocs/trivia/news.md
@@ -36,6 +36,9 @@ author: Tom Copeland
### PMD in general and other Language Modules
+* April 2022 - Prediction of who should refactor the code, research available at
+ .
+
* February 2021 - Artem Krosheninnikov's talk about Quality Assurance Automation:
[Artem Krosheninnikov, Wrike - How static analysis can help in QAA processes](
https://www.youtube.com/watch?v=L42zH5ne074)
diff --git a/docs/pages/pmd/userdocs/cli_reference.md b/docs/pages/pmd/userdocs/cli_reference.md
index 8c1f59df60..1ad48e106d 100644
--- a/docs/pages/pmd/userdocs/cli_reference.md
+++ b/docs/pages/pmd/userdocs/cli_reference.md
@@ -209,18 +209,21 @@ Example:
```
* [apex](pmd_rules_apex.html) (Salesforce Apex)
+* [ecmascript](pmd_rules_ecmascript.html) (JavaScript)
+* [html](pmd_rules_html.html)
* [java](pmd_rules_java.html)
- * [Supported Versions](pmd_languages_java_versions.html)
+ * [Supported Versions](pmd_languages_java.html)
* [ecmascript](pmd_rules_ecmascript.html) (JavaScript)
* [jsp](pmd_rules_jsp.html)
* [modelica](pmd_rules_modelica.html)
* [plsql](pmd_rules_plsql.html)
+* [pom](pmd_rules_pom.html) (Maven POM)
* [scala](pmd_rules_scala.html)
* Supported Versions: 2.10, 2.11, 2.12, 2.13 (default)
* [vf](pmd_rules_vf.html) (Salesforce VisualForce)
* [vm](pmd_rules_vm.html) (Apache Velocity)
-* [xml and xsl](pmd_rules_xml.html)
-
+* [xml](pmd_rules_xml.html)
+* [xsl](pmd_rules_xsl.html)
## Available Report Formats
diff --git a/docs/pages/pmd/userdocs/installation.md b/docs/pages/pmd/userdocs/installation.md
index c50dabc63d..635011fb51 100644
--- a/docs/pages/pmd/userdocs/installation.md
+++ b/docs/pages/pmd/userdocs/installation.md
@@ -15,7 +15,7 @@ sidebar: pmd_sidebar
OpenJDK from [Azul](https://www.azul.com/downloads/zulu-community/)
or [AdoptOpenJDK](https://adoptopenjdk.net/) 1.7 or higher.
- **Note:** For analyzing Apex, JavaScript, Scala or VisualForce or running the [Designer](pmd_userdocs_extending_designer_reference.html)
+ **Note:** For analyzing Apex, HTML, JavaScript, Scala or VisualForce or running the [Designer](pmd_userdocs_extending_designer_reference.html)
at least Java 8 is required.
* A zip archiver, e.g.:
@@ -23,7 +23,7 @@ sidebar: pmd_sidebar
* For Windows: [Winzip](http://winzip.com) or the free [7-zip](http://www.7-zip.org/)
* For Linux / Unix: [InfoZip](http://infozip.sourceforge.net/)
-{% 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." %}
+{% include note.html content="For executing the Designer (./run.sh designer) using [OpenJDK](http://jdk.java.net) or Java 11, you need additionally [OpenJFX](https://openjfx.io/). Download it, extract it and set the environment variable JAVAFX_HOME." %}
### Installation
diff --git a/docs/pages/pmd/userdocs/making_rulesets.md b/docs/pages/pmd/userdocs/making_rulesets.md
index ca5e32dca0..b1b8b0f123 100644
--- a/docs/pages/pmd/userdocs/making_rulesets.md
+++ b/docs/pages/pmd/userdocs/making_rulesets.md
@@ -3,13 +3,12 @@ title: Making rulesets
keywords: [rulesets, reference, rule, exclude, include, pattern, filter]
tags: [getting_started, userdocs]
summary: Making Custom Rulesets for PMD
-last_updated: November 2017
summary: "A ruleset is an XML configuration file, which describes a collection of rules to be executed
in a PMD run. PMD includes built-in rulesets to run quick analyses with a default configuration, but
users are encouraged to make their own rulesets from the start, because they allow for so much
configurability. This page walk you through the creation of a ruleset and the multiple configuration
features offered by rulesets."
-last_updated: May 2018 (6.4.0)
+last_updated: October 2022 (6.51.0)
permalink: pmd_userdocs_making_rulesets.html
author: Tom Copeland , Clément Fournier
---
@@ -118,3 +117,8 @@ You can exclude some files from being processed by a ruleset using **exclude pat
```
+
+## Sharing your ruleset
+
+{% include tip.html content="If you want to share your ruleset, you can add it to the list
+on [3rd party rulesets](pmd_userdocs_3rdpartyrulesets.html)." %}
diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md
index 8abb75f161..e52065ca65 100644
--- a/docs/pages/release_notes.md
+++ b/docs/pages/release_notes.md
@@ -19,11 +19,58 @@ This is a {{ site.pmd.release_type }} release.
### New and noteworthy
+#### New Rules
+* The new Apex rule {% rule apex/bestpractices/ApexUnitTestClassShouldHaveRunAs %} ensures that unit tests
+ use [System.runAs()](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_tools_runas.htm)
+ at least once. This makes the tests more robust, and independent from the user running it.
+
+```xml
+
+```
+
+The rule is part of the quickstart.xml ruleset.
+
+#### Modified Rules
+
+* The Java rule {% rule java/errorprone/TestClassWithoutTestCases %} has a new property `testClassPattern`. This is
+ used to detect empty test classes by name. Previously this rule could only detect empty JUnit3 test cases
+ properly. To switch back to the old behavior, this property can be set to an empty value which disables the
+ test class detection by pattern.
+
### Fixed Issues
+* apex
+ * [#4149](https://github.com/pmd/pmd/issues/4149): \[apex] New rule: ApexUnitTestClassShouldHaveRunAs
+* doc
+ * [#4144](https://github.com/pmd/pmd/pull/4144): \[doc] Update docs to reflect supported languages
+ * [#4163](https://github.com/pmd/pmd/issues/4163): \[doc] Broken links on page "Architecture Decisions"
+* java-bestpractices
+ * [#4140](https://github.com/pmd/pmd/issues/4140): \[java] \[doc] AccessorClassGeneration violations hidden with Java 11
+* java-codestyle
+ * [#4139](https://github.com/pmd/pmd/issues/4139): \[java] UnnecessaryFullyQualifiedName FP when the same simple class name exists in the current package
+* java-documentation
+ * [#4141](https://github.com/pmd/pmd/issues/4141): \[java] UncommentedEmptyConstructor FP when constructor annotated with @Autowired
+* java-performance
+ * [#1167](https://github.com/pmd/pmd/issues/1167): \[java] AvoidArrayLoops false positive on double assignment
+ * [#2080](https://github.com/pmd/pmd/issues/2080): \[java] StringToString rule false-positive with field access
+ * [#2692](https://github.com/pmd/pmd/issues/2692): \[java] \[doc] AvoidArrayLoops flags copy assignment in same array as sub-optimal
+ * [#3437](https://github.com/pmd/pmd/issues/3437): \[java] StringToString doesn't trigger on Bar.class.getSimpleName().toString()
+ * [#3681](https://github.com/pmd/pmd/issues/3681): \[java] StringToString doesn't trigger on string literals
+ * [#3847](https://github.com/pmd/pmd/issues/3847): \[java] AvoidArrayLoops should consider final variables
+ * [#3977](https://github.com/pmd/pmd/issues/3977): \[java] StringToString false-positive with local method name confusion
+ * [#4091](https://github.com/pmd/pmd/issues/4091): \[java] AvoidArrayLoops false negative with do-while loops
+ * [#4148](https://github.com/pmd/pmd/issues/4148): \[java] UseArrayListInsteadOfVector ignores Vector when other classes are imported
+* java-errorprone
+ * [#929](https://github.com/pmd/pmd/issues/929): \[java] Inconsistent results with TestClassWithoutTestCases
+ * [#2636](https://github.com/pmd/pmd/issues/2636): \[java] TestClassWithoutTestCases false positive with JUnit5 ParameterizedTest
+* javascript
+ * [#4165](https://github.com/pmd/pmd/issues/4165): \[javascript] InaccurateNumericLiteral underscore separator notation false positive
### API Changes
### External Contributions
+* [#4142](https://github.com/pmd/pmd/pull/4142): \[java] fix #4141 Update UncommentedEmptyConstructor - ignore @Autowired annotations - [Lynn](https://github.com/LynnBroe) (@LynnBroe)
+* [#4147](https://github.com/pmd/pmd/pull/4147): \[java] Added support for Do-While for AvoidArrayLoops - [Yasar Shaikh](https://github.com/yasarshaikh) (@yasarshaikh)
+* [#4150](https://github.com/pmd/pmd/pull/4150): \[apex] New rule ApexUnitTestClassShouldHaveRunAs #4149 - [Thomas Prouvot](https://github.com/tprouvot) (@tprouvot)
{% endtocmaker %}
diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/bestpractices/ApexUnitTestClassShouldHaveRunAsRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/bestpractices/ApexUnitTestClassShouldHaveRunAsRule.java
new file mode 100644
index 0000000000..7a417a43b0
--- /dev/null
+++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/bestpractices/ApexUnitTestClassShouldHaveRunAsRule.java
@@ -0,0 +1,38 @@
+/**
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
+package net.sourceforge.pmd.lang.apex.rule.bestpractices;
+
+import java.util.List;
+
+import net.sourceforge.pmd.lang.apex.ast.ASTMethod;
+import net.sourceforge.pmd.lang.apex.ast.ASTRunAsBlockStatement;
+import net.sourceforge.pmd.lang.apex.ast.ApexNode;
+import net.sourceforge.pmd.lang.apex.rule.AbstractApexUnitTestRule;
+
+/**
+ * Apex unit tests should have System.runAs methods in them
+ *
+ * @author t.prouvot
+ */
+public class ApexUnitTestClassShouldHaveRunAsRule extends AbstractApexUnitTestRule {
+
+ @Override
+ public Object visit(ASTMethod node, Object data) {
+ if (!isTestMethodOrClass(node)) {
+ return data;
+ }
+
+ return checkForRunAsStatements(node, data);
+ }
+
+ private Object checkForRunAsStatements(ApexNode> node, Object data) {
+ final List runAsStatements = node.findDescendantsOfType(ASTRunAsBlockStatement.class);
+
+ if (runAsStatements.isEmpty()) {
+ addViolation(data, node);
+ }
+ return data;
+ }
+}
diff --git a/pmd-apex/src/main/resources/category/apex/bestpractices.xml b/pmd-apex/src/main/resources/category/apex/bestpractices.xml
index 9ba93ed63e..6763f71d9a 100644
--- a/pmd-apex/src/main/resources/category/apex/bestpractices.xml
+++ b/pmd-apex/src/main/resources/category/apex/bestpractices.xml
@@ -64,6 +64,44 @@ public class Foo {
+
+
+Apex unit tests should include at least one runAs method. This makes the tests more robust, and independent from the
+user running it.
+
+ 3
+
+
+
+
+
3
+
diff --git a/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/rule/bestpractices/ApexUnitTestClassShouldHaveRunAsTest.java b/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/rule/bestpractices/ApexUnitTestClassShouldHaveRunAsTest.java
new file mode 100644
index 0000000000..1c20e4ad7c
--- /dev/null
+++ b/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/rule/bestpractices/ApexUnitTestClassShouldHaveRunAsTest.java
@@ -0,0 +1,11 @@
+/**
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
+package net.sourceforge.pmd.lang.apex.rule.bestpractices;
+
+import net.sourceforge.pmd.testframework.PmdRuleTst;
+
+public class ApexUnitTestClassShouldHaveRunAsTest extends PmdRuleTst {
+ // no additional unit tests
+}
diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/bestpractices/xml/ApexUnitTestClassShouldHaveRunAs.xml b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/bestpractices/xml/ApexUnitTestClassShouldHaveRunAs.xml
new file mode 100644
index 0000000000..3f23a6cd33
--- /dev/null
+++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/bestpractices/xml/ApexUnitTestClassShouldHaveRunAs.xml
@@ -0,0 +1,121 @@
+
+
+
+
+ Problematic apex unit test - no runAs calls
+ 1
+
+
+
+
+
+
+ ApexUnitTestClassShouldHaveRunAs assumes APEX is case sensitive
+ 0
+
+
+
+
+
+
+ ApexUnitTestClassShouldHaveRunAs normal test case
+ 0
+
+
+
+
+
+
+ ApexUnitTestClassShouldHaveRunAs: Verify use of custom class, negative test
+ 2
+ 3,7
+
+
+
+
+
+
+ ApexUnitTestClassShouldHaveRunAs - no runAs calls outside a test class
+ 0
+
+
+
+
+
\ No newline at end of file
diff --git a/pmd-core/src/main/resources/rulesets/releases/6510.xml b/pmd-core/src/main/resources/rulesets/releases/6510.xml
new file mode 100644
index 0000000000..f9d787e9c6
--- /dev/null
+++ b/pmd-core/src/main/resources/rulesets/releases/6510.xml
@@ -0,0 +1,14 @@
+
+
+
+
+This ruleset contains links to rules that are new in PMD v6.51.0
+
+
+
+
+
+
diff --git a/pmd-doc/src/main/java/net/sourceforge/pmd/docs/RuleDocGenerator.java b/pmd-doc/src/main/java/net/sourceforge/pmd/docs/RuleDocGenerator.java
index 924f79fe18..f73d37bea8 100644
--- a/pmd-doc/src/main/java/net/sourceforge/pmd/docs/RuleDocGenerator.java
+++ b/pmd-doc/src/main/java/net/sourceforge/pmd/docs/RuleDocGenerator.java
@@ -392,6 +392,12 @@ public class RuleDocGenerator {
lines.add("");
}
+ if (rule.getMaximumLanguageVersion() != null) {
+ lines.add("**Maximum Language Version:** "
+ + rule.getLanguage().getName() + " " + rule.getMaximumLanguageVersion().getVersion());
+ lines.add("");
+ }
+
lines.addAll(EscapeUtils.escapeLines(toLines(stripIndentation(rule.getDescription()))));
lines.add("");
diff --git a/pmd-doc/src/test/resources/expected/sample.md b/pmd-doc/src/test/resources/expected/sample.md
index c1f20199a4..e878e9c06a 100644
--- a/pmd-doc/src/test/resources/expected/sample.md
+++ b/pmd-doc/src/test/resources/expected/sample.md
@@ -155,6 +155,8 @@ Avoid jumbled loop incrementers - its usually a mistake, and is confusing even i
**Minimum Language Version:** Java 1.5
+**Maximum Language Version:** Java 11
+
Override both `public boolean Object.equals(Object other)`, and `public int Object.hashCode()`, or override neither.
Even if you are inheriting a `hashCode()` from a parent class, consider implementing hashCode and explicitly
delegating to your superclass.
diff --git a/pmd-doc/src/test/resources/rulesets/ruledoctest/sample.xml b/pmd-doc/src/test/resources/rulesets/ruledoctest/sample.xml
index 4037c8ffb8..fb82fa5ac7 100644
--- a/pmd-doc/src/test/resources/rulesets/ruledoctest/sample.xml
+++ b/pmd-doc/src/test/resources/rulesets/ruledoctest/sample.xml
@@ -89,7 +89,8 @@ public class Bar {
message="Ensure you override both equals() and hashCode()"
class="net.sourceforge.pmd.lang.java.rule.errorprone.OverrideBothEqualsAndHashcodeRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_sample.html#overridebothequalsandhashcode"
- minimumLanguageVersion="1.5">
+ minimumLanguageVersion="1.5"
+ maximumLanguageVersion="11">
Override both `public boolean Object.equals(Object other)`, and `public int Object.hashCode()`, or override neither.
Even if you are inheriting a `hashCode()` from a parent class, consider implementing hashCode and explicitly
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/TestClassWithoutTestCasesRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/TestClassWithoutTestCasesRule.java
index 145876c7fe..c720b05b27 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/TestClassWithoutTestCasesRule.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/TestClassWithoutTestCasesRule.java
@@ -5,29 +5,54 @@
package net.sourceforge.pmd.lang.java.rule.errorprone;
import static net.sourceforge.pmd.lang.java.rule.internal.TestFrameworksUtil.isJUnit3Class;
+import static net.sourceforge.pmd.lang.java.rule.internal.TestFrameworksUtil.isJUnit5NestedClass;
+import java.util.regex.Pattern;
+
+import net.sourceforge.pmd.lang.java.ast.ASTAnyTypeDeclaration;
import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration;
import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration;
import net.sourceforge.pmd.lang.java.rule.AbstractJavaRulechainRule;
import net.sourceforge.pmd.lang.java.rule.internal.TestFrameworksUtil;
+import net.sourceforge.pmd.properties.PropertyDescriptor;
+import net.sourceforge.pmd.properties.PropertyFactory;
public class TestClassWithoutTestCasesRule extends AbstractJavaRulechainRule {
+ private static final PropertyDescriptor TEST_CLASS_PATTERN = PropertyFactory.regexProperty("testClassPattern")
+ .defaultValue("^(?:.*\\.)?Test[^\\.]*$|^(?:.*\\.)?.*Tests?$|^(?:.*\\.)?.*TestCase$")
+ .desc("Test class name pattern to identify test classes by their fully qualified name. "
+ + "A empty pattern disables test class detection by name. Since PMD 6.51.0.")
+ .build();
+
public TestClassWithoutTestCasesRule() {
super(ASTClassOrInterfaceDeclaration.class);
+ definePropertyDescriptor(TEST_CLASS_PATTERN);
}
@Override
public Object visit(ASTClassOrInterfaceDeclaration node, Object data) {
- if (isJUnit3Class(node)) {
+ if (isJUnit3Class(node) || isJUnit5NestedClass(node) || isTestClassByPattern(node)) {
boolean hasTests =
node.getDeclarations(ASTMethodDeclaration.class)
- .any(TestFrameworksUtil::isJunit3MethodSignature);
+ .any(TestFrameworksUtil::isTestMethod);
+ boolean hasNestedTestClasses = node.getDeclarations(ASTAnyTypeDeclaration.class)
+ .any(TestFrameworksUtil::isJUnit5NestedClass);
- if (!hasTests) {
- addViolation(data, node);
+ if (!hasTests && !hasNestedTestClasses) {
+ asCtx(data).addViolation(node, node.getSimpleName());
}
}
return null;
}
+
+ private boolean isTestClassByPattern(ASTClassOrInterfaceDeclaration node) {
+ Pattern testClassPattern = getProperty(TEST_CLASS_PATTERN);
+ if (testClassPattern.pattern().isEmpty()) {
+ // detection by pattern is disabled
+ return false;
+ }
+
+ return testClassPattern.matcher(node.getBinaryName()).find();
+ }
}
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/TestFrameworksUtil.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/TestFrameworksUtil.java
index 91470fef89..474d6756bf 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/TestFrameworksUtil.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/TestFrameworksUtil.java
@@ -10,10 +10,12 @@ import java.util.Set;
import net.sourceforge.pmd.lang.java.ast.ASTAnnotation;
import net.sourceforge.pmd.lang.java.ast.ASTAnyTypeDeclaration;
+import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceBody;
import net.sourceforge.pmd.lang.java.ast.ASTMethodCall;
import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration;
import net.sourceforge.pmd.lang.java.ast.AccessNode.Visibility;
import net.sourceforge.pmd.lang.java.ast.JModifier;
+import net.sourceforge.pmd.lang.java.ast.JavaNode;
import net.sourceforge.pmd.lang.java.symbols.JClassSymbol;
import net.sourceforge.pmd.lang.java.symbols.JTypeDeclSymbol;
import net.sourceforge.pmd.lang.java.types.JTypeMirror;
@@ -37,6 +39,8 @@ public final class TestFrameworksUtil {
"org.junit.jupiter.params.ParameterizedTest"
);
+ private static final String JUNIT5_NESTED = "org.junit.jupiter.api.Nested";
+
private static final Set ASSERT_CONTAINERS = setOf("org.junit.Assert",
"org.junit.jupiter.api.Assertions",
"org.hamcrest.MatcherAssert",
@@ -129,6 +133,10 @@ public final class TestFrameworksUtil {
&& TypeTestUtil.isA(JUNIT3_CLASS_NAME, node);
}
+ public static boolean isJUnit5NestedClass(ASTAnyTypeDeclaration innerClassDecl) {
+ return innerClassDecl.isAnnotationPresent(JUNIT5_NESTED);
+ }
+
public static boolean isExpectExceptionCall(ASTMethodCall call) {
return "expect".equals(call.getMethodName()) && TypeTestUtil.isA("org.junit.rules.ExpectedException", call.getQualifier());
}
diff --git a/pmd-java/src/main/resources/category/java/bestpractices.xml b/pmd-java/src/main/resources/category/java/bestpractices.xml
index 0559896afb..d40949e3f5 100644
--- a/pmd-java/src/main/resources/category/java/bestpractices.xml
+++ b/pmd-java/src/main/resources/category/java/bestpractices.xml
@@ -42,11 +42,15 @@ public abstract class Foo {
class="net.sourceforge.pmd.lang.java.rule.bestpractices.AccessorClassGenerationRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_bestpractices.html#accessorclassgeneration">
-Instantiation by way of private constructors from outside of the constructor's class often causes the
+Instantiation by way of private constructors from outside the constructor's class often causes the
generation of an accessor. A factory method, or non-privatization of the constructor can eliminate this
situation. The generated class file is actually an interface. It gives the accessing class the ability
to invoke a new hidden package scope constructor that takes the interface as a supplementary parameter.
This turns a private constructor effectively into one with package scope, and is challenging to discern.
+
+_Note:_ This rule is only executed for Java 10 or lower.
+Since Java 11, [JEP 181: Nest-Based Access Control](https://openjdk.org/jeps/181) has been implemented. This
+means that in Java 11 and above accessor classes are not generated anymore.
3
@@ -74,6 +78,11 @@ public class Outer {
When accessing private fields / methods from another class, the Java compiler will generate accessor methods
with package-private visibility. This adds overhead, and to the dex method count on Android. This situation can
be avoided by changing the visibility of the field / method from private to package-private.
+
+
+_Note:_ This rule is only executed for Java 10 or lower.
+Since Java 11, [JEP 181: Nest-Based Access Control](https://openjdk.org/jeps/181) has been implemented. This
+means that in Java 11 and above accessor classes are not generated anymore.
3
diff --git a/pmd-java/src/main/resources/category/java/documentation.xml b/pmd-java/src/main/resources/category/java/documentation.xml
index cd74404fa7..8a3623387c 100644
--- a/pmd-java/src/main/resources/category/java/documentation.xml
+++ b/pmd-java/src/main/resources/category/java/documentation.xml
@@ -97,7 +97,10 @@ and unintentional empty constructors.
-Test classes end with the suffix Test. Having a non-test class with that name is not a good practice,
-since most people will assume it is a test case. Test classes have test methods named testXXX.
+Test classes typically end with the suffix "Test", "Tests" or "TestCase". Having a non-test class with that name
+is not a good practice, since most people will assume it is a test case. Test classes have test methods
+named "testXXX" (JUnit3) or use annotations (e.g. `@Test`).
+
+The suffix can be configured using the property `testClassPattern`. To disable the detection of possible test classes
+by name, set this property to an empty string.
3
diff --git a/pmd-java/src/main/resources/category/java/performance.xml b/pmd-java/src/main/resources/category/java/performance.xml
index cab117e50d..b331c8a667 100644
--- a/pmd-java/src/main/resources/category/java/performance.xml
+++ b/pmd-java/src/main/resources/category/java/performance.xml
@@ -71,8 +71,12 @@ sb.append('a'); // use this instead
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_performance.html#avoidarrayloops">
-Instead of manually copying data between two arrays, use the more efficient `Arrays.copyOf` or `System.arraycopy`
-methods instead.
+Instead of manually copying data between two arrays, use the more efficient `Arrays.copyOf`
+or `System.arraycopy` method instead.
+
+To copy only part of the array, use `Arrays.copyOfRange` or `System.arraycopy`.
+
+If you want to copy/move elements inside the _same_ array (e.g. shift the elements), use `System.arraycopy`.
3
@@ -80,7 +84,7 @@ methods instead.
+
+
+ 0; i--) {
+ a[i] = a[i - 1];
+ }
+ // equivalent
+ System.arraycopy(a, 0, a, 1, a.length - 1);
+ }
+}
]]>
@@ -630,13 +655,14 @@ ArrayList is a much better Collection implementation than Vector if thread-safe
+
+
+
+ [java] UnnecessaryFullyQualifiedName FP when the same simple class name exists in the current package #4139
+ 0
+
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/documentation/xml/UncommentedEmptyConstructor.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/documentation/xml/UncommentedEmptyConstructor.xml
index fee76365db..5824fb09c9 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/documentation/xml/UncommentedEmptyConstructor.xml
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/documentation/xml/UncommentedEmptyConstructor.xml
@@ -188,4 +188,30 @@ public class MyClass {
}
]]>
+
+
+ #4141 UncommentedEmptyConstructor FP when annotated constructor with @Autowired
+ 0
+
+
+
+
+ #4141 UncommentedEmptyConstructor FP when annotated constructor with @Autowired
+ 0
+
+
+
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/TestClassWithoutTestCases.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/TestClassWithoutTestCases.xml
index 56d9c27c67..b017e0476f 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/TestClassWithoutTestCases.xml
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/TestClassWithoutTestCases.xml
@@ -5,8 +5,12 @@
xsi:schemaLocation="http://pmd.sourceforge.net/rule-tests http://pmd.sourceforge.net/rule-tests_1_0_0.xsd">
- failure case
+ JUnit3: failure case
1
+ 2
+
+ The class 'FooTest' might be a test class, but it contains no test cases.
+
- test method should be public
+ JUnit3: test method should be public
1
- inner class should get checked
+ JUnit3: inner class should get checked
1
2
- test method in inner class not valid
+ JUnit3: test method in inner class not valid
+
1
+ 2
- abstract classes are ok
+ JUnit3: abstract classes are ok
0
- failure case does not extend TestCase
+ failure case does not extend TestCase and testClassPattern is not used
+
0
- #1453 False positive when the test class extends an other.
+ failure case does not extend TestCase and default testClassPattern
+ 1
+ 1
+
+
+
+
+ JUnit4: #1453 False positive when the test class extends an other.
0
- #428 [java] PMD requires public modifier on JUnit 5 test
+ JUnit5: #428 [java] PMD requires public modifier on JUnit 5 test
0
- false positive with anonymous class inside test class
+ JUnit4: false positive with anonymous class inside test class
0
- [java] TestClassWithoutTestCases reports wrong classes in a file #3624
+ JUnit4: [java] TestClassWithoutTestCases reports wrong classes in a file #3624
0
+
+
+ JUnit5: [java] TestClassWithoutTestCases false positive with JUnit5 parameterized test #2636
+ 0
+ 0);
+ }
+}
+]]>
+
+
+
+ JUnit5: [java] TestClassWithoutTestCases false positive with JUnit5 normal test #2636
+ 0
+
+
+
+
+ empty package-private test class identified by default testClassPattern
+ 1
+ 1
+
+
+
+
+ empty test class identified by special testClassPattern
+ my\.pkg\..*Case
+ 1
+ 2
+
+
+
+
+ empty test class identified by special testClassPattern with nested classes
+ my\.pkg\..*Case$
+ 2
+ 2,3
+
+ The class 'MyEmptyCase' might be a test class, but it contains no test cases.
+ The class 'MyNestedCase' might be a test class, but it contains no test cases.
+
+
+
+
+
+ empty test class identified by special testClassPattern - other package
+ my\.pkg\..*Case
+ 0
+
+
+
+
+ TestNG based test class without import
+ 0
+
+
+
+
+ TestNG based test class with import
+ 0
+
+
+
+
+ JUnit5 @Nested tests with tests
+ 0
+
+
+
+
+ JUnit5 @Nested tests without tests
+ 2
+ 6,11
+
+
+
+
+ Ignore other nested classes that are not test classes
+ 1
+ 6
+
+
+
+
+ Default pattern shouldn't match inner classes that are not named test
+ 2
+ 2,9
+
+
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/AvoidArrayLoops.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/AvoidArrayLoops.xml
index b321d410d7..a384dc6b60 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/AvoidArrayLoops.xml
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/AvoidArrayLoops.xml
@@ -53,6 +53,22 @@ public class Foo {
]]>
+
+ copy via do-while loop #4091
+ 1
+
+
+
copy involving multiple arrays is ok
0
@@ -121,12 +137,17 @@ public class Foo {
0
@@ -257,4 +278,125 @@ public class AvoidArrayLoops {
}
]]>
+
+
+ [java] AvoidArrayLoops false positive on double assignment #1167
+ 0
+
+
+
+
+ Nested array on RHS
+ 0
+
+
+
+
+ Ignore multi-dim array assignment #1167
+ 0
+
+
+
+
+ [java] AvoidArrayLoops should consider final variables #3847
+ 3
+ 6,10,13
+
+
+
+
+ Shifting left and right #2692
+ 2
+ 9,19
+ 0; i--) {
+ ints[i] = ints[i - 1];
+ }
+ System.out.println(Arrays.toString(ints)); // [1, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+ ints = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
+ System.arraycopy(ints, 0, ints, 1, ints.length - 1);
+ System.out.println(Arrays.toString(ints)); // [1, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+ }
+}
+]]>
+
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/StringToString.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/StringToString.xml
index 871e545d46..1a3642a147 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/StringToString.xml
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/StringToString.xml
@@ -250,7 +250,39 @@ public class User {
import java.io.*;
class A {
public void foo() {
- String s = new A().str().toString(); // not detected because str() is from another class
+ String s = new A().str().toString(); // not detected because str() is from another class which is not on the auxclasspath
+ s = getString().toString(); // detected
+ s = getData(new FileInputStream()).toString(); // detected because of argument (sub) type
+ s = getData(new Integer(4), new Integer(5)).toString(); // detected because of unique args count
+ }
+ public String getString() {
+ return "exampleStr";
+ }
+ public String getData(InputStream is) {
+ return "argsResolutionIssueExample";
+ }
+ public int getData(String s) {
+ return 0;
+ }
+ public String getData(Number a, Number b) {
+ return "uniqueArgsCountExample";
+ }
+}
+ ]]>
+
+
+
+ Limitations with type resolution
+ 4
+ 7,8,9,10
+
+
+
+ [java] StringToString false-positive with local method name confusion #3977
+ 0
+
+
+
+
+ Use type resolution for method call return type
+ 1
+ 5
+
+
+
+
+ [java] StringToString doesn't trigger on string literals #3681
+ 1
+ 3
+
+
+
+
+ [java] StringToString rule false-positive with field access #2080
+ 0
+
+
+
+
+ [java] StringToString doesn't trigger on Bar.class.getSimpleName().toString() #3437
+ 1
+ 4
+
+
+
+
+ False positive with unqualified toString() call
+ 0
+
+
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/UseArrayListInsteadOfVector.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/UseArrayListInsteadOfVector.xml
index c2f212c9ba..e1d4e96a60 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/UseArrayListInsteadOfVector.xml
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/UseArrayListInsteadOfVector.xml
@@ -5,10 +5,11 @@
xsi:schemaLocation="http://pmd.sourceforge.net/rule-tests http://pmd.sourceforge.net/rule-tests_1_0_0.xsd">
- TEST0
+ No problem using List and ArrayList
0
- TEST1
+ Just using Vector
1
+ 4
- TEST2
+ Using Vector as field
1
+ 3
- TEST3
+ Using Vector as List
1
+ 4
#1146 real problem
1
+ 4
+
+
+ [java] UseArrayListInsteadOfVector ignores Vector when other classes are imported #4148 - sample 1
+ 1
+ 6
+
+
+
+
+ [java] UseArrayListInsteadOfVector ignores Vector when other classes are imported #4148 - sample 2
+ 1
+ 5
+
+
+
+
+ Only consider Vector and not subclasses
+ 0
+
+
diff --git a/pmd-javascript/src/main/java/net/sourceforge/pmd/lang/ecmascript/ast/ASTNumberLiteral.java b/pmd-javascript/src/main/java/net/sourceforge/pmd/lang/ecmascript/ast/ASTNumberLiteral.java
index 3ccae21dbf..c578e2b350 100644
--- a/pmd-javascript/src/main/java/net/sourceforge/pmd/lang/ecmascript/ast/ASTNumberLiteral.java
+++ b/pmd-javascript/src/main/java/net/sourceforge/pmd/lang/ecmascript/ast/ASTNumberLiteral.java
@@ -19,7 +19,10 @@ public final class ASTNumberLiteral extends AbstractEcmascriptNode
+
+
+ [javascript] InaccurateNumericLiteral underscore separator notation false positive #4165
+ 0
+
+
diff --git a/pmd-xml/pom.xml b/pmd-xml/pom.xml
index f259d6e49f..34a8b1e8ad 100644
--- a/pmd-xml/pom.xml
+++ b/pmd-xml/pom.xml
@@ -30,6 +30,7 @@
${*}
+ \
diff --git a/pmd-xml/src/main/resources/category/pom/errorprone.xml b/pmd-xml/src/main/resources/category/pom/errorprone.xml
index 99fae2a99a..ca783643c9 100644
--- a/pmd-xml/src/main/resources/category/pom/errorprone.xml
+++ b/pmd-xml/src/main/resources/category/pom/errorprone.xml
@@ -65,7 +65,7 @@ The following types are considered valid: pom, jar, maven-plugin, ejb, war, ear,
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_pom_errorprone.html#projectversionasdependencyversion">
Using that expression in dependency declarations seems like a shortcut, but it can go wrong.
-By far the most common problem is the use of ${project.version} in a BOM or parent POM.
+By far the most common problem is the use of \${project.version} in a BOM or parent POM.
3
@@ -89,7 +89,7 @@ By far the most common problem is the use of ${project.version} in a BOM or
...
...
- ${project.version}
+ \${project.version}
]]>
diff --git a/pom.xml b/pom.xml
index 32302eadfc..3bd85d6a08 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,10 +10,10 @@
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,
- Modelica, PLSQL, Apache Velocity, XML, XSL, Scala.
+ Modelica, PLSQL, Apache Velocity, HTML, XML, XSL, Scala.
Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code in
- C/C++, C#, Dart, Fortran, Go, Groovy, Java, JavaScript, JSP, Kotlin, Lua, Matlab, Modelica,
+ C/C++, C#, Dart, Fortran, Gherkin, Go, Groovy, HTML, Java, JavaScript, JSP, Kotlin, Lua, Matlab, Modelica,
Objective-C, Perl, PHP, PLSQL, Python, Ruby, Salesforce.com Apex, Scala, Swift and Visualforce.
@@ -795,7 +795,7 @@
org.yaml
snakeyaml
- 1.32
+ 1.33
@@ -989,11 +989,13 @@
com.google.protobuf
protobuf-java
- 3.16.1
+ 3.16.3