From a1bcad2db2ccece6401b0dfae5ce5a983d1410c5 Mon Sep 17 00:00:00 2001 From: LynnBroe Date: Wed, 5 Oct 2022 13:54:41 +0800 Subject: [PATCH 1/5] fix #4141 --- .../resources/category/java/documentation.xml | 5 +++- .../xml/UncommentedEmptyConstructor.xml | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/pmd-java/src/main/resources/category/java/documentation.xml b/pmd-java/src/main/resources/category/java/documentation.xml index 9081295102..8a331af2e6 100644 --- a/pmd-java/src/main/resources/category/java/documentation.xml +++ b/pmd-java/src/main/resources/category/java/documentation.xml @@ -102,7 +102,10 @@ and unintentional empty constructors. [@containsComment = false()] [not(BlockStatement)] [$ignoreExplicitConstructorInvocation = true() or not(ExplicitConstructorInvocation)] - [not(../Annotation/MarkerAnnotation/Name[pmd-java:typeIs('javax.inject.Inject')])] + [not(../Annotation/MarkerAnnotation/Name[ + pmd-java:typeIs('javax.inject.Inject') + or pmd-java:typeIs('org.springframework.beans.factory.annotation.Autowired') + ])] ]]> 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 2d11209715..6ca1de2d16 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 @@ -187,4 +187,30 @@ public class MyClass { } ]]> + + + #4141 UncommentedEmptyConstructor FP when annotated constructor with @Autowired + 0 + + + + + #4141 UncommentedEmptyConstructor FP when annotated constructor with @Autowired + 0 + + + From 9c182974e744b5c2f71f1d0337d09aa62b58595c Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 6 Oct 2022 17:39:56 +0200 Subject: [PATCH 2/5] [doc] Fix ruledoc for POM: ProjectVersionAsDependencyVersion --- pmd-xml/pom.xml | 1 + pmd-xml/src/main/resources/category/pom/errorprone.xml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pmd-xml/pom.xml b/pmd-xml/pom.xml index 733153d749..4e51df9ec1 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 cfedde95c5..a882baa52f 100644 --- a/pmd-xml/src/main/resources/category/pom/errorprone.xml +++ b/pmd-xml/src/main/resources/category/pom/errorprone.xml @@ -67,7 +67,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 @@ -92,7 +92,7 @@ By far the most common problem is the use of ${project.version} in a BOM or ... ... - ${project.version} + \${project.version} ]]> From 17b8661dab2dcd248065c62370729d9001b6b2f1 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 6 Oct 2022 17:41:39 +0200 Subject: [PATCH 3/5] [doc] Use java highlighting in issue templates by default --- .github/ISSUE_TEMPLATE/0rule_violation_false-positive.md | 2 +- .github/ISSUE_TEMPLATE/1rule_violation_false-negative.md | 2 +- .github/ISSUE_TEMPLATE/2new_rule.md | 2 +- .github/ISSUE_TEMPLATE/4bug_report.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/0rule_violation_false-positive.md b/.github/ISSUE_TEMPLATE/0rule_violation_false-positive.md index e02c12eaa8..8faed7c14a 100644 --- a/.github/ISSUE_TEMPLATE/0rule_violation_false-positive.md +++ b/.github/ISSUE_TEMPLATE/0rule_violation_false-positive.md @@ -19,7 +19,7 @@ Please provide the rule name and a link to the rule documentation: **Code Sample demonstrating the issue:** -``` +```java ``` diff --git a/.github/ISSUE_TEMPLATE/1rule_violation_false-negative.md b/.github/ISSUE_TEMPLATE/1rule_violation_false-negative.md index b9480d2c27..51702e0038 100644 --- a/.github/ISSUE_TEMPLATE/1rule_violation_false-negative.md +++ b/.github/ISSUE_TEMPLATE/1rule_violation_false-negative.md @@ -19,7 +19,7 @@ Please provide the rule name and a link to the rule documentation: **Code Sample demonstrating the issue:** -``` +```java ``` diff --git a/.github/ISSUE_TEMPLATE/2new_rule.md b/.github/ISSUE_TEMPLATE/2new_rule.md index 4e79d37f11..52901a1e22 100644 --- a/.github/ISSUE_TEMPLATE/2new_rule.md +++ b/.github/ISSUE_TEMPLATE/2new_rule.md @@ -17,7 +17,7 @@ assignees: '' **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. -``` +```java ``` diff --git a/.github/ISSUE_TEMPLATE/4bug_report.md b/.github/ISSUE_TEMPLATE/4bug_report.md index 5c752659ea..0b3ada2739 100644 --- a/.github/ISSUE_TEMPLATE/4bug_report.md +++ b/.github/ISSUE_TEMPLATE/4bug_report.md @@ -25,7 +25,7 @@ A clear and concise description of what the bug is. **Code Sample demonstrating the issue:** -``` +```java ``` From 78b69fdb960e21a16f0756a823658c57657c5375 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 6 Oct 2022 17:45:38 +0200 Subject: [PATCH 4/5] Update @LynnBroe as a contributor --- .all-contributorsrc | 3 ++- docs/pages/pmd/projectdocs/credits.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 4c9d8d553e..e70e090519 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -6866,7 +6866,8 @@ "avatar_url": "https://avatars.githubusercontent.com/u/109954313?v=4", "profile": "https://github.com/LynnBroe", "contributions": [ - "code" + "code", + "bug" ] }, { diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index 4296e0d000..a51ed0163a 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

🐛 From 38a0950fb9b593a51f2ac2a2d004124452d5939e Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 6 Oct 2022 17:46:13 +0200 Subject: [PATCH 5/5] [doc] Update release notes (#4141, #4142) --- docs/pages/release_notes.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index b8f8783555..ce78e6112e 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -15,10 +15,13 @@ This is a {{ site.pmd.release_type }} release. ### New and noteworthy ### Fixed Issues +* java-documentation + * [#4141](https://github.com/pmd/pmd/issues/4141): \[java] UncommentedEmptyConstructor FP when constructor annotated with @Autowired ### 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) {% endtocmaker %}