From b741ce261cf27cc63bbb3e0ede1e61c708e3582b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AE=B6=E5=A5=A5?= Date: Fri, 27 May 2022 15:32:05 +0800 Subject: [PATCH 01/34] fix addEmptyString in performance.xml --- pmd-java/src/main/resources/category/java/performance.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pmd-java/src/main/resources/category/java/performance.xml b/pmd-java/src/main/resources/category/java/performance.xml index b93f71eb4a..f894facca7 100644 --- a/pmd-java/src/main/resources/category/java/performance.xml +++ b/pmd-java/src/main/resources/category/java/performance.xml @@ -26,6 +26,8 @@ It is much better to use one of the type-specific toString() methods instead. From dcc6977168806f7884f953066ea5799de82b0c2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AE=B6=E5=A5=A5?= Date: Fri, 27 May 2022 16:10:05 +0800 Subject: [PATCH 02/34] add test cases --- .../rule/performance/xml/AddEmptyString.xml | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/AddEmptyString.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/AddEmptyString.xml index 63a0247029..bee7b38177 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/AddEmptyString.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/AddEmptyString.xml @@ -3,7 +3,73 @@ xmlns="http://pmd.sourceforge.net/rule-tests" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sourceforge.net/rule-tests http://pmd.sourceforge.net/rule-tests_1_0_0.xsd"> + + Test case in issue 3625 + 1 + + + + Local Variables be empty String + 3 + + + + Local and global variables be empty String + 4 + + + + Test case in issue 3625 + 1 + + Bad add 1 From ca562fc133e9af3ef7ef1228cce2eff4c0eead96 Mon Sep 17 00:00:00 2001 From: HoshiNoMei <11910516@mail.sustech.edu.cn> Date: Sat, 28 May 2022 20:35:19 +0800 Subject: [PATCH 03/34] Fix the rule xml WhileLoopWithLiteralBoolean --- pmd-java/src/main/resources/category/java/bestpractices.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pmd-java/src/main/resources/category/java/bestpractices.xml b/pmd-java/src/main/resources/category/java/bestpractices.xml index b204e0a9ed..16dbe35d14 100644 --- a/pmd-java/src/main/resources/category/java/bestpractices.xml +++ b/pmd-java/src/main/resources/category/java/bestpractices.xml @@ -2171,13 +2171,16 @@ a block `{}` is sufficient. + + From d4b356a68ee74e8a5cb34240839675a665ec0e7c Mon Sep 17 00:00:00 2001 From: HoshiNoMei <11910516@mail.sustech.edu.cn> Date: Sat, 28 May 2022 22:30:06 +0800 Subject: [PATCH 04/34] Fix the rule xml WhileLoopWithLiteralBoolean --- .../resources/category/java/bestpractices.xml | 4 ++- .../xml/WhileLoopWithLiteralBoolean.xml | 28 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/pmd-java/src/main/resources/category/java/bestpractices.xml b/pmd-java/src/main/resources/category/java/bestpractices.xml index 16dbe35d14..02b12612c4 100644 --- a/pmd-java/src/main/resources/category/java/bestpractices.xml +++ b/pmd-java/src/main/resources/category/java/bestpractices.xml @@ -2172,7 +2172,7 @@ a block `{}` is sufficient. @@ -2187,6 +2187,8 @@ public class Example { while (false) { } // disallowed do { } while (true); // disallowed do { } while (false); // disallowed + do { } while (false | false); // disallowed + do { } while (false || false); // disallowed } } ]]> diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/WhileLoopWithLiteralBoolean.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/WhileLoopWithLiteralBoolean.xml index 15d29a5f46..f3fcd6018f 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/WhileLoopWithLiteralBoolean.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/WhileLoopWithLiteralBoolean.xml @@ -32,6 +32,34 @@ class Foo { ]]> + + do while false | false + 1 + 3 + + + + + do while false || false + 1 + 3 + + + do while call 0 From a5b0a3239ca8391509e8b86c98abeb9592034931 Mon Sep 17 00:00:00 2001 From: dalizi007 <11912017@mail.sustech.edu.cn> Date: Sat, 28 May 2022 23:46:34 +0800 Subject: [PATCH 05/34] [java] fix false negative with unnecessary parenthesis pmd#3949 --- pmd-java/src/main/resources/category/java/design.xml | 7 ++++++- .../java/rule/design/xml/FinalFieldCouldBeStatic.xml | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/pmd-java/src/main/resources/category/java/design.xml b/pmd-java/src/main/resources/category/java/design.xml index b285179dba..2940962d9c 100644 --- a/pmd-java/src/main/resources/category/java/design.xml +++ b/pmd-java/src/main/resources/category/java/design.xml @@ -813,14 +813,19 @@ in each object at runtime. [@Final=true() and @Static=false()] [not(preceding-sibling::Annotation/MarkerAnnotation/Name[@Image="Builder.Default"] and //ImportDeclaration/Name[@Image="lombok.Builder"])] + [not(ReferenceType)] /VariableDeclarator [VariableInitializer/Expression/PrimaryExpression[not(PrimarySuffix)] - /PrimaryPrefix/* + /PrimaryPrefix[not(./AllocationExpression/ClassOrInterfaceType[pmd-java:typeIs('java.lang.Thread')])] + /* [ self::Literal (: literal :) or (: another static field :) self::Name[@Image=//FieldDeclaration[@Static=true()]/VariableDeclarator/@Name] + or + (:unnecessary parenthesis :) + descendant-or-self::Literal ] ] /VariableDeclaratorId diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/FinalFieldCouldBeStatic.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/FinalFieldCouldBeStatic.xml index 459f703cb9..c3321043d5 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/FinalFieldCouldBeStatic.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/FinalFieldCouldBeStatic.xml @@ -189,6 +189,18 @@ public class Foo { //private static final int staticFinal = nonStatic; //noncompliant: Non-static field 'nonStatic' cannot be referenced from a static context private static int staticNonFinal = 1; //no violation cause non-final private final int nonStatic2 = staticNonFinal; //violation because it could be static +} + ]]> + + + + + #3949 - FinalFieldCouldBeStatic false negative with unnecessary parenthesis + + 1 + From 3c1a246fe9f6a9ceb0bc210cd7666d2133bab5be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=85=E5=BB=B6=E5=AE=89?= <11811013@mail.sustech.edu.cn> Date: Sun, 29 May 2022 22:30:39 +0800 Subject: [PATCH 06/34] handle issue 3729 --- .../main/resources/category/java/design.xml | 3 ++ .../java/rule/design/xml/TooManyMethods.xml | 40 +++++++++++++++++-- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/pmd-java/src/main/resources/category/java/design.xml b/pmd-java/src/main/resources/category/java/design.xml index b285179dba..5ec2f35fa3 100644 --- a/pmd-java/src/main/resources/category/java/design.xml +++ b/pmd-java/src/main/resources/category/java/design.xml @@ -1708,6 +1708,9 @@ complexity and find a way to have more fine grained objects. starts-with(@Name,'set') or starts-with(@Name,'is') + and ( + count(../Block/BlockStatement)==1) + ) ]) > $maxmethods ] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/TooManyMethods.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/TooManyMethods.xml index f2185a6397..569ac5f9c6 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/TooManyMethods.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/TooManyMethods.xml @@ -1,8 +1,8 @@ + xmlns="http://pmd.sourceforge.net/rule-tests" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://pmd.sourceforge.net/rule-tests http://pmd.sourceforge.net/rule-tests_1_0_0.xsd"> Less than 10 methods. @@ -110,6 +110,40 @@ public class OuterClass { @Override public void method7() {} } +} + ]]> + + + + #3729 TooManyMethods ignores "real" methods which are named like getters or setters + 0 + From 7f5f0406ec63ef9f7608e598827209d25c2fd746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=85=E5=BB=B6=E5=AE=89?= <100549608+341816041@users.noreply.github.com> Date: Wed, 1 Jun 2022 09:51:23 +0800 Subject: [PATCH 07/34] Update design.xml --- pmd-java/src/main/resources/category/java/design.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-java/src/main/resources/category/java/design.xml b/pmd-java/src/main/resources/category/java/design.xml index 5ec2f35fa3..32a2a1fb6d 100644 --- a/pmd-java/src/main/resources/category/java/design.xml +++ b/pmd-java/src/main/resources/category/java/design.xml @@ -1709,7 +1709,7 @@ complexity and find a way to have more fine grained objects. or starts-with(@Name,'is') and ( - count(../Block/BlockStatement)==1) + count(../Block/BlockStatement)<=1) ) ]) > $maxmethods From ac2dcd8c4df5aae3ef2f3a93f7fd9d4fa5ebbc8a Mon Sep 17 00:00:00 2001 From: Anne Brouwers Date: Wed, 1 Jun 2022 15:11:08 +0200 Subject: [PATCH 08/34] Add Gherkin support to CPD --- pmd-dist/pom.xml | 5 + .../pmd/it/BinaryDistributionIT.java | 4 +- pmd-gherkin/pom.xml | 59 ++ .../pmd/lang/gherkin/antlr4/Gherkin.g4 | 118 ++++ .../sourceforge/pmd/cpd/GherkinLanguage.java | 18 + .../sourceforge/pmd/cpd/GherkinTokenizer.java | 28 + .../pmd/lang/gherkin/antlr4/package-info.java | 11 + .../services/net.sourceforge.pmd.cpd.Language | 1 + .../pmd/cpd/GherkinTokenizerTest.java | 43 ++ .../cpd/testdata/annotatedSource.feature | 73 ++ .../gherkin/cpd/testdata/annotatedSource.txt | 637 ++++++++++++++++++ .../gherkin/cpd/testdata/docstring.feature | 6 + .../lang/gherkin/cpd/testdata/docstring.txt | 15 + pom.xml | 1 + 14 files changed, 1017 insertions(+), 2 deletions(-) create mode 100644 pmd-gherkin/pom.xml create mode 100644 pmd-gherkin/src/main/antlr4/net/sourceforge/pmd/lang/gherkin/antlr4/Gherkin.g4 create mode 100644 pmd-gherkin/src/main/java/net/sourceforge/pmd/cpd/GherkinLanguage.java create mode 100644 pmd-gherkin/src/main/java/net/sourceforge/pmd/cpd/GherkinTokenizer.java create mode 100644 pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/antlr4/package-info.java create mode 100644 pmd-gherkin/src/main/resources/META-INF/services/net.sourceforge.pmd.cpd.Language create mode 100644 pmd-gherkin/src/test/java/net/sourceforge/pmd/cpd/GherkinTokenizerTest.java create mode 100644 pmd-gherkin/src/test/resources/net/sourceforge/pmd/lang/gherkin/cpd/testdata/annotatedSource.feature create mode 100644 pmd-gherkin/src/test/resources/net/sourceforge/pmd/lang/gherkin/cpd/testdata/annotatedSource.txt create mode 100644 pmd-gherkin/src/test/resources/net/sourceforge/pmd/lang/gherkin/cpd/testdata/docstring.feature create mode 100644 pmd-gherkin/src/test/resources/net/sourceforge/pmd/lang/gherkin/cpd/testdata/docstring.txt diff --git a/pmd-dist/pom.xml b/pmd-dist/pom.xml index dd53c4f671..2cdabb29b2 100644 --- a/pmd-dist/pom.xml +++ b/pmd-dist/pom.xml @@ -149,6 +149,11 @@ pmd-fortran ${project.version} + + net.sourceforge.pmd + pmd-gherkin + ${project.version} + net.sourceforge.pmd pmd-go diff --git a/pmd-dist/src/test/java/net/sourceforge/pmd/it/BinaryDistributionIT.java b/pmd-dist/src/test/java/net/sourceforge/pmd/it/BinaryDistributionIT.java index fdb2a97706..c39fea9b74 100644 --- a/pmd-dist/src/test/java/net/sourceforge/pmd/it/BinaryDistributionIT.java +++ b/pmd-dist/src/test/java/net/sourceforge/pmd/it/BinaryDistributionIT.java @@ -28,10 +28,10 @@ public class BinaryDistributionIT extends AbstractBinaryDistributionTest { static { // note: apex, javascript, visualforce, and scala require java8 if (PMDExecutor.isJava7Test()) { - SUPPORTED_LANGUAGES_CPD = "Supported languages: [cpp, cs, dart, fortran, go, groovy, java, jsp, kotlin, lua, matlab, modelica, objectivec, perl, php, plsql, python, ruby, swift, xml]"; + SUPPORTED_LANGUAGES_CPD = "Supported languages: [cpp, cs, dart, fortran, gherkin, go, groovy, java, jsp, kotlin, lua, matlab, modelica, objectivec, perl, php, plsql, python, ruby, swift, xml]"; SUPPORTED_LANGUAGES_PMD = "java, jsp, modelica, plsql, pom, vm, wsdl, xml, xsl"; } else { - SUPPORTED_LANGUAGES_CPD = "Supported languages: [apex, cpp, cs, dart, ecmascript, fortran, go, groovy, html, java, jsp, kotlin, lua, matlab, modelica, objectivec, perl, php, plsql, python, ruby, scala, swift, vf, xml]"; + SUPPORTED_LANGUAGES_CPD = "Supported languages: [apex, cpp, cs, dart, ecmascript, fortran, gherkin, go, groovy, html, java, jsp, kotlin, lua, matlab, modelica, objectivec, perl, php, plsql, python, ruby, scala, swift, vf, xml]"; SUPPORTED_LANGUAGES_PMD = "apex, ecmascript, html, java, jsp, modelica, plsql, pom, scala, vf, vm, wsdl, xml, xsl"; } } diff --git a/pmd-gherkin/pom.xml b/pmd-gherkin/pom.xml new file mode 100644 index 0000000000..a9563a1e9d --- /dev/null +++ b/pmd-gherkin/pom.xml @@ -0,0 +1,59 @@ + + + 4.0.0 + pmd-gherkin + PMD Gherkin + + + net.sourceforge.pmd + pmd + 6.46.0 + ../ + + + + + + org.antlr + antlr4-maven-plugin + + + + maven-resources-plugin + + false + + ${*} + + + + + + + + + net.sourceforge.pmd + pmd-core + + + org.antlr + antlr4-runtime + + + + junit + junit + test + + + net.sourceforge.pmd + pmd-test + test + + + net.sourceforge.pmd + pmd-lang-test + test + + + diff --git a/pmd-gherkin/src/main/antlr4/net/sourceforge/pmd/lang/gherkin/antlr4/Gherkin.g4 b/pmd-gherkin/src/main/antlr4/net/sourceforge/pmd/lang/gherkin/antlr4/Gherkin.g4 new file mode 100644 index 0000000000..c5e1db52c0 --- /dev/null +++ b/pmd-gherkin/src/main/antlr4/net/sourceforge/pmd/lang/gherkin/antlr4/Gherkin.g4 @@ -0,0 +1,118 @@ +grammar Gherkin; + +// PARSER + +main + // start comment needed because each comment should start on a new line except for the start comment + : STARTCOMMENT? feature description* instructionLine* NL* EOF + ; + +feature + : (NL* tagline)* NL* FEATURE? + ; + +instructionLine + : NL+ (instruction | datatable) + ; + +instruction + : rulex description* // the name "rule" is not allowed by ANTLR (used for internal usage), so calling it rulex + | stepInstruction description* (NL+ stepDescription description*)* (NL+ step)* + | tagline + | instructionDescription description* + ; + +stepInstruction + : background + | scenario + | scenarioOutline + ; + +background: BACKGROUND ; +rulex: RULEX ; +scenario: SCENARIO ; +scenarioOutline : SCENARIOOUTLINE ; + +step : stepItem description*; + +stepItem + : and + | anystep + | but + | datatable + | given + | then + | when + | (NL* tagline )* NL* examples + ; + +tagline + : TAG+ + ; + +and: AND ; +anystep: ANYSTEP ; +but: BUT ; +datatable: DATATABLE+ ; +given: GIVEN ; +then: THEN ; +when: WHEN ; +examples: EXAMPLES ; + +// Descriptions +instructionDescription: text | PARAMETER | AND | ANYSTEP | BUT | GIVEN | THEN | WHEN | SCENARIO ; // We have to deal with overlaps with keywords +stepDescription: text | PARAMETER ; // We have to deal with overlaps with keywords +description: text | PARAMETER | TAG | AND | ANYSTEP | BUT | DATATABLE | GIVEN | THEN | WHEN | SCENARIO | SCENARIOOUTLINE | STARTCOMMENT ; // We have to deal with overlaps with keywords + +text: TOKEN+ ; + +// LEXER + +// skipped + +BOMUTF8 : '\u00EF\u00BB\u00BF' -> skip ; + +BOMUTF16 : '\uFEFF' -> skip ; + +WHITESPACE: [ \t]+ -> channel(1) ; + +COMMENT: '\r'?'\n' [ \t]* '#' ~[\r\n]* -> channel(2) ; + +STARTCOMMENT: '#' ~[\r\n]* ; + +DOCSTRING1 + : '"""' .*? '"""' ; + +DOCSTRING2 + : '```' .*? '```' ; + +// Instructions +BACKGROUND: 'Background:' ; +EXAMPLES: ('Examples:' | 'Scenarios:') ; +FEATURE: 'Feature:'; +RULEX: 'Rule:' ; +SCENARIO: ('Example:' | 'Scenario:') ; +SCENARIOOUTLINE : 'Scenario ' ('Outline:' | 'Template:') ; + +// Steps +AND: 'And' ; +ANYSTEP: '*' ; +BUT: 'But' ; +DATATABLE: '|' DATATABLEID? ; // must be an ID because it can contain a space +GIVEN: 'Given' ; +THEN: 'Then' ; +WHEN: 'When' ; + +TAG: '@' ELEMENT+ ; +PARAMETER: '<' PARID '>' | '"' '<' PARID '>' '"' | '\'' '<' PARID '>' '\''; +fragment PARID: [A-Za-z0-9] ([!-=?-~ ]* [!-=?-~])?; // start with an alpha numerical and then all printable characters and end with a non-space +fragment ID: (IDELEMENT | ' ')* IDELEMENT (IDELEMENT | ' ')*; // ID should contain at least one non-whitespace character otherwise the trailing | with a trailing space will match +fragment DATATABLEID: (DATATABLEELEMENT | ' ')* DATATABLEELEMENT (DATATABLEELEMENT | ' ')*; // ID should contain at least one non-whitespace character otherwise the trailing | with a trailing space will match +fragment DATATABLEELEMENT: ELEMENT | '<' | '>' | '"' | '\'' | '\\|' ; +fragment IDELEMENT: ELEMENT | '|' ; +fragment ELEMENT: [!-&(-;=?-{}~\u00A0-\uFFFF] ; + +NL: '\r'? '\n' ; +TOKEN: [!-{}-~\u00A0-\uFFFF]+ ; // match everything that isn't matched yet + + diff --git a/pmd-gherkin/src/main/java/net/sourceforge/pmd/cpd/GherkinLanguage.java b/pmd-gherkin/src/main/java/net/sourceforge/pmd/cpd/GherkinLanguage.java new file mode 100644 index 0000000000..85f50da4cc --- /dev/null +++ b/pmd-gherkin/src/main/java/net/sourceforge/pmd/cpd/GherkinLanguage.java @@ -0,0 +1,18 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.cpd; + +/** + * Language implementation for Gherkin + */ +public class GherkinLanguage extends AbstractLanguage { + + /** + * Creates a new Gherkin Language instance. + */ + public GherkinLanguage() { + super("Gherkin", "gherkin", new GherkinTokenizer(), ".feature"); + } +} diff --git a/pmd-gherkin/src/main/java/net/sourceforge/pmd/cpd/GherkinTokenizer.java b/pmd-gherkin/src/main/java/net/sourceforge/pmd/cpd/GherkinTokenizer.java new file mode 100644 index 0000000000..20b7da848c --- /dev/null +++ b/pmd-gherkin/src/main/java/net/sourceforge/pmd/cpd/GherkinTokenizer.java @@ -0,0 +1,28 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.cpd; + +import org.antlr.v4.runtime.CharStream; + +import net.sourceforge.pmd.cpd.token.AntlrTokenFilter; +import net.sourceforge.pmd.lang.antlr.AntlrTokenManager; +import net.sourceforge.pmd.lang.gherkin.antlr4.GherkinLexer; + +/** + * The Gherkin Tokenizer + */ +public class GherkinTokenizer extends AntlrTokenizer { + + @Override + protected AntlrTokenManager getLexerForSource(SourceCode sourceCode) { + CharStream charStream = AntlrTokenizer.getCharStreamFromSourceCode(sourceCode); + return new AntlrTokenManager(new GherkinLexer(charStream), sourceCode.getFileName()); + } + + @Override + protected AntlrTokenFilter getTokenFilter(final AntlrTokenManager tokenManager) { + return new AntlrTokenFilter(tokenManager); + } +} diff --git a/pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/antlr4/package-info.java b/pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/antlr4/package-info.java new file mode 100644 index 0000000000..3f06008e46 --- /dev/null +++ b/pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/antlr4/package-info.java @@ -0,0 +1,11 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +/** + * The class {@link net.sourceforge.pmd.lang.gherkin.antlr4.GherkinLexer} will be moved to + * package {@code net.sourceforge.pmd.lang.gherkin.ast} with PMD 7. + * + *

