From 3c0aea6c527b8c23dd0ad4a26a299d909ccfb10c Mon Sep 17 00:00:00 2001 From: Oleksandr Shvets Date: Sun, 10 Mar 2024 18:08:07 +0200 Subject: [PATCH] rewrite xpath rule and add some test cases --- .../category/ecmascript/codestyle.xml | 26 ++++++++----------- .../rule/codestyle/xml/UnnecessaryBlock.xml | 17 +++++++++++- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/pmd-javascript/src/main/resources/category/ecmascript/codestyle.xml b/pmd-javascript/src/main/resources/category/ecmascript/codestyle.xml index bb224fd2c1..974cf52bc8 100644 --- a/pmd-javascript/src/main/resources/category/ecmascript/codestyle.xml +++ b/pmd-javascript/src/main/resources/category/ecmascript/codestyle.xml @@ -222,21 +222,17 @@ be misleading. Considering removing this unnecessary Block. 3 - - - + 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 5a244741a0..e84b60894f 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 @@ -174,13 +174,18 @@ do { Bad, switch - 1 + 2 @@ -241,4 +246,14 @@ let a, b, a1, b1, c, d, rest, pop, push; function fn( ({arg}) ){ return arg} ]]> + + not using semicolons case + 0 + +