From c3ec24079450e345a3e69cbbb502fa071224a3a4 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 14 Mar 2024 20:39:56 +0100 Subject: [PATCH] [javascript] Simplify UnnecessaryBlock rule, update tests --- .../category/ecmascript/codestyle.xml | 12 ++--- .../rule/codestyle/UnnecessaryBlockTest.java | 2 +- .../rule/codestyle/xml/UnnecessaryBlock.xml | 49 +++++++++++++++++-- 3 files changed, 50 insertions(+), 13 deletions(-) diff --git a/pmd-javascript/src/main/resources/category/ecmascript/codestyle.xml b/pmd-javascript/src/main/resources/category/ecmascript/codestyle.xml index 974cf52bc8..055c512228 100644 --- a/pmd-javascript/src/main/resources/category/ecmascript/codestyle.xml +++ b/pmd-javascript/src/main/resources/category/ecmascript/codestyle.xml @@ -223,15 +223,9 @@ be misleading. Considering removing this unnecessary Block. diff --git a/pmd-javascript/src/test/java/net/sourceforge/pmd/lang/ecmascript/rule/codestyle/UnnecessaryBlockTest.java b/pmd-javascript/src/test/java/net/sourceforge/pmd/lang/ecmascript/rule/codestyle/UnnecessaryBlockTest.java index cc9d00a3c2..97390b04c5 100644 --- a/pmd-javascript/src/test/java/net/sourceforge/pmd/lang/ecmascript/rule/codestyle/UnnecessaryBlockTest.java +++ b/pmd-javascript/src/test/java/net/sourceforge/pmd/lang/ecmascript/rule/codestyle/UnnecessaryBlockTest.java @@ -6,6 +6,6 @@ package net.sourceforge.pmd.lang.ecmascript.rule.codestyle; import net.sourceforge.pmd.test.PmdRuleTst; -public class UnnecessaryBlockTest extends PmdRuleTst { +class UnnecessaryBlockTest extends PmdRuleTst { // no additional unit tests } diff --git a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/rule/codestyle/xml/UnnecessaryBlock.xml b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/rule/codestyle/xml/UnnecessaryBlock.xml index e84b60894f..c5ed56228d 100644 --- a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/rule/codestyle/xml/UnnecessaryBlock.xml +++ b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/rule/codestyle/xml/UnnecessaryBlock.xml @@ -175,6 +175,7 @@ do { Bad, switch 2 + 2,6 @@ -208,7 +209,7 @@ try { - Ok, destructure assigments + Ok, destructure assigments (#2305) 0 + - not using semicolons case + Ok, destructure assigments (#2305) - without semicolons + 0 + + + + + not using semicolons case (#2305) 0