All other classes will be removed. + */ +package net.sourceforge.pmd.lang.gherkin.antlr4; diff --git a/pmd-gherkin/src/main/resources/META-INF/services/net.sourceforge.pmd.cpd.Language b/pmd-gherkin/src/main/resources/META-INF/services/net.sourceforge.pmd.cpd.Language new file mode 100644 index 0000000000..313dd4ddac --- /dev/null +++ b/pmd-gherkin/src/main/resources/META-INF/services/net.sourceforge.pmd.cpd.Language @@ -0,0 +1 @@ +net.sourceforge.pmd.cpd.GherkinLanguage diff --git a/pmd-gherkin/src/test/java/net/sourceforge/pmd/cpd/GherkinTokenizerTest.java b/pmd-gherkin/src/test/java/net/sourceforge/pmd/cpd/GherkinTokenizerTest.java new file mode 100644 index 0000000000..8dbc3bac22 --- /dev/null +++ b/pmd-gherkin/src/test/java/net/sourceforge/pmd/cpd/GherkinTokenizerTest.java @@ -0,0 +1,43 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.cpd; + +import java.util.Properties; + +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest; + +public class GherkinTokenizerTest extends CpdTextComparisonTest { + + @org.junit.Rule + public ExpectedException ex = ExpectedException.none(); + + public GherkinTokenizerTest() { + super(".feature"); + } + + @Override + protected String getResourcePrefix() { + return "../lang/gherkin/cpd/testdata"; + } + + @Override + public Tokenizer newTokenizer(Properties properties) { + GherkinTokenizer tok = new GherkinTokenizer(); + return tok; + } + + @Test + public void testAnnotatedSource() { + doTest("annotatedSource"); + } + + @Test + public void testDocstring() { + doTest("docstring"); + } +} diff --git a/pmd-gherkin/src/test/resources/net/sourceforge/pmd/lang/gherkin/cpd/testdata/annotatedSource.feature b/pmd-gherkin/src/test/resources/net/sourceforge/pmd/lang/gherkin/cpd/testdata/annotatedSource.feature new file mode 100644 index 0000000000..45008f6c71 --- /dev/null +++ b/pmd-gherkin/src/test/resources/net/sourceforge/pmd/lang/gherkin/cpd/testdata/annotatedSource.feature @@ -0,0 +1,73 @@ +@AnnotatedSource +Feature: Annotated Source + The annotated source displays violations in the source file. It opens in a new window. + + Rules: + 1 Annotation metrics can be selected with a dropdown menu. Only enabled metrics must be shown. + 2 When the annotated source is opened while a specific metric is selected, only that metric should be selected. + 3 A user can scroll through the violations using two buttons (illustrated by up and down arrows). The arrows wrap around the document. + 4 The table collumn "Type" is only shown when multiple metrics are selected + + Scenario: Select a metric type + Given the Annotated Source for file "HIE://11261-37/main/monop/execute.c" + When a user opens the dropdown menu containing "Metric:" + And the user clicks on the dropdown option "Violations/Coding Standard Violations" + Then the selected annotation in the source code should be on line 38 + And the selected annotation in the table should be on line 38 + + Scenario: The user can use the arrows, or "a" and "z" keys, to scroll through the annotations + Given the Annotated Source for file "HIE://11261-37/main/monop/execute.c" + And metric "Coding Standard Violation Annotations" is selected + When the user clicks on the down arrow + And the user presses the "Z" key + And the user clicks on the up arrow + And the user clicks on the up arrow + And the user presses the "A" key + Then the selected annotation in the source code should be on line 254 + + @Rule2 + Scenario Outline: If the user opens the annotated source from e.g. the dashboard for a metric, + only the related annotations should be shown. + Given the Dashboard + And filtering by Project "17607" + And grouping by "File" + And metric "" is selected + When a user opens the file "clalgorithm_settings.c" using the metric table + Then a new browser window with an "Annotated Source" should be opened + Then only the annotations "" should be selected + + Examples: + | metric | annotations | + | TQI Coding Standards | Coding Standard Violation Annotations | + | Coding Standard Violations | Coding Standard Violation Annotations | + | TQI Compiler Warnings | Compiler Warning Annotations | + | Fan Out (%) | Fan Out Annotations | + | TQI Dead Code | Dead Code Annotations | + | TQI Code Duplication | Code Duplication Annotations | + + Scenario: The user should be able to filter Coding Standard Violations by Level + Given the Annotated Source for file "HIE://11514/trunk/components/java/BuildUtil/src/com/tiobe/util/BuildProperties.java" + And the metric "Coding Standard Violations" is selected + When the user opens the dropdown menu "Level" + And the user clicks on the dropdown option "5" + Then there should be 1 violation + And the selected annotation in the source code should be on line 57 + And the annotation should be of level 5 + + @PR27030 + Scenario Outline: The user should be able to filter Coding Standard Violations by Level, Category, Rule, etc + Given the Annotated Source for file "HIE://12939/main/Implementatie/DRGL/src/DirectDoorvoerenAdmin.cpp" + And metric "" is selected + When the user opens the dropdown menu containing "" inside the filter bar + And the user clicks on the dropdown option "

All other classes will be removed. - */ -package net.sourceforge.pmd.lang.gherkin.antlr4; diff --git a/pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/ast/package-info.java b/pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/ast/package-info.java new file mode 100644 index 0000000000..109abde01a --- /dev/null +++ b/pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/ast/package-info.java @@ -0,0 +1,8 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +/** + * Contains the Antlr grammar for Gherkin. + */ +package net.sourceforge.pmd.lang.gherkin.ast; diff --git a/pmd-gherkin/src/test/java/net/sourceforge/pmd/cpd/GherkinTokenizerTest.java b/pmd-gherkin/src/test/java/net/sourceforge/pmd/cpd/GherkinTokenizerTest.java index 8dbc3bac22..b6f0d98754 100644 --- a/pmd-gherkin/src/test/java/net/sourceforge/pmd/cpd/GherkinTokenizerTest.java +++ b/pmd-gherkin/src/test/java/net/sourceforge/pmd/cpd/GherkinTokenizerTest.java @@ -7,15 +7,10 @@ package net.sourceforge.pmd.cpd; import java.util.Properties; import org.junit.Test; -import org.junit.rules.ExpectedException; import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest; public class GherkinTokenizerTest extends CpdTextComparisonTest { - - @org.junit.Rule - public ExpectedException ex = ExpectedException.none(); - public GherkinTokenizerTest() { super(".feature"); } From c5f06cdf8802b6d71a61d1452b8fc627466fd995 Mon Sep 17 00:00:00 2001 From: Anne Brouwers Date: Tue, 28 Jun 2022 17:20:19 +0200 Subject: [PATCH 12/34] Add Gherkin page to docs --- docs/_data/sidebars/pmd_sidebar.yml | 3 +++ docs/pages/pmd/languages/gherkin.md | 15 +++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 docs/pages/pmd/languages/gherkin.md diff --git a/docs/_data/sidebars/pmd_sidebar.yml b/docs/_data/sidebars/pmd_sidebar.yml index 81d095e398..f7ab16ddb0 100644 --- a/docs/_data/sidebars/pmd_sidebar.yml +++ b/docs/_data/sidebars/pmd_sidebar.yml @@ -382,6 +382,9 @@ entries: - title: HTML url: /pmd_languages_html.html output: web, pdf + - title: Gherkin + url: /pmd_languages_gherkin.html + output: web, pdf - title: Developer Documentation output: web, pdf folderitems: diff --git a/docs/pages/pmd/languages/gherkin.md b/docs/pages/pmd/languages/gherkin.md new file mode 100644 index 0000000000..6ab5b6f688 --- /dev/null +++ b/docs/pages/pmd/languages/gherkin.md @@ -0,0 +1,15 @@ +--- +title: Gherkin +permalink: pmd_languages_gherkin.html +--- + +The [Gherkin](https://cucumber.io/docs/gherkin/) language is used to define test cases for the [Cucumber](https://cucumber.io/) testing tool for behavior-driven development. The Gherkin syntax is designed to be +non-technical, making it human-readable for a wide audience. + +## Support in PMD +Starting from version 6.48.0, Gherkin support was added to CPD. + +### Limitations +- Support for Gherkin only extends to CPD to detect code duplication in Cucumber test cases. +- While Gherkin keywords have been translated into various +languages, CPD currently supports only the English version of the Gherkin language. From e2fbe21917bdcfc20e148c2927a3273c8240abfd Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 30 Jun 2022 15:09:01 +0200 Subject: [PATCH 13/34] Update @jborgers 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 77965bd302..01cc1f2486 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -3267,7 +3267,8 @@ "avatar_url": "https://avatars.githubusercontent.com/u/24591067?v=4", "profile": "https://github.com/jborgers", "contributions": [ - "bug" + "bug", + "code" ] }, { diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index af2199ce28..db3d56e52f 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -330,7 +330,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Jens Gerdes

🐛 -
Jeroen Borgers

🐛 +
Jeroen Borgers

🐛 💻
Jerome Russ

🐛
JerritEic

💻 📖
Jiri Pejchal

🐛 From 0fb18f4b293f714adc9a158a5891b86e0940fd52 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 30 Jun 2022 15:09:13 +0200 Subject: [PATCH 14/34] Add @stokpop as a contributor --- .all-contributorsrc | 9 +++ docs/pages/pmd/projectdocs/credits.md | 91 ++++++++++++++------------- 2 files changed, 56 insertions(+), 44 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 01cc1f2486..9fac6ec3ec 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -6731,6 +6731,15 @@ "contributions": [ "bug" ] + }, + { + "login": "stokpop", + "name": "Peter Paul Bakker", + "avatar_url": "https://avatars.githubusercontent.com/u/8797018?v=4", + "profile": "https://www.stokpop.nl/", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index db3d56e52f..80c09f21cc 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -554,408 +554,411 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Peter Kofler

🐛 +
Peter Paul Bakker

💻
Pham Hai Trung

🐛
Philip Graf

💻 🐛
Philip Hachey

🐛
Philippe Ozil

🐛
Phinehas Artemix

🐛
Phokham Nonava

🐛 -
Piotr Szymański

🐛 +
Piotr Szymański

🐛
Piotrek Żygieło

💻 🐛
Pranay Jaiswal

🐛
Prasad Kamath

🐛
Prasanna

🐛
Presh-AR

🐛
Puneet1726

🐛 -
Rafael Cortês

🐛 +
Rafael Cortês

🐛
RaheemShaik999

🐛
RajeshR

💻 🐛
Ramachandra Mohan

🐛
Ramel0921

🐛
Raquel Pau

🐛
Ravikiran Janardhana

🐛 -
Reda Benhemmouche

🐛 +
Reda Benhemmouche

🐛
Renato Oliveira

💻 🐛
Rich DiCroce

🐛
Riot R1cket

🐛
Rishabh Jain

🐛
RishabhDeep Singh

🐛
Robbie Martinus

💻 🐛 -
Robert Henry

🐛 +
Robert Henry

🐛
Robert Painsi

🐛
Robert Russell

🐛
Robert Sösemann

💻 📖 📢 🐛
Robert Whitebit

🐛
Robin Richtsfeld

🐛
Robin Stocker

💻 🐛 -
Robin Wils

🐛 +
Robin Wils

🐛
RochusOest

🐛
Rodolfo Noviski

🐛
Rodrigo Casara

🐛
Rodrigo Fernandes

🐛
Roman Salvador

💻 🐛
Ronald Blaschke

🐛 -
Róbert Papp

🐛 +
Róbert Papp

🐛
Saikat Sengupta

🐛
Saksham Handu

🐛
Saladoc

🐛
Salesforce Bob Lightning

🐛
Sam Carlberg

🐛
Satoshi Kubo

🐛 -
Scott Kennedy

🐛 +
Scott Kennedy

🐛
Scott Wells

🐛 💻
Scrsloota

💻
Sebastian Bögl

🐛
Sebastian Schuberth

🐛
Sebastian Schwarz

🐛
Sergey Gorbaty

🐛 -
Sergey Kozlov

🐛 +
Sergey Kozlov

🐛
Sergey Yanzin

💻 🐛
Seth Wilcox

💻
Shubham

💻 🐛
Simon Xiao

🐛
Srinivasan Venkatachalam

🐛
Stanislav Gromov

🐛 -
Stanislav Myachenkov

💻 +
Stanislav Myachenkov

💻
Stefan Birkner

🐛
Stefan Bohn

🐛
Stefan Endrullis

🐛
Stefan Klöss-Schuster

🐛
Stefan Wolf

🐛
Stephan H. Wissel

🐛 -
Stephen

🐛 +
Stephen

🐛
Stephen Friedrich

🐛
Steve Babula

💻
Stexxe

🐛
Stian Lågstad

🐛
StuartClayton5

🐛
Supun Arunoda

🐛 -
Suren Abrahamyan

🐛 +
Suren Abrahamyan

🐛
SwatiBGupta1110

🐛
SyedThoufich

🐛
Szymon Sasin

🐛
T-chuangxin

🐛
TERAI Atsuhiro

🐛
TIOBE Software

💻 🐛 -
Taylor Smock

🐛 +
Taylor Smock

🐛
Techeira Damián

💻 🐛
Ted Husted

🐛
TehBakker

🐛
The Gitter Badger

🐛
Theodoor

🐛
Thiago Henrique Hüpner

🐛 -
Thibault Meyer

🐛 +
Thibault Meyer

🐛
Thomas Güttler

🐛
Thomas Jones-Low

🐛
Thomas Smith

💻 🐛
ThrawnCA

🐛
Thunderforge

💻 🐛
Tim van der Lippe

🐛 -
Tobias Weimer

💻 🐛 +
Tobias Weimer

💻 🐛
Tom Daly

🐛
Tomer Figenblat

🐛
Tomi De Lucca

💻 🐛
Torsten Kleiber

🐛
TrackerSB

🐛
Ullrich Hafner

🐛 -
Utku Cuhadaroglu

💻 🐛 +
Utku Cuhadaroglu

💻 🐛
Valentin Brandl

🐛
Valeria

🐛
Vasily Anisimov

🐛
Vibhor Goyal

🐛
Vickenty Fesunov

🐛
Victor Noël

🐛 -
Vincent Galloy

💻 +
Vincent Galloy

💻
Vincent HUYNH

🐛
Vincent Maurin

🐛
Vincent Privat

🐛
Vishhwas

🐛
Vitaly

🐛
Vitaly Polonetsky

🐛 -
Vojtech Polivka

🐛 +
Vojtech Polivka

🐛
Vsevolod Zholobov

🐛
Vyom Yadav

💻
Wang Shidong

🐛
Waqas Ahmed

🐛
Wayne J. Earl

🐛
Wchenghui

🐛 -
Will Winder

🐛 +
Will Winder

🐛
William Brockhus

💻 🐛
Wilson Kurniawan

🐛
Wim Deblauwe

🐛
Woongsik Choi

🐛
XenoAmess

💻 🐛
Yang

💻 -
YaroslavTER

🐛 +
YaroslavTER

🐛
Young Chan

💻 🐛
YuJin Kim

🐛
Yuri Dolzhenko

🐛
Yurii Dubinka

🐛
Zoltan Farkas

🐛
Zustin

🐛 -
aaronhurst-google

🐛 +
aaronhurst-google

🐛
alexmodis

🐛
andreoss

🐛
andrey81inmd

💻 🐛
anicoara

🐛
arunprasathav

🐛
asiercamara

🐛 -
astillich-igniti

💻 +
astillich-igniti

💻
avesolovksyy

🐛
avishvat

🐛
avivmu

🐛
axelbarfod1

🐛
b-3-n

🐛
balbhadra9

🐛 -
base23de

🐛 +
base23de

🐛
bergander

🐛
berkam

💻 🐛
breizh31

🐛
caesarkim

🐛
carolyujing

🐛
cesares-basilico

🐛 -
chrite

🐛 +
chrite

🐛
cobratbq

🐛
coladict

🐛
cosmoJFH

🐛
cristalp

🐛
crunsk

🐛
cwholmes

🐛 -
cyberjj999

🐛 +
cyberjj999

🐛
cyw3

🐛
d1ss0nanz

🐛
dalizi007

💻
danbrycefairsailcom

🐛
dariansanity

🐛
darrenmiliband

🐛 -
davidburstrom

🐛 +
davidburstrom

🐛
dbirkman-paloalto

🐛
deepak-patra

🐛
dependabot[bot]

💻 🐛
dinesh150

🐛
diziaq

🐛
dreaminpast123

🐛 -
duanyanan

🐛 +
duanyanan

🐛
dutt-sanjay

🐛
dylanleung

🐛
dzeigler

🐛
ekkirala

🐛
emersonmoura

🐛
fairy

🐛 -
filiprafalowicz

💻 +
filiprafalowicz

💻
foxmason

🐛
frankegabor

🐛
frankl

🐛
freafrea

🐛
fsapatin

🐛
gracia19

🐛 -
guo fei

🐛 +
guo fei

🐛
gurmsc5

🐛
gwilymatgearset

💻 🐛
haigsn

🐛
hemanshu070

🐛
henrik242

🐛
hongpuwu

🐛 -
hvbtup

💻 🐛 +
hvbtup

💻 🐛
igniti GmbH

🐛
ilovezfs

🐛
itaigilo

🐛
jakivey32

🐛
jbennett2091

🐛
jcamerin

🐛 -
jkeener1

🐛 +
jkeener1

🐛
jmetertea

🐛
johnra2

💻
josemanuelrolon

💻 🐛
kabroxiko

💻 🐛
karwer

🐛
kaulonline

🐛 -
kdaemonv

🐛 +
kdaemonv

🐛
kenji21

💻 🐛
kfranic

🐛
khalidkh

🐛
krzyk

🐛
lasselindqvist

🐛
lgemeinhardt

🐛 -
lihuaib

🐛 +
lihuaib

🐛
lonelyma1021

🐛
lpeddy

🐛
lujiefsi

💻
lukelukes

💻
lyriccoder

🐛
marcelmore

🐛 -
matchbox

🐛 +
matchbox

🐛
matthiaskraaz

🐛
meandonlyme

🐛
mikesive

🐛
milossesic

🐛
mriddell95

🐛
mrlzh

🐛 -
msloan

🐛 +
msloan

🐛
mucharlaravalika

🐛
mvenneman

🐛
nareshl119

🐛
nicolas-harraudeau-sonarsource

🐛
noerremark

🐛
novsirion

🐛 -
oggboy

🐛 +
oggboy

🐛
oinume

🐛
orimarko

💻 🐛
pallavi agarwal

🐛
parksungrin

🐛
patpatpat123

🐛
patriksevallius

🐛 -
pbrajesh1

🐛 +
pbrajesh1

🐛
phoenix384

🐛
piotrszymanski-sc

💻
plan3d

🐛
poojasix

🐛
prabhushrikant

🐛
pujitha8783

🐛 -
r-r-a-j

🐛 +
r-r-a-j

🐛
raghujayjunk

🐛
rajeshveera

🐛
rajeswarreddy88

🐛
recdevs

🐛
reudismam

💻 🐛
rijkt

🐛 -
rillig-tk

🐛 +
rillig-tk

🐛
rmohan20

💻 🐛
rxmicro

🐛
ryan-gustafson

💻 🐛
sabi0

🐛
scais

🐛
sebbASF

🐛 -
sergeygorbaty

💻 +
sergeygorbaty

💻
shilko2013

🐛
shiomiyan

📖
simeonKondr

🐛
snajberk

🐛
sniperrifle2004

🐛
snuyanzin

🐛 💻 -
sratz

🐛 +
sratz

🐛
stonio

🐛
sturton

💻 🐛
sudharmohan

🐛
suruchidawar

🐛
svenfinitiv

🐛
tashiscool

🐛 -
test-git-hook

🐛 +
test-git-hook

🐛
testation21

💻 🐛
thanosa

🐛
tiandiyixian

🐛
tobwoerk

🐛
tprouvot

🐛
trentchilders

🐛 -
triandicAnt

🐛 +
triandicAnt

🐛
trishul14

🐛
tsui

🐛
winhkey

🐛
witherspore

🐛
wjljack

🐛
wuchiuwong

🐛 -
xingsong

🐛 +
xingsong

🐛
xioayuge

🐛
xnYi9wRezm

💻 🐛
xuanuy

🐛
xyf0921

🐛
yalechen-cyw3

🐛
yasuharu-sato

🐛 -
zenglian

🐛 +
zenglian

🐛
zgrzyt93

💻 🐛
zh3ng

🐛
zt_soft

🐛
ztt79

🐛
zzzzfeng

🐛
Árpád Magosányi

🐛 + +
任贵杰

🐛 From b14d51829d16debf1f510a5be7d7f2b88c585884 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 1 Jul 2022 09:06:06 +0200 Subject: [PATCH 15/34] [gherkin] Move CPD classes into specific gherkin package --- .../pmd/{ => lang/gherkin}/cpd/GherkinLanguage.java | 4 +++- .../pmd/{ => lang/gherkin}/cpd/GherkinTokenizer.java | 4 +++- .../sourceforge/pmd/{ => lang/gherkin}/cpd/package-info.java | 2 +- .../META-INF/services/net.sourceforge.pmd.cpd.Language | 2 +- .../java/net/sourceforge/pmd/cpd/GherkinTokenizerTest.java | 1 + 5 files changed, 9 insertions(+), 4 deletions(-) rename pmd-gherkin/src/main/java/net/sourceforge/pmd/{ => lang/gherkin}/cpd/GherkinLanguage.java (79%) rename pmd-gherkin/src/main/java/net/sourceforge/pmd/{ => lang/gherkin}/cpd/GherkinTokenizer.java (85%) rename pmd-gherkin/src/main/java/net/sourceforge/pmd/{ => lang/gherkin}/cpd/package-info.java (76%) diff --git a/pmd-gherkin/src/main/java/net/sourceforge/pmd/cpd/GherkinLanguage.java b/pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/cpd/GherkinLanguage.java similarity index 79% rename from pmd-gherkin/src/main/java/net/sourceforge/pmd/cpd/GherkinLanguage.java rename to pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/cpd/GherkinLanguage.java index 1dd68d4e39..d95282944b 100644 --- a/pmd-gherkin/src/main/java/net/sourceforge/pmd/cpd/GherkinLanguage.java +++ b/pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/cpd/GherkinLanguage.java @@ -2,7 +2,9 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.cpd; +package net.sourceforge.pmd.lang.gherkin.cpd; + +import net.sourceforge.pmd.cpd.AbstractLanguage; /** * Language implementation for Gherkin. diff --git a/pmd-gherkin/src/main/java/net/sourceforge/pmd/cpd/GherkinTokenizer.java b/pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/cpd/GherkinTokenizer.java similarity index 85% rename from pmd-gherkin/src/main/java/net/sourceforge/pmd/cpd/GherkinTokenizer.java rename to pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/cpd/GherkinTokenizer.java index 64978c5e7e..a883344b1f 100644 --- a/pmd-gherkin/src/main/java/net/sourceforge/pmd/cpd/GherkinTokenizer.java +++ b/pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/cpd/GherkinTokenizer.java @@ -2,10 +2,12 @@ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.cpd; +package net.sourceforge.pmd.lang.gherkin.cpd; import org.antlr.v4.runtime.CharStream; +import net.sourceforge.pmd.cpd.AntlrTokenizer; +import net.sourceforge.pmd.cpd.SourceCode; import net.sourceforge.pmd.cpd.token.AntlrTokenFilter; import net.sourceforge.pmd.lang.antlr.AntlrTokenManager; import net.sourceforge.pmd.lang.gherkin.ast.GherkinLexer; diff --git a/pmd-gherkin/src/main/java/net/sourceforge/pmd/cpd/package-info.java b/pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/cpd/package-info.java similarity index 76% rename from pmd-gherkin/src/main/java/net/sourceforge/pmd/cpd/package-info.java rename to pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/cpd/package-info.java index 53ab0add38..9a25b68105 100644 --- a/pmd-gherkin/src/main/java/net/sourceforge/pmd/cpd/package-info.java +++ b/pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/cpd/package-info.java @@ -5,4 +5,4 @@ /** * Contains Gherkin tokenizer and language classes. */ -package net.sourceforge.pmd.cpd; +package net.sourceforge.pmd.lang.gherkin.cpd; diff --git a/pmd-gherkin/src/main/resources/META-INF/services/net.sourceforge.pmd.cpd.Language b/pmd-gherkin/src/main/resources/META-INF/services/net.sourceforge.pmd.cpd.Language index 313dd4ddac..fbe21e1710 100644 --- a/pmd-gherkin/src/main/resources/META-INF/services/net.sourceforge.pmd.cpd.Language +++ b/pmd-gherkin/src/main/resources/META-INF/services/net.sourceforge.pmd.cpd.Language @@ -1 +1 @@ -net.sourceforge.pmd.cpd.GherkinLanguage +net.sourceforge.pmd.lang.gherkin.cpd.GherkinLanguage diff --git a/pmd-gherkin/src/test/java/net/sourceforge/pmd/cpd/GherkinTokenizerTest.java b/pmd-gherkin/src/test/java/net/sourceforge/pmd/cpd/GherkinTokenizerTest.java index b6f0d98754..f8f064ea41 100644 --- a/pmd-gherkin/src/test/java/net/sourceforge/pmd/cpd/GherkinTokenizerTest.java +++ b/pmd-gherkin/src/test/java/net/sourceforge/pmd/cpd/GherkinTokenizerTest.java @@ -9,6 +9,7 @@ import java.util.Properties; import org.junit.Test; import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest; +import net.sourceforge.pmd.lang.gherkin.cpd.GherkinTokenizer; public class GherkinTokenizerTest extends CpdTextComparisonTest { public GherkinTokenizerTest() { From 326c03d5a43c5daf4bb290ace50b71a0e436e384 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 1 Jul 2022 09:14:34 +0200 Subject: [PATCH 16/34] Add @ASBrouwers as a contributor --- .all-contributorsrc | 9 ++ docs/pages/pmd/projectdocs/credits.md | 211 +++++++++++++------------- 2 files changed, 116 insertions(+), 104 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 77965bd302..8e1be834a4 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -6730,6 +6730,15 @@ "contributions": [ "bug" ] + }, + { + "login": "ASBrouwers", + "name": "ASBrouwers", + "avatar_url": "https://avatars.githubusercontent.com/u/23551289?v=4", + "profile": "https://github.com/ASBrouwers", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index af2199ce28..9eac8d0a8a 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -17,945 +17,948 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
0xflotus

💻 🐛
1henni

🐛
ALiNew

🐛 +
ASBrouwers

💻
Abhijit Sarkar

🐛
Abhishek Kumar

🐛
Adam

🐛 -
Adam Carroll

🐛 +
Adam Carroll

🐛
Adam Obuchowicz

🐛
Adrian Price

🐛
Adrien Lecharpentier

🐛
Aidan Harding

🐛
Akshat Bahety

💻 🐛
Akshay Thapa

🐛 -
Alan Buttars

🐛 +
Alan Buttars

🐛
Alan Hohn

🐛
Alberto Fernández

💻 🐛
Alex Rentz

🐛
Alex Saveau

🐛
Alex Shesterov

💻 🐛
Alexey Markevich

🐛 -
Alexey Naumov

🐛 +
Alexey Naumov

🐛
Alexey Yudichev

🐛
Alix

🐛
Alix

🐛
Amish Shah

🐛
Amit Prasad

🐛
Amitosh Swain Mahapatra

🐛 -
Anand Subramanian

💻 🐛 +
Anand Subramanian

💻 🐛
Anatoly Trosinenko

💻 🐛
Andi Pabst

💻 🐛
Andrea

🐛
Andrea Aime

🐛
Andreas Dangel

💻 📖 🐛 🚧
Andreas Markussen

🐛 -
Andreas Schmid

🐛 +
Andreas Schmid

🐛
Andreas Turban

🐛
Andrei Paikin

🐛
Andrew

🐛
Andrew Green

🐛
Andrey Fomin

🐛
Andrey Hitrin

🐛 -
Andrey Mochalov

💻 🐛 +
Andrey Mochalov

💻 🐛
Andro72

🐛
Andrwyw

🐛
Andrés Catalán

🐛
Andy Pattenden

🐛
Andy Ray

🐛
Andy Robinson

🐛 -
Andy-2639

🐛 +
Andy-2639

🐛
Ankush Somani

🐛
Anmol Kumar

🐛
Anthony Whitford

🐛
AnthonyKot

🐛
Aravind Hegde

🐛
Arda Aslan

🐛 -
Ari Fogel

🐛 +
Ari Fogel

🐛
Arnaud Jeansen

💻 🐛
Arpit Koolwal

🐛
Artem

💻 🐛
Artem

🐛
Artem Sheremet

🐛
Artur

🐛 -
Artur Bosch

🐛 +
Artur Bosch

🐛
Artur Dryomov

🐛
Artur Ossowski

🐛
AshTheMash

🐛
Ashish Rana

🐛
Atul Kaushal

🐛
August Boland

🐛 -
Aurel Hudec

🐛 +
Aurel Hudec

🐛
Austin Shalit

🐛
Austin Tice

🐛
Ayoub Kaanich

🐛
BBG

💻 📖 🐛
Bailey Tjiong

💻
Barthélemy L.

🐛 -
Basavaraj K N

🐛 +
Basavaraj K N

🐛
Basil Peace

🐛
Belle

🐛
Ben Lerner

🐛
Ben Manes

🐛
Ben McCann

🐛
Bendegúz Nagy

🐛 -
Bennet S Yee

🐛 +
Bennet S Yee

🐛
Benoit Lacelle

🐛
Bernardo Macêdo

🐛
Bernd Farka

🐛
Betina Cynthia Mamani

🐛
Bhanu Prakash Pamidi

💻 🐛
Bhargav Thanki

🐛 -
Binu R J

🐛 +
Binu R J

🐛
Björn Kautler

💻 🐛
Blightbuster

🐛
Bo Zhang

🐛
Bob "Wombat" Hogg

🐛
Bobby Wertman

🐛
Bolarinwa Saheed Olayemi

💻 🐛 -
Boris Petrov

🐛 +
Boris Petrov

🐛
Brad Kent

🐛
Brandon Mikeska

🐛
Brian Batronis

🐛
Brian Johnson

🐛
Brice Dutheil

💻 🐛
Bruno Ferreira

🐛 -
Bruno Ritz

🐛 +
Bruno Ritz

🐛
Cameron Donaldson

🐛
Carlos Macasaet

🐛
Carsten Otto

🐛
Charlie Housh

🐛
Charlie Jonas

🐛
Chas Honton

🐛 -
Chen Yang

🐛 +
Chen Yang

🐛
Chotu

🐛
Chris Smith

🐛
Christian Hujer

🐛
Christian Pontesegger

🐛
ChristianWulf

🐛
Christofer Dutz

💻 -
Christoffer Anselm

🐛 +
Christoffer Anselm

🐛
Christophe Vidal

🐛
Christopher Dancy

🐛
Clemens Prill

🐛
Clint Chester

💻 🐛
Clément Fournier

💻 📖 🐛 🚧
Codacy Badger

🐛 -
Code-Nil

🐛 +
Code-Nil

🐛
ColColonCleaner

🐛
Colin Ingarfield

🐛
Craig Andrews

🐛
Craig Muchinsky

🐛
Cyril

💻 🐛
Dale

💻 -
Damien Jiang

🐛 +
Damien Jiang

🐛
Dan Berindei

🐛
Dan Rollo

🐛
Dan Ziemba

🐛
Daniel Gredler

💻
Daniel Jipa

🐛
Daniel Paul Searles

💻 -
Daniel Reigada

🐛 +
Daniel Reigada

🐛
Danilo Pianini

🐛
Darko

🐛
David

🐛
David Atkinson

🐛
David Burström

💻 🐛
David Goaté

🐛 -
David Golpira

🐛 +
David Golpira

🐛
David Kovařík

🐛
David M. Karr (fullname at gmail.com)

🐛
David Renz

💻 🐛
David Renz

🐛
Deleted user

🐛
Dell Green

🐛 -
Dem Pilafian

🐛 +
Dem Pilafian

🐛
Den

🐛
Denis Borovikov

💻 🐛
Dennie Reniers

💻 🐛
Dennis Kieselhorst

🐛
Derek P. Moore

🐛
Dichotomia

🐛 -
Dionisio Cortés Fernández

💻 🐛 +
Dionisio Cortés Fernández

💻 🐛
Dmitri Bourlatchkov

🐛
Dmitriy Kuzmin

🐛
Dmytro Dashenkov

🐛
Drew Hall

🐛
Dumitru Postoronca

🐛
Dylan Adams

🐛 -
Eden Hao

🐛 +
Eden Hao

🐛
Egor Bredikhin

🐛
Elan P. Kugelmass

🐛
Elder S.

🐛
Emile

🐛
Eric

🐛
Eric Kintzer

🐛 -
Eric Perret

🐛 +
Eric Perret

🐛
Eric Squires

🐛
Erich L Foster

🐛
Erik Bleske

🐛
Ernst Reissner

🐛
F.W. Dekker

🐛
FSchliephacke

🐛 -
Facundo

🐛 +
Facundo

🐛
Federico Giust

🐛
Fedor Sherstobitov

🐛
Felix Lampe

🐛
Filip Golonka

🐛
Filipe Esperandio

💻 🐛
Filippo Nova

🐛 -
Francesco la Torre

🐛 +
Francesco la Torre

🐛
Francisco Duarte

🐛
Frieder Bluemle

🐛
Frits Jalvingh

💻 🐛
G. Bazior

🐛
Gabe Henkes

🐛
Genoud Magloire

🐛 -
Geoffrey555

🐛 +
Geoffrey555

🐛
Georg Romstorfer

🐛
Gio

🐛
Gol

🐛
Gonzalo Exequiel Ibars Ingman

💻 🐛
GooDer

🐛
Gregor Riegler

🐛 -
Grzegorz Olszewski

🐛 +
Grzegorz Olszewski

🐛
Gunther Schrijvers

💻 🐛
Gustavo Krieger

🐛
Guy Elsmore-Paddock

🐛
Görkem Mülayim

🐛
Hanzel Godinez

🐛
Haoliang Chen

🐛 -
Harsh Kukreja

🐛 +
Harsh Kukreja

🐛
Heber

🐛
Henning Schmiedehausen

💻 🐛
Henning von Bargen

💻
Hervé Boutemy

🐛
Himanshu Pandey

🐛
Hokwang Lee

🐛 -
Hooperbloob

💻 +
Hooperbloob

💻
Hung PHAN

🐛
IDoCodingStuffs

💻 🐛
Iccen Gan

🐛
Ignacio Mariano Tirabasso

🐛
Igor Melnichenko

🐛
Igor Moreno

🐛 -
Intelesis-MS

🐛 +
Intelesis-MS

🐛
Iroha_

🐛
Ishan Srivastava

🐛
Ivano Guerini

🐛
Ivar Andreas Bonsaksen

🐛
Ivo Šmíd

🐛
JJengility

🐛 -
Jake Hemmerle

🐛 +
Jake Hemmerle

🐛
James Harrison

🐛 💻
Jan

🐛
Jan Aertgeerts

💻 🐛
Jan Brümmer

🐛
Jan Tříska

🐛
Jan-Lukas Else

🐛 -
Jason Qiu

💻 📖 +
Jason Qiu

💻 📖
Jason Williams

🐛
Jean-Paul Mayer

🐛
Jean-Simon Larochelle

🐛
Jeff Bartolotta

💻 🐛
Jeff Hube

💻 🐛
Jeff Jensen

🐛 -
Jeff May

🐛 +
Jeff May

🐛
Jens Gerdes

🐛
Jeroen Borgers

🐛
Jerome Russ

🐛
JerritEic

💻 📖
Jiri Pejchal

🐛
Jithin Sunny

🐛 -
Jiří Škorpil

🐛 +
Jiří Škorpil

🐛
Joao Machado

🐛
Jochen Krauss

🐛
Johan Hammar

🐛
John Karp

🐛
John Zhang

🐛
John-Teng

💻 🐛 -
Jon Moroney

💻 🐛 +
Jon Moroney

💻 🐛
Jonas Geiregat

🐛
Jonathan Wiesel

💻 🐛
Jordan

🐛
Jordi Llach

🐛
Jorge Solórzano

🐛
JorneVL

🐛 -
Jose Palafox

🐛 +
Jose Palafox

🐛
Jose Stovall

🐛
Joseph

💻
Joseph Heenan

🐛
Josh Feingold

💻 🐛
Josh Holthaus

🐛
Joshua S Arquilevich

🐛 -
João Ferreira

💻 🐛 +
João Ferreira

💻 🐛
João Pedro Schmitt

🐛
Juan Martín Sotuyo Dodero

💻 📖 🐛 🚧
Juan Pablo Civile

🐛
Julian Voronetsky

🐛
Julien

🐛
Julius

🐛 -
JustPRV

🐛 +
JustPRV

🐛
Jörn Huxhorn

🐛
KThompso

🐛
Kai Amundsen

🐛
Karel Vervaeke

🐛
Karl-Andero Mere

🐛
Karl-Philipp Richter

🐛 -
Karsten Silz

🐛 +
Karsten Silz

🐛
Kazuma Watanabe

🐛
Kev

🐛
Keve Müller

🐛
Kevin Guerra

💻
Kevin Jones

🐛
Kevin Wayne

🐛 -
Kieran Black

🐛 +
Kieran Black

🐛
Kirill Zubov

🐛
Kirk Clemens

💻 🐛
Klaus Hartl

🐛
Koen Van Looveren

🐛
Kris Scheibe

💻 🐛
Kunal Thanki

🐛 -
LaLucid

💻 +
LaLucid

💻
Larry Diamond

💻 🐛
Lars Knickrehm

🐛
Leo Gutierrez

🐛
LiGaOg

💻
Lintsi

🐛
Linus Fernandes

🐛 -
Lixon Lookose

🐛 +
Lixon Lookose

🐛
Logesh

🐛
Lorenzo Gabriele

🐛
Loïc Ledoyen

🐛
Lucas Silva

🐛
Lucas Soncini

💻 🐛
Lukasz Slonina

🐛 -
Lukebray

🐛 +
Lukebray

🐛
Lyor Goldstein

🐛
MCMicS

🐛
Macarse

🐛
Machine account for PMD

💻
Maciek Siemczyk

🐛
Maikel Steneker

💻 🐛 -
Maksim Moiseikin

🐛 +
Maksim Moiseikin

🐛
Manfred Koch

🐛
Manuel Moya Ferrer

💻 🐛
Manuel Ryan

🐛
Marat Vyshegorodtsev

🐛
Marcel Härle

🐛
Marcello Fialho

🐛 -
Marcin Rataj

🐛 +
Marcin Rataj

🐛
Mark Adamcin

🐛
Mark Hall

💻 🐛
Mark Kolich

🐛
Mark Pritchard

🐛
Markus Rathgeb

🐛
Marquis Wang

🐛 -
Martin Feldsztejn

🐛 +
Martin Feldsztejn

🐛
Martin Lehmann

🐛
Martin Spamer

🐛
Martin Tarjányi

🐛
MatFl

🐛
Mateusz Stefanski

🐛
Mathieu Gouin

🐛 -
MatiasComercio

💻 🐛 +
MatiasComercio

💻 🐛
Matt Benson

🐛
Matt De Poorter

🐛
Matt Harrah

🐛
Matt Nelson

🐛
Matthew Amos

🐛
Matthew Duggan

🐛 -
Matthew Hall

🐛 +
Matthew Hall

🐛
Matías Fraga

💻 🐛
Maxime Robert

💻 🐛
MetaBF

🐛
Michael

🐛
Michael Bell

🐛
Michael Bernstein

🐛 -
Michael Clay

🐛 +
Michael Clay

🐛
Michael Dombrowski

🐛
Michael Hausegger

🐛
Michael Hoefer

🐛
Michael Möbius

🐛
Michael N. Lipp

🐛
Michael Pellegrini

🐛 -
Michal Kordas

🐛 +
Michal Kordas

🐛
Michał Borek

🐛
Michał Kuliński

🐛
Miguel Núñez Díaz-Montes

🐛
Mihai Ionut

🐛
Mirek Hankus

🐛
Mladjan Gadzic

🐛 -
MrAngry52

🐛 +
MrAngry52

🐛
Muminur Choudhury

🐛
Mykhailo Palahuta

💻 🐛
Nagendra Kumar Singh

🐛
Nahuel Barrios

🐛
Nathan Braun

🐛
Nathan Reynolds

🐛 -
Nathan Reynolds

🐛 +
Nathan Reynolds

🐛
Nathanaël

🐛
Naveen

💻
Nazdravi

🐛
Neha-Dhonde

🐛
Nicholas Doyle

🐛
Nick Butcher

🐛 -
Nico Gallinal

🐛 +
Nico Gallinal

🐛
Nicola Dal Maso

🐛
Nicolas Filotto

💻
Nikita Chursin

🐛
Niklas Baudy

🐛
Nikolas Havrikov

🐛
Nilesh Virkar

🐛 -
Nimit Patel

🐛 +
Nimit Patel

🐛
Niranjan Harpale

🐛
Noah Sussman

🐛
Noah0120

🐛
Noam Tamim

🐛
Noel Grandin

🐛
Olaf Haalstra

🐛 -
Oleg Pavlenko

🐛 +
Oleg Pavlenko

🐛
Oleksii Dykov

💻
Oliver Eikemeier

🐛
Olivier Parent

💻 🐛
Ollie Abbey

💻 🐛
OverDrone

🐛
Ozan Gulle

💻 🐛 -
PUNEET JAIN

🐛 +
PUNEET JAIN

🐛
Parbati Bose

🐛
Paul Berg

🐛
Pavel Bludov

🐛
Pavel Mička

🐛
Pedro Nuno Santos

🐛
Pedro Rijo

🐛 -
Pelisse Romain

💻 📖 🐛 +
Pelisse Romain

💻 📖 🐛
Per Abich

💻
Pete Davids

🐛
Peter Bruin

🐛
Peter Chittum

💻 🐛
Peter Cudmore

🐛
Peter Kasson

🐛 -
Peter Kofler

🐛 +
Peter Kofler

🐛
Pham Hai Trung

🐛
Philip Graf

💻 🐛
Philip Hachey

🐛
Philippe Ozil

🐛
Phinehas Artemix

🐛
Phokham Nonava

🐛 -
Piotr Szymański

🐛 +
Piotr Szymański

🐛
Piotrek Żygieło

💻 🐛
Pranay Jaiswal

🐛
Prasad Kamath

🐛
Prasanna

🐛
Presh-AR

🐛
Puneet1726

🐛 -
Rafael Cortês

🐛 +
Rafael Cortês

🐛
RaheemShaik999

🐛
RajeshR

💻 🐛
Ramachandra Mohan

🐛
Ramel0921

🐛
Raquel Pau

🐛
Ravikiran Janardhana

🐛 -
Reda Benhemmouche

🐛 +
Reda Benhemmouche

🐛
Renato Oliveira

💻 🐛
Rich DiCroce

🐛
Riot R1cket

🐛
Rishabh Jain

🐛
RishabhDeep Singh

🐛
Robbie Martinus

💻 🐛 -
Robert Henry

🐛 +
Robert Henry

🐛
Robert Painsi

🐛
Robert Russell

🐛
Robert Sösemann

💻 📖 📢 🐛
Robert Whitebit

🐛
Robin Richtsfeld

🐛
Robin Stocker

💻 🐛 -
Robin Wils

🐛 +
Robin Wils

🐛
RochusOest

🐛
Rodolfo Noviski

🐛
Rodrigo Casara

🐛
Rodrigo Fernandes

🐛
Roman Salvador

💻 🐛
Ronald Blaschke

🐛 -
Róbert Papp

🐛 +
Róbert Papp

🐛
Saikat Sengupta

🐛
Saksham Handu

🐛
Saladoc

🐛
Salesforce Bob Lightning

🐛
Sam Carlberg

🐛
Satoshi Kubo

🐛 -
Scott Kennedy

🐛 +
Scott Kennedy

🐛
Scott Wells

🐛 💻
Scrsloota

💻
Sebastian Bögl

🐛
Sebastian Schuberth

🐛
Sebastian Schwarz

🐛
Sergey Gorbaty

🐛 -
Sergey Kozlov

🐛 +
Sergey Kozlov

🐛
Sergey Yanzin

💻 🐛
Seth Wilcox

💻
Shubham

💻 🐛
Simon Xiao

🐛
Srinivasan Venkatachalam

🐛
Stanislav Gromov

🐛 -
Stanislav Myachenkov

💻 +
Stanislav Myachenkov

💻
Stefan Birkner

🐛
Stefan Bohn

🐛
Stefan Endrullis

🐛
Stefan Klöss-Schuster

🐛
Stefan Wolf

🐛
Stephan H. Wissel

🐛 -
Stephen

🐛 +
Stephen

🐛
Stephen Friedrich

🐛
Steve Babula

💻
Stexxe

🐛
Stian Lågstad

🐛
StuartClayton5

🐛
Supun Arunoda

🐛 -
Suren Abrahamyan

🐛 +
Suren Abrahamyan

🐛
SwatiBGupta1110

🐛
SyedThoufich

🐛
Szymon Sasin

🐛
T-chuangxin

🐛
TERAI Atsuhiro

🐛
TIOBE Software

💻 🐛 -
Taylor Smock

🐛 +
Taylor Smock

🐛
Techeira Damián

💻 🐛
Ted Husted

🐛
TehBakker

🐛
The Gitter Badger

🐛
Theodoor

🐛
Thiago Henrique Hüpner

🐛 -
Thibault Meyer

🐛 +
Thibault Meyer

🐛
Thomas Güttler

🐛
Thomas Jones-Low

🐛
Thomas Smith

💻 🐛
ThrawnCA

🐛
Thunderforge

💻 🐛
Tim van der Lippe

🐛 -
Tobias Weimer

💻 🐛 +
Tobias Weimer

💻 🐛
Tom Daly

🐛
Tomer Figenblat

🐛
Tomi De Lucca

💻 🐛
Torsten Kleiber

🐛
TrackerSB

🐛
Ullrich Hafner

🐛 -
Utku Cuhadaroglu

💻 🐛 +
Utku Cuhadaroglu

💻 🐛
Valentin Brandl

🐛
Valeria

🐛
Vasily Anisimov

🐛
Vibhor Goyal

🐛
Vickenty Fesunov

🐛
Victor Noël

🐛 -
Vincent Galloy

💻 +
Vincent Galloy

💻
Vincent HUYNH

🐛
Vincent Maurin

🐛
Vincent Privat

🐛
Vishhwas

🐛
Vitaly

🐛
Vitaly Polonetsky

🐛 -
Vojtech Polivka

🐛 +
Vojtech Polivka

🐛
Vsevolod Zholobov

🐛
Vyom Yadav

💻
Wang Shidong

🐛
Waqas Ahmed

🐛
Wayne J. Earl

🐛
Wchenghui

🐛 -
Will Winder

🐛 +
Will Winder

🐛
William Brockhus

💻 🐛
Wilson Kurniawan

🐛
Wim Deblauwe

🐛
Woongsik Choi

🐛
XenoAmess

💻 🐛
Yang

💻 -
YaroslavTER

🐛 +
YaroslavTER

🐛
Young Chan

💻 🐛
YuJin Kim

🐛
Yuri Dolzhenko

🐛
Yurii Dubinka

🐛
Zoltan Farkas

🐛
Zustin

🐛 -
aaronhurst-google

🐛 +
aaronhurst-google

🐛
alexmodis

🐛
andreoss

🐛
andrey81inmd

💻 🐛
anicoara

🐛
arunprasathav

🐛
asiercamara

🐛 -
astillich-igniti

💻 +
astillich-igniti

💻
avesolovksyy

🐛
avishvat

🐛
avivmu

🐛
axelbarfod1

🐛
b-3-n

🐛
balbhadra9

🐛 -
base23de

🐛 +
base23de

🐛
bergander

🐛
berkam

💻 🐛
breizh31

🐛
caesarkim

🐛
carolyujing

🐛
cesares-basilico

🐛 -
chrite

🐛 +
chrite

🐛
cobratbq

🐛
coladict

🐛
cosmoJFH

🐛
cristalp

🐛
crunsk

🐛
cwholmes

🐛 -
cyberjj999

🐛 +
cyberjj999

🐛
cyw3

🐛
d1ss0nanz

🐛
dalizi007

💻
danbrycefairsailcom

🐛
dariansanity

🐛
darrenmiliband

🐛 -
davidburstrom

🐛 +
davidburstrom

🐛
dbirkman-paloalto

🐛
deepak-patra

🐛
dependabot[bot]

💻 🐛
dinesh150

🐛
diziaq

🐛
dreaminpast123

🐛 -
duanyanan

🐛 +
duanyanan

🐛
dutt-sanjay

🐛
dylanleung

🐛
dzeigler

🐛
ekkirala

🐛
emersonmoura

🐛
fairy

🐛 -
filiprafalowicz

💻 +
filiprafalowicz

💻
foxmason

🐛
frankegabor

🐛
frankl

🐛
freafrea

🐛
fsapatin

🐛
gracia19

🐛 -
guo fei

🐛 +
guo fei

🐛
gurmsc5

🐛
gwilymatgearset

💻 🐛
haigsn

🐛
hemanshu070

🐛
henrik242

🐛
hongpuwu

🐛 -
hvbtup

💻 🐛 +
hvbtup

💻 🐛
igniti GmbH

🐛
ilovezfs

🐛
itaigilo

🐛
jakivey32

🐛
jbennett2091

🐛
jcamerin

🐛 -
jkeener1

🐛 +
jkeener1

🐛
jmetertea

🐛
johnra2

💻
josemanuelrolon

💻 🐛
kabroxiko

💻 🐛
karwer

🐛
kaulonline

🐛 -
kdaemonv

🐛 +
kdaemonv

🐛
kenji21

💻 🐛
kfranic

🐛
khalidkh

🐛
krzyk

🐛
lasselindqvist

🐛
lgemeinhardt

🐛 -
lihuaib

🐛 +
lihuaib

🐛
lonelyma1021

🐛
lpeddy

🐛
lujiefsi

💻
lukelukes

💻
lyriccoder

🐛
marcelmore

🐛 -
matchbox

🐛 +
matchbox

🐛
matthiaskraaz

🐛
meandonlyme

🐛
mikesive

🐛
milossesic

🐛
mriddell95

🐛
mrlzh

🐛 -
msloan

🐛 +
msloan

🐛
mucharlaravalika

🐛
mvenneman

🐛
nareshl119

🐛
nicolas-harraudeau-sonarsource

🐛
noerremark

🐛
novsirion

🐛 -
oggboy

🐛 +
oggboy

🐛
oinume

🐛
orimarko

💻 🐛
pallavi agarwal

🐛
parksungrin

🐛
patpatpat123

🐛
patriksevallius

🐛 -
pbrajesh1

🐛 +
pbrajesh1

🐛
phoenix384

🐛
piotrszymanski-sc

💻
plan3d

🐛
poojasix

🐛
prabhushrikant

🐛
pujitha8783

🐛 -
r-r-a-j

🐛 +
r-r-a-j

🐛
raghujayjunk

🐛
rajeshveera

🐛
rajeswarreddy88

🐛
recdevs

🐛
reudismam

💻 🐛
rijkt

🐛 -
rillig-tk

🐛 +
rillig-tk

🐛
rmohan20

💻 🐛
rxmicro

🐛
ryan-gustafson

💻 🐛
sabi0

🐛
scais

🐛
sebbASF

🐛 -
sergeygorbaty

💻 +
sergeygorbaty

💻
shilko2013

🐛
shiomiyan

📖
simeonKondr

🐛
snajberk

🐛
sniperrifle2004

🐛
snuyanzin

🐛 💻 -
sratz

🐛 +
sratz

🐛
stonio

🐛
sturton

💻 🐛
sudharmohan

🐛
suruchidawar

🐛
svenfinitiv

🐛
tashiscool

🐛 -
test-git-hook

🐛 +
test-git-hook

🐛
testation21

💻 🐛
thanosa

🐛
tiandiyixian

🐛
tobwoerk

🐛
tprouvot

🐛
trentchilders

🐛 -
triandicAnt

🐛 +
triandicAnt

🐛
trishul14

🐛
tsui

🐛
winhkey

🐛
witherspore

🐛
wjljack

🐛
wuchiuwong

🐛 -
xingsong

🐛 +
xingsong

🐛
xioayuge

🐛
xnYi9wRezm

💻 🐛
xuanuy

🐛
xyf0921

🐛
yalechen-cyw3

🐛
yasuharu-sato

🐛 -
zenglian

🐛 +
zenglian

🐛
zgrzyt93

💻 🐛
zh3ng

🐛
zt_soft

🐛
ztt79

🐛
zzzzfeng

🐛
Árpád Magosányi

🐛 + +
任贵杰

🐛 From ed6ac96e4996f2ca903f321cd144d8f023527ac9 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 1 Jul 2022 09:18:03 +0200 Subject: [PATCH 17/34] [doc] Update release notes (#4017) --- docs/pages/pmd/languages/gherkin.md | 5 +++-- docs/pages/release_notes.md | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/pages/pmd/languages/gherkin.md b/docs/pages/pmd/languages/gherkin.md index 6ab5b6f688..123bae7d49 100644 --- a/docs/pages/pmd/languages/gherkin.md +++ b/docs/pages/pmd/languages/gherkin.md @@ -3,8 +3,9 @@ title: Gherkin permalink: pmd_languages_gherkin.html --- -The [Gherkin](https://cucumber.io/docs/gherkin/) language is used to define test cases for the [Cucumber](https://cucumber.io/) testing tool for behavior-driven development. The Gherkin syntax is designed to be -non-technical, making it human-readable for a wide audience. +The [Gherkin](https://cucumber.io/docs/gherkin/) language is used to define test cases for the +[Cucumber](https://cucumber.io/) testing tool for behavior-driven development. +The Gherkin syntax is designed to be non-technical, making it human-readable for a wide audience. ## Support in PMD Starting from version 6.48.0, Gherkin support was added to CPD. diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index b8f8783555..1d5530f711 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -14,11 +14,22 @@ This is a {{ site.pmd.release_type }} release. ### New and noteworthy +#### Gherkin support +Thanks to the contribution from [Anne Brouwers](https://github.com/ASBrouwers) PMD now has CPD support +for the [Gherkin](https://cucumber.io/docs/gherkin/) language. It is used to defined test cases for the +[Cucumber](https://cucumber.io/) testing tool for behavior-driven development. + +Being based on a proper Antlr grammar, CPD can: + +* ignore comments +* honor [comment-based suppressions](pmd_userdocs_cpd.html#suppression) + ### Fixed Issues ### API Changes ### External Contributions +* [#4017](https://github.com/pmd/pmd/pull/4017): Add Gherkin support to CPD - [@ASBrouwers](https://github.com/ASBrouwers) {% endtocmaker %} From d333e09f3df39f745ab7268a210f94fb4fa73762 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 1 Jul 2022 10:52:27 +0200 Subject: [PATCH 18/34] [java] Improve AddEmptyString (#3984) --- .../resources/category/java/performance.xml | 8 +- .../rule/performance/xml/AddEmptyString.xml | 127 +++++++++--------- 2 files changed, 67 insertions(+), 68 deletions(-) diff --git a/pmd-java/src/main/resources/category/java/performance.xml b/pmd-java/src/main/resources/category/java/performance.xml index f894facca7..da96595d85 100644 --- a/pmd-java/src/main/resources/category/java/performance.xml +++ b/pmd-java/src/main/resources/category/java/performance.xml @@ -17,7 +17,7 @@ Rules that flag suboptimal code. externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_performance.html#addemptystring"> The conversion of literals to strings by concatenating them with empty strings is inefficient. -It is much better to use one of the type-specific toString() methods instead. +It is much better to use one of the type-specific `toString()` methods instead or `String.valuef()`. 3 @@ -27,7 +27,11 @@ It is much better to use one of the type-specific toString() methods instead. diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/AddEmptyString.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/AddEmptyString.xml index bee7b38177..aa3b071b1c 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/AddEmptyString.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/AddEmptyString.xml @@ -3,73 +3,7 @@ xmlns="http://pmd.sourceforge.net/rule-tests" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sourceforge.net/rule-tests http://pmd.sourceforge.net/rule-tests_1_0_0.xsd"> - - Test case in issue 3625 - 1 - - - - Local Variables be empty String - 3 - - - - Local and global variables be empty String - 4 - - - - Test case in issue 3625 - 1 - - Bad add 1 @@ -116,6 +50,67 @@ public class Foo { @Deprecated(since = "" + VERSION) public void foo() { } +} + ]]> + + + + [java] AddEmptyString - false negative with empty var #3625 + 1 + 4 + + + + + Local Variables be empty String + 3 + 8,9,10 + + + + Local and global variables be empty String + 4 + 9,10,11,12 + From cfcfa32dfb506b08228af7ac2d6621a008f7ef6d Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 1 Jul 2022 10:55:01 +0200 Subject: [PATCH 19/34] [doc] Update release notes (#3984, #3625) --- 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 1d5530f711..a3a8efe793 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -25,10 +25,13 @@ Being based on a proper Antlr grammar, CPD can: * honor [comment-based suppressions](pmd_userdocs_cpd.html#suppression) ### Fixed Issues +* java-performance + * [#3625](https://github.com/pmd/pmd/issues/3625): \[java] AddEmptyString - false negative with empty var ### API Changes ### External Contributions +* [#3984](https://github.com/pmd/pmd/pull/3984): \[java] Fix AddEmptyString false-negative issue - [@LiGaOg](https://github.com/LiGaOg) * [#4017](https://github.com/pmd/pmd/pull/4017): Add Gherkin support to CPD - [@ASBrouwers](https://github.com/ASBrouwers) {% endtocmaker %} From f15cd8febc818ffcdd87ca30192138868938869b Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 1 Jul 2022 11:10:02 +0200 Subject: [PATCH 20/34] [java] AddEmptyString - fix false positive with scoping --- pmd-java/src/main/resources/category/java/performance.xml | 2 +- .../pmd/lang/java/rule/performance/xml/AddEmptyString.xml | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pmd-java/src/main/resources/category/java/performance.xml b/pmd-java/src/main/resources/category/java/performance.xml index da96595d85..c696c2f0ee 100644 --- a/pmd-java/src/main/resources/category/java/performance.xml +++ b/pmd-java/src/main/resources/category/java/performance.xml @@ -28,7 +28,7 @@ It is much better to use one of the type-specific `toString()` methods instead o //AdditiveExpression/PrimaryExpression/PrimaryPrefix/Literal[@Image='""' and not(ancestor::Annotation)] | //AdditiveExpression/PrimaryExpression/PrimaryPrefix/Name - [@Image = //(LocalVariableDeclaration[@Final = true()]|FieldDeclaration[@Final = true()]) + [@Image = (//FieldDeclaration[@Final = true()]|ancestor::MethodDeclaration//LocalVariableDeclaration[@Final = true()]) /VariableDeclarator[@Initializer = true()] [VariableInitializer/Expression/PrimaryExpression/PrimaryPrefix/Literal[@Image='""']] /VariableDeclaratorId/@Name] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/AddEmptyString.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/AddEmptyString.xml index aa3b071b1c..052a50f8ef 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/AddEmptyString.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/AddEmptyString.xml @@ -102,7 +102,7 @@ class Main { final String outerString1 = ""; final String outerString2 = ""; - public static void main(String[] args) { + public static void main(String[] args, String otherString) { final String innerString1 = ""; final String innerString2 = ""; @@ -110,6 +110,11 @@ class Main { String b = outerString2 + 514; String c = innerString1 + 1919; String d = innerString2 + 810; + String e = otherString + 42; // should not be flagged, otherString is a method parameter. Not to be confused with otherString local var in otherMethod + } + + void otherMethod() { + final String otherString = ""; } } ]]> From 6fb5b3b9600faa3868983506f398d8e921c1fb29 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 1 Jul 2022 12:20:23 +0200 Subject: [PATCH 21/34] [java] Improve WhileLoopWithLiteralBoolean (#3988) --- .../resources/category/java/bestpractices.xml | 29 +++- .../xml/WhileLoopWithLiteralBoolean.xml | 147 ++++++++++++++++-- 2 files changed, 161 insertions(+), 15 deletions(-) diff --git a/pmd-java/src/main/resources/category/java/bestpractices.xml b/pmd-java/src/main/resources/category/java/bestpractices.xml index 02b12612c4..e865f684e4 100644 --- a/pmd-java/src/main/resources/category/java/bestpractices.xml +++ b/pmd-java/src/main/resources/category/java/bestpractices.xml @@ -2172,8 +2172,33 @@ a block `{}` is sufficient. = 1]] +| +(: while loops with conditional and'ed boolean literals, maybe parenthesized :) +//WhileStatement[Expression/(AndExpression|ConditionalAndExpression|(PrimaryExpression/PrimaryPrefix/Expression/(AndExpression|ConditionalAndExpression))) + (: at least one false literal :) + [count(PrimaryExpression/PrimaryPrefix/Literal/BooleanLiteral[@True = false()]) >= 1]] +| +(: do-while loops with conditional or'ed boolean literals, maybe parenthesized :) +//DoStatement[Expression/(InclusiveOrExpression|ConditionalOrExpression|(PrimaryExpression/PrimaryPrefix/Expression/(InclusiveOrExpression|ConditionalOrExpression))) + [count(PrimaryExpression/PrimaryPrefix/Literal/BooleanLiteral) = 2]] +| +(: do-while loops with conditional and'ed boolean literals, maybe parenthesized :) +//DoStatement[Expression/(AndExpression|ConditionalAndExpression|(PrimaryExpression/PrimaryPrefix/Expression/(AndExpression|ConditionalAndExpression))) + (: at least one false literal :) + [count(PrimaryExpression/PrimaryPrefix/Literal/BooleanLiteral[@True = false()]) >= 1 + (: or two true literals (e.g. true & true) :) + or count(PrimaryExpression/PrimaryPrefix/Literal/BooleanLiteral[@True = true()]) = 2]] ]]> diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/WhileLoopWithLiteralBoolean.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/WhileLoopWithLiteralBoolean.xml index f3fcd6018f..36b063fd31 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/WhileLoopWithLiteralBoolean.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/WhileLoopWithLiteralBoolean.xml @@ -6,13 +6,31 @@ do while true - 1 - 3 + 2 + 3,5 + + + + do while true | true + 4 + 3,4,5,6 + @@ -20,41 +38,48 @@ class Foo { do while false - 1 - 3 + 2 + 3,5 - do while false | false - 1 - 3 + do while false | false #3455 + 2 + 3,5 - do while false || false - 1 - 3 + do while false || false #3455 + 2 + 3,6 @@ -74,7 +99,7 @@ class Foo { - while true + while true - allowed 0 while false - 1 - 3 + 2 + 3,5 + + + + while false | false + 4 + 3,4,5,6 + @@ -112,4 +155,82 @@ class Foo { } ]]> + + + conditional or with only one boolean literal + 0 + + + + + conditional and with only one boolean literal + 3 + 3,4,5 + + + + + conditional-and boolean literal + 28 + 10,11,12,13,14,15,16,17,18,19,20,21,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39 + + From c82505353c8e95abc667f9bde85a75d4323d55b0 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 1 Jul 2022 12:23:25 +0200 Subject: [PATCH 22/34] [doc] Update release notes (#3455, #3988) --- 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 1d5530f711..2ad229b0d4 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -25,10 +25,13 @@ Being based on a proper Antlr grammar, CPD can: * honor [comment-based suppressions](pmd_userdocs_cpd.html#suppression) ### Fixed Issues +* java-bestpractices + * [#3455](https://github.com/pmd/pmd/issues/3455): \[java] WhileLoopWithLiteralBoolean - false negative with complex expressions ### API Changes ### External Contributions +* [#3988](https://github.com/pmd/pmd/pull/3988): \[java] Modify WhileLoopWithLiteralBoolean to meet the missing case #3455 - [@VoidxHoshi](https://github.com/VoidxHoshi) * [#4017](https://github.com/pmd/pmd/pull/4017): Add Gherkin support to CPD - [@ASBrouwers](https://github.com/ASBrouwers) {% endtocmaker %} From 7557abb739aefefe456274de2aafae5e9e87e3be Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 1 Jul 2022 12:25:13 +0200 Subject: [PATCH 23/34] Update pmd-java/src/main/resources/category/java/performance.xml --- pmd-java/src/main/resources/category/java/performance.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-java/src/main/resources/category/java/performance.xml b/pmd-java/src/main/resources/category/java/performance.xml index c696c2f0ee..d211ac31b4 100644 --- a/pmd-java/src/main/resources/category/java/performance.xml +++ b/pmd-java/src/main/resources/category/java/performance.xml @@ -17,7 +17,7 @@ Rules that flag suboptimal code. externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_performance.html#addemptystring"> The conversion of literals to strings by concatenating them with empty strings is inefficient. -It is much better to use one of the type-specific `toString()` methods instead or `String.valuef()`. +It is much better to use one of the type-specific `toString()` methods instead or `String.valueOf()`. 3 From 82245b07947ad2e5307a0c941f4ca7c970689647 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 1 Jul 2022 14:43:46 +0200 Subject: [PATCH 24/34] [core] Fix compile errors with PlainTextLanguage --- .../pmd/lang/PlainTextLanguage.java | 107 ++++++------------ 1 file changed, 37 insertions(+), 70 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/PlainTextLanguage.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/PlainTextLanguage.java index 830ddd2d77..61b6c815b1 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/PlainTextLanguage.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/PlainTextLanguage.java @@ -4,24 +4,12 @@ package net.sourceforge.pmd.lang; -import java.io.IOException; -import java.io.Reader; -import java.util.Collections; -import java.util.Map; - -import net.sourceforge.pmd.Rule; -import net.sourceforge.pmd.RuleContext; -import net.sourceforge.pmd.RuleViolation; import net.sourceforge.pmd.annotation.Experimental; -import net.sourceforge.pmd.lang.ast.AbstractNode; -import net.sourceforge.pmd.lang.ast.Node; -import net.sourceforge.pmd.lang.ast.ParseException; +import net.sourceforge.pmd.lang.ast.AstInfo; +import net.sourceforge.pmd.lang.ast.Parser; import net.sourceforge.pmd.lang.ast.RootNode; import net.sourceforge.pmd.lang.ast.SourceCodePositioner; -import net.sourceforge.pmd.lang.rule.AbstractRuleViolationFactory; -import net.sourceforge.pmd.lang.rule.ParametricRuleViolation; -import net.sourceforge.pmd.lang.rule.RuleViolationFactory; -import net.sourceforge.pmd.util.IOUtil; +import net.sourceforge.pmd.lang.ast.impl.AbstractNode; /** * A dummy language implementation whose parser produces a single node. @@ -52,57 +40,10 @@ public final class PlainTextLanguage extends BaseLanguageModule { return INSTANCE; } - private static class TextLvh extends AbstractLanguageVersionHandler { - - private static final RuleViolationFactory RV_FACTORY = new AbstractRuleViolationFactory() { - @Override - protected RuleViolation createRuleViolation(Rule rule, RuleContext ruleContext, Node node, String s) { - return new ParametricRuleViolation<>(rule, ruleContext, node, s); - } - - @Override - protected RuleViolation createRuleViolation(Rule rule, RuleContext ruleContext, Node node, String s, int i, int i1) { - return new ParametricRuleViolation<>(rule, ruleContext, node, s); - } - }; - + private static class TextLvh implements LanguageVersionHandler { @Override - public RuleViolationFactory getRuleViolationFactory() { - return RV_FACTORY; - } - - @Override - public Parser getParser(final ParserOptions parserOptions) { - return new Parser() { - @Override - public ParserOptions getParserOptions() { - return parserOptions; - } - - @Override - public TokenManager getTokenManager(String s, Reader reader) { - return null; - } - - @Override - public boolean canParse() { - return true; - } - - @Override - public Node parse(String s, Reader reader) throws ParseException { - try { - return new PlainTextFile(IOUtil.readToString(reader)); - } catch (IOException e) { - throw new ParseException(e); - } - } - - @Override - public Map getSuppressMap() { - return Collections.emptyMap(); - } - }; + public Parser getParser() { + return parserTask -> new PlainTextFile(parserTask); } } @@ -110,14 +51,20 @@ public final class PlainTextLanguage extends BaseLanguageModule { * The only node produced by the parser of {@link PlainTextLanguage}. */ public static final class PlainTextFile extends AbstractNode implements RootNode { + private final int beginLine; + private final int beginColumn; + private final int endLine; + private final int endColumn; - PlainTextFile(String fileText) { - super(0); - SourceCodePositioner positioner = new SourceCodePositioner(fileText); + private final AstInfo astInfo; + + PlainTextFile(Parser.ParserTask parserTask) { + SourceCodePositioner positioner = new SourceCodePositioner(parserTask.getSourceText()); this.beginLine = 1; this.beginColumn = 1; this.endLine = positioner.getLastLine(); this.endColumn = positioner.getLastLineColumn(); + this.astInfo = new AstInfo<>(parserTask, this); } @Override @@ -131,8 +78,23 @@ public final class PlainTextLanguage extends BaseLanguageModule { } @Override - public void setImage(String image) { - throw new UnsupportedOperationException(); + public int getBeginLine() { + return beginLine; + } + + @Override + public int getBeginColumn() { + return beginColumn; + } + + @Override + public int getEndLine() { + return endLine; + } + + @Override + public int getEndColumn() { + return endColumn; } @Override @@ -149,6 +111,11 @@ public final class PlainTextLanguage extends BaseLanguageModule { public String toString() { return "Plain text file (" + endLine + "lines)"; } + + @Override + public AstInfo getAstInfo() { + return astInfo; + } } } From f8e9adf2c55a8f01f85966ba25351792862a18f2 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 1 Jul 2022 14:56:33 +0200 Subject: [PATCH 25/34] [java] Fix WhileLoopWithLiteralBoolean tests --- pmd-java/src/main/resources/category/java/bestpractices.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pmd-java/src/main/resources/category/java/bestpractices.xml b/pmd-java/src/main/resources/category/java/bestpractices.xml index 2ef92f8b99..7b023fe06d 100644 --- a/pmd-java/src/main/resources/category/java/bestpractices.xml +++ b/pmd-java/src/main/resources/category/java/bestpractices.xml @@ -1837,7 +1837,7 @@ a block `{}` is sufficient. [count(BooleanLiteral[@True = false()]) >= 1]] | (: while loops with conditional and'ed boolean literals, maybe parenthesized :) -//WhileStatement[(.|InfixExpression[@Operator=('&', '&&')]) +//WhileStatement[(InfixExpression[@Operator=('&', '&&')]) (: at least one false literal :) [count(BooleanLiteral[@True = false()]) >= 1]] | @@ -1846,7 +1846,7 @@ a block `{}` is sufficient. [count(BooleanLiteral) = 2]] | (: do-while loops with conditional and'ed boolean literals, maybe parenthesized :) -//DoStatement[(.|InfixExpression[@Operator=('&', '&&')]) +//DoStatement[(InfixExpression[@Operator=('&', '&&')]) (: at least one false literal :) [count(BooleanLiteral[@True = false()]) >= 1]] ]]> From c79db6e5f3d5943eeedcba7b4aa033f23351c7ca Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 1 Jul 2022 14:59:39 +0200 Subject: [PATCH 26/34] [kotlin] Mark kotlin language module @Experimental --- .../net/sourceforge/pmd/lang/kotlin/KotlinLanguageModule.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/KotlinLanguageModule.java b/pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/KotlinLanguageModule.java index e8b9c7fe50..6f67a40ae2 100644 --- a/pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/KotlinLanguageModule.java +++ b/pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/KotlinLanguageModule.java @@ -4,11 +4,15 @@ package net.sourceforge.pmd.lang.kotlin; +import net.sourceforge.pmd.annotation.Experimental; import net.sourceforge.pmd.lang.BaseLanguageModule; /** * Language Module for Kotlin + * + *

Note: Kotlin support is considered an experimental feature. The AST structure might change.

*/ +@Experimental public class KotlinLanguageModule extends BaseLanguageModule { /** The name. */ From a7340fce4c13c16a4a5e9b35dae7f3a1c4a9080b Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 1 Jul 2022 15:09:46 +0200 Subject: [PATCH 27/34] [gherkin] Migrate to PMD 7 --- pmd-gherkin/pom.xml | 2 +- .../lang/gherkin/cpd/GherkinTokenizer.java | 10 +- .../gherkin/cpd/testdata/annotatedSource.txt | 1124 ++++++++--------- .../lang/gherkin/cpd/testdata/docstring.txt | 20 +- 4 files changed, 575 insertions(+), 581 deletions(-) diff --git a/pmd-gherkin/pom.xml b/pmd-gherkin/pom.xml index e49be3647b..0d9cb40112 100644 --- a/pmd-gherkin/pom.xml +++ b/pmd-gherkin/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 6.48.0-SNAPSHOT + 7.0.0-SNAPSHOT ../pom.xml diff --git a/pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/cpd/GherkinTokenizer.java b/pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/cpd/GherkinTokenizer.java index a883344b1f..485be4bf2d 100644 --- a/pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/cpd/GherkinTokenizer.java +++ b/pmd-gherkin/src/main/java/net/sourceforge/pmd/lang/gherkin/cpd/GherkinTokenizer.java @@ -6,10 +6,9 @@ package net.sourceforge.pmd.lang.gherkin.cpd; import org.antlr.v4.runtime.CharStream; -import net.sourceforge.pmd.cpd.AntlrTokenizer; import net.sourceforge.pmd.cpd.SourceCode; -import net.sourceforge.pmd.cpd.token.AntlrTokenFilter; -import net.sourceforge.pmd.lang.antlr.AntlrTokenManager; +import net.sourceforge.pmd.cpd.internal.AntlrTokenizer; +import net.sourceforge.pmd.lang.ast.impl.antlr4.AntlrTokenManager; import net.sourceforge.pmd.lang.gherkin.ast.GherkinLexer; /** @@ -22,9 +21,4 @@ public class GherkinTokenizer extends AntlrTokenizer { CharStream charStream = AntlrTokenizer.getCharStreamFromSourceCode(sourceCode); return new AntlrTokenManager(new GherkinLexer(charStream), sourceCode.getFileName()); } - - @Override - protected AntlrTokenFilter getTokenFilter(final AntlrTokenManager tokenManager) { - return new AntlrTokenFilter(tokenManager); - } } diff --git a/pmd-gherkin/src/test/resources/net/sourceforge/pmd/lang/gherkin/cpd/testdata/annotatedSource.txt b/pmd-gherkin/src/test/resources/net/sourceforge/pmd/lang/gherkin/cpd/testdata/annotatedSource.txt index 1d01cc3e6a..cf05f81f6b 100644 --- a/pmd-gherkin/src/test/resources/net/sourceforge/pmd/lang/gherkin/cpd/testdata/annotatedSource.txt +++ b/pmd-gherkin/src/test/resources/net/sourceforge/pmd/lang/gherkin/cpd/testdata/annotatedSource.txt @@ -1,637 +1,637 @@ [Image] or [Truncated image[ Bcol Ecol L1 - [@AnnotatedSource] 1 16 - [\n] 18 18 + [@AnnotatedSource] 1 17 + [\n] 18 19 L2 - [Feature:] 1 8 - [Annotated] 10 18 - [Source] 20 25 - [\n] 26 26 + [Feature:] 1 9 + [Annotated] 10 19 + [Source] 20 26 + [\n] 26 27 L3 - [The] 3 5 - [annotated] 7 15 - [source] 17 22 - [displays] 24 31 - [violations] 33 42 - [in] 44 45 - [the] 47 49 - [source] 51 56 - [file.] 58 62 - [It] 64 65 - [opens] 67 71 - [in] 73 74 - [a] 76 76 - [new] 78 80 - [window.] 82 88 - [\n] 89 89 + [The] 3 6 + [annotated] 7 16 + [source] 17 23 + [displays] 24 32 + [violations] 33 43 + [in] 44 46 + [the] 47 50 + [source] 51 57 + [file.] 58 63 + [It] 64 66 + [opens] 67 72 + [in] 73 75 + [a] 76 77 + [new] 78 81 + [window.] 82 89 + [\n] 89 90 L4 - [\n] 3 3 + [\n] 3 4 L5 - [Rules:] 3 8 - [\n] 9 9 + [Rules:] 3 9 + [\n] 9 10 L6 - [1] 3 3 - [Annotation] 5 14 - [metrics] 16 22 - [can] 24 26 - [be] 28 29 - [selected] 31 38 - [with] 40 43 - [a] 45 45 - [dropdown] 47 54 - [menu.] 56 60 - [Only] 62 65 - [enabled] 67 73 - [metrics] 75 81 - [must] 83 86 - [be] 88 89 - [shown.] 91 96 - [\n] 97 97 + [1] 3 4 + [Annotation] 5 15 + [metrics] 16 23 + [can] 24 27 + [be] 28 30 + [selected] 31 39 + [with] 40 44 + [a] 45 46 + [dropdown] 47 55 + [menu.] 56 61 + [Only] 62 66 + [enabled] 67 74 + [metrics] 75 82 + [must] 83 87 + [be] 88 90 + [shown.] 91 97 + [\n] 97 98 L7 - [2] 3 3 - [When] 5 8 - [the] 10 12 - [annotated] 14 22 - [source] 24 29 - [is] 31 32 - [opened] 34 39 - [while] 41 45 - [a] 47 47 - [specific] 49 56 - [metric] 58 63 - [is] 65 66 - [selected,] 68 76 - [only] 78 81 - [that] 83 86 - [metric] 88 93 - [should] 95 100 - [be] 102 103 - [selected.] 105 113 - [\n] 114 114 + [2] 3 4 + [When] 5 9 + [the] 10 13 + [annotated] 14 23 + [source] 24 30 + [is] 31 33 + [opened] 34 40 + [while] 41 46 + [a] 47 48 + [specific] 49 57 + [metric] 58 64 + [is] 65 67 + [selected,] 68 77 + [only] 78 82 + [that] 83 87 + [metric] 88 94 + [should] 95 101 + [be] 102 104 + [selected.] 105 114 + [\n] 114 115 L8 - [3] 3 3 - [A] 5 5 - [user] 7 10 - [can] 12 14 - [scroll] 16 21 - [through] 23 29 - [the] 31 33 - [violations] 35 44 - [using] 46 50 - [two] 52 54 - [buttons] 56 62 - [(illustrated] 64 75 - [by] 77 78 - [up] 80 81 - [and] 83 85 - [down] 87 90 - [arrows).] 92 99 - [The] 101 103 - [arrows] 105 110 - [wrap] 112 115 - [around] 117 122 - [the] 124 126 - [document.] 128 136 - [\n] 137 137 + [3] 3 4 + [A] 5 6 + [user] 7 11 + [can] 12 15 + [scroll] 16 22 + [through] 23 30 + [the] 31 34 + [violations] 35 45 + [using] 46 51 + [two] 52 55 + [buttons] 56 63 + [(illustrated] 64 76 + [by] 77 79 + [up] 80 82 + [and] 83 86 + [down] 87 91 + [arrows).] 92 100 + [The] 101 104 + [arrows] 105 111 + [wrap] 112 116 + [around] 117 123 + [the] 124 127 + [document.] 128 137 + [\n] 137 138 L9 - [4] 3 3 - [The] 5 7 - [table] 9 13 - [collumn] 15 21 - ["Type"] 23 28 - [is] 30 31 - [only] 33 36 - [shown] 38 42 - [when] 44 47 - [multiple] 49 56 - [metrics] 58 64 - [are] 66 68 - [selected] 70 77 - [\n] 78 78 + [4] 3 4 + [The] 5 8 + [table] 9 14 + [collumn] 15 22 + ["Type"] 23 29 + [is] 30 32 + [only] 33 37 + [shown] 38 43 + [when] 44 48 + [multiple] 49 57 + [metrics] 58 65 + [are] 66 69 + [selected] 70 78 + [\n] 78 79 L10 - [\n] 1 1 + [\n] 1 2 L11 - [Scenario:] 3 11 - [Select] 13 18 - [a] 20 20 - [metric] 22 27 - [type] 29 32 - [\n] 33 33 + [Scenario:] 3 12 + [Select] 13 19 + [a] 20 21 + [metric] 22 28 + [type] 29 33 + [\n] 33 34 L12 - [Given] 4 8 - [the] 10 12 - [Annotated] 14 22 - [Source] 24 29 - [for] 31 33 - [file] 35 38 - ["HIE://11261-37/main/monop/execute[ 40 76 - [\n] 77 77 + [Given] 4 9 + [the] 10 13 + [Annotated] 14 23 + [Source] 24 30 + [for] 31 34 + [file] 35 39 + ["HIE://11261-37/main/monop/execute[ 40 77 + [\n] 77 78 L13 - [When] 5 8 - [a] 10 10 - [user] 12 15 - [opens] 17 21 - [the] 23 25 - [dropdown] 27 34 - [menu] 36 39 - [containing] 41 50 - ["Metric:"] 52 60 - [\n] 61 61 + [When] 5 9 + [a] 10 11 + [user] 12 16 + [opens] 17 22 + [the] 23 26 + [dropdown] 27 35 + [menu] 36 40 + [containing] 41 51 + ["Metric:"] 52 61 + [\n] 61 62 L14 - [And] 6 8 - [the] 10 12 - [user] 14 17 - [clicks] 19 24 - [on] 26 27 - [the] 29 31 - [dropdown] 33 40 - [option] 42 47 - ["Violations/Coding] 49 66 - [Standard] 68 75 - [Violations"] 77 87 - [\n] 88 88 + [And] 6 9 + [the] 10 13 + [user] 14 18 + [clicks] 19 25 + [on] 26 28 + [the] 29 32 + [dropdown] 33 41 + [option] 42 48 + ["Violations/Coding] 49 67 + [Standard] 68 76 + [Violations"] 77 88 + [\n] 88 89 L15 - [Then] 5 8 - [the] 10 12 - [selected] 14 21 - [annotation] 23 32 - [in] 34 35 - [the] 37 39 - [source] 41 46 - [code] 48 51 - [should] 53 58 - [be] 60 61 - [on] 63 64 - [line] 66 69 - [38] 71 72 - [\n] 74 74 + [Then] 5 9 + [the] 10 13 + [selected] 14 22 + [annotation] 23 33 + [in] 34 36 + [the] 37 40 + [source] 41 47 + [code] 48 52 + [should] 53 59 + [be] 60 62 + [on] 63 65 + [line] 66 70 + [38] 71 73 + [\n] 74 75 L16 - [And] 6 8 - [the] 10 12 - [selected] 14 21 - [annotation] 23 32 - [in] 34 35 - [the] 37 39 - [table] 41 45 - [should] 47 52 - [be] 54 55 - [on] 57 58 - [line] 60 63 - [38] 65 66 - [\n] 67 67 + [And] 6 9 + [the] 10 13 + [selected] 14 22 + [annotation] 23 33 + [in] 34 36 + [the] 37 40 + [table] 41 46 + [should] 47 53 + [be] 54 56 + [on] 57 59 + [line] 60 64 + [38] 65 67 + [\n] 67 68 L17 - [\n] 1 1 + [\n] 1 2 L18 - [Scenario:] 3 11 - [The] 13 15 - [user] 17 20 - [can] 22 24 - [use] 26 28 - [the] 30 32 - [arrows,] 34 40 - [or] 42 43 - ["a"] 45 47 - [and] 49 51 - ["z"] 53 55 - [keys,] 57 61 - [to] 63 64 - [scroll] 66 71 - [through] 73 79 - [the] 81 83 - [annotations] 85 95 - [\n] 96 96 + [Scenario:] 3 12 + [The] 13 16 + [user] 17 21 + [can] 22 25 + [use] 26 29 + [the] 30 33 + [arrows,] 34 41 + [or] 42 44 + ["a"] 45 48 + [and] 49 52 + ["z"] 53 56 + [keys,] 57 62 + [to] 63 65 + [scroll] 66 72 + [through] 73 80 + [the] 81 84 + [annotations] 85 96 + [\n] 96 97 L19 - [Given] 3 7 - [the] 9 11 - [Annotated] 13 21 - [Source] 23 28 - [for] 30 32 - [file] 34 37 - ["HIE://11261-37/main/monop/execute[ 39 75 - [\n] 76 76 + [Given] 3 8 + [the] 9 12 + [Annotated] 13 22 + [Source] 23 29 + [for] 30 33 + [file] 34 38 + ["HIE://11261-37/main/monop/execute[ 39 76 + [\n] 76 77 L20 - [And] 5 7 - [metric] 9 14 - ["Coding] 16 22 - [Standard] 24 31 - [Violation] 33 41 - [Annotations"] 43 54 - [is] 56 57 - [selected] 59 66 - [\n] 67 67 + [And] 5 8 + [metric] 9 15 + ["Coding] 16 23 + [Standard] 24 32 + [Violation] 33 42 + [Annotations"] 43 55 + [is] 56 58 + [selected] 59 67 + [\n] 67 68 L21 - [When] 4 7 - [the] 9 11 - [user] 13 16 - [clicks] 18 23 - [on] 25 26 - [the] 28 30 - [down] 32 35 - [arrow] 37 41 - [\n] 42 42 + [When] 4 8 + [the] 9 12 + [user] 13 17 + [clicks] 18 24 + [on] 25 27 + [the] 28 31 + [down] 32 36 + [arrow] 37 42 + [\n] 42 43 L22 - [And] 5 7 - [the] 9 11 - [user] 13 16 - [presses] 18 24 - [the] 26 28 - ["Z"] 30 32 - [key] 34 36 - [\n] 37 37 + [And] 5 8 + [the] 9 12 + [user] 13 17 + [presses] 18 25 + [the] 26 29 + ["Z"] 30 33 + [key] 34 37 + [\n] 37 38 L23 - [And] 5 7 - [the] 9 11 - [user] 13 16 - [clicks] 18 23 - [on] 25 26 - [the] 28 30 - [up] 32 33 - [arrow] 35 39 - [\n] 40 40 + [And] 5 8 + [the] 9 12 + [user] 13 17 + [clicks] 18 24 + [on] 25 27 + [the] 28 31 + [up] 32 34 + [arrow] 35 40 + [\n] 40 41 L24 - [And] 5 7 - [the] 9 11 - [user] 13 16 - [clicks] 18 23 - [on] 25 26 - [the] 28 30 - [up] 32 33 - [arrow] 35 39 - [\n] 40 40 + [And] 5 8 + [the] 9 12 + [user] 13 17 + [clicks] 18 24 + [on] 25 27 + [the] 28 31 + [up] 32 34 + [arrow] 35 40 + [\n] 40 41 L25 - [And] 5 7 - [the] 9 11 - [user] 13 16 - [presses] 18 24 - [the] 26 28 - ["A"] 30 32 - [key] 34 36 - [\n] 37 37 + [And] 5 8 + [the] 9 12 + [user] 13 17 + [presses] 18 25 + [the] 26 29 + ["A"] 30 33 + [key] 34 37 + [\n] 37 38 L26 - [Then] 4 7 - [the] 9 11 - [selected] 13 20 - [annotation] 22 31 - [in] 33 34 - [the] 36 38 - [source] 40 45 - [code] 47 50 - [should] 52 57 - [be] 59 60 - [on] 62 63 - [line] 65 68 - [254] 70 72 - [\n] 74 74 + [Then] 4 8 + [the] 9 12 + [selected] 13 21 + [annotation] 22 32 + [in] 33 35 + [the] 36 39 + [source] 40 46 + [code] 47 51 + [should] 52 58 + [be] 59 61 + [on] 62 64 + [line] 65 69 + [254] 70 73 + [\n] 74 75 L27 - [\n] 1 1 + [\n] 1 2 L28 - [@Rule2] 3 8 - [\n] 9 9 + [@Rule2] 3 9 + [\n] 9 10 L29 - [Scenario Outline:] 3 19 - [If] 21 22 - [the] 24 26 - [user] 28 31 - [opens] 33 37 - [the] 39 41 - [annotated] 43 51 - [source] 53 58 - [from] 60 63 - [e.g.] 65 68 - [the] 70 72 - [dashboard] 74 82 - [for] 84 86 - [a] 88 88 - [metric,] 90 96 - [\n] 97 97 + [Scenario Outline:] 3 20 + [If] 21 23 + [the] 24 27 + [user] 28 32 + [opens] 33 38 + [the] 39 42 + [annotated] 43 52 + [source] 53 59 + [from] 60 64 + [e.g.] 65 69 + [the] 70 73 + [dashboard] 74 83 + [for] 84 87 + [a] 88 89 + [metric,] 90 97 + [\n] 97 98 L30 - [only] 5 8 - [the] 10 12 - [related] 14 20 - [annotations] 22 32 - [should] 34 39 - [be] 41 42 - [shown.] 44 49 - [\n] 50 50 + [only] 5 9 + [the] 10 13 + [related] 14 21 + [annotations] 22 33 + [should] 34 40 + [be] 41 43 + [shown.] 44 50 + [\n] 50 51 L31 - [Given] 3 7 - [the] 9 11 - [Dashboard] 13 21 - [\n] 22 22 + [Given] 3 8 + [the] 9 12 + [Dashboard] 13 22 + [\n] 22 23 L32 - [And] 5 7 - [filtering] 9 17 - [by] 19 20 - [Project] 22 28 - ["17607"] 30 36 - [\n] 37 37 + [And] 5 8 + [filtering] 9 18 + [by] 19 21 + [Project] 22 29 + ["17607"] 30 37 + [\n] 37 38 L33 - [And] 5 7 - [grouping] 9 16 - [by] 18 19 - ["File"] 21 26 - [\n] 27 27 + [And] 5 8 + [grouping] 9 17 + [by] 18 20 + ["File"] 21 27 + [\n] 27 28 L34 - [And] 5 7 - [metric] 9 14 - [""] 16 25 - [is] 27 28 - [selected] 30 37 - [\n] 38 38 + [And] 5 8 + [metric] 9 15 + [""] 16 26 + [is] 27 29 + [selected] 30 38 + [\n] 38 39 L35 - [When] 4 7 - [a] 9 9 - [user] 11 14 - [opens] 16 20 - [the] 22 24 - [file] 26 29 - ["clalgorithm_settings.c"] 31 54 - [using] 56 60 - [the] 62 64 - [metric] 66 71 - [table] 73 77 - [\n] 78 78 + [When] 4 8 + [a] 9 10 + [user] 11 15 + [opens] 16 21 + [the] 22 25 + [file] 26 30 + ["clalgorithm_settings.c"] 31 55 + [using] 56 61 + [the] 62 65 + [metric] 66 72 + [table] 73 78 + [\n] 78 79 L36 - [Then] 4 7 - [a] 9 9 - [new] 11 13 - [browser] 15 21 - [window] 23 28 - [with] 30 33 - [an] 35 36 - ["Annotated] 38 47 - [Source"] 49 55 - [should] 57 62 - [be] 64 65 - [opened] 67 72 - [\n] 75 75 + [Then] 4 8 + [a] 9 10 + [new] 11 14 + [browser] 15 22 + [window] 23 29 + [with] 30 34 + [an] 35 37 + ["Annotated] 38 48 + [Source"] 49 56 + [should] 57 63 + [be] 64 66 + [opened] 67 73 + [\n] 75 76 L37 - [Then] 4 7 - [only] 9 12 - [the] 14 16 - [annotations] 18 28 - [""] 30 44 - [should] 46 51 - [be] 53 54 - [selected] 56 63 - [\n] 64 64 + [Then] 4 8 + [only] 9 13 + [the] 14 17 + [annotations] 18 29 + [""] 30 45 + [should] 46 52 + [be] 53 55 + [selected] 56 64 + [\n] 64 65 L38 - [\n] 4 4 + [\n] 4 5 L39 - [Examples:] 3 11 - [\n] 12 12 + [Examples:] 3 12 + [\n] 12 13 L40 - [| metric ] 3 31 - [| annotations [ 32 71 - [|] 72 72 - [\n] 73 73 + [| metric ] 3 32 + [| annotations [ 32 72 + [|] 72 73 + [\n] 73 74 L41 - [| TQI Coding Standards ] 3 31 - [| Coding Standard Violation Annota[ 32 71 - [|] 72 72 - [\n] 75 75 + [| TQI Coding Standards ] 3 32 + [| Coding Standard Violation Annota[ 32 72 + [|] 72 73 + [\n] 75 76 L42 - [| Coding Standard Violations ] 3 31 - [| Coding Standard Violation Annota[ 32 71 - [|] 72 72 - [\n] 75 75 + [| Coding Standard Violations ] 3 32 + [| Coding Standard Violation Annota[ 32 72 + [|] 72 73 + [\n] 75 76 L43 - [| TQI Compiler Warnings ] 3 31 - [| Compiler Warning Annotations [ 32 71 - [|] 72 72 - [\n] 75 75 + [| TQI Compiler Warnings ] 3 32 + [| Compiler Warning Annotations [ 32 72 + [|] 72 73 + [\n] 75 76 L44 - [| Fan Out (%) ] 3 31 - [| Fan Out Annotations [ 32 71 - [|] 72 72 - [\n] 75 75 + [| Fan Out (%) ] 3 32 + [| Fan Out Annotations [ 32 72 + [|] 72 73 + [\n] 75 76 L45 - [| TQI Dead Code ] 3 31 - [| Dead Code Annotations [ 32 71 - [|] 72 72 - [\n] 75 75 + [| TQI Dead Code ] 3 32 + [| Dead Code Annotations [ 32 72 + [|] 72 73 + [\n] 75 76 L46 - [| TQI Code Duplication ] 3 31 - [| Code Duplication Annotations [ 32 71 - [|] 72 72 - [\n] 73 73 + [| TQI Code Duplication ] 3 32 + [| Code Duplication Annotations [ 32 72 + [|] 72 73 + [\n] 73 74 L47 - [\n] 3 3 + [\n] 3 4 L48 - [Scenario:] 3 11 - [The] 13 15 - [user] 17 20 - [should] 22 27 - [be] 29 30 - [able] 32 35 - [to] 37 38 - [filter] 40 45 - [Coding] 47 52 - [Standard] 54 61 - [Violations] 63 72 - [by] 74 75 - [Level] 77 81 - [\n] 82 82 + [Scenario:] 3 12 + [The] 13 16 + [user] 17 21 + [should] 22 28 + [be] 29 31 + [able] 32 36 + [to] 37 39 + [filter] 40 46 + [Coding] 47 53 + [Standard] 54 62 + [Violations] 63 73 + [by] 74 76 + [Level] 77 82 + [\n] 82 83 L49 - [Given] 5 9 - [the] 11 13 - [Annotated] 15 23 - [Source] 25 30 - [for] 32 34 - [file] 36 39 - ["HIE://11514/trunk/components/java[ 41 125 - [\n] 126 126 + [Given] 5 10 + [the] 11 14 + [Annotated] 15 24 + [Source] 25 31 + [for] 32 35 + [file] 36 40 + ["HIE://11514/trunk/components/java[ 41 126 + [\n] 126 127 L50 - [And] 5 7 - [the] 11 13 - [metric] 15 20 - ["Coding] 22 28 - [Standard] 30 37 - [Violations"] 39 49 - [is] 51 52 - [selected] 54 61 - [\n] 62 62 + [And] 5 8 + [the] 11 14 + [metric] 15 21 + ["Coding] 22 29 + [Standard] 30 38 + [Violations"] 39 50 + [is] 51 53 + [selected] 54 62 + [\n] 62 63 L51 - [When] 5 8 - [the] 11 13 - [user] 15 18 - [opens] 20 24 - [the] 26 28 - [dropdown] 30 37 - [menu] 39 42 - ["Level"] 44 50 - [\n] 51 51 + [When] 5 9 + [the] 11 14 + [user] 15 19 + [opens] 20 25 + [the] 26 29 + [dropdown] 30 38 + [menu] 39 43 + ["Level"] 44 51 + [\n] 51 52 L52 - [And] 5 7 - [the] 11 13 - [user] 15 18 - [clicks] 20 25 - [on] 27 28 - [the] 30 32 - [dropdown] 34 41 - [option] 43 48 - ["5"] 50 52 - [\n] 53 53 + [And] 5 8 + [the] 11 14 + [user] 15 19 + [clicks] 20 26 + [on] 27 29 + [the] 30 33 + [dropdown] 34 42 + [option] 43 49 + ["5"] 50 53 + [\n] 53 54 L53 - [Then] 5 8 - [there] 11 15 - [should] 17 22 - [be] 24 25 - [1] 27 27 - [violation] 29 37 - [\n] 38 38 + [Then] 5 9 + [there] 11 16 + [should] 17 23 + [be] 24 26 + [1] 27 28 + [violation] 29 38 + [\n] 38 39 L54 - [And] 5 7 - [the] 11 13 - [selected] 15 22 - [annotation] 24 33 - [in] 35 36 - [the] 38 40 - [source] 42 47 - [code] 49 52 - [should] 54 59 - [be] 61 62 - [on] 64 65 - [line] 67 70 - [57] 72 73 - [\n] 74 74 + [And] 5 8 + [the] 11 14 + [selected] 15 23 + [annotation] 24 34 + [in] 35 37 + [the] 38 41 + [source] 42 48 + [code] 49 53 + [should] 54 60 + [be] 61 63 + [on] 64 66 + [line] 67 71 + [57] 72 74 + [\n] 74 75 L55 - [And] 5 7 - [the] 11 13 - [annotation] 15 24 - [should] 26 31 - [be] 33 34 - [of] 36 37 - [level] 39 43 - [5] 45 45 - [\n] 47 47 + [And] 5 8 + [the] 11 14 + [annotation] 15 25 + [should] 26 32 + [be] 33 35 + [of] 36 38 + [level] 39 44 + [5] 45 46 + [\n] 47 48 L56 - [\n] 1 1 + [\n] 1 2 L57 - [@PR27030] 3 10 - [\n] 11 11 + [@PR27030] 3 11 + [\n] 11 12 L58 - [Scenario Outline:] 3 19 - [The] 21 23 - [user] 25 28 - [should] 30 35 - [be] 37 38 - [able] 40 43 - [to] 45 46 - [filter] 48 53 - [Coding] 55 60 - [Standard] 62 69 - [Violations] 71 80 - [by] 82 83 - [Level,] 85 90 - [Category,] 92 100 - [Rule,] 102 106 - [etc] 108 110 - [\n] 111 111 + [Scenario Outline:] 3 20 + [The] 21 24 + [user] 25 29 + [should] 30 36 + [be] 37 39 + [able] 40 44 + [to] 45 47 + [filter] 48 54 + [Coding] 55 61 + [Standard] 62 70 + [Violations] 71 81 + [by] 82 84 + [Level,] 85 91 + [Category,] 92 101 + [Rule,] 102 107 + [etc] 108 111 + [\n] 111 112 L59 - [Given] 5 9 - [the] 11 13 - [Annotated] 15 23 - [Source] 25 30 - [for] 32 34 - [file] 36 39 - ["HIE://12939/main/Implementatie/DR[ 41 107 - [\n] 108 108 + [Given] 5 10 + [the] 11 14 + [Annotated] 15 24 + [Source] 25 31 + [for] 32 35 + [file] 36 40 + ["HIE://12939/main/Implementatie/DR[ 41 108 + [\n] 108 109 L60 - [And] 5 7 - [metric] 9 14 - [""] 16 25 - [is] 27 28 - [selected] 30 37 - [\n] 38 38 + [And] 5 8 + [metric] 9 15 + [""] 16 26 + [is] 27 29 + [selected] 30 38 + [\n] 38 39 L61 - [When] 5 8 - [the] 10 12 - [user] 14 17 - [opens] 19 23 - [the] 25 27 - [dropdown] 29 36 - [menu] 38 41 - [containing] 43 52 - [""] 54 63 - [inside] 65 70 - [the] 72 74 - [filter] 76 81 - [bar] 83 85 - [\n] 86 86 + [When] 5 9 + [the] 10 13 + [user] 14 18 + [opens] 19 24 + [the] 25 28 + [dropdown] 29 37 + [menu] 38 42 + [containing] 43 53 + [""] 54 64 + [inside] 65 71 + [the] 72 75 + [filter] 76 82 + [bar] 83 86 + [\n] 86 87 L62 - [And] 5 7 - [the] 9 11 - [user] 13 16 - [clicks] 18 23 - [on] 25 26 - [the] 28 30 - [dropdown] 32 39 - [option] 41 46 - ["