From 65fef39a4cbf5ea6b74d8d4b15c3f01a4dd06a52 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Mon, 25 Jul 2022 21:43:54 -0700 Subject: [PATCH 01/96] Initial Lua type grammar --- .../sourceforge/pmd/lang/lua/antlr4/Lua.g4 | 77 +++++++++++++++++-- 1 file changed, 71 insertions(+), 6 deletions(-) diff --git a/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 b/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 index 59c0b86a60..12773b012a 100644 --- a/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 +++ b/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 @@ -71,12 +71,13 @@ chunk ; block - : stat* laststat? + : (stat ';'?)* (laststat ';'?)? ; stat : ';' | varlist '=' explist + | var compoundop exp | functioncall | label | 'break' @@ -85,11 +86,12 @@ stat | 'while' exp 'do' block 'end' | 'repeat' block 'until' exp | 'if' exp 'then' block ('elseif' exp 'then' block)* ('else' block)? 'end' - | 'for' NAME '=' exp ',' exp (',' exp)? 'do' block 'end' - | 'for' namelist 'in' explist 'do' block 'end' + | 'for' binding '=' exp ',' exp (',' exp)? 'do' block 'end' + | 'for' bindinglist 'in' explist 'do' block 'end' | 'function' funcname funcbody | 'local' 'function' NAME funcbody - | 'local' attnamelist ('=' explist)? + | 'local' bindinglist ('=' explist)? + | ('export')? 'type' NAME ('<' GenericTypeParameterList '>')? '=' Type ; attnamelist @@ -101,7 +103,7 @@ attrib ; laststat - : 'return' explist? | 'break' | 'continue' ';'? + : 'return' explist? | 'break' | 'continue' ; label @@ -120,6 +122,12 @@ namelist : NAME (',' NAME)* ; +binding + : NAME (':' Type ('?')?)? + ; + +bindinglist: binding (',' bindinglist)?; + explist : (exp ',')* exp ; @@ -131,6 +139,7 @@ exp | '...' | functiondef | prefixexp + | ifelseexp | tableconstructor | exp operatorPower exp | operatorUnary exp @@ -143,6 +152,8 @@ exp | exp operatorBitwise exp ; +ifelseexp: 'if' exp 'then' exp ('elseif' exp 'then' exp)* 'else' exp; + prefixexp : varOrExp nameAndArgs* ; @@ -176,7 +187,7 @@ functiondef ; funcbody - : '(' parlist? ')' block 'end' + : ('<' NAME '>')? '(' parlist? ')' block (':' '...'? NAME ) 'end' // GenericTypeParameterList and ReturnType ; parlist @@ -199,6 +210,8 @@ fieldsep : ',' | ';' ; +compoundop: '+=' | '-=' | '*=' | '/=' | '%=' | '^=' | '..='; + operatorOr : 'or'; @@ -234,6 +247,58 @@ string : NORMALSTRING | CHARSTRING | LONGSTRING ; +SimpleType + : 'nil' + | SingletonType + | NAME /* ('.' NAME)? */ ('<' TypeParams '>')? + | 'typeof' '(' NAME ('(' ')')? | '...' ')' // can't use `exp`, manually handle common cases + | TableType + | FunctionType + ; + +SingletonType + : NORMALSTRING | CHARSTRING + | 'true' + | 'false' + ; + +Type + : SimpleType ('?')? + | SimpleType ('?')? ('|' Type) // can't use Type because it's mutually left-recursive + | SimpleType ('?')? ('&' Type) // can't use Type because it's mutually left-recursive + ; + +GenericTypePackParameter: NAME '...' ('=' (('(' (TypeList)? ')') | VariadicTypePack | GenericTypePack))?; // TypePack must be inlined here + +GenericTypeParameterList: NAME ('=' Type)? (',' GenericTypeParameterList)? | GenericTypePackParameter (',' GenericTypePackParameter)*; + +TypeList: Type (',' Type)? | VariadicTypePack; + +TypeParams: (Type | VariadicTypePack | GenericTypePack) (',' TypeParams)?; // had to remove TypePack + +// TypePack: + +GenericTypePack: NAME '...'; + +VariadicTypePack: '...' Type; + +ReturnType: Type | '(' Type ',' Type ')' | '(' ')'; // can't use TypePack, inline common cases + +TableIndexer: '[' Type ']' ':' Type; + +TableProp: NAME ':' Type; + +TablePropOrIndexer + : TableProp | TableIndexer; + +PropList + : TablePropOrIndexer ((','|';') TablePropOrIndexer)* (','|';')?; + +TableType + : '{' PropList '}'; + +FunctionType: ('<' GenericTypeParameterList '>')? '(' (TypeList)? ')' '->' (Type | '(' ')' | '(' (TypeList) ')'); // inline ReturnType to avoid greediness + // LEXER NAME From 8aaa1302cccf913c3658f207f137bd9c05367749 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Tue, 26 Jul 2022 00:13:35 -0700 Subject: [PATCH 02/96] Support all Luau type extension syntax available in all test corpus sources. Add a regression test for a few of the things that required tweaks. --- .../sourceforge/pmd/lang/lua/antlr4/Lua.g4 | 80 ++++--- .../sourceforge/pmd/cpd/LuaTokenizerTest.java | 5 + .../lang/lua/cpd/testdata/regressionTest.lua | 24 +++ .../lang/lua/cpd/testdata/regressionTest.txt | 203 ++++++++++++++++++ 4 files changed, 271 insertions(+), 41 deletions(-) create mode 100644 pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.lua create mode 100644 pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.txt diff --git a/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 b/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 index 12773b012a..62ac80363d 100644 --- a/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 +++ b/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 @@ -102,20 +102,28 @@ attrib : ('<' NAME '>')? ; -laststat - : 'return' explist? | 'break' | 'continue' - ; - label : '::' NAME '::' ; +laststat + : 'return' explist? | 'break' | 'continue' + ; + funcname : NAME ('.' NAME)* (':' NAME)? ; -varlist - : var (',' var)* +funcbody + : ('<' GenericTypeParameterList '>')? '(' parlist? ')' (':' '...'? ReturnType ) block 'end' // GenericTypeParameterList and ReturnType + ; + +parlist + : bindinglist (',' '...')? | '...' + ; + +explist + : (exp ',')* exp ; namelist @@ -128,32 +136,14 @@ binding bindinglist: binding (',' bindinglist)?; -explist - : (exp ',')* exp +var + : (NAME | '(' exp ')' varSuffix) varSuffix* ; -exp - : 'nil' | 'false' | 'true' - | number - | string - | '...' - | functiondef - | prefixexp - | ifelseexp - | tableconstructor - | exp operatorPower exp - | operatorUnary exp - | exp operatorMulDivMod exp - | exp operatorAddSub exp - | exp operatorStrcat exp - | exp operatorComparison exp - | exp operatorAnd exp - | exp operatorOr exp - | exp operatorBitwise exp +varlist + : var (',' var)* ; -ifelseexp: 'if' exp 'then' exp ('elseif' exp 'then' exp)* 'else' exp; - prefixexp : varOrExp nameAndArgs* ; @@ -162,12 +152,26 @@ functioncall : varOrExp nameAndArgs+ ; -varOrExp - : var | '(' exp ')' +exp + : (asexp | operatorUnary exp) ( binop exp )* ; -var - : (NAME | '(' exp ')' varSuffix) varSuffix* +ifelseexp: 'if' exp 'then' exp ('elseif' exp 'then' exp)* 'else' exp; + +asexp: simpleexp ('::' Type)?; + +simpleexp + : 'nil' | 'false' | 'true' + | number + | string + | '...' + | 'function' funcbody + | prefixexp + | ifelseexp + | tableconstructor; + +varOrExp + : var | '(' exp ')' ; varSuffix @@ -186,14 +190,6 @@ functiondef : 'function' funcbody ; -funcbody - : ('<' NAME '>')? '(' parlist? ')' block (':' '...'? NAME ) 'end' // GenericTypeParameterList and ReturnType - ; - -parlist - : namelist (',' '...')? | '...' - ; - tableconstructor : '{' fieldlist? '}' ; @@ -212,6 +208,8 @@ fieldsep compoundop: '+=' | '-=' | '*=' | '/=' | '%=' | '^=' | '..='; +binop: operatorAddSub | operatorMulDivMod | operatorPower | operatorStrcat | operatorComparison | operatorAnd | operatorOr | operatorBitwise; + operatorOr : 'or'; @@ -276,7 +274,7 @@ TypeList: Type (',' Type)? | VariadicTypePack; TypeParams: (Type | VariadicTypePack | GenericTypePack) (',' TypeParams)?; // had to remove TypePack -// TypePack: +// TypePack: inlined everywhere to avoid overly greedy match when out-of-context GenericTypePack: NAME '...'; diff --git a/pmd-lua/src/test/java/net/sourceforge/pmd/cpd/LuaTokenizerTest.java b/pmd-lua/src/test/java/net/sourceforge/pmd/cpd/LuaTokenizerTest.java index 76d18a3ffa..ccbd16450d 100644 --- a/pmd-lua/src/test/java/net/sourceforge/pmd/cpd/LuaTokenizerTest.java +++ b/pmd-lua/src/test/java/net/sourceforge/pmd/cpd/LuaTokenizerTest.java @@ -39,4 +39,9 @@ public class LuaTokenizerTest extends CpdTextComparisonTest { public void testTabWidth() { doTest("tabWidth"); } + + @Test + public void testRegression() { + doTest("regressionTest"); + } } diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.lua b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.lua new file mode 100644 index 0000000000..6b46463859 --- /dev/null +++ b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.lua @@ -0,0 +1,24 @@ +--!strict +type Array = { T } +local x = 31337 +local _negativeLiteral = -3 +local _negativeVariable = -x +local _notLiteral = not true +local _notVariable = not x +local _length = #{x} +export type Function = (...any) -> T... + +return function (req, ...: boolean): ({[string|number]: any}, string, Function<...any>) + local body = string.format("%s %s\n", req.method, req.path) + local res = { + code = 200, + { "Content-Type", "text/plain" }, + { "Content-Length", #body } :: Array, + } :: { [any]: number | Array } + if req.keepAlive then + res[#res + 1] = { "Connection", "Keep-Alive" } + res[#res + 2] = { ... } + end + + return res, body, function(...): ...any return ... end +end \ No newline at end of file diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.txt b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.txt new file mode 100644 index 0000000000..f02a9b767c --- /dev/null +++ b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.txt @@ -0,0 +1,203 @@ + [Image] or [Truncated image[ Bcol Ecol +L2 + [type] 1 4 + [Array] 6 10 + [<] 11 11 + [T] 12 12 + [=] 14 14 + [any] 16 18 + [>] 19 19 + [=] 21 21 + [{] 23 23 + [T] 25 25 + [}] 27 27 +L3 + [local] 1 5 + [x] 7 7 + [=] 9 9 + [31337] 11 15 +L4 + [local] 1 5 + [_negativeLiteral] 7 22 + [=] 24 24 + [-] 26 26 + [3] 27 27 +L5 + [local] 1 5 + [_negativeVariable] 7 23 + [=] 25 25 + [-] 27 27 + [x] 28 28 +L6 + [local] 1 5 + [_notLiteral] 7 17 + [=] 19 19 + [not] 21 23 + [true] 25 28 +L7 + [local] 1 5 + [_notVariable] 7 18 + [=] 20 20 + [not] 22 24 + [x] 26 26 +L8 + [local] 1 5 + [_length] 7 13 + [=] 15 15 + [#] 17 17 + [{] 18 18 + [x] 19 19 + [}] 20 20 +L9 + [export] 1 6 + [type] 8 11 + [Function] 13 20 + [<] 21 21 + [T...] 22 25 + [=] 27 27 + [...any] 29 34 + [>] 35 35 + [=] 37 37 + [(] 39 39 + [...any] 40 45 + [)] 46 46 + [-] 48 48 + [>] 49 49 + [T...] 51 54 +L11 + [return] 1 6 + [function] 8 15 + [(] 17 17 + [req] 18 20 + [,] 21 21 + [...] 23 25 + [:] 26 26 + [boolean] 28 34 + [)] 35 35 + [:] 36 36 + [(] 38 38 + [{] 39 39 + [\[] 40 40 + [string|number] 41 53 + [\]] 54 54 + [:] 55 55 + [any] 57 59 + [}] 60 60 + [,] 61 61 + [string] 63 68 + [,] 69 69 + [Function<...any>] 71 86 + [)] 87 87 +L12 + [local] 3 7 + [body] 9 12 + [=] 14 14 + [string] 16 21 + [.] 22 22 + [format] 23 28 + [(] 29 29 + ["%s %s\\n"] 30 38 + [,] 39 39 + [req] 41 43 + [.] 44 44 + [method] 45 50 + [,] 51 51 + [req] 53 55 + [.] 56 56 + [path] 57 60 + [)] 61 61 +L13 + [local] 3 7 + [res] 9 11 + [=] 13 13 + [{] 15 15 +L14 + [code] 5 8 + [=] 10 10 + [200] 12 14 + [,] 15 15 +L15 + [{] 5 5 + ["Content-Type"] 7 20 + [,] 21 21 + ["text/plain"] 23 34 + [}] 36 36 + [,] 37 37 +L16 + [{] 5 5 + ["Content-Length"] 7 22 + [,] 23 23 + [#] 25 25 + [body] 26 29 + [}] 31 31 + [::] 33 34 + [Array] 36 45 + [,] 46 46 +L17 + [}] 3 3 + [::] 5 6 + [{] 8 8 + [\[] 10 10 + [any] 11 13 + [\]] 14 14 + [:] 15 15 + [number] 17 22 + [|] 24 24 + [Array] 26 30 + [<] 31 31 + [string] 32 37 + [|] 39 39 + [boolean] 41 47 + [>] 48 48 + [}] 50 50 +L18 + [if] 3 4 + [req] 6 8 + [.] 9 9 + [keepAlive] 10 18 + [then] 20 23 +L19 + [res] 5 7 + [\[] 8 8 + [#] 9 9 + [res] 10 12 + [+] 14 14 + [1] 16 16 + [\]] 17 17 + [=] 19 19 + [{] 21 21 + ["Connection"] 23 34 + [,] 35 35 + ["Keep-Alive"] 37 48 + [}] 50 50 +L20 + [res] 5 7 + [\[] 8 8 + [#] 9 9 + [res] 10 12 + [+] 14 14 + [2] 16 16 + [\]] 17 17 + [=] 19 19 + [{] 21 21 + [...] 23 25 + [}] 27 27 +L21 + [end] 3 5 +L23 + [return] 3 8 + [res] 10 12 + [,] 13 13 + [body] 15 18 + [,] 19 19 + [function] 21 28 + [(] 29 29 + [...)] 30 33 + [:] 34 34 + [...any] 36 41 + [return] 43 48 + [...] 50 52 + [end] 54 56 +L24 + [end] 1 3 +EOF From cfb8374611107702191b7dc379c3f146087ea096 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Tue, 26 Jul 2022 13:25:14 -0700 Subject: [PATCH 03/96] Capture more syntax scenarios in the regression test, update the snapshot. --- .../lang/lua/cpd/testdata/regressionTest.lua | 12 +- .../lang/lua/cpd/testdata/regressionTest.txt | 128 +++++++++++------- 2 files changed, 89 insertions(+), 51 deletions(-) diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.lua b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.lua index 6b46463859..1c391a37a6 100644 --- a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.lua +++ b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.lua @@ -8,17 +8,19 @@ local _notVariable = not x local _length = #{x} export type Function = (...any) -> T... -return function (req, ...: boolean): ({[string|number]: any}, string, Function<...any>) +return function (req, ...: boolean): ({[string|number]: T}, string, Function<...any>) local body = string.format("%s %s\n", req.method, req.path) local res = { code = 200, { "Content-Type", "text/plain" }, { "Content-Length", #body } :: Array, } :: { [any]: number | Array } - if req.keepAlive then - res[#res + 1] = { "Connection", "Keep-Alive" } - res[#res + 2] = { ... } + if (req :: any).keepAlive then + local socketType: "Connection" | "Pingback" | "" = "" :: "" + socketType = "Connection" :: "Connection" + res[#res + 1] = { socketType :: string, "Keep-Alive" } + res[#res - 2] = { ... } end - return res, body, function(...): ...any return ... end + return (res :: any) :: { T }, body, function(...): ...any return ... end end \ No newline at end of file diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.txt b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.txt index f02a9b767c..2be84bbb8a 100644 --- a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.txt +++ b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.txt @@ -67,27 +67,30 @@ L9 L11 [return] 1 6 [function] 8 15 - [(] 17 17 - [req] 18 20 - [,] 21 21 - [...] 23 25 - [:] 26 26 - [boolean] 28 34 - [)] 35 35 - [:] 36 36 - [(] 38 38 - [{] 39 39 - [\[] 40 40 - [string|number] 41 53 - [\]] 54 54 - [:] 55 55 - [any] 57 59 - [}] 60 60 - [,] 61 61 - [string] 63 68 - [,] 69 69 - [Function<...any>] 71 86 - [)] 87 87 + [<] 17 17 + [T] 18 18 + [>] 19 19 + [(] 20 20 + [req] 21 23 + [,] 24 24 + [...] 26 28 + [:] 29 29 + [boolean] 31 37 + [)] 38 38 + [:] 39 39 + [(] 41 41 + [{] 42 42 + [\[] 43 43 + [string|number] 44 56 + [\]] 57 57 + [:] 58 58 + [T] 60 60 + [}] 61 61 + [,] 62 62 + [string] 64 69 + [,] 70 70 + [Function<...any>] 72 87 + [)] 88 88 L12 [local] 3 7 [body] 9 12 @@ -152,11 +155,34 @@ L17 [}] 50 50 L18 [if] 3 4 - [req] 6 8 - [.] 9 9 - [keepAlive] 10 18 - [then] 20 23 + [(] 6 6 + [req] 7 9 + [::] 11 12 + [any] 14 16 + [)] 17 17 + [.] 18 18 + [keepAlive] 19 27 + [then] 29 32 L19 + [local] 5 9 + [socketType] 11 20 + [:] 21 21 + ["Connection"] 23 34 + [|] 36 36 + ["Pingback"] 38 47 + [|] 49 49 + [""] 51 52 + [=] 54 54 + [""] 56 57 + [::] 59 60 + [""] 62 63 +L20 + [socketType] 5 14 + [=] 16 16 + ["Connection"] 18 29 + [::] 31 32 + ["Connection"] 34 45 +L21 [res] 5 7 [\[] 8 8 [#] 9 9 @@ -166,38 +192,48 @@ L19 [\]] 17 17 [=] 19 19 [{] 21 21 - ["Connection"] 23 34 - [,] 35 35 - ["Keep-Alive"] 37 48 - [}] 50 50 -L20 + [socketType] 23 32 + [::] 34 35 + [string] 37 42 + [,] 43 43 + ["Keep-Alive"] 45 56 + [}] 58 58 +L22 [res] 5 7 [\[] 8 8 [#] 9 9 [res] 10 12 - [+] 14 14 + [-] 14 14 [2] 16 16 [\]] 17 17 [=] 19 19 [{] 21 21 [...] 23 25 [}] 27 27 -L21 - [end] 3 5 L23 + [end] 3 5 +L25 [return] 3 8 - [res] 10 12 - [,] 13 13 - [body] 15 18 - [,] 19 19 - [function] 21 28 - [(] 29 29 - [...)] 30 33 - [:] 34 34 - [...any] 36 41 - [return] 43 48 - [...] 50 52 - [end] 54 56 -L24 + [(] 10 10 + [res] 11 13 + [::] 15 16 + [any] 18 20 + [)] 21 21 + [::] 23 24 + [{] 26 26 + [T] 28 28 + [}] 30 30 + [,] 31 31 + [body] 33 36 + [,] 37 37 + [function] 39 46 + [(] 47 47 + [...)] 48 51 + [:] 52 52 + [...any] 54 59 + [return] 61 66 + [...] 68 70 + [end] 72 74 +L26 [end] 1 3 EOF From 3d6fab0782464562aee9a0f7d72971de4d0efc9e Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Tue, 26 Jul 2022 13:29:19 -0700 Subject: [PATCH 04/96] rename new snapshot artifact to better express intent --- .../src/test/java/net/sourceforge/pmd/cpd/LuaTokenizerTest.java | 2 +- .../lang/lua/cpd/testdata/{regressionTest.lua => luauTypes.lua} | 0 .../lang/lua/cpd/testdata/{regressionTest.txt => luauTypes.txt} | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/{regressionTest.lua => luauTypes.lua} (100%) rename pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/{regressionTest.txt => luauTypes.txt} (100%) diff --git a/pmd-lua/src/test/java/net/sourceforge/pmd/cpd/LuaTokenizerTest.java b/pmd-lua/src/test/java/net/sourceforge/pmd/cpd/LuaTokenizerTest.java index ccbd16450d..83b39442a1 100644 --- a/pmd-lua/src/test/java/net/sourceforge/pmd/cpd/LuaTokenizerTest.java +++ b/pmd-lua/src/test/java/net/sourceforge/pmd/cpd/LuaTokenizerTest.java @@ -42,6 +42,6 @@ public class LuaTokenizerTest extends CpdTextComparisonTest { @Test public void testRegression() { - doTest("regressionTest"); + doTest("luauTypes"); } } diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.lua b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.lua similarity index 100% rename from pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.lua rename to pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.lua diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.txt b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt similarity index 100% rename from pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/regressionTest.txt rename to pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt From 68eaf06e1a9aeaef5607f4f60a478b2a109204fc Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 28 Jul 2022 11:55:51 +0200 Subject: [PATCH 05/96] [doc] Add proposal for architecture decision records --- docs/_data/sidebars/pmd_sidebar.yml | 3 ++ docs/pages/pmd/projectdocs/decisions.md | 14 +++++ docs/pages/pmd/projectdocs/decisions/adr-1.md | 52 +++++++++++++++++++ .../pmd/projectdocs/decisions/adr-NNN.md | 27 ++++++++++ 4 files changed, 96 insertions(+) create mode 100644 docs/pages/pmd/projectdocs/decisions.md create mode 100644 docs/pages/pmd/projectdocs/decisions/adr-1.md create mode 100644 docs/pages/pmd/projectdocs/decisions/adr-NNN.md diff --git a/docs/_data/sidebars/pmd_sidebar.yml b/docs/_data/sidebars/pmd_sidebar.yml index f7ab16ddb0..476a38b2b4 100644 --- a/docs/_data/sidebars/pmd_sidebar.yml +++ b/docs/_data/sidebars/pmd_sidebar.yml @@ -469,6 +469,9 @@ entries: - title: Old release notes url: /pmd_release_notes_old.html output: web, pdf + - title: Decisions + url: /pmd_projectdocs_decisions.html + output: web, pdf - title: null output: web, pdf subfolders: diff --git a/docs/pages/pmd/projectdocs/decisions.md b/docs/pages/pmd/projectdocs/decisions.md new file mode 100644 index 0000000000..fd130d53af --- /dev/null +++ b/docs/pages/pmd/projectdocs/decisions.md @@ -0,0 +1,14 @@ +--- +title: Architecture Design Decisions +sidebar: pmd_sidebar +permalink: pmd_projectdocs_decisions.html +last_updated: July 2022 +--- + +
    +{% for page in site.pages %} + {% if page.adr == true and page.adr_status != "" %} +
  • {{ page.title }} ({{ page.adr_status }})
  • + {% endif %} +{% endfor %} +
diff --git a/docs/pages/pmd/projectdocs/decisions/adr-1.md b/docs/pages/pmd/projectdocs/decisions/adr-1.md new file mode 100644 index 0000000000..e7208f9761 --- /dev/null +++ b/docs/pages/pmd/projectdocs/decisions/adr-1.md @@ -0,0 +1,52 @@ +--- +title: ADR 1 - Use architecture decision records +sidebar: pmd_sidebar +permalink: pmd_projectdocs_decisions_adr_1.html +sidebaractiveurl: /pmd_projectdocs_decisions.html +adr: true +# Proposed / Accepted / Deprecated / Superseded +adr_status: "Proposed" +last_updated: July 2022 +--- + +# Context + +PMD has grown over 20 years as an open-source project. Along the way many decisions have been made, but they are not +explicitly documented. PMD is also developed by many individuals and the original developers might +not even be around anymore. + +Without having documentation records about decisions it is hard for new developers to understand the reasons +of past decisions. This might lead to either ignore these past (unknown) decisions and change it without +fully understanding its consequences. This could create new issues down the road, e.g. a decision supporting +a requirement that is not tested. + +On the other hand, accepting the past decisions without challenging it might slow down the project and +possible innovations. It could lead to a situation where the developers are afraid to change anything +in order to not break the system. + +Past decisions have been made within context and the context can change. Therefore, past decisions can still be +valid today, or they don't apply anymore. In that case, the decision should be revisited. + +See also the blog post [Documenting Architecture Decisions](https://cognitect.com/blog/2011/11/15/documenting-architecture-decisions) +by Michael Nygard. + +There are many templates around to choose from. +gives a nice summary. + +# Decision + +We will document the decisions we make as a project as a collection of "Architecture Decision Records". +In order to keep it simple, we will use only a simple template proposed by Michael Nygard. +The documents are stored together with the source code and are part of the generated documentation site. + +# Status + +{{ page.adr_status }} + +# Consequences + +Explicitly documenting decisions has the benefit that new developers joining the projects know about the decisions +and can read the context and consequences of the decisions. This will likely also improve the overall quality +as the decisions need to be formulated and written down. Everybody is on the same page. + +However, this also adds additional tasks, and it takes time to write down and document the decisions. diff --git a/docs/pages/pmd/projectdocs/decisions/adr-NNN.md b/docs/pages/pmd/projectdocs/decisions/adr-NNN.md new file mode 100644 index 0000000000..53ece1ee44 --- /dev/null +++ b/docs/pages/pmd/projectdocs/decisions/adr-NNN.md @@ -0,0 +1,27 @@ +--- +title: ADR NNN - Template +sidebar: pmd_sidebar +permalink: pmd_projectdocs_decisions_adr_NNN.html +adr: true +# Proposed / Accepted / Deprecated / Superseded +adr_status: "" +last_updated: July 2022 +--- + + + +# Context + +What is the issue that we're seeing that is motivating this decision or change? + +# Decision + +What is the change that we're proposing and/or doing? + +# Status + +{{ page.adr_status }} + +# Consequences + +What becomes easier or more difficult to do because of this change? From cbbe0e0cb0c6cf9fc25bcea4ffe3be1f9611fbe1 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 28 Jul 2022 14:29:02 +0200 Subject: [PATCH 06/96] [doc] Add "ADR 2 - Policy on the use of Kotlin for development" --- docs/pages/pmd/projectdocs/decisions/adr-2.md | 65 +++++++++++++++++++ .../pmd/projectdocs/decisions/adr-NNN.md | 1 + 2 files changed, 66 insertions(+) create mode 100644 docs/pages/pmd/projectdocs/decisions/adr-2.md diff --git a/docs/pages/pmd/projectdocs/decisions/adr-2.md b/docs/pages/pmd/projectdocs/decisions/adr-2.md new file mode 100644 index 0000000000..b02030f9af --- /dev/null +++ b/docs/pages/pmd/projectdocs/decisions/adr-2.md @@ -0,0 +1,65 @@ +--- +title: ADR 2 - Policy on the use of Kotlin for development +sidebar: pmd_sidebar +permalink: pmd_projectdocs_decisions_adr_2.html +sidebaractiveurl: /pmd_projectdocs_decisions.html +adr: true +# Proposed / Accepted / Deprecated / Superseded +adr_status: "Proposed" +last_updated: July 2022 +--- + +# Context + +We currently use Kotlin only for unit tests at some places (e.g. pmd-lang-test module provides a couple of base +test classes). We were cautious to expand Kotlin because of poor development support outside JetBrain's +IntelliJ IDEA. E.g. the [Kotlin Plugin for Eclipse](https://marketplace.eclipse.org/content/kotlin-plugin-eclipse) +doesn't work properly as described in the reviews. + +For VS Code there is a [Kotlin Plugin](https://marketplace.visualstudio.com/items?itemName=mathiasfrohlich.Kotlin) +with basic features. Online IDEs like gitpod.io and GitHub Codespaces are often based on VS Code. + +Using Kotlin means, that we accept, that PMD can only be developed with IntelliJ IDEA. This feels like a vendor lock-in. + +Also, bringing in a mix of languages might make maintenance a bit harder and make it harder for new contributors. +However - PMD is a tool that deals with many, many languages anyway, so this is maybe not a real argument. + +Nevertheless, extending the usage of Kotlin within PMD can also increase contributions. + +# Decision + +We are generally open to the idea to increase usage of Kotlin within PMD. In order to gain experience +and to keep it within bounds and therefore maintainable we came up with the following rules: + +* The module `pmd-core` should stay in plain Java. This helps in keeping binary compatibility when changing sources. + `pmd-core` contains the main APIs for all language modules. We currently release all modules at the same time, + so this is not a real problem for now. But that might change in the future: Because only few language modules have + actual changes per release, it doesn't really make sense to release everything as long as the modules stay + compatible. But that's another story. +* For (unit) testing, Kotlin can be used in `pmd-core` and in the language modules. The test frameworks can also + use Kotlin (`pmd-test` doesn't yet, `pmd-lang-test` does already). +* Additionally: from now on, we allow to have the individual language modules be implemented in different languages + when it makes sense. So, a language module might decide to use plain Java (like now) or also Kotlin + (or other languages if it fits). +* When mixing languages (e.g. Java + Kotlin), we need to care that the modules can still be used with plain Java. + E.g. when writing custom rules: `pmd-java` provides a couple of APIs for rules (like symbol table, type resolution) + and we should not force the users to use Kotlin (at least not for language modules which already exist and + for which users might have written custom rules in Java already). +* It is also possible to write the entire language module in Kotlin only. Then the rules would be written in Kotlin + as well. And the possible problems when mixing languages are gone. But that applies only for new language modules. + For compatibility reasons an existing language modules shouldn't be rewritten into Kotlin. That would be a + major version change. + +# Status + +{{ page.adr_status }} + +# Consequences + +Allowing more Kotlin in PMD can attract new contributions. It might make it easier to develop small DSLs. +Also, other languages than Kotlin could be used, e.g. for `pmd-scala` Scala might make sense. + +On the other side, other IDEs than IntelliJ IDEA will have a difficult time to deal with PMD's source code. +Eclipse can't be used practically anymore. + +Maintaining a polyglot code base with multiple languages is likely to be more challenging. diff --git a/docs/pages/pmd/projectdocs/decisions/adr-NNN.md b/docs/pages/pmd/projectdocs/decisions/adr-NNN.md index 53ece1ee44..8388f98136 100644 --- a/docs/pages/pmd/projectdocs/decisions/adr-NNN.md +++ b/docs/pages/pmd/projectdocs/decisions/adr-NNN.md @@ -2,6 +2,7 @@ title: ADR NNN - Template sidebar: pmd_sidebar permalink: pmd_projectdocs_decisions_adr_NNN.html +sidebaractiveurl: /pmd_projectdocs_decisions.html adr: true # Proposed / Accepted / Deprecated / Superseded adr_status: "" From 738c19b398d44be450a720707356c26ba1a2cffb Mon Sep 17 00:00:00 2001 From: Lynn <109954313+LynnBroe@users.noreply.github.com> Date: Wed, 24 Aug 2022 14:41:50 +0800 Subject: [PATCH 07/96] Update UnusedPrivateFieldRule.java revise SpyBean about unusedprivatefield --- .../pmd/lang/java/rule/bestpractices/UnusedPrivateFieldRule.java | 1 + 1 file changed, 1 insertion(+) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateFieldRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateFieldRule.java index 06133f4bf4..7d89eb19c5 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateFieldRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateFieldRule.java @@ -58,6 +58,7 @@ public class UnusedPrivateFieldRule extends AbstractLombokAwareRule { defaultValues.add("org.mockito.Mock"); defaultValues.add("org.mockito.Spy"); defaultValues.add("org.springframework.boot.test.mock.mockito.MockBean"); + defaultValues.add("org.springframework.boot.test.mock.mockito.SpyBean"); return defaultValues; } From 292ec8983319049721ac9d3ce8dae7fc0ee2fd4f Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Wed, 24 Aug 2022 11:23:56 +0200 Subject: [PATCH 08/96] [java] ConstructorCallsOverridableMethod should consider method calls with var access Fixes #4099 --- docs/pages/release_notes.md | 3 +++ ...ConstructorCallsOverridableMethodRule.java | 10 +++++++-- .../xml/ConstructorCallsOverridableMethod.xml | 22 +++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index b8f8783555..a952fb3e2b 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -16,6 +16,9 @@ This is a {{ site.pmd.release_type }} release. ### Fixed Issues +* java-errorprone + * [#4099](https://github.com/pmd/pmd/issues/4099): \[java] ConstructorCallsOverridableMethod should consider method calls with var access + ### API Changes ### External Contributions diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java index 740842f9fc..f099ea315e 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java @@ -38,6 +38,7 @@ import net.sourceforge.pmd.lang.java.ast.ASTReferenceType; import net.sourceforge.pmd.lang.java.ast.ASTType; import net.sourceforge.pmd.lang.java.ast.AccessNode; import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule; +import net.sourceforge.pmd.lang.java.typeresolution.typedefinition.JavaTypeDefinition; /** * Searches through all methods and constructors called from constructors. It @@ -1083,8 +1084,13 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul type = "long"; } } else if (arg.getChild(0) instanceof ASTName) { - // ASTName n = (ASTName)arg.getChild(0); - type = "ref"; + ASTName n = (ASTName) (arg.getChild(0)); + JavaTypeDefinition typeDefinition = n.getTypeDefinition(); + if (typeDefinition != null) { + type = typeDefinition.getType().getName(); + } else { + type = "ref"; + } } } argumentTypes.add(type); diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml index f6fc70406f..1d0ac78c9b 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml @@ -320,4 +320,26 @@ import java.lang.annotation.*; } ]]> + + [java] ConstructorCallsOverridableMethod should consider method calls with var access #4099 + 2 + 4,11 + + From bc21be40722cee3e0fbff3f99734ca4be02722f7 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Wed, 24 Aug 2022 12:18:48 +0200 Subject: [PATCH 09/96] Fix handling of reference types --- .../ConstructorCallsOverridableMethodRule.java | 7 ++++++- .../xml/ConstructorCallsOverridableMethod.xml | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java index f099ea315e..9e60c58230 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java @@ -1048,7 +1048,12 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul if (type.getChild(0) instanceof ASTPrimitiveType) { parameterTypes.add(type.getChild(0).getImage()); } else if (type.getChild(0) instanceof ASTReferenceType) { - parameterTypes.add("ref"); + JavaTypeDefinition typeDefinition = type.getTypeDefinition(); + if (typeDefinition != null) { + parameterTypes.add(typeDefinition.getType().getName()); + } else { + parameterTypes.add("ref"); + } } else { parameterTypes.add(""); } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml index 1d0ac78c9b..bb4568c073 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml @@ -322,8 +322,8 @@ import java.lang.annotation.*; [java] ConstructorCallsOverridableMethod should consider method calls with var access #4099 - 2 - 4,11 + 3 + 4,11,18 From 596f1296001ede2c4047f767b08bc196cc72f9de Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Wed, 24 Aug 2022 15:04:43 +0200 Subject: [PATCH 10/96] Fix False positive with public method call on new instance --- ...ConstructorCallsOverridableMethodRule.java | 18 ++++++------ .../xml/ConstructorCallsOverridableMethod.xml | 28 +++++++++++++++++++ 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java index 9e60c58230..343498ba38 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java @@ -14,6 +14,7 @@ import java.util.Set; import java.util.TreeMap; import net.sourceforge.pmd.lang.ast.Node; +import net.sourceforge.pmd.lang.java.ast.ASTAllocationExpression; import net.sourceforge.pmd.lang.java.ast.ASTAnnotationTypeDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTArgumentList; import net.sourceforge.pmd.lang.java.ast.ASTArguments; @@ -275,21 +276,18 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul // check prefix type match ASTPrimaryPrefix child2 = (ASTPrimaryPrefix) child; if (getNameFromPrefix(child2) == null) { - if (child2.getImage() == null) { + if (child2.usesThisModifier()) { thisIndex = x; break; - } else { - // happens when super is used - // [super.method(): image = 'method'] + } else if (child2.usesSuperModifier()) { superFirst = true; thisIndex = x; - // the true super is at an unusable - // index because super.method() has only - // 2 nodes [method=0,()=1] - // as opposed to the 3 you might expect - // and which this.method() actually has. - // [this=0,method=1.()=2] break; + } else if (child2.getFirstChildOfType(ASTAllocationExpression.class) != null) { + // change of scope - the method call is neither on this or super, + // but on a different instance. + // ignore this method call + return null; } } } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml index bb4568c073..82903ec954 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml @@ -346,6 +346,34 @@ class Foo3 { } public void bar(String s) {} } +]]> + + + False positive with public method call on new instance + 2 + 4,5 + From 64675dc60045cf1465d52fd5cba4f7f5e133459f Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Wed, 24 Aug 2022 15:35:44 +0200 Subject: [PATCH 11/96] Fix handling of array types --- ...ConstructorCallsOverridableMethodRule.java | 20 +++++------- .../xml/ConstructorCallsOverridableMethod.xml | 32 +++++++++++++++++-- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java index 343498ba38..24389963d3 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java @@ -33,10 +33,9 @@ import net.sourceforge.pmd.lang.java.ast.ASTName; import net.sourceforge.pmd.lang.java.ast.ASTPrimaryExpression; import net.sourceforge.pmd.lang.java.ast.ASTPrimaryPrefix; import net.sourceforge.pmd.lang.java.ast.ASTPrimarySuffix; -import net.sourceforge.pmd.lang.java.ast.ASTPrimitiveType; import net.sourceforge.pmd.lang.java.ast.ASTRecordDeclaration; -import net.sourceforge.pmd.lang.java.ast.ASTReferenceType; import net.sourceforge.pmd.lang.java.ast.ASTType; +import net.sourceforge.pmd.lang.java.ast.ASTVariableDeclaratorId; import net.sourceforge.pmd.lang.java.ast.AccessNode; import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule; import net.sourceforge.pmd.lang.java.typeresolution.typedefinition.JavaTypeDefinition; @@ -1043,17 +1042,14 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul if (parameters != null) { for (ASTFormalParameter p : parameters) { ASTType type = p.getFirstChildOfType(ASTType.class); - if (type.getChild(0) instanceof ASTPrimitiveType) { - parameterTypes.add(type.getChild(0).getImage()); - } else if (type.getChild(0) instanceof ASTReferenceType) { - JavaTypeDefinition typeDefinition = type.getTypeDefinition(); - if (typeDefinition != null) { - parameterTypes.add(typeDefinition.getType().getName()); - } else { - parameterTypes.add("ref"); - } + ASTVariableDeclaratorId varId = p.getFirstChildOfType(ASTVariableDeclaratorId.class); + + JavaTypeDefinition typeDefinition = type.getTypeDefinition(); + if (typeDefinition != null) { + typeDefinition = typeDefinition.withDimensions(varId.getArrayDepth()); + parameterTypes.add(typeDefinition.getType().getName()); } else { - parameterTypes.add(""); + parameterTypes.add("ref"); } } } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml index 82903ec954..e68d1bfc0a 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml @@ -322,8 +322,8 @@ import java.lang.annotation.*; [java] ConstructorCallsOverridableMethod should consider method calls with var access #4099 - 3 - 4,11,18 + 7 + 4,11,18,25,32,39,46 From a4afb5966745d16b1771ea57811c998d69daa7a9 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Wed, 24 Aug 2022 15:53:13 +0200 Subject: [PATCH 12/96] Fix handling of varargs --- ...ConstructorCallsOverridableMethodRule.java | 3 +++ .../xml/ConstructorCallsOverridableMethod.xml | 21 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java index 24389963d3..a38495bd5d 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java @@ -1047,6 +1047,9 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul JavaTypeDefinition typeDefinition = type.getTypeDefinition(); if (typeDefinition != null) { typeDefinition = typeDefinition.withDimensions(varId.getArrayDepth()); + if (p.isVarargs()) { + typeDefinition = typeDefinition.withDimensions(1); + } parameterTypes.add(typeDefinition.getType().getName()); } else { parameterTypes.add("ref"); diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml index e68d1bfc0a..2fa3ae0229 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml @@ -322,9 +322,12 @@ import java.lang.annotation.*; [java] ConstructorCallsOverridableMethod should consider method calls with var access #4099 - 7 - 4,11,18,25,32,39,46 + 9 + 7,14,21,28,35,42,49,56,63 { + public Foo9(Set arg) { + bar(arg); // should report a warning at this line + } + public void bar(Collection s) {} // base type +} ]]> From 5f0cb7d757cab81c33a15b487122a7d610a04835 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Wed, 24 Aug 2022 16:18:09 +0200 Subject: [PATCH 13/96] Support subtyping --- ...ConstructorCallsOverridableMethodRule.java | 156 ++++++++---------- 1 file changed, 71 insertions(+), 85 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java index a38495bd5d..fb69536e23 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java @@ -18,7 +18,6 @@ import net.sourceforge.pmd.lang.java.ast.ASTAllocationExpression; import net.sourceforge.pmd.lang.java.ast.ASTAnnotationTypeDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTArgumentList; import net.sourceforge.pmd.lang.java.ast.ASTArguments; -import net.sourceforge.pmd.lang.java.ast.ASTBooleanLiteral; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit; import net.sourceforge.pmd.lang.java.ast.ASTConstructorDeclaration; @@ -179,11 +178,11 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul private List referenceNames; private List qualifierNames; private int argumentSize; - private List argumentTypes; + private List> argumentTypes; private boolean superCall; private MethodInvocation(ASTPrimaryExpression ape, List qualifierNames, List referenceNames, - String name, int argumentSize, List argumentTypes, boolean superCall) { + String name, int argumentSize, List> argumentTypes, boolean superCall) { this.ape = ape; this.qualifierNames = qualifierNames; this.referenceNames = referenceNames; @@ -205,7 +204,7 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul return argumentSize; } - public List getArgumentTypes() { + public List> getArgumentTypes() { return argumentTypes; } @@ -221,6 +220,15 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul return ape; } + public boolean matches(ASTMethodDeclaration methodDeclaration) { + String methName = methodDeclaration.getName(); + int count = methodDeclaration.getArity(); + List> parameterTypes = getMethodDeclaratorParameterTypes(methodDeclaration); + return methName.equals(getName()) + && getArgumentCount() == count + && compareParameterAndArgumentTypes(parameterTypes, getArgumentTypes()); + } + public static MethodInvocation getMethod(ASTPrimaryExpression node) { MethodInvocation meth = null; int i = node.getNumChildren(); @@ -238,7 +246,7 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul String methodName = null; ASTArguments args = (ASTArguments) lastNode.getChild(0); int numOfArguments = args.size(); - List argumentTypes = ConstructorCallsOverridableMethodRule.getArgumentTypes(args); + List> argumentTypes = ConstructorCallsOverridableMethodRule.getArgumentTypes(args); boolean superFirst = false; int thisIndex = -1; @@ -448,7 +456,7 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul private ASTExplicitConstructorInvocation eci; private String name; private int count = 0; - private List argumentTypes = new ArrayList<>(); + private List> argumentTypes = new ArrayList<>(); ConstructorInvocation(ASTExplicitConstructorInvocation eci) { this.eci = eci; @@ -469,13 +477,19 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul return count; } - public List getArgumentTypes() { + public List> getArgumentTypes() { return argumentTypes; } public String getName() { return name; } + + public boolean matches(ASTConstructorDeclaration constructorDeclaration) { + int matchConstArgCount = constructorDeclaration.getArity(); + List> parameterTypes = getMethodDeclaratorParameterTypes(constructorDeclaration); + return matchConstArgCount == getArgumentCount() && compareParameterAndArgumentTypes(parameterTypes, getArgumentTypes()); + } } private static final class MethodHolder { @@ -673,14 +687,8 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul for (MethodInvocation meth : getCurrentEvalPackage().calledMethods) { // check against each dangerous method in class for (MethodHolder h : getCurrentEvalPackage().allMethodsOfClass.keySet()) { - if (h.isDangerous()) { - String methName = h.getASTMethodDeclaration().getName(); - int count = h.getASTMethodDeclaration().getArity(); - List parameterTypes = getMethodDeclaratorParameterTypes(h.getASTMethodDeclaration()); - if (methName.equals(meth.getName()) && meth.getArgumentCount() == count - && parameterTypes.equals(meth.getArgumentTypes())) { - addViolation(data, meth.getASTPrimaryExpression(), "method '" + h.getCalled() + "'"); - } + if (h.isDangerous() && meth.matches(h.getASTMethodDeclaration())) { + addViolation(data, meth.getASTPrimaryExpression(), "method '" + h.getCalled() + "'"); } } } @@ -737,19 +745,13 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul // System.out.println("Called meth is " + meth); for (MethodHolder h3 : classMethodMap.keySet()) { // need to skip self here h == h3 - if (h3.isDangerous()) { - String matchMethodName = h3.getASTMethodDeclaration().getName(); - int matchMethodParamCount = h3.getASTMethodDeclaration().getArity(); - List parameterTypes = getMethodDeclaratorParameterTypes(h3.getASTMethodDeclaration()); + if (h3.isDangerous() && meth.matches(h3.getASTMethodDeclaration())) { // System.out.println("matching " + matchMethodName + " // to " + meth.getName()); - if (matchMethodName.equals(meth.getName()) && matchMethodParamCount == meth.getArgumentCount() - && parameterTypes.equals(meth.getArgumentTypes())) { - h.setDangerous(); - h.setCalledMethod(matchMethodName); - found = true; - break; - } + h.setDangerous(); + h.setCalledMethod(meth.getName()); + found = true; + break; } } } @@ -786,19 +788,13 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul // check each of the already evaluated methods: need to // optimize this out for (MethodHolder h : evaluatedMethods) { - if (h.isDangerous()) { - String matchName = h.getASTMethodDeclaration().getName(); - int matchParamCount = h.getASTMethodDeclaration().getArity(); - List parameterTypes = getMethodDeclaratorParameterTypes(h.getASTMethodDeclaration()); - if (methName.equals(matchName) && methArgCount == matchParamCount - && parameterTypes.equals(meth.getArgumentTypes())) { - ch.setDangerous(true); - // System.out.println("evaluateDangerOfConstructors1 - // setting dangerous constructor with " + - // ch.getASTConstructorDeclaration().getParameterCount() - // + " params"); - break; - } + if (h.isDangerous() && meth.matches(h.getASTMethodDeclaration())) { + ch.setDangerous(true); + // System.out.println("evaluateDangerOfConstructors1 + // setting dangerous constructor with " + + // ch.getASTConstructorDeclaration().getParameterCount() + // + " params"); + break; } } } @@ -825,23 +821,18 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul } // if its not dangerous then evaluate if it should be // if it calls dangerous constructor mark it as dangerous - int cCount = calledC.getArgumentCount(); for (Iterator innerConstIter = classConstructorMap.keySet().iterator(); innerConstIter .hasNext() && !ch.isDangerous();) { // forget skipping self because that introduces another // check for each, but only 1 hit ConstructorHolder h2 = innerConstIter.next(); - if (h2.isDangerous()) { - int matchConstArgCount = h2.getASTConstructorDeclaration().getArity(); - List parameterTypes = getMethodDeclaratorParameterTypes(h2.getASTConstructorDeclaration()); - if (matchConstArgCount == cCount && parameterTypes.equals(calledC.getArgumentTypes())) { - ch.setDangerous(true); - found = true; - // System.out.println("evaluateDangerOfConstructors2 - // setting dangerous constructor with " + - // ch.getASTConstructorDeclaration().getParameterCount() - // + " params"); - } + if (h2.isDangerous() && calledC.matches(h2.getASTConstructorDeclaration())) { + ch.setDangerous(true); + found = true; + // System.out.println("evaluateDangerOfConstructors2 + // setting dangerous constructor with " + + // ch.getASTConstructorDeclaration().getParameterCount() + // + " params"); } } } @@ -1036,9 +1027,9 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul return name; } - private static List getMethodDeclaratorParameterTypes(ASTMethodOrConstructorDeclaration methodOrConstructorDeclarator) { + private static List> getMethodDeclaratorParameterTypes(ASTMethodOrConstructorDeclaration methodOrConstructorDeclarator) { ASTFormalParameters parameters = methodOrConstructorDeclarator.getFirstDescendantOfType(ASTFormalParameters.class); - List parameterTypes = new ArrayList<>(); + List> parameterTypes = new ArrayList<>(); if (parameters != null) { for (ASTFormalParameter p : parameters) { ASTType type = p.getFirstChildOfType(ASTType.class); @@ -1050,54 +1041,49 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul if (p.isVarargs()) { typeDefinition = typeDefinition.withDimensions(1); } - parameterTypes.add(typeDefinition.getType().getName()); + parameterTypes.add(typeDefinition.getType()); } else { - parameterTypes.add("ref"); + parameterTypes.add(null); // unknown type } } } return parameterTypes; } - private static List getArgumentTypes(ASTArguments args) { - List argumentTypes = new ArrayList<>(); + private static List> getArgumentTypes(ASTArguments args) { + List> argumentTypes = new ArrayList<>(); ASTArgumentList argumentList = args.getFirstChildOfType(ASTArgumentList.class); if (argumentList != null) { for (int a = 0; a < argumentList.getNumChildren(); a++) { Node expression = argumentList.getChild(a); ASTPrimaryPrefix arg = expression.getFirstDescendantOfType(ASTPrimaryPrefix.class); - String type = ""; - if (arg != null && arg.getNumChildren() > 0) { - if (arg.getChild(0) instanceof ASTLiteral) { - ASTLiteral lit = (ASTLiteral) arg.getChild(0); - if (lit.isCharLiteral()) { - type = "char"; - } else if (lit.isFloatLiteral()) { - type = "float"; - } else if (lit.isIntLiteral()) { - type = "int"; - } else if (lit.isStringLiteral()) { - type = "String"; - } else if (lit.getNumChildren() > 0 && lit.getChild(0) instanceof ASTBooleanLiteral) { - type = "boolean"; - } else if (lit.isDoubleLiteral()) { - type = "double"; - } else if (lit.isLongLiteral()) { - type = "long"; - } - } else if (arg.getChild(0) instanceof ASTName) { - ASTName n = (ASTName) (arg.getChild(0)); - JavaTypeDefinition typeDefinition = n.getTypeDefinition(); - if (typeDefinition != null) { - type = typeDefinition.getType().getName(); - } else { - type = "ref"; - } - } + Class type = null; + JavaTypeDefinition typeDefinition = arg.getTypeDefinition(); + if (typeDefinition != null) { + type = typeDefinition.getType(); } argumentTypes.add(type); } } return argumentTypes; } + + private static boolean compareParameterAndArgumentTypes(List> parameters, List> arguments) { + if (parameters.size() != arguments.size()) { + return false; + } + + for (int i = 0; i < parameters.size(); i++) { + Class param = parameters.get(i); + Class argument = arguments.get(i); + + if (param != null && argument != null + && param != argument + && !param.isAssignableFrom(argument)) { + return false; + } + } + + return true; + } } From f58719f7a6ea2292c5f2e053efefb844ca6d3d0e Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Wed, 24 Aug 2022 16:33:38 +0200 Subject: [PATCH 14/96] Fix NPE --- .../ConstructorCallsOverridableMethodRule.java | 8 ++++++-- .../xml/ConstructorCallsOverridableMethod.xml | 11 +++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java index fb69536e23..31488b455d 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java @@ -11,6 +11,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.StringTokenizer; import java.util.TreeMap; import net.sourceforge.pmd.lang.ast.Node; @@ -390,8 +391,11 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul String toParse = getNameFromPrefix(child); // System.out.println("parsing for var names in : " // + toParse); - java.util.StringTokenizer st = new java.util.StringTokenizer(toParse, "."); - while (st.hasMoreTokens()) { + StringTokenizer st = null; + if (toParse != null) { + st = new StringTokenizer(toParse, "."); + } + while (st != null && st.hasMoreTokens()) { String value = st.nextToken(); if (!st.hasMoreTokens()) { if (i == 2) { diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml index 2fa3ae0229..4714a3f953 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml @@ -419,6 +419,17 @@ class Foo { public void publicMethod() { } } +]]> + + + NPE when trying to find method name of method call + 0 + From e3145b0e36f9ed24d85a7af855033af06957f9b0 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Wed, 24 Aug 2022 16:38:04 +0200 Subject: [PATCH 15/96] Fix PMD - unused local variables --- .../rule/errorprone/ConstructorCallsOverridableMethodRule.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java index 31488b455d..3a642ed7ff 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java @@ -787,8 +787,6 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul // but were never evaluated, // they need reevaluation MethodInvocation meth = calledMethsIter.next(); // CCE - String methName = meth.getName(); - int methArgCount = meth.getArgumentCount(); // check each of the already evaluated methods: need to // optimize this out for (MethodHolder h : evaluatedMethods) { From c374d3934fe08fce176bebd14c328e569c65b6d4 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Wed, 31 Aug 2022 19:52:02 +0200 Subject: [PATCH 16/96] Bump pmd from 6.48.0 to 6.49.0 --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index bfe3fe4c34..9036d17f18 100644 --- a/pom.xml +++ b/pom.xml @@ -407,22 +407,22 @@ net.sourceforge.pmd pmd-core - 6.48.0 + 6.49.0 net.sourceforge.pmd pmd-java - 6.48.0 + 6.49.0 net.sourceforge.pmd pmd-jsp - 6.48.0 + 6.49.0 net.sourceforge.pmd pmd-javascript - 6.48.0 + 6.49.0 From ca2ee055626cd251d1718e96762639063681b46b Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 1 Sep 2022 10:49:48 +0200 Subject: [PATCH 17/96] [doc] Add page for 3rd party rulesets --- docs/_data/sidebars/pmd_sidebar.yml | 3 ++ docs/pages/pmd/projectdocs/trivia/news.md | 31 ++++++++++++++++----- docs/pages/pmd/userdocs/3rdpartyrulesets.md | 27 ++++++++++++++++++ 3 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 docs/pages/pmd/userdocs/3rdpartyrulesets.md diff --git a/docs/_data/sidebars/pmd_sidebar.yml b/docs/_data/sidebars/pmd_sidebar.yml index f7ab16ddb0..e0e3854f86 100644 --- a/docs/_data/sidebars/pmd_sidebar.yml +++ b/docs/_data/sidebars/pmd_sidebar.yml @@ -58,6 +58,9 @@ entries: - title: PMD Report formats url: /pmd_userdocs_report_formats.html output: web, pdf + - title: 3rd party rulesets + output: web, pdf + url: /pmd_userdocs_3rdpartyrulesets.html - title: null output: web, pdf subfolders: diff --git a/docs/pages/pmd/projectdocs/trivia/news.md b/docs/pages/pmd/projectdocs/trivia/news.md index 8fb06bbd4c..2cf8db566d 100644 --- a/docs/pages/pmd/projectdocs/trivia/news.md +++ b/docs/pages/pmd/projectdocs/trivia/news.md @@ -9,26 +9,43 @@ author: Tom Copeland ### Salesforce / Apex Language Module +* October 2020 - [Salesforce CLI Scanner Custom XPath Rules - Part 1](https://bobbuzzard.blogspot.com/2020/10/salesforce-cli-scanner-custom-xpath.html), + [Salesforce CLI Scanner Custom XPath Rules - Part 2](http://bobbuzzard.blogspot.com/2020/10/salesforce-cli-scanner-custom-xpath_11.html) + by [Keir Bowden](https://twitter.com/bob_buzzard) + * March 2020 - [Helping Salesforce developers create readable and maintainable Apex code](https://gearset.com/blog/helping-sf-developers-create-readable-and-maintainable-apex-code) * July 2019 - [Apex PMD \| Static code analysis - Apex Hours](https://youtu.be/34PxAHtAavU) -* June 2019 - [Pluralsight](https://www.pluralsight.com/authors/don-robins) Course about leveraging PMD usage for Salesforce by [Robert Sรถsemann](https://github.com/rsoesemann) (Apex Language Module Contributor) [Play by Play: Automated Code Analysis in Salesforce - a Tools Deep-Dive](https://www.pluralsight.com/courses/play-by-play-automated-code-analysis-in-salesforce) +* June 2019 - [Pluralsight](https://www.pluralsight.com/authors/don-robins) Course about leveraging PMD usage for + Salesforce by [Robert Sรถsemann](https://github.com/rsoesemann) (Apex Language Module Contributor) + [Play by Play: Automated Code Analysis in Salesforce - a Tools Deep-Dive](https://www.pluralsight.com/courses/play-by-play-automated-code-analysis-in-salesforce) -* June 2018 - [Salesforce Way Podcast](https://salesforceway.com/podcast/podcast/) with [Robert Sรถsemann](https://github.com/rsoesemann) [Static Code Analysis with PMD for Apex](https://salesforceway.com/podcast/podcast/static-code-analysis-with-pmd-for-apex/) +* June 2018 - [Salesforce Way Podcast](https://salesforceway.com/podcast/podcast/) with + [Robert Sรถsemann](https://github.com/rsoesemann) [Static Code Analysis with PMD for Apex](https://salesforceway.com/podcast/podcast/static-code-analysis-with-pmd-for-apex/) -* January 2018 - [Webinar: How to contribute Apex rules to PMD with Robert Sรถsemann](https://www.youtube.com/watch?v=7_Ex9WWS_3Q) +* January 2018 - [Webinar: How to contribute Apex rules to PMD with Robert Sรถsemann](https://www.youtube.com/watch?v=7_Ex9WWS_3Q) -* August 2017 - Webinar about how to use PMD with The Welkin Suite Salesforce IDE - Author [Robert Sรถsemann](https://github.com/rsoesemann) - [Improving your Apex Code Quality with PMD in The Welkin Suite](https://www.youtube.com/watch?v=Ypyiy5b6huc) +* August 2017 - Webinar about how to use PMD with The Welkin Suite Salesforce IDE - Author + [Robert Sรถsemann](https://github.com/rsoesemann) - [Improving your Apex Code Quality with PMD in The Welkin Suite](https://www.youtube.com/watch?v=Ypyiy5b6huc) -* November 2016 - Recording of [Robert Sรถsemann](https://github.com/rsoesemann)'s Session at Salesforce Dreamforce Conference about enforcing Clean Code in the Salesforce world using PMD and other tools [Clean Apex Code with Automatic Code Metrics](https://www.youtube.com/watch?v=bW7m6y6bEug) +* November 2016 - Recording of [Robert Sรถsemann](https://github.com/rsoesemann)'s Session at Salesforce Dreamforce + Conference about enforcing Clean Code in the Salesforce world using PMD and other tools + [Clean Apex Code with Automatic Code Metrics](https://www.youtube.com/watch?v=bW7m6y6bEug) ### PMD in general and other Language Modules -* February 2021 - Artem Krosheninnikov's talk about Quality Assurance Automation: [Artem Krosheninnikov, Wrike - How static analysis can help in QAA processes](https://www.youtube.com/watch?v=L42zH5ne074) +* February 2021 - Artem Krosheninnikov's talk about Quality Assurance Automation: + [Artem Krosheninnikov, Wrike - How static analysis can help in QAA processes]( + https://www.youtube.com/watch?v=L42zH5ne074) -* May 2019 - [Code quality assurance with PMD โ€“ An extensible static code analyser for Java and other languages](https://www.datarespons.com/code-quality-assurance-with-pmd/) +* December 2020 - Jeroen Borgers' talk about finding performance bugs with PMD: + [J-Fall Virtual 2020: Jeroen Borgers - Fixing your performance and concurrency bugs before they bite you]( + https://www.youtube.com/watch?v=Z_sT38KTRNk) + +* May 2019 - [Code quality assurance with PMD โ€“ An extensible static code analyser for Java and other languages]( + https://www.datarespons.com/code-quality-assurance-with-pmd/) * February 2012 - Romain Pelisse's lightning talk at FOSDEM 2012 about "PMD5: What can it do for you?". [Video recording is available](http://video.fosdem.org/2012/lightningtalks/PMD5.webm). diff --git a/docs/pages/pmd/userdocs/3rdpartyrulesets.md b/docs/pages/pmd/userdocs/3rdpartyrulesets.md new file mode 100644 index 0000000000..ecbfee2818 --- /dev/null +++ b/docs/pages/pmd/userdocs/3rdpartyrulesets.md @@ -0,0 +1,27 @@ +--- +title: 3rd party rulesets +tags: [rule_references, userdocs] +summary: Lists rulesets and rules from the community +permalink: pmd_userdocs_3rdpartyrulesets.html +last_updated: September 2022 +--- + +## For Java + +* **jPinpoint rules:** PMD rule set for performance aware Java and Kotlin coding. + * +* **arch4u-pmd** is a library with pmd rules that bring new regulations related to known problems in REST API, logging, + monitoring, etc., including reconfigured default pmd rules to decrease false-positive violations during usage of + well-known frameworks like Spring, Quarkus, etc. + * +* Sample ruleset from **maxdocs**, a multi markup wiki engine. + * +* Sample ruleset from **geotools**, an open source Java library that provides tools for geospatial data. + * + * + + +## For Apex +* **unhappy-soup**, a repository with problematic Salesforce code to showcase PMD, the SFDX Scanner CLI + * + From ba0f2a2bfd0d3b4c3cd7a62fb5682dc4ad0e01ef Mon Sep 17 00:00:00 2001 From: LynnBroe Date: Mon, 5 Sep 2022 21:16:13 +0800 Subject: [PATCH 18/96] Update UnusedPrivateField.xml --- .../rule/bestpractices/xml/UnusedPrivateField.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateField.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateField.xml index 3574634255..3b6c0af121 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateField.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateField.xml @@ -742,6 +742,19 @@ public class MyTest { void test() { target.methodToTest(); } +} + ]]> + + + + #4037 false positive with Spring @SpyBean + 0 + From 0f99ef0c3c5168356f8785e7d3ba289df397820d Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Tue, 6 Sep 2022 18:33:26 +0200 Subject: [PATCH 19/96] [html] Bump jsoup from 1.14.3 to 1.15.3 Fixes https://github.com/pmd/pmd/security/dependabot/23 CVE-2022-36033 https://github.com/advisories/GHSA-gp7f-rwcx-9369 --- pmd-html/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-html/pom.xml b/pmd-html/pom.xml index bbd5c0a746..cab9828d2d 100644 --- a/pmd-html/pom.xml +++ b/pmd-html/pom.xml @@ -31,7 +31,7 @@ org.jsoup jsoup - 1.14.3 + 1.15.3 From 898454510d2a3d89dcf5b5aedb3dd4f025077d03 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Tue, 6 Sep 2022 19:28:11 +0200 Subject: [PATCH 20/96] [doc] Update ADRs from PR review comments --- docs/pages/pmd/projectdocs/decisions.md | 2 +- docs/pages/pmd/projectdocs/decisions/adr-1.md | 22 ++++++++++++++++--- docs/pages/pmd/projectdocs/decisions/adr-2.md | 20 ++++++++++------- .../pmd/projectdocs/decisions/adr-NNN.md | 8 ++++++- 4 files changed, 39 insertions(+), 13 deletions(-) diff --git a/docs/pages/pmd/projectdocs/decisions.md b/docs/pages/pmd/projectdocs/decisions.md index fd130d53af..af0258c29c 100644 --- a/docs/pages/pmd/projectdocs/decisions.md +++ b/docs/pages/pmd/projectdocs/decisions.md @@ -1,5 +1,5 @@ --- -title: Architecture Design Decisions +title: Architecture Decisions sidebar: pmd_sidebar permalink: pmd_projectdocs_decisions.html last_updated: July 2022 diff --git a/docs/pages/pmd/projectdocs/decisions/adr-1.md b/docs/pages/pmd/projectdocs/decisions/adr-1.md index e7208f9761..07bf1f84fa 100644 --- a/docs/pages/pmd/projectdocs/decisions/adr-1.md +++ b/docs/pages/pmd/projectdocs/decisions/adr-1.md @@ -6,7 +6,7 @@ sidebaractiveurl: /pmd_projectdocs_decisions.html adr: true # Proposed / Accepted / Deprecated / Superseded adr_status: "Proposed" -last_updated: July 2022 +last_updated: September 2022 --- # Context @@ -31,7 +31,7 @@ See also the blog post [Documenting Architecture Decisions](https://cognitect.co by Michael Nygard. There are many templates around to choose from. -gives a nice summary. +gives a nice summary. The page gives a good overview on ADR and for adr-related tooling. # Decision @@ -39,9 +39,19 @@ We will document the decisions we make as a project as a collection of "Architec In order to keep it simple, we will use only a simple template proposed by Michael Nygard. The documents are stored together with the source code and are part of the generated documentation site. +A new ADR should be proposed with a pull request to open the discussion. +The initial status of the new ADR is "Proposed". When maintainer consensus is reached during the PR +review, then the status is changed to "Accepted" when the PR is merged. +A new entry in the "Change History" section should be added, when the PR is merged. + +In order to propose a change to an existing ADR a new pull request should be opened which modifies the ADR. +The change can be to amend the ADR or to challenge it and maybe deprecate it. A new entry in the +"Change History" section should be added to summary the change. When maintainer consensus is reached +during the PR review, then the PR can be merged and the ADR is updated. + # Status -{{ page.adr_status }} +{{ page.adr_status }} (Last updated: {{ page.last_updated }}) # Consequences @@ -50,3 +60,9 @@ and can read the context and consequences of the decisions. This will likely als as the decisions need to be formulated and written down. Everybody is on the same page. However, this also adds additional tasks, and it takes time to write down and document the decisions. + +# Change History + +2022-09-06: Added section "Change History" to the template. Added "Last updated" to "Status" section. + +2022-07-28: Proposed initial version. diff --git a/docs/pages/pmd/projectdocs/decisions/adr-2.md b/docs/pages/pmd/projectdocs/decisions/adr-2.md index b02030f9af..1e77d6af2c 100644 --- a/docs/pages/pmd/projectdocs/decisions/adr-2.md +++ b/docs/pages/pmd/projectdocs/decisions/adr-2.md @@ -6,7 +6,7 @@ sidebaractiveurl: /pmd_projectdocs_decisions.html adr: true # Proposed / Accepted / Deprecated / Superseded adr_status: "Proposed" -last_updated: July 2022 +last_updated: September 2022 --- # Context @@ -39,27 +39,31 @@ and to keep it within bounds and therefore maintainable we came up with the foll * For (unit) testing, Kotlin can be used in `pmd-core` and in the language modules. The test frameworks can also use Kotlin (`pmd-test` doesn't yet, `pmd-lang-test` does already). * Additionally: from now on, we allow to have the individual language modules be implemented in different languages - when it makes sense. So, a language module might decide to use plain Java (like now) or also Kotlin - (or other languages if it fits). + when it makes sense. So, a language module might decide to use plain Java (like now) or also Kotlin. * When mixing languages (e.g. Java + Kotlin), we need to care that the modules can still be used with plain Java. E.g. when writing custom rules: `pmd-java` provides a couple of APIs for rules (like symbol table, type resolution) and we should not force the users to use Kotlin (at least not for language modules which already exist and for which users might have written custom rules in Java already). * It is also possible to write the entire language module in Kotlin only. Then the rules would be written in Kotlin as well. And the possible problems when mixing languages are gone. But that applies only for new language modules. - For compatibility reasons an existing language modules shouldn't be rewritten into Kotlin. That would be a +* When refactoring an existing language module from Java only to introduce Kotlin, care needs to be taken to + not make incompatible changes. If compatibility (binary or source) can't be maintained, then that would be a major version change. # Status -{{ page.adr_status }} +{{ page.adr_status }} (Last updated: {{ page.last_updated }}) # Consequences Allowing more Kotlin in PMD can attract new contributions. It might make it easier to develop small DSLs. -Also, other languages than Kotlin could be used, e.g. for `pmd-scala` Scala might make sense. +In the future we might also consider to use other languages than Kotlin, e.g. for `pmd-scala` Scala might make sense. -On the other side, other IDEs than IntelliJ IDEA will have a difficult time to deal with PMD's source code. -Eclipse can't be used practically anymore. +On the other side, other IDEs than IntelliJ IDEA will have a difficult time to deal with PMD's source code +when Kotlin is used. Eclipse can't be used practically anymore. Maintaining a polyglot code base with multiple languages is likely to be more challenging. + +# Change History + +2022-07-28: Proposed initial version. diff --git a/docs/pages/pmd/projectdocs/decisions/adr-NNN.md b/docs/pages/pmd/projectdocs/decisions/adr-NNN.md index 8388f98136..b18a9b2866 100644 --- a/docs/pages/pmd/projectdocs/decisions/adr-NNN.md +++ b/docs/pages/pmd/projectdocs/decisions/adr-NNN.md @@ -21,8 +21,14 @@ What is the change that we're proposing and/or doing? # Status -{{ page.adr_status }} +{{ page.adr_status }} (Last updated: {{ page.last_updated }}) # Consequences What becomes easier or more difficult to do because of this change? + +# Change History + +YYYY-MM-DD: Add xyz. + +YYYY-MM-DD: Proposed initial version. From 026015954abc5ec65ba021f6926f854f1f536e26 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Wed, 7 Sep 2022 19:29:55 -0700 Subject: [PATCH 21/96] Move rules from lexer to parser. Fix some bugs found in manual testing. Add bugs found via manual testing to new lua test file. --- .../sourceforge/pmd/lang/lua/antlr4/Lua.g4 | 92 +++++++++-------- .../pmd/lang/lua/cpd/testdata/luauTypes.lua | 4 + .../pmd/lang/lua/cpd/testdata/luauTypes.txt | 99 ++++++++++++++----- 3 files changed, 128 insertions(+), 67 deletions(-) diff --git a/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 b/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 index 62ac80363d..1f84395d51 100644 --- a/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 +++ b/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 @@ -91,7 +91,7 @@ stat | 'function' funcname funcbody | 'local' 'function' NAME funcbody | 'local' bindinglist ('=' explist)? - | ('export')? 'type' NAME ('<' GenericTypeParameterList '>')? '=' Type + | ('export')? 'type' NAME ('<' genericTypeParameterList '>')? '=' type ; attnamelist @@ -115,7 +115,7 @@ funcname ; funcbody - : ('<' GenericTypeParameterList '>')? '(' parlist? ')' (':' '...'? ReturnType ) block 'end' // GenericTypeParameterList and ReturnType + : ('<' genericTypeParameterList '>')? '(' parlist? ')' (':' '...'? returnType ) block 'end' // genericTypeParameterList and returnType ; parlist @@ -131,7 +131,7 @@ namelist ; binding - : NAME (':' Type ('?')?)? + : NAME (':' type ('?')?)? ; bindinglist: binding (',' bindinglist)?; @@ -158,10 +158,10 @@ exp ifelseexp: 'if' exp 'then' exp ('elseif' exp 'then' exp)* 'else' exp; -asexp: simpleexp ('::' Type)?; +asexp: simpleexp ('::' type)?; simpleexp - : 'nil' | 'false' | 'true' + : NIL | BOOLEAN | number | string | '...' @@ -242,73 +242,81 @@ number ; string - : NORMALSTRING | CHARSTRING | LONGSTRING + : NORMALSTRING | LONGSTRING ; -SimpleType - : 'nil' - | SingletonType - | NAME /* ('.' NAME)? */ ('<' TypeParams '>')? +simpleType + : NIL + | singletonType + | NAME ('.' NAME)? ('<' typeParams '>')? | 'typeof' '(' NAME ('(' ')')? | '...' ')' // can't use `exp`, manually handle common cases - | TableType - | FunctionType + | tableType + | functionType ; -SingletonType - : NORMALSTRING | CHARSTRING - | 'true' - | 'false' +singletonType + : NORMALSTRING | BOOLEAN ; -Type - : SimpleType ('?')? - | SimpleType ('?')? ('|' Type) // can't use Type because it's mutually left-recursive - | SimpleType ('?')? ('&' Type) // can't use Type because it's mutually left-recursive +type + : simpleType ('?')? + | simpleType ('?')? ('|' type) // can't use type because it's mutually left-recursive + | simpleType ('?')? ('&' type) // can't use type because it's mutually left-recursive ; -GenericTypePackParameter: NAME '...' ('=' (('(' (TypeList)? ')') | VariadicTypePack | GenericTypePack))?; // TypePack must be inlined here +genericTypePackParameter: NAME '...' ('=' (('(' (typeList)? ')') | variadicTypePack | genericTypePack))?; // typePack must be inlined here -GenericTypeParameterList: NAME ('=' Type)? (',' GenericTypeParameterList)? | GenericTypePackParameter (',' GenericTypePackParameter)*; +genericTypeParameterList: NAME ('=' type)? (',' genericTypeParameterList)? | genericTypePackParameter (',' genericTypePackParameter)*; -TypeList: Type (',' Type)? | VariadicTypePack; +typeList: type (',' type)? | variadicTypePack; -TypeParams: (Type | VariadicTypePack | GenericTypePack) (',' TypeParams)?; // had to remove TypePack +typeParams: (type | variadicTypePack | genericTypePack) (',' typeParams)?; // had to remove typePack -// TypePack: inlined everywhere to avoid overly greedy match when out-of-context +// typePack: inlined everywhere to avoid overly greedy match when out-of-context -GenericTypePack: NAME '...'; +genericTypePack: NAME '...'; -VariadicTypePack: '...' Type; +variadicTypePack: '...' type; -ReturnType: Type | '(' Type ',' Type ')' | '(' ')'; // can't use TypePack, inline common cases +returnType: variadicTypePack | '(' typeList ')' | '(' ')'; // can't use typePack, inline common cases -TableIndexer: '[' Type ']' ':' Type; +tableIndexer: '[' type ']' ':' type; -TableProp: NAME ':' Type; +tableProp: NAME ':' type; -TablePropOrIndexer - : TableProp | TableIndexer; +tablePropOrIndexer + : tableProp | tableIndexer; -PropList - : TablePropOrIndexer ((','|';') TablePropOrIndexer)* (','|';')?; +propList + : tablePropOrIndexer ((','|';') tablePropOrIndexer)* (','|';')?; -TableType - : '{' PropList '}'; +tableType + : '{' propList '}'; + +functionType: ('<' genericTypeParameterList '>')? '(' (typeList)? ')' '->' returnType; + +require + : 'require' '(' (NAME ('.' NAME)*) | NORMALSTRING ')' ('::' type)? + ; -FunctionType: ('<' GenericTypeParameterList '>')? '(' (TypeList)? ')' '->' (Type | '(' ')' | '(' (TypeList) ')'); // inline ReturnType to avoid greediness // LEXER +NIL + : 'nil' + ; + +BOOLEAN + : 'true' | 'false' + ; + NAME : [a-zA-Z_][a-zA-Z_0-9]* ; NORMALSTRING : '"' ( EscapeSequence | ~('\\'|'"') )* '"' - ; - -CHARSTRING - : '\'' ( EscapeSequence | ~('\''|'\\') )* '\'' + | '\'' ( EscapeSequence | ~('\\'|'\'') )* '\'' ; LONGSTRING @@ -401,7 +409,7 @@ LINE_COMMENT ; WS - : [ \t\u000C\r\n]+ -> skip + : [ \n\r\t\u000B\u000C\u0000]+ -> channel(HIDDEN) ; SHEBANG diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.lua b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.lua index 1c391a37a6..2294030324 100644 --- a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.lua +++ b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.lua @@ -7,6 +7,10 @@ local _notLiteral = not true local _notVariable = not x local _length = #{x} export type Function = (...any) -> T... +local _PlatformService = nil +local game = require(script.Parent.game) :: any +pcall(function() _PlatformService = game:GetService('PlatformService') end) + return function (req, ...: boolean): ({[string|number]: T}, string, Function<...any>) local body = string.format("%s %s\n", req.method, req.path) diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt index 2be84bbb8a..7eb53efa9e 100644 --- a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt +++ b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt @@ -53,18 +53,56 @@ L9 [type] 8 11 [Function] 13 20 [<] 21 21 - [T...] 22 25 + [T] 22 22 + [...] 23 25 [=] 27 27 - [...any] 29 34 + [...] 29 31 + [any] 32 34 [>] 35 35 [=] 37 37 [(] 39 39 - [...any] 40 45 + [...] 40 42 + [any] 43 45 [)] 46 46 - [-] 48 48 - [>] 49 49 - [T...] 51 54 + [->] 48 49 + [T] 51 51 + [...] 52 54 +L10 + [local] 1 5 + [_PlatformService] 7 22 + [=] 24 24 + [nil] 26 28 L11 + [local] 1 5 + [game] 7 10 + [=] 12 12 + [require] 14 20 + [(] 21 21 + [script] 22 27 + [.] 28 28 + [Parent] 29 34 + [.] 35 35 + [game] 36 39 + [)] 40 40 + [::] 42 43 + [any] 45 47 +L12 + [pcall] 1 5 + [(] 6 6 + [function] 7 14 + [(] 15 15 + [)] 16 16 + [_PlatformService] 18 33 + [=] 35 35 + [game] 37 40 + [:] 41 41 + [GetService] 42 51 + [(] 52 52 + ['PlatformService'] 53 69 + [)] 70 70 + [end] 72 74 + [)] 75 75 +L15 [return] 1 6 [function] 8 15 [<] 17 17 @@ -81,7 +119,9 @@ L11 [(] 41 41 [{] 42 42 [\[] 43 43 - [string|number] 44 56 + [string] 44 49 + [|] 50 50 + [number] 51 56 [\]] 57 57 [:] 58 58 [T] 60 60 @@ -89,9 +129,13 @@ L11 [,] 62 62 [string] 64 69 [,] 70 70 - [Function<...any>] 72 87 + [Function] 72 79 + [<] 80 80 + [...] 81 83 + [any] 84 86 + [>] 87 87 [)] 88 88 -L12 +L16 [local] 3 7 [body] 9 12 [=] 14 14 @@ -109,24 +153,24 @@ L12 [.] 56 56 [path] 57 60 [)] 61 61 -L13 +L17 [local] 3 7 [res] 9 11 [=] 13 13 [{] 15 15 -L14 +L18 [code] 5 8 [=] 10 10 [200] 12 14 [,] 15 15 -L15 +L19 [{] 5 5 ["Content-Type"] 7 20 [,] 21 21 ["text/plain"] 23 34 [}] 36 36 [,] 37 37 -L16 +L20 [{] 5 5 ["Content-Length"] 7 22 [,] 23 23 @@ -134,9 +178,12 @@ L16 [body] 26 29 [}] 31 31 [::] 33 34 - [Array] 36 45 + [Array] 36 40 + [<] 41 41 + [any] 42 44 + [>] 45 45 [,] 46 46 -L17 +L21 [}] 3 3 [::] 5 6 [{] 8 8 @@ -153,7 +200,7 @@ L17 [boolean] 41 47 [>] 48 48 [}] 50 50 -L18 +L22 [if] 3 4 [(] 6 6 [req] 7 9 @@ -163,7 +210,7 @@ L18 [.] 18 18 [keepAlive] 19 27 [then] 29 32 -L19 +L23 [local] 5 9 [socketType] 11 20 [:] 21 21 @@ -176,13 +223,13 @@ L19 [""] 56 57 [::] 59 60 [""] 62 63 -L20 +L24 [socketType] 5 14 [=] 16 16 ["Connection"] 18 29 [::] 31 32 ["Connection"] 34 45 -L21 +L25 [res] 5 7 [\[] 8 8 [#] 9 9 @@ -198,7 +245,7 @@ L21 [,] 43 43 ["Keep-Alive"] 45 56 [}] 58 58 -L22 +L26 [res] 5 7 [\[] 8 8 [#] 9 9 @@ -210,9 +257,9 @@ L22 [{] 21 21 [...] 23 25 [}] 27 27 -L23 +L27 [end] 3 5 -L25 +L29 [return] 3 8 [(] 10 10 [res] 11 13 @@ -228,12 +275,14 @@ L25 [,] 37 37 [function] 39 46 [(] 47 47 - [...)] 48 51 + [...] 48 50 + [)] 51 51 [:] 52 52 - [...any] 54 59 + [...] 54 56 + [any] 57 59 [return] 61 66 [...] 68 70 [end] 72 74 -L26 +L30 [end] 1 3 EOF From 7cf9c6571e16b5ee786f1a1ee1fd15101c2956fc Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Wed, 7 Sep 2022 19:37:13 -0700 Subject: [PATCH 22/96] add an if-expression twist --- .../pmd/lang/lua/cpd/testdata/luauTypes.lua | 2 +- .../pmd/lang/lua/cpd/testdata/luauTypes.txt | 33 ++++++++++++------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.lua b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.lua index 2294030324..6afb9b7c56 100644 --- a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.lua +++ b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.lua @@ -26,5 +26,5 @@ return function (req, ...: boolean): ({[string|number]: T}, string, Function< res[#res - 2] = { ... } end - return (res :: any) :: { T }, body, function(...): ...any return ... end + return (res :: any) :: { T }, (if req then body else "") :: string, function(...): ...any return ... end end \ No newline at end of file diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt index 7eb53efa9e..1517afea84 100644 --- a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt +++ b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt @@ -271,18 +271,27 @@ L29 [T] 28 28 [}] 30 30 [,] 31 31 - [body] 33 36 - [,] 37 37 - [function] 39 46 - [(] 47 47 - [...] 48 50 - [)] 51 51 - [:] 52 52 - [...] 54 56 - [any] 57 59 - [return] 61 66 - [...] 68 70 - [end] 72 74 + [(] 33 33 + [if] 34 35 + [req] 37 39 + [then] 41 44 + [body] 46 49 + [else] 51 54 + [""] 56 57 + [)] 58 58 + [::] 60 61 + [string] 63 68 + [,] 69 69 + [function] 71 78 + [(] 79 79 + [...] 80 82 + [)] 83 83 + [:] 84 84 + [...] 86 88 + [any] 89 91 + [return] 93 98 + [...] 100 102 + [end] 104 106 L30 [end] 1 3 EOF From 7747b750914c8c3e6a21b2de728f1bf5ed1c5824 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Thu, 8 Sep 2022 12:46:43 -0700 Subject: [PATCH 23/96] Cleanups and minor tweaks for issues found in testing across 500KLOC of open source Lua code. --- .../sourceforge/pmd/lang/lua/antlr4/Lua.g4 | 23 ++++++++++--------- .../pmd/lang/lua/cpd/testdata/luauTypes.lua | 2 +- .../pmd/lang/lua/cpd/testdata/luauTypes.txt | 6 +++-- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 b/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 index 1f84395d51..30e36071ff 100644 --- a/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 +++ b/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 @@ -62,6 +62,7 @@ Tested by Matt Hargett with: - Entire codebase and test suite for neovim v0.7.2: https://github.com/neovim/neovim/tree/v0.7.2 - Entire codebase for World of Warcraft Interface: https://github.com/tomrus88/BlizzardInterfaceCode - Benchmarks and conformance test suite for Luau 0.537: https://github.com/Roblox/luau/tree/0.537 + - Entire Lua codebase for nmap 7.92 : https://github.com/nmap/nmap */ grammar Lua; @@ -115,7 +116,7 @@ funcname ; funcbody - : ('<' genericTypeParameterList '>')? '(' parlist? ')' (':' '...'? returnType ) block 'end' // genericTypeParameterList and returnType + : ('<' genericTypeParameterList '>')? '(' parlist? ')' (':' '...'? returnType ) block 'end' ; parlist @@ -249,7 +250,7 @@ simpleType : NIL | singletonType | NAME ('.' NAME)? ('<' typeParams '>')? - | 'typeof' '(' NAME ('(' ')')? | '...' ')' // can't use `exp`, manually handle common cases + | 'typeof' '(' exp ')' | tableType | functionType ; @@ -260,25 +261,25 @@ singletonType type : simpleType ('?')? - | simpleType ('?')? ('|' type) // can't use type because it's mutually left-recursive - | simpleType ('?')? ('&' type) // can't use type because it's mutually left-recursive + | type ('|' type) + | type ('&' type) ; -genericTypePackParameter: NAME '...' ('=' (('(' (typeList)? ')') | variadicTypePack | genericTypePack))?; // typePack must be inlined here +genericTypePackParameter: NAME '...' ('=' (typePack | variadicTypePack | genericTypePack))?; genericTypeParameterList: NAME ('=' type)? (',' genericTypeParameterList)? | genericTypePackParameter (',' genericTypePackParameter)*; -typeList: type (',' type)? | variadicTypePack; +typeList: type (',' typeList)? | variadicTypePack; -typeParams: (type | variadicTypePack | genericTypePack) (',' typeParams)?; // had to remove typePack +typeParams: (type | typePack | variadicTypePack | genericTypePack) (',' typeParams)?; -// typePack: inlined everywhere to avoid overly greedy match when out-of-context +typePack: '(' (typeList)? ')'; genericTypePack: NAME '...'; variadicTypePack: '...' type; -returnType: variadicTypePack | '(' typeList ')' | '(' ')'; // can't use typePack, inline common cases +returnType: type | typePack; tableIndexer: '[' type ']' ':' type; @@ -288,7 +289,7 @@ tablePropOrIndexer : tableProp | tableIndexer; propList - : tablePropOrIndexer ((','|';') tablePropOrIndexer)* (','|';')?; + : tablePropOrIndexer (fieldsep tablePropOrIndexer)* fieldsep?; tableType : '{' propList '}'; @@ -296,7 +297,7 @@ tableType functionType: ('<' genericTypeParameterList '>')? '(' (typeList)? ')' '->' returnType; require - : 'require' '(' (NAME ('.' NAME)*) | NORMALSTRING ')' ('::' type)? + : 'local'? bindinglist '=' 'require' '(' exp ')' ('.' NAME)* ('::' type)? ';'? ; diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.lua b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.lua index 6afb9b7c56..9e418a61de 100644 --- a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.lua +++ b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.lua @@ -8,7 +8,7 @@ local _notVariable = not x local _length = #{x} export type Function = (...any) -> T... local _PlatformService = nil -local game = require(script.Parent.game) :: any +local game = require(script.Parent.game).default :: any pcall(function() _PlatformService = game:GetService('PlatformService') end) diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt index 1517afea84..ac7939686c 100644 --- a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt +++ b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt @@ -84,8 +84,10 @@ L11 [.] 35 35 [game] 36 39 [)] 40 40 - [::] 42 43 - [any] 45 47 + [.] 41 41 + [default] 42 48 + [::] 50 51 + [any] 53 55 L12 [pcall] 1 5 [(] 6 6 From 11b7bda8719926cc0f3363dd560ff7d81579b302 Mon Sep 17 00:00:00 2001 From: mohan-chinnappan-n Date: Fri, 9 Sep 2022 04:21:56 -0400 Subject: [PATCH 24/96] Update TreeExportCli.java missing --file arg in "Example: ast-dump --format xml --language java --file MyFile.java" added --- .../java/net/sourceforge/pmd/util/treeexport/TreeExportCli.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/util/treeexport/TreeExportCli.java b/pmd-core/src/main/java/net/sourceforge/pmd/util/treeexport/TreeExportCli.java index cd7c7c7e99..5ad05cb9da 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/util/treeexport/TreeExportCli.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/util/treeexport/TreeExportCli.java @@ -139,7 +139,7 @@ public class TreeExportCli { sb.append(System.lineSeparator()) .append(System.lineSeparator()); - sb.append("Example: ast-dump --format xml --language java MyFile.java") + sb.append("Example: ast-dump --format xml --language java --file MyFile.java") .append(System.lineSeparator()); System.err.print(sb); From b8b4e513ac232711f00ed9e4b699b7a2459e1233 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Fri, 9 Sep 2022 16:42:18 -0700 Subject: [PATCH 25/96] Support multi-line 'normal' strings. Support skipping literal sequences. More minor adjustments to make the testing corpus tokenize without errors. --- .../sourceforge/pmd/lang/lua/antlr4/Lua.g4 | 88 +++++++--- .../net/sourceforge/pmd/cpd/LuaLanguage.java | 15 +- .../net/sourceforge/pmd/cpd/LuaTokenizer.java | 166 +++++++++++++++++- .../pmd/lang/lua/cpd/testdata/luauTypes.lua | 10 +- .../pmd/lang/lua/cpd/testdata/luauTypes.txt | 69 ++++---- 5 files changed, 283 insertions(+), 65 deletions(-) diff --git a/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 b/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 index 30e36071ff..4676055f48 100644 --- a/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 +++ b/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 @@ -77,7 +77,7 @@ block stat : ';' - | varlist '=' explist + | varlist ASSIGNMENT explist | var compoundop exp | functioncall | label @@ -87,11 +87,11 @@ stat | 'while' exp 'do' block 'end' | 'repeat' block 'until' exp | 'if' exp 'then' block ('elseif' exp 'then' block)* ('else' block)? 'end' - | 'for' binding '=' exp ',' exp (',' exp)? 'do' block 'end' + | 'for' binding ASSIGNMENT exp ',' exp (',' exp)? 'do' block 'end' | 'for' bindinglist 'in' explist 'do' block 'end' | 'function' funcname funcbody - | 'local' 'function' NAME funcbody - | 'local' bindinglist ('=' explist)? + | LOCAL 'function' NAME funcbody + | LOCAL bindinglist (ASSIGNMENT explist)? | ('export')? 'type' NAME ('<' genericTypeParameterList '>')? '=' type ; @@ -116,7 +116,7 @@ funcname ; funcbody - : ('<' genericTypeParameterList '>')? '(' parlist? ')' (':' '...'? returnType ) block 'end' + : ('<' genericTypeParameterList '>')? OPEN_PARENS parlist? CLOSE_PARENS (':' '...'? returnType ) block 'end' ; parlist @@ -138,7 +138,7 @@ binding bindinglist: binding (',' bindinglist)?; var - : (NAME | '(' exp ')' varSuffix) varSuffix* + : (NAME | OPEN_PARENS exp CLOSE_PARENS varSuffix) varSuffix* ; varlist @@ -172,11 +172,11 @@ simpleexp | tableconstructor; varOrExp - : var | '(' exp ')' + : var | OPEN_PARENS exp CLOSE_PARENS ; varSuffix - : nameAndArgs* ('[' exp ']' | '.' NAME) + : nameAndArgs* (OPEN_BRACKET exp CLOSE_BRACKET | '.' NAME) ; nameAndArgs @@ -184,7 +184,7 @@ nameAndArgs ; args - : '(' explist? ')' | tableconstructor | string + : OPEN_PARENS explist? CLOSE_PARENS | tableconstructor | string ; functiondef @@ -192,7 +192,7 @@ functiondef ; tableconstructor - : '{' fieldlist? '}' + : OPEN_BRACE fieldlist? CLOSE_BRACE ; fieldlist @@ -200,7 +200,7 @@ fieldlist ; field - : '[' exp ']' '=' exp | NAME '=' exp | exp + : OPEN_BRACKET exp CLOSE_BRACKET ASSIGNMENT exp | NAME ASSIGNMENT exp | exp ; fieldsep @@ -220,6 +220,8 @@ operatorAnd operatorComparison : '<' | '>' | '<=' | '>=' | '~=' | '=='; +ASSIGNMENT: '='; + operatorStrcat : '..'; @@ -243,20 +245,20 @@ number ; string - : NORMALSTRING | LONGSTRING + : NORMAL_STRING | LONG_STRING | INTERPOLATED_STRING ; simpleType : NIL | singletonType | NAME ('.' NAME)? ('<' typeParams '>')? - | 'typeof' '(' exp ')' + | 'typeof' OPEN_PARENS exp CLOSE_PARENS | tableType | functionType ; singletonType - : NORMALSTRING | BOOLEAN + : NORMAL_STRING | BOOLEAN ; type @@ -273,7 +275,7 @@ typeList: type (',' typeList)? | variadicTypePack; typeParams: (type | typePack | variadicTypePack | genericTypePack) (',' typeParams)?; -typePack: '(' (typeList)? ')'; +typePack: OPEN_PARENS (typeList)? CLOSE_PARENS; genericTypePack: NAME '...'; @@ -281,7 +283,7 @@ variadicTypePack: '...' type; returnType: type | typePack; -tableIndexer: '[' type ']' ':' type; +tableIndexer: OPEN_BRACKET type CLOSE_BRACKET ':' type; tableProp: NAME ':' type; @@ -292,17 +294,25 @@ propList : tablePropOrIndexer (fieldsep tablePropOrIndexer)* fieldsep?; tableType - : '{' propList '}'; + : OPEN_BRACE propList CLOSE_BRACE; -functionType: ('<' genericTypeParameterList '>')? '(' (typeList)? ')' '->' returnType; +functionType: ('<' genericTypeParameterList '>')? OPEN_PARENS (typeList)? CLOSE_PARENS '->' returnType; require - : 'local'? bindinglist '=' 'require' '(' exp ')' ('.' NAME)* ('::' type)? ';'? + : 'local'? bindinglist '=' REQUIRE OPEN_PARENS exp CLOSE_PARENS ('.' NAME)* ('::' type)? ';'? ; // LEXER +LOCAL + : 'local' + ; + +REQUIRE + : 'require' + ; + NIL : 'nil' ; @@ -315,19 +325,23 @@ NAME : [a-zA-Z_][a-zA-Z_0-9]* ; -NORMALSTRING - : '"' ( EscapeSequence | ~('\\'|'"') )* '"' - | '\'' ( EscapeSequence | ~('\\'|'\'') )* '\'' +NORMAL_STRING + : '"' (~["\\\r\n\u0085\u2028\u2029] | EscapeSequence | '\\\n')* '"' + | '\'' (~['\\\r\n\u0085\u2028\u2029] | EscapeSequence | '\\\n')* '\'' ; -LONGSTRING - : '[' NESTED_STR ']' +INTERPOLATED_STRING + : '`' (~[`\\\r\n\u0085\u2028\u2029] | EscapeSequence | '\\\n')* '`' + ; + +LONG_STRING + : OPEN_BRACKET NESTED_STR CLOSE_BRACKET ; fragment NESTED_STR : '=' NESTED_STR '=' - | '[' .*? ']' + | OPEN_BRACKET .*? CLOSE_BRACKET ; INT @@ -350,6 +364,26 @@ HEX_FLOAT | '0' [xX] HexDigit+ HexExponentPart ; +OPEN_BRACE: '{'; +CLOSE_BRACE: '}'; + +OPEN_BRACKET: '['; +CLOSE_BRACKET: ']'; + +OPEN_PARENS: '('; +CLOSE_PARENS: ')'; + +NL + : '\r\n' | '\r' | '\n' + | '\u0085' // ' + | '\u2028' //'' + | '\u2029' //'' + ; + +COMMA + : ',' + ; + fragment ExponentPart : [eE] [+-]? Digit+ @@ -362,8 +396,8 @@ HexExponentPart fragment EscapeSequence - : '\\' [abfnrtvz"'|$#\\] // World of Warcraft Lua additionally escapes |$# - | '\\' '\r'? '\n' + : '\\' [abfnrtvz"'`|$#\\] // World of Warcraft Lua additionally escapes |$# + | NL | DecimalEscape | HexEscape | UtfEscape diff --git a/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaLanguage.java b/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaLanguage.java index e2a87ec878..2e485e13b8 100644 --- a/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaLanguage.java +++ b/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaLanguage.java @@ -4,15 +4,28 @@ package net.sourceforge.pmd.cpd; +import java.util.Properties; + /** * Language implementation for Lua */ public class LuaLanguage extends AbstractLanguage { + public LuaLanguage() { + this(System.getProperties()); + } + /** * Creates a new Lua Language instance. */ - public LuaLanguage() { + public LuaLanguage(Properties properties) { super("Lua", "lua", new LuaTokenizer(), ".lua"); + setProperties(properties); + } + + @Override + public final void setProperties(Properties properties) { + LuaTokenizer tokenizer = (LuaTokenizer) getTokenizer(); + tokenizer.setProperties(properties); } } diff --git a/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaTokenizer.java b/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaTokenizer.java index 23c292dbe7..8e4f354b17 100644 --- a/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaTokenizer.java +++ b/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaTokenizer.java @@ -4,8 +4,11 @@ package net.sourceforge.pmd.cpd; +import java.util.Properties; + import org.antlr.v4.runtime.CharStream; +import net.sourceforge.pmd.cpd.token.AntlrToken; import net.sourceforge.pmd.cpd.token.AntlrTokenFilter; import net.sourceforge.pmd.lang.antlr.AntlrTokenManager; import net.sourceforge.pmd.lang.lua.antlr4.LuaLexer; @@ -15,6 +18,22 @@ import net.sourceforge.pmd.lang.lua.antlr4.LuaLexer; */ public class LuaTokenizer extends AntlrTokenizer { + private boolean ignoreLiteralSequences = false; + + /** + * Sets the possible options for the C# tokenizer. + * + * @param properties the properties + * @see #OPTION_IGNORE_LITERAL_SEQUENCES + */ + public void setProperties(Properties properties) { + ignoreLiteralSequences = getBooleanProperty(properties, OPTION_IGNORE_LITERAL_SEQUENCES); + } + + private boolean getBooleanProperty(final Properties properties, final String property) { + return Boolean.parseBoolean(properties.getProperty(property, Boolean.FALSE.toString())); + } + @Override protected AntlrTokenManager getLexerForSource(SourceCode sourceCode) { CharStream charStream = AntlrTokenizer.getCharStreamFromSourceCode(sourceCode); @@ -23,6 +42,151 @@ public class LuaTokenizer extends AntlrTokenizer { @Override protected AntlrTokenFilter getTokenFilter(final AntlrTokenManager tokenManager) { - return new AntlrTokenFilter(tokenManager); + return new LuaTokenFilter(tokenManager, ignoreLiteralSequences); + } + + /** + * The {@link LuaTokenFilter} extends the {@link AntlrTokenFilter} to discard + * Lua-specific tokens. + *

+ * By default, it enables annotation-based CPD suppression. + * If the --ignoreUsings flag is provided, require() directives are filtered out. + *

+ */ + private static class LuaTokenFilter extends AntlrTokenFilter { + + private final boolean ignoreLiteralSequences; + private boolean discardingRequires = false; + private boolean discardingNL = false; + private AntlrToken discardingLiteralsUntil = null; + private boolean discardCurrent = false; + + + LuaTokenFilter(final AntlrTokenManager tokenManager, boolean ignoreLiteralSequences) { + super(tokenManager); + this.ignoreLiteralSequences = ignoreLiteralSequences; + } + + @Override + protected void analyzeToken(final AntlrToken currentToken) { + skipNewLines(currentToken); + } + + @Override + protected void analyzeTokens(final AntlrToken currentToken, final Iterable remainingTokens) { + discardCurrent = false; + skipRequires(currentToken, remainingTokens); + skipLiteralSequences(currentToken, remainingTokens); + } + + private void skipRequires(final AntlrToken currentToken, final Iterable remainingTokens) { + final int type = currentToken.getKind(); + if (type == LuaLexer.REQUIRE) { + discardingRequires = true; + } else if (type == LuaLexer.CLOSE_PARENS && discardingRequires) { + discardingRequires = false; + discardCurrent = true; + } + } + + private void skipNewLines(final AntlrToken currentToken) { + discardingNL = currentToken.getKind() == LuaLexer.NL; + } + + private void skipLiteralSequences(final AntlrToken currentToken, final Iterable remainingTokens) { + if (ignoreLiteralSequences) { + final int type = currentToken.getKind(); + if (isDiscardingLiterals()) { + if (currentToken == discardingLiteralsUntil) { // NOPMD - intentional check for reference equality + discardingLiteralsUntil = null; + discardCurrent = true; + } + } else if (type == LuaLexer.OPEN_BRACE + || type == LuaLexer.OPEN_BRACKET + || type == LuaLexer.OPEN_PARENS) { + final AntlrToken finalToken = findEndOfSequenceOfLiterals(remainingTokens); + discardingLiteralsUntil = finalToken; + } + } + } + + private AntlrToken findEndOfSequenceOfLiterals(final Iterable remainingTokens) { + boolean seenLiteral = false; + int braceCount = 0; + int bracketCount = 0; + int parenCount = 0; + for (final AntlrToken token : remainingTokens) { + switch (token.getKind()) { + case LuaLexer.INT: + case LuaLexer.NORMAL_STRING: + case LuaLexer.INTERPOLATED_STRING: + case LuaLexer.LONG_STRING: + case LuaLexer.HEX_FLOAT: + case LuaLexer.HEX: + case LuaLexer.FLOAT: + case LuaLexer.NIL: + case LuaLexer.BOOLEAN: + seenLiteral = true; + break; // can be skipped; continue to the next token + case LuaLexer.COMMA: + break; // can be skipped; continue to the next token + case LuaLexer.NL: + // this helps skip large multi-line data table sequences in Lua + break; // can be skipped; continue to the next token + case LuaLexer.ASSIGNMENT: + // this helps skip large data table sequences in Lua: { ["bob"] = "uncle", ["alice"] = "enby" } + break; // can be skipped; continue to the next token + case LuaLexer.OPEN_BRACE: + braceCount++; + break; // curly braces are allowed, as long as they're balanced + case LuaLexer.CLOSE_BRACE: + braceCount--; + if (braceCount < 0) { + // end of the list in the braces; skip all contents + return seenLiteral ? token : null; + } else { + // curly braces are not yet balanced; continue to the next token + break; + } + case LuaLexer.OPEN_BRACKET: + bracketCount++; + break; // brackets are allowed, as long as they're balanced + case LuaLexer.CLOSE_BRACKET: + bracketCount--; + if (bracketCount < 0) { + // end of the list in the brackets; skip all contents + return seenLiteral ? token : null; + } else { + // brackets are not yet balanced; continue to the next token + break; + } + case LuaLexer.OPEN_PARENS: + parenCount++; + break; // parens are allowed, as long as they're balanced + case LuaLexer.CLOSE_PARENS: + parenCount--; + if (parenCount < 0) { + // end of the list in the parens; skip all contents + return seenLiteral ? token : null; + } else { + // parens are not yet balanced; continue to the next token + break; + } + default: + // some other token than the expected ones; this is not a sequence of literals + return null; + } + } + return null; + } + + public boolean isDiscardingLiterals() { + return discardingLiteralsUntil != null; + } + + @Override + protected boolean isLanguageSpecificDiscarding() { + return discardingRequires || discardingNL || isDiscardingLiterals() || discardCurrent; + } } } diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.lua b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.lua index 9e418a61de..da4e9ddf80 100644 --- a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.lua +++ b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.lua @@ -11,18 +11,22 @@ local _PlatformService = nil local game = require(script.Parent.game).default :: any pcall(function() _PlatformService = game:GetService('PlatformService') end) - return function (req, ...: boolean): ({[string|number]: T}, string, Function<...any>) local body = string.format("%s %s\n", req.method, req.path) local res = { code = 200, { "Content-Type", "text/plain" }, - { "Content-Length", #body } :: Array, + { + "Content-Length", + #body, + ["Auth.Confirm"] = [[่‡ณ๏ผš%sใ€‚]], + + } :: Array, } :: { [any]: number | Array } if (req :: any).keepAlive then local socketType: "Connection" | "Pingback" | "" = "" :: "" socketType = "Connection" :: "Connection" - res[#res + 1] = { socketType :: string, "Keep-Alive" } + res[#res + 1] = { socketType :: string, `\`${req.keepAlive}\`` } res[#res - 2] = { ... } end diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt index ac7939686c..f1a3934c53 100644 --- a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt +++ b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt @@ -76,14 +76,6 @@ L11 [local] 1 5 [game] 7 10 [=] 12 12 - [require] 14 20 - [(] 21 21 - [script] 22 27 - [.] 28 28 - [Parent] 29 34 - [.] 35 35 - [game] 36 39 - [)] 40 40 [.] 41 41 [default] 42 48 [::] 50 51 @@ -104,7 +96,7 @@ L12 [)] 70 70 [end] 72 74 [)] 75 75 -L15 +L14 [return] 1 6 [function] 8 15 [<] 17 17 @@ -137,7 +129,7 @@ L15 [any] 84 86 [>] 87 87 [)] 88 88 -L16 +L15 [local] 3 7 [body] 9 12 [=] 14 14 @@ -155,37 +147,48 @@ L16 [.] 56 56 [path] 57 60 [)] 61 61 -L17 +L16 [local] 3 7 [res] 9 11 [=] 13 13 [{] 15 15 -L18 +L17 [code] 5 8 [=] 10 10 [200] 12 14 [,] 15 15 -L19 +L18 [{] 5 5 ["Content-Type"] 7 20 [,] 21 21 ["text/plain"] 23 34 [}] 36 36 [,] 37 37 -L20 +L19 [{] 5 5 +L20 ["Content-Length"] 7 22 [,] 23 23 - [#] 25 25 - [body] 26 29 - [}] 31 31 - [::] 33 34 - [Array] 36 40 - [<] 41 41 - [any] 42 44 - [>] 45 45 - [,] 46 46 L21 + [#] 7 7 + [body] 8 11 + [,] 12 12 +L22 + [\[] 7 7 + ["Auth.Confirm"] 8 21 + [\]] 22 22 + [=] 24 24 + [\[\[่‡ณ๏ผš%sใ€‚\]\]] 26 34 + [,] 35 35 +L24 + [}] 5 5 + [::] 7 8 + [Array] 10 14 + [<] 15 15 + [any] 16 18 + [>] 19 19 + [,] 20 20 +L25 [}] 3 3 [::] 5 6 [{] 8 8 @@ -202,7 +205,7 @@ L21 [boolean] 41 47 [>] 48 48 [}] 50 50 -L22 +L26 [if] 3 4 [(] 6 6 [req] 7 9 @@ -212,7 +215,7 @@ L22 [.] 18 18 [keepAlive] 19 27 [then] 29 32 -L23 +L27 [local] 5 9 [socketType] 11 20 [:] 21 21 @@ -225,13 +228,13 @@ L23 [""] 56 57 [::] 59 60 [""] 62 63 -L24 +L28 [socketType] 5 14 [=] 16 16 ["Connection"] 18 29 [::] 31 32 ["Connection"] 34 45 -L25 +L29 [res] 5 7 [\[] 8 8 [#] 9 9 @@ -245,9 +248,9 @@ L25 [::] 34 35 [string] 37 42 [,] 43 43 - ["Keep-Alive"] 45 56 - [}] 58 58 -L26 + [`\\`${req.keepAlive}\\``] 45 66 + [}] 68 68 +L30 [res] 5 7 [\[] 8 8 [#] 9 9 @@ -259,9 +262,9 @@ L26 [{] 21 21 [...] 23 25 [}] 27 27 -L27 +L31 [end] 3 5 -L29 +L33 [return] 3 8 [(] 10 10 [res] 11 13 @@ -294,6 +297,6 @@ L29 [return] 93 98 [...] 100 102 [end] 104 106 -L30 +L34 [end] 1 3 EOF From 7d9a84fddebf38ce6808e9c1db6a5091baa2e5ca Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Fri, 9 Sep 2022 16:51:33 -0700 Subject: [PATCH 26/96] Format to have more consistent style with itself. Most other files appear to have mixed formatting. --- .../sourceforge/pmd/lang/lua/antlr4/Lua.g4 | 213 +++++++++++++----- 1 file changed, 154 insertions(+), 59 deletions(-) diff --git a/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 b/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 index 4676055f48..2c2603c0a2 100644 --- a/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 +++ b/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 @@ -120,7 +120,8 @@ funcbody ; parlist - : bindinglist (',' '...')? | '...' + : bindinglist (',' '...')? + | '...' ; explist @@ -135,7 +136,9 @@ binding : NAME (':' type ('?')?)? ; -bindinglist: binding (',' bindinglist)?; +bindinglist + : binding (',' bindinglist)? + ; var : (NAME | OPEN_PARENS exp CLOSE_PARENS varSuffix) varSuffix* @@ -157,9 +160,13 @@ exp : (asexp | operatorUnary exp) ( binop exp )* ; -ifelseexp: 'if' exp 'then' exp ('elseif' exp 'then' exp)* 'else' exp; +ifelseexp + : 'if' exp 'then' exp ('elseif' exp 'then' exp)* 'else' exp + ; -asexp: simpleexp ('::' type)?; +asexp + : simpleexp ('::' type)? + ; simpleexp : NIL | BOOLEAN @@ -172,7 +179,8 @@ simpleexp | tableconstructor; varOrExp - : var | OPEN_PARENS exp CLOSE_PARENS + : var + | OPEN_PARENS exp CLOSE_PARENS ; varSuffix @@ -184,7 +192,9 @@ nameAndArgs ; args - : OPEN_PARENS explist? CLOSE_PARENS | tableconstructor | string + : OPEN_PARENS explist? CLOSE_PARENS + | tableconstructor + | string ; functiondef @@ -200,16 +210,34 @@ fieldlist ; field - : OPEN_BRACKET exp CLOSE_BRACKET ASSIGNMENT exp | NAME ASSIGNMENT exp | exp + : OPEN_BRACKET exp CLOSE_BRACKET ASSIGNMENT exp + | NAME ASSIGNMENT exp + | exp ; fieldsep - : ',' | ';' + : ',' + | ';' ; -compoundop: '+=' | '-=' | '*=' | '/=' | '%=' | '^=' | '..='; +compoundop + : '+=' + | '-=' + + | '*=' + | '/=' + | '%=' + | '^=' + | '..='; -binop: operatorAddSub | operatorMulDivMod | operatorPower | operatorStrcat | operatorComparison | operatorAnd | operatorOr | operatorBitwise; +binop: operatorAddSub + | operatorMulDivMod + | operatorPower + | operatorStrcat + | operatorComparison + | operatorAnd + | operatorOr + | operatorBitwise; operatorOr : 'or'; @@ -218,34 +246,62 @@ operatorAnd : 'and'; operatorComparison - : '<' | '>' | '<=' | '>=' | '~=' | '=='; + : '<' + | '>' + | '<=' + | '>=' + | '~=' + | '==' + ; -ASSIGNMENT: '='; +ASSIGNMENT + : '=' + ; operatorStrcat : '..'; operatorAddSub - : '+' | '-'; + : '+' + | '-' + ; operatorMulDivMod - : '*' | '/' | '%' | '//'; + : '*' + | '/' + | '%' + | '//' + ; operatorBitwise - : '&' | '|' | '~' | '<<' | '>>'; + : '&' + | '|' + | '~' + | '<<' + | '>>' + ; operatorUnary - : 'not' | '#' | '-' | '~'; + : 'not' + | '#' + | '-' + | '~' + ; operatorPower : '^'; number - : INT | HEX | FLOAT | HEX_FLOAT + : INT + | HEX + | FLOAT + | HEX_FLOAT ; string - : NORMAL_STRING | LONG_STRING | INTERPOLATED_STRING + : NORMAL_STRING + | LONG_STRING + | INTERPOLATED_STRING ; simpleType @@ -258,7 +314,8 @@ simpleType ; singletonType - : NORMAL_STRING | BOOLEAN + : NORMAL_STRING + | BOOLEAN ; type @@ -267,41 +324,64 @@ type | type ('&' type) ; -genericTypePackParameter: NAME '...' ('=' (typePack | variadicTypePack | genericTypePack))?; - -genericTypeParameterList: NAME ('=' type)? (',' genericTypeParameterList)? | genericTypePackParameter (',' genericTypePackParameter)*; - -typeList: type (',' typeList)? | variadicTypePack; - -typeParams: (type | typePack | variadicTypePack | genericTypePack) (',' typeParams)?; - -typePack: OPEN_PARENS (typeList)? CLOSE_PARENS; - -genericTypePack: NAME '...'; - -variadicTypePack: '...' type; - -returnType: type | typePack; - -tableIndexer: OPEN_BRACKET type CLOSE_BRACKET ':' type; - -tableProp: NAME ':' type; - -tablePropOrIndexer - : tableProp | tableIndexer; - -propList - : tablePropOrIndexer (fieldsep tablePropOrIndexer)* fieldsep?; - -tableType - : OPEN_BRACE propList CLOSE_BRACE; - -functionType: ('<' genericTypeParameterList '>')? OPEN_PARENS (typeList)? CLOSE_PARENS '->' returnType; - -require - : 'local'? bindinglist '=' REQUIRE OPEN_PARENS exp CLOSE_PARENS ('.' NAME)* ('::' type)? ';'? +genericTypePackParameter + : NAME '...' ('=' (typePack | variadicTypePack | genericTypePack))? ; +genericTypeParameterList + : NAME ('=' type)? (',' genericTypeParameterList)? + | genericTypePackParameter (',' genericTypePackParameter)* + ; + +typeList + : type (',' typeList)? | variadicTypePack + ; + +typeParams + : (type | typePack | variadicTypePack | genericTypePack) (',' typeParams)? + ; + +typePack + : OPEN_PARENS (typeList)? CLOSE_PARENS + ; + +genericTypePack + : NAME '...' + ; + +variadicTypePack + : '...' type + ; + +returnType + : type + | typePack + ; + +tableIndexer + : OPEN_BRACKET type CLOSE_BRACKET ':' type + ; + +tableProp + : NAME ':' type + ; + +tablePropOrIndexer + : tableProp + | tableIndexer + ; + +propList + : tablePropOrIndexer (fieldsep tablePropOrIndexer)* fieldsep? + ; + +tableType + : OPEN_BRACE propList CLOSE_BRACE + ; + +functionType + : ('<' genericTypeParameterList '>')? OPEN_PARENS (typeList)? CLOSE_PARENS '->' returnType + ; // LEXER @@ -318,7 +398,8 @@ NIL ; BOOLEAN - : 'true' | 'false' + : 'true' + | 'false' ; NAME @@ -364,14 +445,28 @@ HEX_FLOAT | '0' [xX] HexDigit+ HexExponentPart ; -OPEN_BRACE: '{'; -CLOSE_BRACE: '}'; +OPEN_BRACE + : '{' + ; -OPEN_BRACKET: '['; -CLOSE_BRACKET: ']'; +CLOSE_BRACE + : '}' + ; -OPEN_PARENS: '('; -CLOSE_PARENS: ')'; +OPEN_BRACKET + : '[' + ; +CLOSE_BRACKET + : ']' + ; + +OPEN_PARENS: + '(' + ; + +CLOSE_PARENS + : ')' + ; NL : '\r\n' | '\r' | '\n' From 01ea52f90c428dbcb0eeaf4b9262f12b4e6d16ed Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 10 Sep 2022 10:34:25 +0200 Subject: [PATCH 27/96] [cli] Fix java version detection in run.sh Fixes #4118 --- docs/pages/release_notes.md | 2 ++ pmd-dist/src/main/resources/scripts/run.sh | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index b8f8783555..2afc096898 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -15,6 +15,8 @@ This is a {{ site.pmd.release_type }} release. ### New and noteworthy ### Fixed Issues +* cli + * [#4118](https://github.com/pmd/pmd/issues/4118): \[cli] run.sh designer reports "integer expression expected" ### API Changes diff --git a/pmd-dist/src/main/resources/scripts/run.sh b/pmd-dist/src/main/resources/scripts/run.sh index 1501db12bc..ece76fc949 100755 --- a/pmd-dist/src/main/resources/scripts/run.sh +++ b/pmd-dist/src/main/resources/scripts/run.sh @@ -2,7 +2,7 @@ usage() { echo "Usage:" - echo " $(basename $0) [-h|-v] ..." + echo " $(basename "$0") [-h|-v] ..." echo "" echo "application-name: valid options are: $(valid_app_options)" echo "-h print this help" @@ -60,9 +60,9 @@ java_heapsize_settings() { set_lib_dir() { - if [ -z ${LIB_DIR} ]; then + if [ -z "${LIB_DIR}" ]; then # Allow for symlinks to this script - if [ -L $0 ]; then + if [ -L "$0" ]; then local script_real_loc=$(readlink "$0") else local script_real_loc=$0 @@ -83,23 +83,25 @@ check_lib_dir() { } function script_exit() { - echo $1 >&2 + echo "$1" >&2 exit 1 } determine_java_version() { local full_ver=$(java -version 2>&1) - # java_ver is eg "18" for java 1.8, "90" for java 9.0, "100" for java 10.0.x - readonly java_ver=$(echo $full_ver | sed -n '{ + # java_ver is eg "80" for java 1.8, "90" for java 9.0, "100" for java 10.0.x + readonly java_ver=$(echo "$full_ver" | sed -n '{ # replace early access versions, e.g. 11-ea with 11.0.0 s/-ea/.0.0/ # replace versions such as 10 with 10.0.0 s/version "\([0-9]\{1,\}\)"/version "\1.0.0"/ + # replace old java versions 1.x.* (java 1.7, java 1.8) with x.* + s/version "1\.\(.*\)"/version "\1"/ # extract the major and minor parts of the version - s/^.* version "\(.*\)\.\(.*\)\..*".*$/\1\2/p + s/^.* version "\([0-9]\{1,\}\)\.\([0-9]\{1,\}\).*".*$/\1\2/p }') # java_vendor is either java (oracle) or openjdk - readonly java_vendor=$(echo $full_ver | sed -n -e 's/^\(.*\) version .*$/\1/p') + readonly java_vendor=$(echo "$full_ver" | sed -n -e 's/^\(.*\) version .*$/\1/p') } jre_specific_vm_options() { @@ -197,7 +199,7 @@ case "${APPNAME}" in readonly CLASSNAME="net.sourceforge.pmd.util.treeexport.TreeExportCli" ;; *) - echo "${APPNAME} is NOT a valid application name, valid options are:$(valid_app_options)" + echo "${APPNAME} is NOT a valid application name, valid options are: $(valid_app_options)" ;; esac From 0b6a9ce0a7126bfcfccda40320b7a16d8bab73c8 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 10 Sep 2022 10:46:04 +0200 Subject: [PATCH 28/96] Add manual test script --- .../src/test/resources/scripts/runtest.sh | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100755 pmd-dist/src/test/resources/scripts/runtest.sh diff --git a/pmd-dist/src/test/resources/scripts/runtest.sh b/pmd-dist/src/test/resources/scripts/runtest.sh new file mode 100755 index 0000000000..34185ddb1c --- /dev/null +++ b/pmd-dist/src/test/resources/scripts/runtest.sh @@ -0,0 +1,88 @@ +#!/bin/bash +# BSD-style license; for more info see http://pmd.sourceforge.net/license.html + +# +# Simple manual test script +# - code is copied from run.sh to be tested here (so please check, it might be out of sync) +# - mostly the function "determine_java_version" is tested here +# - just run it with "./runtest.sh" and look at the output +# - test cases are at the end of this script +# + +export LANG=en_US.UTF-8 + +FULL_JAVA_VERSION="" + +get_full_java_version() { + #java -version 2>&1 + #echo "openjdk version \"11.0.6\" 2022-08-12" + echo "$FULL_JAVA_VERSION" +} + +determine_java_version() { + local full_ver=$(get_full_java_version) + # java_ver is eg "80" for java 1.8, "90" for java 9.0, "100" for java 10.0.x + java_ver=$(echo "$full_ver" | sed -n '{ + # replace early access versions, e.g. 11-ea with 11.0.0 + s/-ea/.0.0/ + # replace versions such as 10 with 10.0.0 + s/version "\([0-9]\{1,\}\)"/version "\1.0.0"/ + # replace old java versions 1.x.* (java 1.7, java 1.8) with x.* + s/version "1\.\(.*\)"/version "\1"/ + # extract the major and minor parts of the version + s/^.* version "\([0-9]\{1,\}\)\.\([0-9]\{1,\}\).*".*$/\1\2/p + }') + # java_vendor is either java (oracle) or openjdk + java_vendor=$(echo "$full_ver" | sed -n -e 's/^\(.*\) version .*$/\1/p') +} + +jre_specific_vm_options() { + options="" + if [ "$java_ver" -ge 70 ] && [ "$java_ver" -lt 80 ] + then + options="detected java 7" + elif [ "$java_ver" -ge 80 ] && [ "$java_ver" -lt 90 ] + then + options="detected java 8" + elif [ "$java_ver" -ge 90 ] && [ "$java_ver" -lt 110 ] && [ "$java_vendor" = "java" ] + then + options="detected java 9 or 10 from oracle" + elif [ "$java_vendor" = "openjdk" ] || ( [ "$java_vendor" = "java" ] && [ "$java_ver" -ge 110 ] ) + then + options="detected java 11 from oracle or any openjdk" + fi + echo $options +} + +run_test() { + FULL_JAVA_VERSION="$1" + EXPECTED_VENDOR="$2" + EXPECTED_VER="$3" + EXPECTED="$4" + echo "Testing: '${FULL_JAVA_VERSION}'" + determine_java_version + java_opts="$(jre_specific_vm_options)" + echo -n "java_ver: $java_ver " + if [ "$EXPECTED_VER" = "$java_ver" ]; then echo -e "\e[32mOK\e[0m"; else echo -e "\e[31mFAILED\e[0m"; fi + echo -n "java_vendor: $java_vendor " + if [ "$EXPECTED_VENDOR" = "$java_vendor" ]; then echo -e "\e[32mOK\e[0m"; else echo -e "\e[31mFAILED\e[0m"; fi + echo -n "java_opts: $java_opts " + if [ "$EXPECTED" = "$java_opts" ]; then echo -e "\e[32mOK\e[0m"; else echo -e "\e[31mFAILED\e[0m - expected: ${EXPECTED}"; fi + echo +} + +run_test "java version \"1.7.0_80\"" "java" "70" "detected java 7" +run_test "openjdk version \"1.7.0_352\"" "openjdk" "70" "detected java 7" +run_test "java version \"1.8.0_271\"" "java" "80" "detected java 8" +run_test "openjdk version \"1.8.0_345\"" "openjdk" "80" "detected java 8" +run_test "java version \"9.0.4\"" "java" "90" "detected java 9 or 10 from oracle" +run_test "openjdk version \"9.0.4\"" "openjdk" "90" "detected java 11 from oracle or any openjdk" +run_test "java version \"10.0.2\" 2018-07-17" "java" "100" "detected java 9 or 10 from oracle" +run_test "openjdk version \"11.0.6\" 2022-08-12" "openjdk" "110" "detected java 11 from oracle or any openjdk" +run_test "openjdk version \"11.0.6.1\" 2022-08-12" "openjdk" "110" "detected java 11 from oracle or any openjdk" +run_test "java version \"11.0.13\" 2021-10-19 LTS" "java" "110" "detected java 11 from oracle or any openjdk" +run_test "openjdk version \"17.0.4\" 2022-08-12" "openjdk" "170" "detected java 11 from oracle or any openjdk" +run_test "openjdk version \"17.1.4\" 2022-08-12" "openjdk" "171" "detected java 11 from oracle or any openjdk" +run_test "openjdk version \"17.0.4.1\" 2022-08-12" "openjdk" "170" "detected java 11 from oracle or any openjdk" +run_test "openjdk version \"18.0.2.1\" 2022-08-18" "openjdk" "180" "detected java 11 from oracle or any openjdk" +run_test "openjdk version \"19-ea\" 2022-09-20" "openjdk" "190" "detected java 11 from oracle or any openjdk" From 48269572ebcdc3791a2f48c3583b15454c46a006 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 10 Sep 2022 15:41:58 +0200 Subject: [PATCH 29/96] Use the same jversion convention in designer.bat java 1.8.0: 80 java 9.0: 90 java 17.0: 170 --- .../src/main/resources/scripts/designer.bat | 28 +++-- .../test/resources/scripts/designertest.bat | 103 ++++++++++++++++++ 2 files changed, 120 insertions(+), 11 deletions(-) create mode 100644 pmd-dist/src/test/resources/scripts/designertest.bat diff --git a/pmd-dist/src/main/resources/scripts/designer.bat b/pmd-dist/src/main/resources/scripts/designer.bat index bc3cbb9188..a53623c28c 100644 --- a/pmd-dist/src/main/resources/scripts/designer.bat +++ b/pmd-dist/src/main/resources/scripts/designer.bat @@ -4,35 +4,41 @@ set OPTS= set MAIN_CLASS=net.sourceforge.pmd.util.fxdesigner.DesignerStarter -:: sets the jver variable to the java version, eg 901 for 9.0.1+x or 180 for 1.8.0_171-b11 +:: sets the jver variable to the java version, eg 90 for 9.0.1+x or 80 for 1.8.0_171-b11 or 110 for 11.0.6.1 :: sets the jvendor variable to either java (oracle) or openjdk for /f tokens^=1^,3^,4^,5^ delims^=.-_+^"^ %%j in ('java -version 2^>^&1 ^| find "version"') do ( set jvendor=%%j if %%l EQU ea ( - set /A "jver=%%k00" + set /A "jver=%%k0" ) else ( - set /A jver=%%k%%l%%m + if %%k EQU 1 ( + :: for java version 1.7.x, 1.8.x, ignore the first 1. + set /A "jver=%%l%%m" + ) else ( + set /A "jver=%%k%%l" + ) ) ) + Set "jreopts=" :: oracle java 9 and 10 has javafx included as a module -if /I "%jvendor%" EQU "java" ( - if %jver% GEQ 900 ( - if %jver% LSS 1100 ( +if /I %jvendor% == java ( + if %jver% GEQ 90 ( + if %jver% LSS 110 ( :: enable reflection - Set jreopts=--add-opens javafx.controls/javafx.scene.control.skin=ALL-UNNAMED + set jreopts=--add-opens javafx.controls/javafx.scene.control.skin=ALL-UNNAMED ) ) ) set "_needjfxlib=0" -if /I "%jvendor%" EQU "openjdk" set _needjfxlib=1 -if /I "%jvendor%" EQU "java" ( - if %jver% GEQ 1100 set _needjfxlib=1 +if /I %jvendor% == openjdk set _needjfxlib=1 +if /I %jvendor% == java ( + if %jver% GEQ 110 set _needjfxlib=1 ) if %_needjfxlib% EQU 1 ( - if %jver% LSS 1000 ( + if %jver% LSS 100 ( echo For openjfx at least java 10 is required. pause exit diff --git a/pmd-dist/src/test/resources/scripts/designertest.bat b/pmd-dist/src/test/resources/scripts/designertest.bat new file mode 100644 index 0000000000..d43a5ff146 --- /dev/null +++ b/pmd-dist/src/test/resources/scripts/designertest.bat @@ -0,0 +1,103 @@ +@echo off + +:: BSD-style license; for more info see http://pmd.sourceforge.net/license.html + +:: +:: Simple manual test script +:: - code is copied from designer.bat to be tested here (so please check, it might be out of sync) +:: - mostly the function "determine_java_version" is tested here +:: - just run it with "designertest.bat" and look at the output +:: - test cases are at the end of this script +:: + +GOTO :main + +:determine_java_version +:: sets the jver variable to the java version, eg 90 for 9.0.1+x or 80 for 1.8.0_171-b11 or 110 for 11.0.6.1 +:: sets the jvendor variable to either java (oracle) or openjdk +for /f tokens^=1^,3^,4^,5^ delims^=.-_+^"^ %%j in (%full_version%) do ( + set jvendor=%%j + if %%l EQU ea ( + set /A "jver=%%k0" + ) else ( + if %%k EQU 1 ( + :: for java version 1.7.x, 1.8.x, ignore the first 1. + set /A "jver=%%l%%m" + ) else ( + set /A "jver=%%k%%l" + ) + ) +) + +set detection= +if %jver% GEQ 70 ( + if %jver% LSS 80 ( + set detection="detected java 7" + ) +) +if [%detection%] == [] ( + if %jver% GEQ 80 ( + if %jver% LSS 90 ( + set detection="detected java 8" + ) + ) +) +if [%detection%] == [] ( + if %jver% GEQ 90 ( + if %jver% LSS 110 ( + if %jvendor% == java ( + set detection="detected java 9 or 10 from oracle" + ) + ) + ) +) +if [%detection%] == [] ( + if %jvendor% == openjdk ( + set detection="detected java 11 from oracle or any openjdk" + ) +) +if [%detection%] == [] ( + if %jvendor% == java ( + if %jver% GEQ 110 ( + set detection="detected java 11 from oracle or any openjdk" + ) + ) +) + +EXIT /B + + + +:run_test +set full_version=%1 +set expected_vendor=%2 +set expected_version=%3 +set expected_detection=%4 + +CALL :determine_java_version + +echo full_version: %full_version% +if %jver% == %expected_version% ( echo jver: %jver% OK ) ELSE ( echo jver: %jver% EXPECTED: %expected_version%  ) +if %jvendor% == %expected_vendor% ( echo jvendor: %jvendor% OK ) ELSE ( echo jvendor: %jvendor% EXPECTED: %expected_vendor%  ) +if [%detection%] == [%expected_detection%] ( echo detection: %detection% OK ) ELSE ( echo detection: %detection% EXPECTED: %expected_detection%  ) +echo. + +EXIT /B + +:main + +CALL :run_test "java version ""1.7.0_80""" java 70 "detected java 7" +CALL :run_test "openjdk version ""1.7.0_352""" openjdk 70 "detected java 7" +CALL :run_test "java version ""1.8.0_271""" java 80 "detected java 8" +CALL :run_test "openjdk version ""1.8.0_345""" openjdk 80 "detected java 8" +CALL :run_test "java version ""9.0.4""" java 90 "detected java 9 or 10 from oracle" +CALL :run_test "openjdk version ""9.0.4""" openjdk 90 "detected java 11 from oracle or any openjdk" +CALL :run_test "java version ""10.0.2"" 2018-07-17" java 100 "detected java 9 or 10 from oracle" +CALL :run_test "openjdk version ""11.0.6"" 2022-08-12" openjdk 110 "detected java 11 from oracle or any openjdk" +CALL :run_test "openjdk version ""11.0.6.1"" 2022-08-12" openjdk 110 "detected java 11 from oracle or any openjdk" +CALL :run_test "java version ""11.0.13"" 2021-10-19 LTS" java 110 "detected java 11 from oracle or any openjdk" +CALL :run_test "openjdk version ""17.0.4"" 2022-08-12" openjdk 170 "detected java 11 from oracle or any openjdk" +CALL :run_test "openjdk version ""17.1.4"" 2022-08-12" openjdk 171 "detected java 11 from oracle or any openjdk" +CALL :run_test "openjdk version ""17.0.4.1"" 2022-08-12" openjdk 170 "detected java 11 from oracle or any openjdk" +CALL :run_test "openjdk version ""18.0.2.1"" 2022-08-18" openjdk 180 "detected java 11 from oracle or any openjdk" +CALL :run_test "openjdk version ""19-ea"" 2022-09-20" openjdk 190 "detected java 11 from oracle or any openjdk" From 9a46adf8a9787277f47613bfbccfdbd97d8ee578 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 10 Sep 2022 16:54:24 +0200 Subject: [PATCH 30/96] Bump maven-pmd-plugin from 3.18.0 to 3.19.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9036d17f18..9037678aa3 100644 --- a/pom.xml +++ b/pom.xml @@ -94,7 +94,7 @@ 3.0.0-M5 9.3 3.1.2 - 3.18.0 + 3.19.0 1.10.12 3.2.0 4.7.2 From 15100104425fe9372a686036a3c9628ef82e807f Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 10 Sep 2022 16:54:52 +0200 Subject: [PATCH 31/96] Bump maven-checkstyle-plugin from 3.1.2 to 3.2.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9037678aa3..d54fd0c10e 100644 --- a/pom.xml +++ b/pom.xml @@ -93,7 +93,7 @@ 5.0 3.0.0-M5 9.3 - 3.1.2 + 3.2.0 3.19.0 1.10.12 3.2.0 From 940252bafcbd6fedf4465297b4ebe5972df47554 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 10 Sep 2022 16:55:03 +0200 Subject: [PATCH 32/96] Bump checkstyle from 9.3 to 10.3.3 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d54fd0c10e..992a104099 100644 --- a/pom.xml +++ b/pom.xml @@ -92,7 +92,7 @@ 5.0 3.0.0-M5 - 9.3 + 10.3.3 3.2.0 3.19.0 1.10.12 From ba262675af36840e8fb5ca1042a1b7d94a95248e Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 10 Sep 2022 17:14:59 +0200 Subject: [PATCH 33/96] Bump org.yaml:snakeyaml from 1.30 to 1.31 Fixes https://github.com/advisories/GHSA-3mc7-4q67-w48m Fixes https://github.com/pmd/pmd/security/dependabot/24 Fixes CVE-2022-25857 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 992a104099..bece94f2d0 100644 --- a/pom.xml +++ b/pom.xml @@ -770,7 +770,7 @@ org.yaml snakeyaml - 1.30 + 1.31 From dba3a76312f69f08c9833dcabc35976b25789eb7 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sun, 11 Sep 2022 11:09:29 +0200 Subject: [PATCH 34/96] Add @mohan-chinnappan-n as a contributor --- .all-contributorsrc | 12 +++++++++++- docs/pages/pmd/projectdocs/credits.md | 25 +++++++++++++------------ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 908c5cc8cb..3120c1af00 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -6798,7 +6798,8 @@ "contributions": [ "doc" ] - },{ + }, + { "login": "pacvz", "name": "pacvz", "avatar_url": "https://avatars.githubusercontent.com/u/35453365?v=4", @@ -6806,6 +6807,15 @@ "contributions": [ "code" ] + }, + { + "login": "mohan-chinnappan-n", + "name": "mohan-chinnappan-n", + "avatar_url": "https://avatars.githubusercontent.com/u/5963194?v=4", + "profile": "https://mohan-chinnappan-n.github.io/about/cv.html", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index 536ffc76a9..53a6336d25 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -863,111 +863,112 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
meandonlyme

๐Ÿ›
mikesive

๐Ÿ›
milossesic

๐Ÿ› +
mohan-chinnappan-n

๐Ÿ’ป
mriddell95

๐Ÿ›
mrlzh

๐Ÿ›
msloan

๐Ÿ› -
mucharlaravalika

๐Ÿ› +
mucharlaravalika

๐Ÿ›
mvenneman

๐Ÿ›
nareshl119

๐Ÿ›
nicolas-harraudeau-sonarsource

๐Ÿ›
noerremark

๐Ÿ›
novsirion

๐Ÿ›
oggboy

๐Ÿ› -
oinume

๐Ÿ› +
oinume

๐Ÿ›
orimarko

๐Ÿ’ป ๐Ÿ›
pacvz

๐Ÿ’ป
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 91d8930e9111c35ac38691e49d32b4361110d01f Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sun, 11 Sep 2022 11:09:46 +0200 Subject: [PATCH 35/96] [doc] Update release notes (#4116) --- docs/pages/release_notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index b8f8783555..84d0bc0712 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -15,10 +15,12 @@ This is a {{ site.pmd.release_type }} release. ### New and noteworthy ### Fixed Issues +* [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Missing --file arg in TreeExport CLI example ### API Changes ### External Contributions +* [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Fix missing --file arg in TreeExport CLI example - [@mohan-chinnappan-n](https://github.com/mohan-chinnappan-n) {% endtocmaker %} From 0962a33e1489b4437f970987ae88042a5c1d6e8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20=C5=BBygie=C5=82o?= Date: Thu, 7 Jul 2022 13:03:15 +0200 Subject: [PATCH 36/96] Fix typo --- 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 edeecae3fd..9cedd65fac 100644 --- a/pmd-java/src/main/resources/category/java/design.xml +++ b/pmd-java/src/main/resources/category/java/design.xml @@ -17,7 +17,7 @@ Rules that help you discover design issues. message="No abstract method which means that the keyword is most likely used to prevent instantiation. Use a private or protected constructor instead." externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_design.html#abstractclasswithoutanymethod"> -If an abstract class does not provides any methods, it may be acting as a simple data container +If an abstract class does not provide any methods, it may be acting as a simple data container that is not meant to be instantiated. In this case, it is probably better to use a private or protected constructor in order to prevent instantiation than make the class misleadingly abstract. From 57138dc1c7aa4a09ba55fcf4218afdc2cbab5d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20=C5=BBygie=C5=82o?= Date: Thu, 7 Jul 2022 13:04:24 +0200 Subject: [PATCH 37/96] Fix punctuation/use full stop in sentence --- 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 9cedd65fac..5b472ad544 100644 --- a/pmd-java/src/main/resources/category/java/design.xml +++ b/pmd-java/src/main/resources/category/java/design.xml @@ -53,7 +53,7 @@ public abstract class Example { class="net.sourceforge.pmd.lang.rule.XPathRule" externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_design.html#avoidcatchinggenericexception"> -Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block +Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block. 3 From f4a0dff0c9b732b82530e59ce352364ca03f5c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20=C5=BBygie=C5=82o?= Date: Tue, 21 Jul 2020 23:23:32 +0200 Subject: [PATCH 38/96] Add missing 'to' and agree verb with subject --- pmd-java/src/main/resources/category/java/bestpractices.xml | 2 +- 1 file changed, 1 insertion(+), 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 e865f684e4..122b0e4dc7 100644 --- a/pmd-java/src/main/resources/category/java/bestpractices.xml +++ b/pmd-java/src/main/resources/category/java/bestpractices.xml @@ -19,7 +19,7 @@ Rules which enforce generally accepted best practices. The abstract class does not contain any abstract methods. An abstract class suggests an incomplete implementation, which is to be completed by subclasses implementing the abstract methods. If the class is intended to be used as a base class only (not to be instantiated -directly) a protected constructor can be provided prevent direct instantiation. +directly) a protected constructor can be provided to prevent direct instantiation. 3 From a3ea6be9caa76fc75ec7cce383e4fd1d15c3eded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20=C5=BBygie=C5=82o?= Date: Mon, 12 Sep 2022 20:29:00 +0200 Subject: [PATCH 39/96] Fix it's -> its --- pmd-java/src/main/resources/category/java/codestyle.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-java/src/main/resources/category/java/codestyle.xml b/pmd-java/src/main/resources/category/java/codestyle.xml index f9770a891b..f222b6cf88 100644 --- a/pmd-java/src/main/resources/category/java/codestyle.xml +++ b/pmd-java/src/main/resources/category/java/codestyle.xml @@ -436,7 +436,7 @@ public class ร‰lรฉphant {} externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_codestyle.html#commentdefaultaccessmodifier"> To avoid mistakes if we want that an Annotation, Class, Enum, Method, Constructor or Field have a default access modifier -we must add a comment at the beginning of it's declaration. +we must add a comment at the beginning of its declaration. By default the comment must be `/* default */` or `/* package */`, if you want another, you have to provide a regular expression. This rule ignores by default all cases that have a @VisibleForTesting annotation. Use the property "ignoredAnnotations" to customize the recognized annotations. From 936cbafd36c4548f1517a457cfdb3f40ef9b4bad Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Tue, 13 Sep 2022 21:58:02 -0700 Subject: [PATCH 40/96] remove unused param --- .../src/main/java/net/sourceforge/pmd/cpd/LuaTokenizer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaTokenizer.java b/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaTokenizer.java index 8e4f354b17..cd9a260b6d 100644 --- a/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaTokenizer.java +++ b/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaTokenizer.java @@ -75,11 +75,11 @@ public class LuaTokenizer extends AntlrTokenizer { @Override protected void analyzeTokens(final AntlrToken currentToken, final Iterable remainingTokens) { discardCurrent = false; - skipRequires(currentToken, remainingTokens); + skipRequires(currentToken); skipLiteralSequences(currentToken, remainingTokens); } - private void skipRequires(final AntlrToken currentToken, final Iterable remainingTokens) { + private void skipRequires(final AntlrToken currentToken) { final int type = currentToken.getKind(); if (type == LuaLexer.REQUIRE) { discardingRequires = true; From f7a5f9cad98babfc8cff8e0209ea110bb5948958 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Tue, 13 Sep 2022 22:17:43 -0700 Subject: [PATCH 41/96] fix incorrect comments --- .../src/main/java/net/sourceforge/pmd/cpd/LuaTokenizer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaTokenizer.java b/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaTokenizer.java index cd9a260b6d..328c5e8ab0 100644 --- a/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaTokenizer.java +++ b/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaTokenizer.java @@ -21,7 +21,7 @@ public class LuaTokenizer extends AntlrTokenizer { private boolean ignoreLiteralSequences = false; /** - * Sets the possible options for the C# tokenizer. + * Sets the possible options for the Lua tokenizer. * * @param properties the properties * @see #OPTION_IGNORE_LITERAL_SEQUENCES @@ -49,8 +49,8 @@ public class LuaTokenizer extends AntlrTokenizer { * The {@link LuaTokenFilter} extends the {@link AntlrTokenFilter} to discard * Lua-specific tokens. *

- * By default, it enables annotation-based CPD suppression. - * If the --ignoreUsings flag is provided, require() directives are filtered out. + * By default, it discards semicolons, require statements, and + * enables annotation-based CPD suppression. *

*/ private static class LuaTokenFilter extends AntlrTokenFilter { From 05c30a1053628e90c5ec28374d2ef017a436182d Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Tue, 13 Sep 2022 22:52:14 -0700 Subject: [PATCH 42/96] Update documentation and changelog --- docs/pages/pmd/userdocs/cpd/cpd.md | 2 +- docs/pages/release_notes.md | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/pages/pmd/userdocs/cpd/cpd.md b/docs/pages/pmd/userdocs/cpd/cpd.md index 67b81492be..22d594259b 100644 --- a/docs/pages/pmd/userdocs/cpd/cpd.md +++ b/docs/pages/pmd/userdocs/cpd/cpd.md @@ -122,7 +122,7 @@ Novice as much as advanced readers may want to [read on on Refactoring Guru](htt {% include custom/cli_option_row.html options="--ignore-literal-sequences" description="Ignore sequences of literals (common e.g. in list initializers)" default="false" - languages="C#, C++" + languages="C#, C++, Lua" %} {% include custom/cli_option_row.html options="--ignore-usings" description="Ignore `using` directives in C# when comparing text" diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 84d0bc0712..720dd44e3e 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -14,13 +14,22 @@ This is a {{ site.pmd.release_type }} release. ### New and noteworthy +#### Luau Support + +This release of PMD brings support for [Luau](https://github.com/Roblox/luau), a gradually typed language derived from Lua. + ### Fixed Issues * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Missing --file arg in TreeExport CLI example ### API Changes +#### CPD CLI + +* CPD now supports the `--ignore-literal-sequences` argument when analyzing Lua code. + ### External Contributions * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Fix missing --file arg in TreeExport CLI example - [@mohan-chinnappan-n](https://github.com/mohan-chinnappan-n) +* [#4066](https://github.com/pmd/pmd/pull/4066): \[lua] Add support for Luau syntax and skipping literal sequences in CPD - [@matthargett](https://github.com/matthargett) {% endtocmaker %} From 7f7f8f7b6a1f5f23ac7af94a5066f1e229e9ed19 Mon Sep 17 00:00:00 2001 From: Oleg Andreych Date: Fri, 26 Aug 2022 00:26:10 +0500 Subject: [PATCH 43/96] False-positive UnnecessaryFullyQualifiedName when nested and non-nested classes with the same name and in the same package are used together #4085 --- .../UnnecessaryFullyQualifiedNameRule.java | 31 ++++++++++++++++--- .../xml/UnnecessaryFullyQualifiedName.xml | 19 ++++++++++++ 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryFullyQualifiedNameRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryFullyQualifiedNameRule.java index 32bf8fa21c..36773e3a91 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryFullyQualifiedNameRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryFullyQualifiedNameRule.java @@ -17,7 +17,9 @@ import java.util.logging.Logger; import org.apache.commons.lang3.StringUtils; import net.sourceforge.pmd.RuleContext; +import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceType; +import net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit; import net.sourceforge.pmd.lang.java.ast.ASTImportDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTName; import net.sourceforge.pmd.lang.java.ast.ASTNameList; @@ -186,9 +188,11 @@ public class UnnecessaryFullyQualifiedNameRule extends AbstractJavaRule { if (matches.isEmpty()) { if (isJavaLangImplicit(node)) { - addViolation(data, node, new Object[] { node.getImage(), "java.lang.*", "implicit "}); + addViolation(data, node, new Object[]{node.getImage(), "java.lang.*", "implicit "}); } else if (isSamePackage(node, name)) { - addViolation(data, node, new Object[] { node.getImage(), currentPackage + ".*", "same package "}); + if (!hasSameSimpleNameInScope(node)) { + addViolation(data, node, new Object[]{node.getImage(), currentPackage + ".*", "same package "}); + } } } else { ASTImportDeclaration firstMatch = findFirstMatch(matches); @@ -199,11 +203,30 @@ public class UnnecessaryFullyQualifiedNameRule extends AbstractJavaRule { String importStr = firstMatch.getImportedName() + (firstMatch.isImportOnDemand() ? ".*" : ""); String type = firstMatch.isStatic() ? "static " : ""; - addViolation(data, node, new Object[] { node.getImage(), importStr, type }); + addViolation(data, node, new Object[]{node.getImage(), importStr, type}); } } } + private boolean hasSameSimpleNameInScope(TypeNode node) { + final ASTCompilationUnit root = node.getRoot(); + final List declarationDescendants = root.findDescendantsOfType(ASTClassOrInterfaceDeclaration.class); + final Class nodeType = node.getType(); + + if (nodeType == null) { + return false; + } + + final String nodeSimpleName = nodeType.getSimpleName(); + + for (ASTClassOrInterfaceDeclaration declarationDescendant : declarationDescendants) { + if (nodeSimpleName.equals(declarationDescendant.getSimpleName())) { + return true; + } + } + return false; + } + private ASTImportDeclaration findFirstMatch(List imports) { // first search only static imports ASTImportDeclaration result = null; @@ -404,7 +427,7 @@ public class UnnecessaryFullyQualifiedNameRule extends AbstractJavaRule { // Is it a conflict with a class in the same file? final Set qualifiedTypes = node.getScope().getEnclosingScope(SourceFileScope.class) - .getQualifiedTypeNames().keySet(); + .getQualifiedTypeNames().keySet(); for (final String qualified : qualifiedTypes) { int fullLength = qualified.length(); if (qualified.endsWith(unqualifiedName) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryFullyQualifiedName.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryFullyQualifiedName.xml index f95d7bc81e..865f62c789 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryFullyQualifiedName.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryFullyQualifiedName.xml @@ -622,6 +622,25 @@ public class UnnecessaryFullyQualifiedName { ]]> + + False positive when same package inner class is referenced (not enum) + 0 + + + #2098 false positive with annotated package 0 From af30f4cef92d882d253ee2f0c9d5144737412635 Mon Sep 17 00:00:00 2001 From: Oleg Andreych Date: Sun, 18 Sep 2022 15:29:50 +0500 Subject: [PATCH 44/96] False-positive UnnecessaryFullyQualifiedName when nested and non-nested classes with the same name and in the same package are used together #4085 * Regression fix; --- .../UnnecessaryFullyQualifiedNameRule.java | 10 +++++----- .../xml/UnnecessaryFullyQualifiedName.xml | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryFullyQualifiedNameRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryFullyQualifiedNameRule.java index 36773e3a91..5348abca59 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryFullyQualifiedNameRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryFullyQualifiedNameRule.java @@ -188,10 +188,11 @@ public class UnnecessaryFullyQualifiedNameRule extends AbstractJavaRule { if (matches.isEmpty()) { if (isJavaLangImplicit(node)) { - addViolation(data, node, new Object[]{node.getImage(), "java.lang.*", "implicit "}); + asCtx(data).addViolation(node, + node.getImage(), "java.lang.*", "implicit "); } else if (isSamePackage(node, name)) { if (!hasSameSimpleNameInScope(node)) { - addViolation(data, node, new Object[]{node.getImage(), currentPackage + ".*", "same package "}); + asCtx(data).addViolation(node, node.getImage(), currentPackage + ".*", "same package "); } } } else { @@ -217,10 +218,9 @@ public class UnnecessaryFullyQualifiedNameRule extends AbstractJavaRule { return false; } - final String nodeSimpleName = nodeType.getSimpleName(); - for (ASTClassOrInterfaceDeclaration declarationDescendant : declarationDescendants) { - if (nodeSimpleName.equals(declarationDescendant.getSimpleName())) { + if (nodeType.getSimpleName().equals(declarationDescendant.getSimpleName()) + && !nodeType.getName().equals(declarationDescendant.getQualifiedName().toString())) { return true; } } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryFullyQualifiedName.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryFullyQualifiedName.xml index 865f62c789..426bb9b4b6 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryFullyQualifiedName.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryFullyQualifiedName.xml @@ -641,6 +641,21 @@ public class OuterTestClass { ]]> + + Should report fully-qualified name usage of a class in itself. + 1 + 4 + + + #2098 false positive with annotated package 0 From 600561e44cc4942ca888990f4ec6d8c7c86d147f Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 19 Sep 2022 21:02:02 +0200 Subject: [PATCH 45/96] build: harden build.yml permissions Signed-off-by: Alex --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f94319eb05..cb7a64a706 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,6 +14,9 @@ on: - cron: '0 4 1 * *' workflow_dispatch: +permissions: + contents: read # to fetch code (actions/checkout) + jobs: build: runs-on: ${{ matrix.os }} From 4966e99082560df6a5dc03cd21fd38a9eb62c2e7 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 19 Sep 2022 21:10:13 +0200 Subject: [PATCH 46/96] build: harden git-repo-sync.yml permissions Signed-off-by: Alex --- .github/workflows/git-repo-sync.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/git-repo-sync.yml b/.github/workflows/git-repo-sync.yml index 3cfb2e23e9..790922db40 100644 --- a/.github/workflows/git-repo-sync.yml +++ b/.github/workflows/git-repo-sync.yml @@ -9,6 +9,9 @@ on: - '**' workflow_dispatch: +permissions: + contents: read # to fetch code (actions/checkout) + jobs: build: runs-on: ubuntu-latest From 9d7c37cef73348a64b3886ea340a100d1e078bab Mon Sep 17 00:00:00 2001 From: Suvashri <112872981+Suvashri@users.noreply.github.com> Date: Wed, 21 Sep 2022 15:28:51 +0530 Subject: [PATCH 47/96] Update 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 d211ac31b4..14a8958bcb 100644 --- a/pmd-java/src/main/resources/category/java/performance.xml +++ b/pmd-java/src/main/resources/category/java/performance.xml @@ -845,7 +845,7 @@ private String baz() { Switch statements are intended to be used to support complex branching behaviour. Using a switch for only a few cases is ill-advised, since switches are not as easy to understand as if-then statements. In these cases use the -if-then statement to increase code readability. +if-else statement to increase code readability. 3 From dcd8ff0ac082bc38760e7154ef73bc321bd48a81 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 24 Sep 2022 17:13:29 +0200 Subject: [PATCH 48/96] [lua] Fix parsing of short/long comments --- .../net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 | 17 +++++++++++------ .../sourceforge/pmd/cpd/LuaTokenizerTest.java | 5 +++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 b/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 index 2c2603c0a2..fc94fa1b50 100644 --- a/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 +++ b/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 @@ -469,11 +469,11 @@ CLOSE_PARENS ; NL - : '\r\n' | '\r' | '\n' - | '\u0085' // ' - | '\u2028' //'' - | '\u2029' //'' - ; + : '\r\n' | '\r' | '\n' + | '\u0085' // ' + | '\u2028' //'' + | '\u2029' //'' + ; COMMA : ',' @@ -525,6 +525,11 @@ HexDigit : [0-9a-fA-F] ; +fragment +StartingSingleCommentLineInputCharacter + : ~[[\r\n\u0085\u2028\u2029] + ; + fragment SingleLineInputCharacter : ~[\r\n\u0085\u2028\u2029] @@ -535,7 +540,7 @@ COMMENT ; LINE_COMMENT - : '--' SingleLineInputCharacter* -> channel(HIDDEN) + : '--' (NL | StartingSingleCommentLineInputCharacter SingleLineInputCharacter*) -> channel(HIDDEN) ; WS diff --git a/pmd-lua/src/test/java/net/sourceforge/pmd/cpd/LuaTokenizerTest.java b/pmd-lua/src/test/java/net/sourceforge/pmd/cpd/LuaTokenizerTest.java index 83b39442a1..fb77931286 100644 --- a/pmd-lua/src/test/java/net/sourceforge/pmd/cpd/LuaTokenizerTest.java +++ b/pmd-lua/src/test/java/net/sourceforge/pmd/cpd/LuaTokenizerTest.java @@ -44,4 +44,9 @@ public class LuaTokenizerTest extends CpdTextComparisonTest { public void testRegression() { doTest("luauTypes"); } + + @Test + public void testComment() { + doTest("comment"); + } } From 746fcbf086c514895dd85e7b7a451b3035d8e102 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 24 Sep 2022 17:18:32 +0200 Subject: [PATCH 49/96] [lua] Fixups from #4066 --- docs/pages/release_notes.md | 5 +++-- .../main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 | 1 + .../test/java/net/sourceforge/pmd/cpd/LuaTokenizerTest.java | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 720dd44e3e..1c624b8efb 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -14,9 +14,10 @@ This is a {{ site.pmd.release_type }} release. ### New and noteworthy -#### Luau Support +#### Lua now supports additionally Luau -This release of PMD brings support for [Luau](https://github.com/Roblox/luau), a gradually typed language derived from Lua. +This release of PMD adds support for [Luau](https://github.com/Roblox/luau), a gradually typed language derived +from Lua. This means, that the Lua language in PMD can now parse both Lua and Luau. ### Fixed Issues * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Missing --file arg in TreeExport CLI example diff --git a/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 b/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 index fc94fa1b50..fde74727ac 100644 --- a/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 +++ b/pmd-lua/src/main/antlr4/net/sourceforge/pmd/lang/lua/antlr4/Lua.g4 @@ -108,6 +108,7 @@ label ; laststat + // "continue" is a luau addition and actually not a reserved keyword : 'return' explist? | 'break' | 'continue' ; diff --git a/pmd-lua/src/test/java/net/sourceforge/pmd/cpd/LuaTokenizerTest.java b/pmd-lua/src/test/java/net/sourceforge/pmd/cpd/LuaTokenizerTest.java index fb77931286..9c8705d4b4 100644 --- a/pmd-lua/src/test/java/net/sourceforge/pmd/cpd/LuaTokenizerTest.java +++ b/pmd-lua/src/test/java/net/sourceforge/pmd/cpd/LuaTokenizerTest.java @@ -41,7 +41,7 @@ public class LuaTokenizerTest extends CpdTextComparisonTest { } @Test - public void testRegression() { + public void testLuauTypes() { doTest("luauTypes"); } From 4d630031c462acef63aa46665b179b6a7f06a623 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 24 Sep 2022 17:29:00 +0200 Subject: [PATCH 50/96] Add missing test files --- .../pmd/lang/lua/cpd/testdata/comment.lua | 13 +++++++++++ .../pmd/lang/lua/cpd/testdata/comment.txt | 23 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/comment.lua create mode 100644 pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/comment.txt diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/comment.lua b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/comment.lua new file mode 100644 index 0000000000..d79dc5db81 --- /dev/null +++ b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/comment.lua @@ -0,0 +1,13 @@ + +-- inline comment ("long comment") +print(1 --[[, 2]]) + +-- line comment ("short comment") +print(1) -- comment + +-- inline comment with multiple lines ("long comment") +print(1 --[[comment line 1 +comment line 2]]) + +-- line comment without any content +print(1) -- diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/comment.txt b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/comment.txt new file mode 100644 index 0000000000..f6f1fd25fd --- /dev/null +++ b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/comment.txt @@ -0,0 +1,23 @@ + [Image] or [Truncated image[ Bcol Ecol +L3 + [print] 1 5 + [(] 6 6 + [1] 7 7 + [)] 18 18 +L6 + [print] 1 5 + [(] 6 6 + [1] 7 7 + [)] 8 8 +L9 + [print] 1 5 + [(] 6 6 + [1] 7 7 +L10 + [)] 17 17 +L13 + [print] 1 5 + [(] 6 6 + [1] 7 7 + [)] 8 8 +EOF From 993c5f809a70606093b67d03d7bbd5bb864a89ba Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 24 Sep 2022 17:35:55 +0200 Subject: [PATCH 51/96] 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 14a8958bcb..84a7da762d 100644 --- a/pmd-java/src/main/resources/category/java/performance.xml +++ b/pmd-java/src/main/resources/category/java/performance.xml @@ -844,7 +844,7 @@ private String baz() { externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_performance.html#toofewbranchesforaswitchstatement"> Switch statements are intended to be used to support complex branching behaviour. Using a switch for only a few -cases is ill-advised, since switches are not as easy to understand as if-then statements. In these cases use the +cases is ill-advised, since switches are not as easy to understand as if-else statements. In these cases use the if-else statement to increase code readability. 3 From f23f5c2f2bcf0b18a3960a1d1a67b67d912c7162 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 24 Sep 2022 17:45:48 +0200 Subject: [PATCH 52/96] [doc] Update release notes (#4131) --- docs/pages/release_notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 84d0bc0712..1336a55897 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -21,6 +21,7 @@ This is a {{ site.pmd.release_type }} release. ### External Contributions * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Fix missing --file arg in TreeExport CLI example - [@mohan-chinnappan-n](https://github.com/mohan-chinnappan-n) +* [#4131](https://github.com/pmd/pmd/pull/4131): \[doc] TooFewBranchesForASwitchStatement - Use "if-else" instead of "if-then" - [@Suvashri](https://github.com/Suvashri) {% endtocmaker %} From d6b5f1cf52705904ec595e8b219c98e681fa3398 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 24 Sep 2022 17:46:14 +0200 Subject: [PATCH 53/96] Add @Suvashri as a contributor --- .all-contributorsrc | 9 ++++ docs/pages/pmd/projectdocs/credits.md | 71 ++++++++++++++------------- 2 files changed, 45 insertions(+), 35 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 3120c1af00..e29348424c 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -6816,6 +6816,15 @@ "contributions": [ "code" ] + }, + { + "login": "Suvashri", + "name": "Suvashri", + "avatar_url": "https://avatars.githubusercontent.com/u/112872981?v=4", + "profile": "https://github.com/Suvashri", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index 53a6336d25..9f1604b29a 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -659,315 +659,316 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
StuartClayton5

๐Ÿ›
Supun Arunoda

๐Ÿ›
Suren Abrahamyan

๐Ÿ› -
SwatiBGupta1110

๐Ÿ› +
Suvashri

๐Ÿ“– +
SwatiBGupta1110

๐Ÿ›
SyedThoufich

๐Ÿ›
Szymon Sasin

๐Ÿ›
T-chuangxin

๐Ÿ›
TERAI Atsuhiro

๐Ÿ›
TIOBE Software

๐Ÿ’ป ๐Ÿ›
Taylor Smock

๐Ÿ› -
Techeira Damiรกn

๐Ÿ’ป ๐Ÿ› +
Techeira Damiรกn

๐Ÿ’ป ๐Ÿ›
Ted Husted

๐Ÿ›
TehBakker

๐Ÿ›
The Gitter Badger

๐Ÿ›
Theodoor

๐Ÿ›
Thiago Henrique Hรผpner

๐Ÿ›
Thibault Meyer

๐Ÿ› -
Thomas Gรผttler

๐Ÿ› +
Thomas Gรผttler

๐Ÿ›
Thomas Jones-Low

๐Ÿ›
Thomas Smith

๐Ÿ’ป ๐Ÿ›
ThrawnCA

๐Ÿ›
Thunderforge

๐Ÿ’ป ๐Ÿ›
Tim van der Lippe

๐Ÿ›
Tobias Weimer

๐Ÿ’ป ๐Ÿ› -
Tom Daly

๐Ÿ› +
Tom Daly

๐Ÿ›
Tomer Figenblat

๐Ÿ›
Tomi De Lucca

๐Ÿ’ป ๐Ÿ›
Torsten Kleiber

๐Ÿ›
TrackerSB

๐Ÿ›
Ullrich Hafner

๐Ÿ›
Utku Cuhadaroglu

๐Ÿ’ป ๐Ÿ› -
Valentin Brandl

๐Ÿ› +
Valentin Brandl

๐Ÿ›
Valeria

๐Ÿ›
Vasily Anisimov

๐Ÿ›
Vibhor Goyal

๐Ÿ›
Vickenty Fesunov

๐Ÿ›
Victor Noรซl

๐Ÿ›
Vincent Galloy

๐Ÿ’ป -
Vincent HUYNH

๐Ÿ› +
Vincent HUYNH

๐Ÿ›
Vincent Maurin

๐Ÿ›
Vincent Privat

๐Ÿ›
Vishhwas

๐Ÿ›
Vitaly

๐Ÿ›
Vitaly Polonetsky

๐Ÿ›
Vojtech Polivka

๐Ÿ› -
Vsevolod Zholobov

๐Ÿ› +
Vsevolod Zholobov

๐Ÿ›
Vyom Yadav

๐Ÿ’ป
Wang Shidong

๐Ÿ›
Waqas Ahmed

๐Ÿ›
Wayne J. Earl

๐Ÿ›
Wchenghui

๐Ÿ›
Will Winder

๐Ÿ› -
William Brockhus

๐Ÿ’ป ๐Ÿ› +
William Brockhus

๐Ÿ’ป ๐Ÿ›
Wilson Kurniawan

๐Ÿ›
Wim Deblauwe

๐Ÿ›
Woongsik Choi

๐Ÿ›
XenoAmess

๐Ÿ’ป ๐Ÿ›
Yang

๐Ÿ’ป
YaroslavTER

๐Ÿ› -
Young Chan

๐Ÿ’ป ๐Ÿ› +
Young Chan

๐Ÿ’ป ๐Ÿ›
YuJin Kim

๐Ÿ›
Yuri Dolzhenko

๐Ÿ›
Yurii Dubinka

๐Ÿ›
Zoltan Farkas

๐Ÿ›
Zustin

๐Ÿ›
aaronhurst-google

๐Ÿ› ๐Ÿ’ป -
alexmodis

๐Ÿ› +
alexmodis

๐Ÿ›
andreoss

๐Ÿ›
andrey81inmd

๐Ÿ’ป ๐Ÿ›
anicoara

๐Ÿ›
arunprasathav

๐Ÿ›
asiercamara

๐Ÿ›
astillich-igniti

๐Ÿ’ป -
avesolovksyy

๐Ÿ› +
avesolovksyy

๐Ÿ›
avishvat

๐Ÿ›
avivmu

๐Ÿ›
axelbarfod1

๐Ÿ›
b-3-n

๐Ÿ›
balbhadra9

๐Ÿ›
base23de

๐Ÿ› -
bergander

๐Ÿ› +
bergander

๐Ÿ›
berkam

๐Ÿ’ป ๐Ÿ›
breizh31

๐Ÿ›
caesarkim

๐Ÿ›
carolyujing

๐Ÿ›
cesares-basilico

๐Ÿ›
chrite

๐Ÿ› -
cobratbq

๐Ÿ› +
cobratbq

๐Ÿ›
coladict

๐Ÿ›
cosmoJFH

๐Ÿ›
cristalp

๐Ÿ›
crunsk

๐Ÿ›
cwholmes

๐Ÿ›
cyberjj999

๐Ÿ› -
cyw3

๐Ÿ› +
cyw3

๐Ÿ›
d1ss0nanz

๐Ÿ›
dalizi007

๐Ÿ’ป
danbrycefairsailcom

๐Ÿ›
dariansanity

๐Ÿ›
darrenmiliband

๐Ÿ›
davidburstrom

๐Ÿ› -
dbirkman-paloalto

๐Ÿ› +
dbirkman-paloalto

๐Ÿ›
deepak-patra

๐Ÿ›
dependabot[bot]

๐Ÿ’ป ๐Ÿ›
dinesh150

๐Ÿ›
diziaq

๐Ÿ›
dreaminpast123

๐Ÿ›
duanyanan

๐Ÿ› -
dutt-sanjay

๐Ÿ› +
dutt-sanjay

๐Ÿ›
dylanleung

๐Ÿ›
dzeigler

๐Ÿ›
ekkirala

๐Ÿ›
emersonmoura

๐Ÿ›
fairy

๐Ÿ›
filiprafalowicz

๐Ÿ’ป -
foxmason

๐Ÿ› +
foxmason

๐Ÿ›
frankegabor

๐Ÿ›
frankl

๐Ÿ›
freafrea

๐Ÿ›
fsapatin

๐Ÿ›
gracia19

๐Ÿ›
guo fei

๐Ÿ› -
gurmsc5

๐Ÿ› +
gurmsc5

๐Ÿ›
gwilymatgearset

๐Ÿ’ป ๐Ÿ›
haigsn

๐Ÿ›
hemanshu070

๐Ÿ›
henrik242

๐Ÿ›
hongpuwu

๐Ÿ›
hvbtup

๐Ÿ’ป ๐Ÿ› -
igniti GmbH

๐Ÿ› +
igniti GmbH

๐Ÿ›
ilovezfs

๐Ÿ›
itaigilo

๐Ÿ›
jakivey32

๐Ÿ›
jbennett2091

๐Ÿ›
jcamerin

๐Ÿ›
jkeener1

๐Ÿ› -
jmetertea

๐Ÿ› +
jmetertea

๐Ÿ›
johnra2

๐Ÿ’ป
josemanuelrolon

๐Ÿ’ป ๐Ÿ›
kabroxiko

๐Ÿ’ป ๐Ÿ›
karwer

๐Ÿ›
kaulonline

๐Ÿ›
kdaemonv

๐Ÿ› -
kenji21

๐Ÿ’ป ๐Ÿ› +
kenji21

๐Ÿ’ป ๐Ÿ›
kfranic

๐Ÿ›
khalidkh

๐Ÿ›
krzyk

๐Ÿ›
lasselindqvist

๐Ÿ›
lgemeinhardt

๐Ÿ›
lihuaib

๐Ÿ› -
lonelyma1021

๐Ÿ› +
lonelyma1021

๐Ÿ›
lpeddy

๐Ÿ›
lujiefsi

๐Ÿ’ป
lukelukes

๐Ÿ’ป
lyriccoder

๐Ÿ›
marcelmore

๐Ÿ›
matchbox

๐Ÿ› -
matthiaskraaz

๐Ÿ› +
matthiaskraaz

๐Ÿ›
meandonlyme

๐Ÿ›
mikesive

๐Ÿ›
milossesic

๐Ÿ›
mohan-chinnappan-n

๐Ÿ’ป
mriddell95

๐Ÿ›
mrlzh

๐Ÿ› -
msloan

๐Ÿ› +
msloan

๐Ÿ›
mucharlaravalika

๐Ÿ›
mvenneman

๐Ÿ›
nareshl119

๐Ÿ›
nicolas-harraudeau-sonarsource

๐Ÿ›
noerremark

๐Ÿ›
novsirion

๐Ÿ› -
oggboy

๐Ÿ› +
oggboy

๐Ÿ›
oinume

๐Ÿ›
orimarko

๐Ÿ’ป ๐Ÿ›
pacvz

๐Ÿ’ป
pallavi agarwal

๐Ÿ›
parksungrin

๐Ÿ›
patpatpat123

๐Ÿ› -
patriksevallius

๐Ÿ› +
patriksevallius

๐Ÿ›
pbrajesh1

๐Ÿ›
phoenix384

๐Ÿ›
piotrszymanski-sc

๐Ÿ’ป
plan3d

๐Ÿ›
poojasix

๐Ÿ›
prabhushrikant

๐Ÿ› -
pujitha8783

๐Ÿ› +
pujitha8783

๐Ÿ›
r-r-a-j

๐Ÿ›
raghujayjunk

๐Ÿ›
rajeshveera

๐Ÿ›
rajeswarreddy88

๐Ÿ›
recdevs

๐Ÿ›
reudismam

๐Ÿ’ป ๐Ÿ› -
rijkt

๐Ÿ› +
rijkt

๐Ÿ›
rillig-tk

๐Ÿ›
rmohan20

๐Ÿ’ป ๐Ÿ›
rxmicro

๐Ÿ›
ryan-gustafson

๐Ÿ’ป ๐Ÿ›
sabi0

๐Ÿ›
scais

๐Ÿ› -
sebbASF

๐Ÿ› +
sebbASF

๐Ÿ›
sergeygorbaty

๐Ÿ’ป
shilko2013

๐Ÿ›
shiomiyan

๐Ÿ“–
simeonKondr

๐Ÿ›
snajberk

๐Ÿ›
sniperrifle2004

๐Ÿ› -
snuyanzin

๐Ÿ› ๐Ÿ’ป +
snuyanzin

๐Ÿ› ๐Ÿ’ป
sratz

๐Ÿ›
stonio

๐Ÿ›
sturton

๐Ÿ’ป ๐Ÿ›
sudharmohan

๐Ÿ›
suruchidawar

๐Ÿ›
svenfinitiv

๐Ÿ› -
tashiscool

๐Ÿ› +
tashiscool

๐Ÿ›
test-git-hook

๐Ÿ›
testation21

๐Ÿ’ป ๐Ÿ›
thanosa

๐Ÿ›
tiandiyixian

๐Ÿ›
tobwoerk

๐Ÿ›
tprouvot

๐Ÿ› ๐Ÿ’ป -
trentchilders

๐Ÿ› +
trentchilders

๐Ÿ›
triandicAnt

๐Ÿ›
trishul14

๐Ÿ›
tsui

๐Ÿ›
winhkey

๐Ÿ›
witherspore

๐Ÿ›
wjljack

๐Ÿ› -
wuchiuwong

๐Ÿ› +
wuchiuwong

๐Ÿ›
xingsong

๐Ÿ›
xioayuge

๐Ÿ›
xnYi9wRezm

๐Ÿ’ป ๐Ÿ›
xuanuy

๐Ÿ›
xyf0921

๐Ÿ›
yalechen-cyw3

๐Ÿ› -
yasuharu-sato

๐Ÿ› +
yasuharu-sato

๐Ÿ›
zenglian

๐Ÿ›
zgrzyt93

๐Ÿ’ป ๐Ÿ›
zh3ng

๐Ÿ›
zt_soft

๐Ÿ›
ztt79

๐Ÿ›
zzzzfeng

๐Ÿ› -
รrpรกd Magosรกnyi

๐Ÿ› +
รrpรกd Magosรกnyi

๐Ÿ›
ไปป่ดตๆฐ

๐Ÿ›
่Œ…ๅปถๅฎ‰

๐Ÿ’ป From b56e697b28a887947b783e47186e2e56dc7000b4 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 24 Sep 2022 17:50:55 +0200 Subject: [PATCH 54/96] Bump org.yaml:snakeyaml from 1.31 to 1.32 Fixes https://github.com/pmd/pmd/security/dependabot/25 Fixes https://github.com/advisories/GHSA-9w3m-gqgf-c4p9 Fixes CVE-2022-38752 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bece94f2d0..569c34bfd1 100644 --- a/pom.xml +++ b/pom.xml @@ -770,7 +770,7 @@ org.yaml snakeyaml - 1.31 + 1.32 From 0dcff7245549f6bcfe9f27c1fab6e5219ce5fd77 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 24 Sep 2022 17:52:56 +0200 Subject: [PATCH 55/96] Update gems Fixes https://github.com/pmd/pmd/security/dependabot/26 Fixes https://github.com/advisories/GHSA-4qw4-jpp4-8gvp --- Gemfile.lock | 29 +++++++++++++++-------------- docs/Gemfile.lock | 20 ++++++++++---------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0a16d16858..f47c7c5067 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,8 @@ GEM remote: https://rubygems.org/ specs: - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) claide (1.1.0) claide-plugins (0.9.2) cork @@ -12,7 +12,7 @@ GEM concurrent-ruby (1.1.10) cork (0.3.0) colored2 (~> 3.1) - danger (8.6.1) + danger (9.0.0) claide (~> 1.0) claide-plugins (>= 0.9.2) colored2 (~> 3.1) @@ -23,12 +23,12 @@ GEM kramdown (~> 2.3) kramdown-parser-gfm (~> 1.0) no_proxy_fix - octokit (~> 4.7) + octokit (~> 5.0) terminal-table (>= 1, < 4) differ (0.1.2) et-orbi (1.2.7) tzinfo - faraday (1.10.0) + faraday (1.10.2) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -43,7 +43,7 @@ GEM faraday-em_http (1.0.0) faraday-em_synchrony (1.0.0) faraday-excon (1.1.0) - faraday-http-cache (2.4.0) + faraday-http-cache (2.4.1) faraday (>= 0.8) faraday-httpclient (1.0.1) faraday-multipart (1.0.4) @@ -53,25 +53,26 @@ GEM faraday-patron (1.0.0) faraday-rack (1.0.0) faraday-retry (1.0.3) - fugit (1.5.3) + fugit (1.7.1) et-orbi (~> 1, >= 1.2.7) raabro (~> 1.4) - git (1.11.0) + git (1.12.0) + addressable (~> 2.8) rchardet (~> 1.8) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - liquid (5.3.0) + liquid (5.4.0) logger-colors (1.0.0) mini_portile2 (2.8.0) multipart-post (2.2.3) nap (1.1.0) no_proxy_fix (0.1.2) - nokogiri (1.13.7) + nokogiri (1.13.8) mini_portile2 (~> 2.8.0) racc (~> 1.4) - octokit (4.25.1) + octokit (5.6.1) faraday (>= 1, < 3) sawyer (~> 0.9) open4 (1.3.4) @@ -82,12 +83,12 @@ GEM nokogiri (~> 1.13) rufus-scheduler (~> 3.8) slop (~> 4.6) - public_suffix (4.0.7) + public_suffix (5.0.0) raabro (1.4.0) racc (1.6.0) rchardet (1.8.0) rexml (3.2.5) - rouge (3.29.0) + rouge (4.0.0) ruby2_keywords (0.0.5) rufus-scheduler (3.8.2) fugit (~> 1.1, >= 1.1.6) @@ -100,7 +101,7 @@ GEM unicode-display_width (>= 1.1.1, < 3) tzinfo (2.0.5) concurrent-ruby (~> 1.0) - unicode-display_width (2.2.0) + unicode-display_width (2.3.0) PLATFORMS ruby diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index f85828b039..37ab0dfb1e 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -1,20 +1,20 @@ GEM remote: https://rubygems.org/ specs: - activesupport (6.0.5.1) + activesupport (6.0.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) zeitwerk (~> 2.2, >= 2.2.2) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.11.1) colorator (1.1.0) - commonmarker (0.23.5) + commonmarker (0.23.6) concurrent-ruby (1.1.10) dnsruby (1.61.9) simpleidn (~> 0.1) @@ -25,10 +25,10 @@ GEM ffi (>= 1.15.0) eventmachine (1.2.7) execjs (2.8.1) - faraday (2.3.0) - faraday-net_http (~> 2.0) + faraday (2.5.2) + faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) - faraday-net_http (2.0.3) + faraday-net_http (3.0.0) ffi (1.15.5) forwardable-extended (2.6.0) gemoji (3.0.1) @@ -211,8 +211,8 @@ GEM jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) - minitest (5.16.2) - nokogiri (1.13.7) + minitest (5.16.3) + nokogiri (1.13.8) mini_portile2 (~> 2.8.0) racc (~> 1.4) octokit (4.25.1) @@ -222,7 +222,7 @@ GEM forwardable-extended (~> 2.6) public_suffix (4.0.7) racc (1.6.0) - rb-fsevent (0.11.1) + rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) rexml (3.2.5) From a44c3287328a15f100cd6ccb992b286ea5cb2284 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Mon, 26 Sep 2022 18:39:49 +0200 Subject: [PATCH 56/96] [java] FinalFieldCouldBeStatic - ignore synchronized statements in non-static methods Fixes #4090 --- docs/pages/release_notes.md | 5 +++- .../main/resources/category/java/design.xml | 2 ++ .../design/xml/FinalFieldCouldBeStatic.xml | 30 +++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 364ff7c856..a47b35abbe 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -20,7 +20,10 @@ This release of PMD adds support for [Luau](https://github.com/Roblox/luau), a g from Lua. This means, that the Lua language in PMD can now parse both Lua and Luau. ### Fixed Issues -* [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Missing --file arg in TreeExport CLI example +* core + * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Missing --file arg in TreeExport CLI example +* java-design + * [#4090](https://github.com/pmd/pmd/issues/4090): \[java] FinalFieldCouldBeStatic false positive with non-static synchronized block (regression in 6.48, worked with 6.47) ### API Changes diff --git a/pmd-java/src/main/resources/category/java/design.xml b/pmd-java/src/main/resources/category/java/design.xml index edeecae3fd..39b45d1992 100644 --- a/pmd-java/src/main/resources/category/java/design.xml +++ b/pmd-java/src/main/resources/category/java/design.xml @@ -836,6 +836,8 @@ in each object at runtime. ] ] /VariableDeclaratorId + [not(@Image = //MethodDeclaration[@Static = false()]//SynchronizedStatement/Expression/PrimaryExpression/ + (PrimaryPrefix/Name|PrimarySuffix[preceding-sibling::PrimaryPrefix[@ThisModifier = true()]])/@Image)] ]]> 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 e5f41598a0..4ed2aed5c1 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 @@ -231,4 +231,34 @@ public class Foo { } ]]>
+ + + [java] FinalFieldCouldBeStatic false positive with non-static synchronized block (regression in 6.48, worked with 6.47) #4090 + 1 + 4 + + From dd82e5e19f3200f454ad82377d00941c199dad79 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Mon, 26 Sep 2022 19:45:11 +0200 Subject: [PATCH 57/96] Add java-regression-tests for regression testing Fixes #3431 --- .ci/files/project-list.xml | 8 ++++++++ docs/pages/release_notes.md | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.ci/files/project-list.xml b/.ci/files/project-list.xml index ce357698bc..0690ddb302 100644 --- a/.ci/files/project-list.xml +++ b/.ci/files/project-list.xml @@ -169,4 +169,12 @@ EOF v2.3.0 samples + + + java-regression-tests + git + https://github.com/pmd/java-regression-tests.git + main + realpath java-regression-tests-*.jar + diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 364ff7c856..5af1074fbb 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -20,7 +20,10 @@ This release of PMD adds support for [Luau](https://github.com/Roblox/luau), a g from Lua. This means, that the Lua language in PMD can now parse both Lua and Luau. ### Fixed Issues -* [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Missing --file arg in TreeExport CLI example +* core + * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Missing --file arg in TreeExport CLI example +* java + * [#3431](https://github.com/pmd/pmd/issues/3431): \[java] Add sample java project to regression-tester which uses new language constructs ### API Changes From d30edd618eb98e3f8fdb7713264fd342fa9b39d0 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Mon, 26 Sep 2022 20:45:49 +0200 Subject: [PATCH 58/96] Change something in pmd-core to let the regression tester run --- pmd-core/src/main/java/net/sourceforge/pmd/PMD.java | 1 + 1 file changed, 1 insertion(+) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java b/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java index 70dcecaacf..7c3ab37f96 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java @@ -63,6 +63,7 @@ import net.sourceforge.pmd.util.log.internal.SimpleMessageReporter; */ public class PMD { + private static final Logger LOG = Logger.getLogger(PMD.class.getName()); /** From 1ea82f1ee63b18ff7c2e2c57d25db3499ede5fe4 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Tue, 27 Sep 2022 19:38:25 +0200 Subject: [PATCH 59/96] Fix git connection for java-regression-tests --- .ci/files/project-list.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/files/project-list.xml b/.ci/files/project-list.xml index 0690ddb302..dc8eb00bcb 100644 --- a/.ci/files/project-list.xml +++ b/.ci/files/project-list.xml @@ -173,7 +173,7 @@ EOF java-regression-tests git - https://github.com/pmd/java-regression-tests.git + https://github.com/pmd/java-regression-tests main realpath java-regression-tests-*.jar From b59ceb6c607659f9c43dd79a9695ff9ce633494f Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Tue, 27 Sep 2022 20:55:25 +0200 Subject: [PATCH 60/96] [java] ConstructorCallsOverridableMethod - fix false negatives - Use type of the method call result - Do not consider super method calls, but this references --- ...ConstructorCallsOverridableMethodRule.java | 22 +++++--- .../AbstractThing.java | 19 +++++++ .../Thing.java | 11 ++++ .../xml/ConstructorCallsOverridableMethod.xml | 50 +++++++++++++++++++ 4 files changed, 96 insertions(+), 6 deletions(-) create mode 100644 pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/errorprone/constructorcallsoverridablemethod/AbstractThing.java create mode 100644 pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/errorprone/constructorcallsoverridablemethod/Thing.java diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java index 3a642ed7ff..ff8244c270 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java @@ -37,6 +37,8 @@ import net.sourceforge.pmd.lang.java.ast.ASTRecordDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTType; import net.sourceforge.pmd.lang.java.ast.ASTVariableDeclaratorId; import net.sourceforge.pmd.lang.java.ast.AccessNode; +import net.sourceforge.pmd.lang.java.ast.JavaNode; +import net.sourceforge.pmd.lang.java.ast.TypeNode; import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule; import net.sourceforge.pmd.lang.java.typeresolution.typedefinition.JavaTypeDefinition; @@ -322,7 +324,7 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul String name = child.getImage(); // special case if (i == 2) { // last named node = method name methodName = name; - } else { + } else if (name != null) { // not the last named node so its only // var name varNames.add(name); @@ -1057,12 +1059,20 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul ASTArgumentList argumentList = args.getFirstChildOfType(ASTArgumentList.class); if (argumentList != null) { for (int a = 0; a < argumentList.getNumChildren(); a++) { - Node expression = argumentList.getChild(a); - ASTPrimaryPrefix arg = expression.getFirstDescendantOfType(ASTPrimaryPrefix.class); + JavaNode expression = argumentList.getChild(a); + final TypeNode typeNode; + if (expression instanceof TypeNode) { + typeNode = (TypeNode) expression; + } else { + typeNode = expression.getFirstDescendantOfType(ASTPrimaryPrefix.class); + } + Class type = null; - JavaTypeDefinition typeDefinition = arg.getTypeDefinition(); - if (typeDefinition != null) { - type = typeDefinition.getType(); + if (typeNode != null) { + JavaTypeDefinition typeDefinition = typeNode.getTypeDefinition(); + if (typeDefinition != null) { + type = typeDefinition.getType(); + } } argumentTypes.add(type); } diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/errorprone/constructorcallsoverridablemethod/AbstractThing.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/errorprone/constructorcallsoverridablemethod/AbstractThing.java new file mode 100644 index 0000000000..184216ed41 --- /dev/null +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/errorprone/constructorcallsoverridablemethod/AbstractThing.java @@ -0,0 +1,19 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.java.rule.errorprone.constructorcallsoverridablemethod; + +public abstract class AbstractThing implements Thing { + protected AbstractThing(Thing original) { + setName(original.getName()); + } + + @Override + public void setName(String name) { } + + @Override + public String getName() { + return ""; + } +} diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/errorprone/constructorcallsoverridablemethod/Thing.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/errorprone/constructorcallsoverridablemethod/Thing.java new file mode 100644 index 0000000000..70f21878ee --- /dev/null +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/errorprone/constructorcallsoverridablemethod/Thing.java @@ -0,0 +1,11 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.java.rule.errorprone.constructorcallsoverridablemethod; + +public interface Thing { + String getName(); + + void setName(String name); +} diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml index 4714a3f953..11dd0b0a2d 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml @@ -430,6 +430,56 @@ class Foo { ((String) o).length(); } } +]]> + + + + False negative with method call as argument + 1 + 5 + + + + + Clone and finalize overridden + 3 + 3,4,5 + From 58c9f361d3447e10e0ebcfe3cd00c7709a361267 Mon Sep 17 00:00:00 2001 From: Luis Alcantar Date: Wed, 28 Sep 2022 12:01:32 -0700 Subject: [PATCH 61/96] [java] issue#3859: Exclude junit5 test methods from the commentDefaultAccessModifierRule There was a conflict between the CommentDefaultAccessModifier and the JUnit5TestShouldBePackagePrivate rule. while the JUnit5TestShouldBePackagePrivate rule passed, the CommentDefaultAccessModifier complained about the lack of a comment on the method encapsulation generating a false alert. example "@org.junit.jupiter.api.Test void MissingCommentMethod {}", missing " /* default */" but not required in junit5. The changes will exclude methods with junit5 @Test or @ParameterizedTest annotation for the commentDefaultAccessModifierRule. --- docs/pages/release_notes.md | 2 + .../CommentDefaultAccessModifierRule.java | 8 +++- .../MethodNamingConventionsRule.java | 7 +-- .../java/types/TestingFrameworkTypeUtil.java | 28 ++++++++++++ .../types/TestingFrameworkTypeUtilTest.java | 45 +++++++++++++++++++ .../xml/CommentDefaultAccessModifier.xml | 15 +++++++ 6 files changed, 99 insertions(+), 6 deletions(-) create mode 100644 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TestingFrameworkTypeUtil.java create mode 100644 pmd-java/src/test/java/net/sourceforge/pmd/lang/java/types/TestingFrameworkTypeUtilTest.java diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 364ff7c856..aab407056f 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -21,6 +21,7 @@ from Lua. This means, that the Lua language in PMD can now parse both Lua and Lu ### Fixed Issues * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Missing --file arg in TreeExport CLI example +* [#3859](https://github.com/pmd/pmd/pull/3859): \[java] CommentDefaultAccessModifier is triggered in JUnit5 test class ### API Changes @@ -32,6 +33,7 @@ from Lua. This means, that the Lua language in PMD can now parse both Lua and Lu * [#4066](https://github.com/pmd/pmd/pull/4066): \[lua] Add support for Luau syntax and skipping literal sequences in CPD - [@matthargett](https://github.com/matthargett) * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Fix missing --file arg in TreeExport CLI example - [@mohan-chinnappan-n](https://github.com/mohan-chinnappan-n) * [#4131](https://github.com/pmd/pmd/pull/4131): \[doc] TooFewBranchesForASwitchStatement - Use "if-else" instead of "if-then" - [@Suvashri](https://github.com/Suvashri) +* [#3859](https://github.com/pmd/pmd/pull/3859): \[java] CommentDefaultAccessModifier is triggered in JUnit5 test class [@lfalcantar](https://github.com/lfalcantar) {% endtocmaker %} diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/CommentDefaultAccessModifierRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/CommentDefaultAccessModifierRule.java index 2891b13843..ac2d287a74 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/CommentDefaultAccessModifierRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/CommentDefaultAccessModifierRule.java @@ -25,6 +25,7 @@ import net.sourceforge.pmd.lang.java.ast.AccessNode; import net.sourceforge.pmd.lang.java.ast.Annotatable; import net.sourceforge.pmd.lang.java.ast.Comment; import net.sourceforge.pmd.lang.java.rule.AbstractIgnoredAnnotationRule; +import net.sourceforge.pmd.lang.java.types.TestingFrameworkTypeUtil; import net.sourceforge.pmd.properties.PropertyDescriptor; import net.sourceforge.pmd.properties.PropertyFactory; @@ -72,9 +73,14 @@ public class CommentDefaultAccessModifierRule extends AbstractIgnoredAnnotationR return super.visit(node, data); } + /* + * The method determines is the method needs to be included in the violations report + * Also, the code needs to check that the method is not a Test from junit5 + * to avoid conflicts with JUnit5TestShouldBePackagePrivate + */ @Override public Object visit(final ASTMethodDeclaration decl, final Object data) { - if (shouldReport(decl)) { + if (!TestingFrameworkTypeUtil.isJunit5Test(decl) && shouldReport(decl)) { addViolationWithMessage(data, decl, String.format(MESSAGE, decl.getFirstChildOfType(ASTMethodDeclarator.class).getImage(), "method")); } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/MethodNamingConventionsRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/MethodNamingConventionsRule.java index 3d8b99554d..5b152f50c3 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/MethodNamingConventionsRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/MethodNamingConventionsRule.java @@ -14,6 +14,7 @@ import net.sourceforge.pmd.lang.java.ast.ASTAnyTypeDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTEnumConstant; import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; +import net.sourceforge.pmd.lang.java.types.TestingFrameworkTypeUtil; import net.sourceforge.pmd.lang.java.types.TypeTestUtil; import net.sourceforge.pmd.properties.BooleanProperty; import net.sourceforge.pmd.properties.PropertyBuilder.RegexPropertyBuilder; @@ -48,10 +49,6 @@ public class MethodNamingConventionsRule extends AbstractNamingConventionRule + + + + #3859 [java] CommentDefaultAccessModifier is triggered in JUnit5 method. + and it was conflicting with rule JUnit5TestShouldBePackagePrivate + 0 + From d94a9439117f11823a088d71601f16dfd02995f5 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Sep 2022 11:15:02 +0200 Subject: [PATCH 62/96] [java] ConstructorCallsOverridableMethod - fix false negatives - Identify method calls of generic methods --- .../typeinference/TypeInferenceResolver.java | 4 ++- .../typeresolution/ClassTypeResolverTest.java | 15 ++++++++++- .../testdata/MethodCallExpressionTypes.java | 8 +++++- .../xml/ConstructorCallsOverridableMethod.xml | 26 +++++++++++++++++-- 4 files changed, 48 insertions(+), 5 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/typeinference/TypeInferenceResolver.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/typeinference/TypeInferenceResolver.java index ed2fa306ae..17c8320689 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/typeinference/TypeInferenceResolver.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/typeinference/TypeInferenceResolver.java @@ -234,7 +234,9 @@ public final class TypeInferenceResolver { for (Variable var : variablesToResolve) { List lowerBounds = getLowerBoundsOf(var, bounds); // TODO: should call incorporation - instantiations.put(var, lub(lowerBounds)); + if (!lowerBounds.isEmpty()) { + instantiations.put(var, lub(lowerBounds)); + } } uninstantiatedVariables.removeAll(variablesToResolve); diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/typeresolution/ClassTypeResolverTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/typeresolution/ClassTypeResolverTest.java index cef6b52fa1..3b8680ccca 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/typeresolution/ClassTypeResolverTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/typeresolution/ClassTypeResolverTest.java @@ -19,6 +19,7 @@ import static org.junit.Assert.assertSame; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util.HashSet; @@ -47,6 +48,7 @@ import net.sourceforge.pmd.lang.java.ast.ASTFormalParameter; import net.sourceforge.pmd.lang.java.ast.ASTImportDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTLiteral; import net.sourceforge.pmd.lang.java.ast.ASTLocalVariableDeclaration; +import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTName; import net.sourceforge.pmd.lang.java.ast.ASTNullLiteral; import net.sourceforge.pmd.lang.java.ast.ASTPrimaryExpression; @@ -1873,9 +1875,20 @@ public class ClassTypeResolverTest { @Test public void testMethodCallExpressionTypes() throws Exception { ASTCompilationUnit cu = java11.parseClass(MethodCallExpressionTypes.class); - ASTPrimaryExpression expr = cu.getFirstDescendantOfType(ASTPrimaryExpression.class); + List methods = cu.findDescendantsOfType(ASTMethodDeclaration.class); + + // objectsToString + ASTPrimaryExpression expr = methods.get(0).getFirstDescendantOfType(ASTPrimaryExpression.class); assertEquals(forClass(String.class), expr.getTypeDefinition()); assertEquals(forClass(Objects.class), expr.getFirstChildOfType(ASTPrimaryPrefix.class).getTypeDefinition()); + + // arraysAsList + expr = methods.get(1).getFirstDescendantOfType(ASTPrimaryExpression.class); + // note: the type parameter is not correct - it should be bound to String and not object + // but that's close enough - import is, that we correctly identified the method call + // and the result of the method call is a List. + assertEquals(forClass(List.class, forClass(Object.class)), expr.getTypeDefinition()); + assertEquals(forClass(Arrays.class), expr.getFirstChildOfType(ASTPrimaryPrefix.class).getTypeDefinition()); } private JavaTypeDefinition getChildTypeDef(Node node, int childIndex) { diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/typeresolution/testdata/MethodCallExpressionTypes.java b/pmd-java/src/test/java/net/sourceforge/pmd/typeresolution/testdata/MethodCallExpressionTypes.java index a9fdc44da4..bfaf54bd30 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/typeresolution/testdata/MethodCallExpressionTypes.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/typeresolution/testdata/MethodCallExpressionTypes.java @@ -4,10 +4,16 @@ package net.sourceforge.pmd.typeresolution.testdata; +import java.util.Arrays; +import java.util.Collection; import java.util.Objects; public class MethodCallExpressionTypes { - public void bar() { + public void objectsToString() { Objects.toString(null); } + + public void arraysAsList() { + Collection l = Arrays.asList("a"); + } } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml index 11dd0b0a2d..82d5452a57 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml @@ -456,8 +456,8 @@ public abstract class AbstractThing implements Thing { Clone and finalize overridden - 3 - 3,4,5 + 6 + 3,4,5,7,8,9 + + + + False negative with var args and Arrays.asList + 1 + 6 + names) { } +} ]]> From 5840afe39a1bec770d09de97d9687fd011a25f52 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Sep 2022 12:16:43 +0200 Subject: [PATCH 63/96] [java] ConstructorCallsOverridableMethod - improve message for call chains --- ...ConstructorCallsOverridableMethodRule.java | 33 ++++++++++++++----- .../resources/category/java/errorprone.xml | 2 +- .../xml/ConstructorCallsOverridableMethod.xml | 30 +++++++++++++++++ 3 files changed, 55 insertions(+), 10 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java index ff8244c270..e4d2f8c573 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java @@ -7,7 +7,9 @@ package net.sourceforge.pmd.lang.java.rule.errorprone; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.Deque; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -501,18 +503,24 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul private static final class MethodHolder { private ASTMethodDeclaration amd; private boolean dangerous; - private String called; + private Deque callStack = new LinkedList<>(); MethodHolder(ASTMethodDeclaration amd) { this.amd = amd; } - public void setCalledMethod(String name) { - this.called = name; + public void addToStack(String name) { + callStack.push(name); } - public String getCalled() { - return this.called; + public void addToStack(Deque otherStack) { + for (String name : otherStack) { + callStack.addLast(name); + } + } + + public Deque getCallStack() { + return callStack; } public ASTMethodDeclaration getASTMethodDeclaration() { @@ -694,7 +702,14 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul // check against each dangerous method in class for (MethodHolder h : getCurrentEvalPackage().allMethodsOfClass.keySet()) { if (h.isDangerous() && meth.matches(h.getASTMethodDeclaration())) { - addViolation(data, meth.getASTPrimaryExpression(), "method '" + h.getCalled() + "'"); + if (h.getCallStack().size() > 1) { + String overridableMethod = h.getCallStack().getLast(); + asCtx(data).addViolation(meth.getASTPrimaryExpression(), "method '" + overridableMethod + "'", + " (call stack: " + h.getCallStack() + ")"); + } else { + String overridableMethod = meth.getName(); + asCtx(data).addViolation(meth.getASTPrimaryExpression(), "method '" + overridableMethod + "'", ""); + } } } } @@ -712,7 +727,7 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul for (ConstructorInvocation ci : getCurrentEvalPackage().calledConstructors) { if (ci.getArgumentCount() == paramCount) { // match name super / this !? - addViolation(data, ci.getASTExplicitConstructorInvocation(), "constructor"); + asCtx(data).addViolation(ci.getASTExplicitConstructorInvocation(), "constructor", ""); } } } @@ -755,7 +770,8 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul // System.out.println("matching " + matchMethodName + " // to " + meth.getName()); h.setDangerous(); - h.setCalledMethod(meth.getName()); + h.addToStack(h3.getCallStack()); + h.addToStack(meth.getName()); found = true; break; } @@ -946,7 +962,6 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul if (!node.isAbstract() && !node.isPrivate() && !node.isStatic() && !node.isFinal()) { // Skip abstract methods, have a separate rule for that h.setDangerous(); // this method is overridable - h.setCalledMethod(node.getName()); } List l = new ArrayList<>(); addCalledMethodsOfNode(node, l, getCurrentEvalPackage().className); diff --git a/pmd-java/src/main/resources/category/java/errorprone.xml b/pmd-java/src/main/resources/category/java/errorprone.xml index 4472626154..77c809b50d 100644 --- a/pmd-java/src/main/resources/category/java/errorprone.xml +++ b/pmd-java/src/main/resources/category/java/errorprone.xml @@ -1170,7 +1170,7 @@ boolean x = (y == Double.NaN); diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml index 82d5452a57..03244da556 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml @@ -502,6 +502,36 @@ class Foo { public void setNames(Collection names) { } } +]]> + + + + Misleading message for method call chain + 1 + 3 + + Overridable method 'overridableMethod' called during object construction (call stack: [otherMethod1, otherMethod2, overridableMethod]) + + From d21a562e900d661cea61e60d0c96c15bea8eff4f Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Sep 2022 14:12:22 +0200 Subject: [PATCH 64/96] [java] ConstructorCallsOverridableMethod - fix message for call chains First method in the chain was missing --- ...ConstructorCallsOverridableMethodRule.java | 9 +++++---- .../xml/ConstructorCallsOverridableMethod.xml | 20 ++++++++++++++++--- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java index e4d2f8c573..531932a3a9 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConstructorCallsOverridableMethodRule.java @@ -702,12 +702,13 @@ public final class ConstructorCallsOverridableMethodRule extends AbstractJavaRul // check against each dangerous method in class for (MethodHolder h : getCurrentEvalPackage().allMethodsOfClass.keySet()) { if (h.isDangerous() && meth.matches(h.getASTMethodDeclaration())) { - if (h.getCallStack().size() > 1) { - String overridableMethod = h.getCallStack().getLast(); + Deque completeCallStack = new LinkedList<>(h.getCallStack()); + completeCallStack.addFirst(meth.getName()); + String overridableMethod = completeCallStack.getLast(); + if (completeCallStack.size() > 1) { asCtx(data).addViolation(meth.getASTPrimaryExpression(), "method '" + overridableMethod + "'", - " (call stack: " + h.getCallStack() + ")"); + " (call stack: " + completeCallStack + ")"); } else { - String overridableMethod = meth.getName(); asCtx(data).addViolation(meth.getASTPrimaryExpression(), "method '" + overridableMethod + "'", ""); } } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml index 03244da556..63885ec4f0 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml @@ -507,15 +507,19 @@ class Foo { Misleading message for method call chain - 1 - 3 + 3 + 3,4,5 - Overridable method 'overridableMethod' called during object construction (call stack: [otherMethod1, otherMethod2, overridableMethod]) + Overridable method 'overridableMethod' called during object construction (call stack: [intermediatePrivateMethod, otherMethod1, otherMethod2, overridableMethod]) + Overridable method 'overridableMethod' called during object construction (call stack: [shorterChain, overridableMethod]) + Overridable method 'otherOverridableMethod' called during object construction (call stack: [differentChain, otherOverridableMethod]) From 3ba63285ac7d4a4a4a2ddd610df44551a798d1df Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Sep 2022 15:04:35 +0200 Subject: [PATCH 65/96] [java] CommentDefaultAccessModifier - configure JUnit5 annotations to be ignored --- .../CommentDefaultAccessModifierRule.java | 12 ++++- .../MethodNamingConventionsRule.java | 7 ++- .../java/types/TestingFrameworkTypeUtil.java | 28 ------------ .../types/TestingFrameworkTypeUtilTest.java | 45 ------------------- .../xml/CommentDefaultAccessModifier.xml | 3 +- 5 files changed, 16 insertions(+), 79 deletions(-) delete mode 100644 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TestingFrameworkTypeUtil.java delete mode 100644 pmd-java/src/test/java/net/sourceforge/pmd/lang/java/types/TestingFrameworkTypeUtilTest.java diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/CommentDefaultAccessModifierRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/CommentDefaultAccessModifierRule.java index ac2d287a74..f859d2d6f5 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/CommentDefaultAccessModifierRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/CommentDefaultAccessModifierRule.java @@ -25,7 +25,6 @@ import net.sourceforge.pmd.lang.java.ast.AccessNode; import net.sourceforge.pmd.lang.java.ast.Annotatable; import net.sourceforge.pmd.lang.java.ast.Comment; import net.sourceforge.pmd.lang.java.rule.AbstractIgnoredAnnotationRule; -import net.sourceforge.pmd.lang.java.types.TestingFrameworkTypeUtil; import net.sourceforge.pmd.properties.PropertyDescriptor; import net.sourceforge.pmd.properties.PropertyFactory; @@ -58,6 +57,15 @@ public class CommentDefaultAccessModifierRule extends AbstractIgnoredAnnotationR Collection ignoredStrings = new ArrayList<>(); ignoredStrings.add("com.google.common.annotations.VisibleForTesting"); ignoredStrings.add("android.support.annotation.VisibleForTesting"); + ignoredStrings.add("org.junit.jupiter.api.Test"); + ignoredStrings.add("org.junit.jupiter.api.ParameterizedTest"); + ignoredStrings.add("org.junit.jupiter.api.RepeatedTest"); + ignoredStrings.add("org.junit.jupiter.api.TestFactory"); + ignoredStrings.add("org.junit.jupiter.api.TestTemplate"); + ignoredStrings.add("org.junit.jupiter.api.BeforeEach"); + ignoredStrings.add("org.junit.jupiter.api.BeforeAll"); + ignoredStrings.add("org.junit.jupiter.api.AfterEach"); + ignoredStrings.add("org.junit.jupiter.api.AfterAll"); return ignoredStrings; } @@ -80,7 +88,7 @@ public class CommentDefaultAccessModifierRule extends AbstractIgnoredAnnotationR */ @Override public Object visit(final ASTMethodDeclaration decl, final Object data) { - if (!TestingFrameworkTypeUtil.isJunit5Test(decl) && shouldReport(decl)) { + if (shouldReport(decl)) { addViolationWithMessage(data, decl, String.format(MESSAGE, decl.getFirstChildOfType(ASTMethodDeclarator.class).getImage(), "method")); } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/MethodNamingConventionsRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/MethodNamingConventionsRule.java index 5b152f50c3..3d8b99554d 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/MethodNamingConventionsRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/MethodNamingConventionsRule.java @@ -14,7 +14,6 @@ import net.sourceforge.pmd.lang.java.ast.ASTAnyTypeDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTEnumConstant; import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; -import net.sourceforge.pmd.lang.java.types.TestingFrameworkTypeUtil; import net.sourceforge.pmd.lang.java.types.TypeTestUtil; import net.sourceforge.pmd.properties.BooleanProperty; import net.sourceforge.pmd.properties.PropertyBuilder.RegexPropertyBuilder; @@ -49,6 +48,10 @@ public class MethodNamingConventionsRule extends AbstractNamingConventionRule - #3859 [java] CommentDefaultAccessModifier is triggered in JUnit5 method. - and it was conflicting with rule JUnit5TestShouldBePackagePrivate + #3859 [java] CommentDefaultAccessModifier is triggered in JUnit5 method and it was conflicting with rule JUnit5TestShouldBePackagePrivate 0 Date: Thu, 29 Sep 2022 15:06:20 +0200 Subject: [PATCH 66/96] [doc] Update release notes (#3859, #4137) --- docs/pages/release_notes.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index aab407056f..a293f1b95a 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -21,7 +21,7 @@ from Lua. This means, that the Lua language in PMD can now parse both Lua and Lu ### Fixed Issues * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Missing --file arg in TreeExport CLI example -* [#3859](https://github.com/pmd/pmd/pull/3859): \[java] CommentDefaultAccessModifier is triggered in JUnit5 test class +* [#3859](https://github.com/pmd/pmd/issues/3859): \[java] CommentDefaultAccessModifier is triggered in JUnit5 test class ### API Changes @@ -33,7 +33,7 @@ from Lua. This means, that the Lua language in PMD can now parse both Lua and Lu * [#4066](https://github.com/pmd/pmd/pull/4066): \[lua] Add support for Luau syntax and skipping literal sequences in CPD - [@matthargett](https://github.com/matthargett) * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Fix missing --file arg in TreeExport CLI example - [@mohan-chinnappan-n](https://github.com/mohan-chinnappan-n) * [#4131](https://github.com/pmd/pmd/pull/4131): \[doc] TooFewBranchesForASwitchStatement - Use "if-else" instead of "if-then" - [@Suvashri](https://github.com/Suvashri) -* [#3859](https://github.com/pmd/pmd/pull/3859): \[java] CommentDefaultAccessModifier is triggered in JUnit5 test class [@lfalcantar](https://github.com/lfalcantar) +* [#4137](https://github.com/pmd/pmd/pull/4137): \[java] Fixes 3859: Exclude junit5 test methods from the commentDefaultAccessModifierRule - [@lfalcantar](https://github.com/lfalcantar) {% endtocmaker %} From dbe2881d6d6fbc9cdd232b3c45d750d9980b674a Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Sep 2022 15:09:22 +0200 Subject: [PATCH 67/96] [doc] CommentDefaultAccessModifier - update rule description --- docs/pages/release_notes.md | 5 +++++ pmd-java/src/main/resources/category/java/codestyle.xml | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index a293f1b95a..b85a996ace 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -19,6 +19,11 @@ This is a {{ site.pmd.release_type }} release. This release of PMD adds support for [Luau](https://github.com/Roblox/luau), a gradually typed language derived from Lua. This means, that the Lua language in PMD can now parse both Lua and Luau. +#### Modified rules + +* The Java rule {% rule java/codestyle/CommentDefaultAccessModifier %} now by default ignores JUnit5 annotated + methods. This behavior can be customized using the property `ignoredAnnotations`. + ### Fixed Issues * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Missing --file arg in TreeExport CLI example * [#3859](https://github.com/pmd/pmd/issues/3859): \[java] CommentDefaultAccessModifier is triggered in JUnit5 test class diff --git a/pmd-java/src/main/resources/category/java/codestyle.xml b/pmd-java/src/main/resources/category/java/codestyle.xml index f9770a891b..ec8f37cc46 100644 --- a/pmd-java/src/main/resources/category/java/codestyle.xml +++ b/pmd-java/src/main/resources/category/java/codestyle.xml @@ -436,9 +436,10 @@ public class ร‰lรฉphant {} externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_codestyle.html#commentdefaultaccessmodifier"> To avoid mistakes if we want that an Annotation, Class, Enum, Method, Constructor or Field have a default access modifier -we must add a comment at the beginning of it's declaration. -By default the comment must be `/* default */` or `/* package */`, if you want another, you have to provide a regular expression. -This rule ignores by default all cases that have a @VisibleForTesting annotation. Use the +we must add a comment at the beginning of its declaration. +By default, the comment must be `/* default */` or `/* package */`, if you want another, you have to provide a regular expression. + +This rule ignores by default all cases that have a `@VisibleForTesting` annotation or any JUnit5 annotation. Use the property "ignoredAnnotations" to customize the recognized annotations. 3 From defb0cd47c18a4848a30bdc1270f6aa972541739 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Sep 2022 15:42:05 +0200 Subject: [PATCH 68/96] [doc] Update release notes (#1718, #2348) --- docs/pages/release_notes.md | 2 + .../xml/ConstructorCallsOverridableMethod.xml | 45 ++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index ab600104dc..8a8a544073 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -23,6 +23,8 @@ from Lua. This means, that the Lua language in PMD can now parse both Lua and Lu * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Missing --file arg in TreeExport CLI example * java-errorprone + * [#1718](https://github.com/pmd/pmd/issues/1718): \[java] ConstructorCallsOverridableMethod false positive when calling super method + * [#2348](https://github.com/pmd/pmd/issues/2348): \[java] ConstructorCallsOverridableMethod occurs when unused overloaded method is defined * [#4099](https://github.com/pmd/pmd/issues/4099): \[java] ConstructorCallsOverridableMethod should consider method calls with var access ### API Changes diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml index 63885ec4f0..34590797be 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConstructorCallsOverridableMethod.xml @@ -455,7 +455,7 @@ public abstract class AbstractThing implements Thing { - Clone and finalize overridden + Clone and finalize overridden #1718 6 3,4,5,7,8,9 + + + + [java] ConstructorCallsOverridableMethod occurs when unused overloaded method is defined #2348 + 0 + + + + + [java] ConstructorCallsOverridableMethod occurs when unused overloaded method is defined #2348 - sample 2 + 0 + From 792fe44d0ba4211d88878183b78d82c57c238169 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Sep 2022 15:54:50 +0200 Subject: [PATCH 69/96] Fixups from review (#4128) --- .../rule/codestyle/UnnecessaryFullyQualifiedNameRule.java | 2 +- .../java/rule/codestyle/xml/UnnecessaryFullyQualifiedName.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryFullyQualifiedNameRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryFullyQualifiedNameRule.java index 5348abca59..8091d944e3 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryFullyQualifiedNameRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryFullyQualifiedNameRule.java @@ -204,7 +204,7 @@ public class UnnecessaryFullyQualifiedNameRule extends AbstractJavaRule { String importStr = firstMatch.getImportedName() + (firstMatch.isImportOnDemand() ? ".*" : ""); String type = firstMatch.isStatic() ? "static " : ""; - addViolation(data, node, new Object[]{node.getImage(), importStr, type}); + asCtx(data).addViolation(node, node.getImage(), importStr, type); } } } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryFullyQualifiedName.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryFullyQualifiedName.xml index 426bb9b4b6..097e096767 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryFullyQualifiedName.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryFullyQualifiedName.xml @@ -623,7 +623,7 @@ public class UnnecessaryFullyQualifiedName { - False positive when same package inner class is referenced (not enum) + False positive when same package inner class is referenced (not enum) #4085 0 - Should report fully-qualified name usage of a class in itself. + Should report fully-qualified name usage of a class in itself #4085 1 4 Date: Thu, 29 Sep 2022 16:02:51 +0200 Subject: [PATCH 70/96] Add @osiegmar as a contributor --- .all-contributorsrc | 9 +++ docs/pages/pmd/projectdocs/credits.md | 99 ++++++++++++++------------- docs/pages/release_notes.md | 6 ++ 3 files changed, 65 insertions(+), 49 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index e29348424c..3a4f606e6c 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -6825,6 +6825,15 @@ "contributions": [ "doc" ] + }, + { + "login": "osiegmar", + "name": "Oliver Siegmar", + "avatar_url": "https://avatars.githubusercontent.com/u/1918869?v=4", + "profile": "https://github.com/osiegmar", + "contributions": [ + "financial" + ] } ], "contributorsPerLine": 7, diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index 9f1604b29a..940e872308 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -533,441 +533,442 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Oleg Pavlenko

๐Ÿ›
Oleksii Dykov

๐Ÿ’ป
Oliver Eikemeier

๐Ÿ› -
Olivier Parent

๐Ÿ’ป ๐Ÿ› +
Oliver Siegmar

๐Ÿ’ต +
Olivier Parent

๐Ÿ’ป ๐Ÿ›
Ollie Abbey

๐Ÿ’ป ๐Ÿ›
OverDrone

๐Ÿ›
Ozan Gulle

๐Ÿ’ป ๐Ÿ›
PUNEET JAIN

๐Ÿ›
Parbati Bose

๐Ÿ›
Paul Berg

๐Ÿ› -
Pavel Bludov

๐Ÿ› +
Pavel Bludov

๐Ÿ›
Pavel Miฤka

๐Ÿ›
Pedro Nuno Santos

๐Ÿ›
Pedro Rijo

๐Ÿ›
Pelisse Romain

๐Ÿ’ป ๐Ÿ“– ๐Ÿ›
Per Abich

๐Ÿ’ป
Pete Davids

๐Ÿ› -
Peter Bruin

๐Ÿ› +
Peter Bruin

๐Ÿ›
Peter Chittum

๐Ÿ’ป ๐Ÿ›
Peter Cudmore

๐Ÿ›
Peter Kasson

๐Ÿ›
Peter Kofler

๐Ÿ›
Peter Paul Bakker

๐Ÿ’ป
Pham Hai Trung

๐Ÿ› -
Philip Graf

๐Ÿ’ป ๐Ÿ› +
Philip Graf

๐Ÿ’ป ๐Ÿ›
Philip Hachey

๐Ÿ›
Philippe Ozil

๐Ÿ›
Phinehas Artemix

๐Ÿ›
Phokham Nonava

๐Ÿ›
Piotr Szymaล„ski

๐Ÿ›
Piotrek ลปygieล‚o

๐Ÿ’ป ๐Ÿ› -
Pranay Jaiswal

๐Ÿ› +
Pranay Jaiswal

๐Ÿ›
Prasad Kamath

๐Ÿ›
Prasanna

๐Ÿ›
Presh-AR

๐Ÿ›
Puneet1726

๐Ÿ›
Rafael Cortรชs

๐Ÿ›
RaheemShaik999

๐Ÿ› -
RajeshR

๐Ÿ’ป ๐Ÿ› +
RajeshR

๐Ÿ’ป ๐Ÿ›
Ramachandra Mohan

๐Ÿ›
Ramel0921

๐Ÿ›
Raquel Pau

๐Ÿ›
Ravikiran Janardhana

๐Ÿ›
Reda Benhemmouche

๐Ÿ›
Renato Oliveira

๐Ÿ’ป ๐Ÿ› -
Rich DiCroce

๐Ÿ› +
Rich DiCroce

๐Ÿ›
Riot R1cket

๐Ÿ›
Rishabh Jain

๐Ÿ›
RishabhDeep Singh

๐Ÿ›
Robbie Martinus

๐Ÿ’ป ๐Ÿ›
Robert Henry

๐Ÿ›
Robert Painsi

๐Ÿ› -
Robert Russell

๐Ÿ› +
Robert Russell

๐Ÿ›
Robert Sรถsemann

๐Ÿ’ป ๐Ÿ“– ๐Ÿ“ข ๐Ÿ›
Robert Whitebit

๐Ÿ›
Robin Richtsfeld

๐Ÿ›
Robin Stocker

๐Ÿ’ป ๐Ÿ›
Robin Wils

๐Ÿ›
RochusOest

๐Ÿ› -
Rodolfo Noviski

๐Ÿ› +
Rodolfo Noviski

๐Ÿ›
Rodrigo Casara

๐Ÿ›
Rodrigo Fernandes

๐Ÿ›
Roman Salvador

๐Ÿ’ป ๐Ÿ›
Ronald Blaschke

๐Ÿ›
Rรณbert Papp

๐Ÿ›
Saikat Sengupta

๐Ÿ› -
Saksham Handu

๐Ÿ› +
Saksham Handu

๐Ÿ›
Saladoc

๐Ÿ›
Salesforce Bob Lightning

๐Ÿ›
Sam Carlberg

๐Ÿ›
Satoshi Kubo

๐Ÿ›
Scott Kennedy

๐Ÿ›
Scott Wells

๐Ÿ› ๐Ÿ’ป -
Scrsloota

๐Ÿ’ป +
Scrsloota

๐Ÿ’ป
Sebastian Bรถgl

๐Ÿ›
Sebastian Schuberth

๐Ÿ›
Sebastian Schwarz

๐Ÿ›
Sergey Gorbaty

๐Ÿ›
Sergey Kozlov

๐Ÿ›
Sergey Yanzin

๐Ÿ’ป ๐Ÿ› -
Seth Wilcox

๐Ÿ’ป +
Seth Wilcox

๐Ÿ’ป
Shubham

๐Ÿ’ป ๐Ÿ›
Simon Abykov

๐Ÿ’ป
Simon Xiao

๐Ÿ›
Srinivasan Venkatachalam

๐Ÿ›
Stanislav Gromov

๐Ÿ›
Stanislav Myachenkov

๐Ÿ’ป -
Stefan Birkner

๐Ÿ› +
Stefan Birkner

๐Ÿ›
Stefan Bohn

๐Ÿ›
Stefan Endrullis

๐Ÿ›
Stefan Klรถss-Schuster

๐Ÿ›
Stefan Wolf

๐Ÿ›
Stephan H. Wissel

๐Ÿ›
Stephen

๐Ÿ› -
Stephen Friedrich

๐Ÿ› +
Stephen Friedrich

๐Ÿ›
Steve Babula

๐Ÿ’ป
Stexxe

๐Ÿ›
Stian Lรฅgstad

๐Ÿ›
StuartClayton5

๐Ÿ›
Supun Arunoda

๐Ÿ›
Suren Abrahamyan

๐Ÿ› -
Suvashri

๐Ÿ“– +
Suvashri

๐Ÿ“–
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

๐Ÿ›
mohan-chinnappan-n

๐Ÿ’ป
mriddell95

๐Ÿ› -
mrlzh

๐Ÿ› +
mrlzh

๐Ÿ›
msloan

๐Ÿ›
mucharlaravalika

๐Ÿ›
mvenneman

๐Ÿ›
nareshl119

๐Ÿ›
nicolas-harraudeau-sonarsource

๐Ÿ›
noerremark

๐Ÿ› -
novsirion

๐Ÿ› +
novsirion

๐Ÿ›
oggboy

๐Ÿ›
oinume

๐Ÿ›
orimarko

๐Ÿ’ป ๐Ÿ›
pacvz

๐Ÿ’ป
pallavi agarwal

๐Ÿ›
parksungrin

๐Ÿ› -
patpatpat123

๐Ÿ› +
patpatpat123

๐Ÿ›
patriksevallius

๐Ÿ›
pbrajesh1

๐Ÿ›
phoenix384

๐Ÿ›
piotrszymanski-sc

๐Ÿ’ป
plan3d

๐Ÿ›
poojasix

๐Ÿ› -
prabhushrikant

๐Ÿ› +
prabhushrikant

๐Ÿ›
pujitha8783

๐Ÿ›
r-r-a-j

๐Ÿ›
raghujayjunk

๐Ÿ›
rajeshveera

๐Ÿ›
rajeswarreddy88

๐Ÿ›
recdevs

๐Ÿ› -
reudismam

๐Ÿ’ป ๐Ÿ› +
reudismam

๐Ÿ’ป ๐Ÿ›
rijkt

๐Ÿ›
rillig-tk

๐Ÿ›
rmohan20

๐Ÿ’ป ๐Ÿ›
rxmicro

๐Ÿ›
ryan-gustafson

๐Ÿ’ป ๐Ÿ›
sabi0

๐Ÿ› -
scais

๐Ÿ› +
scais

๐Ÿ›
sebbASF

๐Ÿ›
sergeygorbaty

๐Ÿ’ป
shilko2013

๐Ÿ›
shiomiyan

๐Ÿ“–
simeonKondr

๐Ÿ›
snajberk

๐Ÿ› -
sniperrifle2004

๐Ÿ› +
sniperrifle2004

๐Ÿ›
snuyanzin

๐Ÿ› ๐Ÿ’ป
sratz

๐Ÿ›
stonio

๐Ÿ›
sturton

๐Ÿ’ป ๐Ÿ›
sudharmohan

๐Ÿ›
suruchidawar

๐Ÿ› -
svenfinitiv

๐Ÿ› +
svenfinitiv

๐Ÿ›
tashiscool

๐Ÿ›
test-git-hook

๐Ÿ›
testation21

๐Ÿ’ป ๐Ÿ›
thanosa

๐Ÿ›
tiandiyixian

๐Ÿ›
tobwoerk

๐Ÿ› -
tprouvot

๐Ÿ› ๐Ÿ’ป +
tprouvot

๐Ÿ› ๐Ÿ’ป
trentchilders

๐Ÿ›
triandicAnt

๐Ÿ›
trishul14

๐Ÿ›
tsui

๐Ÿ›
winhkey

๐Ÿ›
witherspore

๐Ÿ› -
wjljack

๐Ÿ› +
wjljack

๐Ÿ›
wuchiuwong

๐Ÿ›
xingsong

๐Ÿ›
xioayuge

๐Ÿ›
xnYi9wRezm

๐Ÿ’ป ๐Ÿ›
xuanuy

๐Ÿ›
xyf0921

๐Ÿ› -
yalechen-cyw3

๐Ÿ› +
yalechen-cyw3

๐Ÿ›
yasuharu-sato

๐Ÿ›
zenglian

๐Ÿ›
zgrzyt93

๐Ÿ’ป ๐Ÿ›
zh3ng

๐Ÿ›
zt_soft

๐Ÿ›
ztt79

๐Ÿ› -
zzzzfeng

๐Ÿ› +
zzzzfeng

๐Ÿ›
รrpรกd Magosรกnyi

๐Ÿ›
ไปป่ดตๆฐ

๐Ÿ›
่Œ…ๅปถๅฎ‰

๐Ÿ’ป diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 364ff7c856..69dc9614ba 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -28,6 +28,12 @@ from Lua. This means, that the Lua language in PMD can now parse both Lua and Lu * CPD now supports the `--ignore-literal-sequences` argument when analyzing Lua code. +### Financial Contributions + +Many thanks to our sponsors: + +* [Oliver Siegmar](https://github.com/osiegmar) (@osiegmar) + ### External Contributions * [#4066](https://github.com/pmd/pmd/pull/4066): \[lua] Add support for Luau syntax and skipping literal sequences in CPD - [@matthargett](https://github.com/matthargett) * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Fix missing --file arg in TreeExport CLI example - [@mohan-chinnappan-n](https://github.com/mohan-chinnappan-n) From 560a9a078184877536de04106385a32f92538542 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Sep 2022 16:05:43 +0200 Subject: [PATCH 71/96] [doc] Update release notes --- docs/pages/release_notes.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 69dc9614ba..809984dc8f 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -20,7 +20,8 @@ This release of PMD adds support for [Luau](https://github.com/Roblox/luau), a g from Lua. This means, that the Lua language in PMD can now parse both Lua and Luau. ### Fixed Issues -* [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Missing --file arg in TreeExport CLI example +* core + * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Missing --file arg in TreeExport CLI example ### API Changes @@ -35,9 +36,9 @@ Many thanks to our sponsors: * [Oliver Siegmar](https://github.com/osiegmar) (@osiegmar) ### External Contributions -* [#4066](https://github.com/pmd/pmd/pull/4066): \[lua] Add support for Luau syntax and skipping literal sequences in CPD - [@matthargett](https://github.com/matthargett) -* [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Fix missing --file arg in TreeExport CLI example - [@mohan-chinnappan-n](https://github.com/mohan-chinnappan-n) -* [#4131](https://github.com/pmd/pmd/pull/4131): \[doc] TooFewBranchesForASwitchStatement - Use "if-else" instead of "if-then" - [@Suvashri](https://github.com/Suvashri) +* [#4066](https://github.com/pmd/pmd/pull/4066): \[lua] Add support for Luau syntax and skipping literal sequences in CPD - [Matt Hargett](https://github.com/matthargett) (@matthargett) +* [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Fix missing --file arg in TreeExport CLI example - [mohan-chinnappan-n](https://github.com/mohan-chinnappan-n) (@mohan-chinnappan-n) +* [#4131](https://github.com/pmd/pmd/pull/4131): \[doc] TooFewBranchesForASwitchStatement - Use "if-else" instead of "if-then" - [Suvashri](https://github.com/Suvashri) (@Suvashri) {% endtocmaker %} From fe1222abfe5034d59b76429b80d410b2a1959fc0 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Sep 2022 16:08:08 +0200 Subject: [PATCH 72/96] [doc] Update release notes (#4109) --- docs/pages/release_notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index b8f8783555..cafacaa10e 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -15,6 +15,8 @@ This is a {{ site.pmd.release_type }} release. ### New and noteworthy ### Fixed Issues +* doc + * [#4109](https://github.com/pmd/pmd/pull/4109): \[doc] Add page for 3rd party rulesets ### API Changes From 00201ae9f7447e61b6c724f03455c8bb794ff09a Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Sep 2022 16:13:07 +0200 Subject: [PATCH 73/96] Update @pzygielo 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 3120c1af00..3fedd6a198 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -492,7 +492,8 @@ "profile": "https://github.com/pzygielo", "contributions": [ "code", - "bug" + "bug", + "doc" ] }, { diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index 53a6336d25..34ff789e94 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -568,7 +568,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Phinehas Artemix

๐Ÿ›
Phokham Nonava

๐Ÿ›
Piotr Szymaล„ski

๐Ÿ› -
Piotrek ลปygieล‚o

๐Ÿ’ป ๐Ÿ› +
Piotrek ลปygieล‚o

๐Ÿ’ป ๐Ÿ› ๐Ÿ“–
Pranay Jaiswal

๐Ÿ› From cb85a01a88548f85bd29d24189eacc655b392a65 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Sep 2022 16:13:41 +0200 Subject: [PATCH 74/96] [doc] Update release notes (#4124) --- 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 84d0bc0712..66a2088ece 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -16,11 +16,14 @@ This is a {{ site.pmd.release_type }} release. ### Fixed Issues * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Missing --file arg in TreeExport CLI example +* doc + * [#4124](https://github.com/pmd/pmd/pull/4124): \[doc] Fix typos in Java rule docs ### API Changes ### External Contributions * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Fix missing --file arg in TreeExport CLI example - [@mohan-chinnappan-n](https://github.com/mohan-chinnappan-n) +* [#4124](https://github.com/pmd/pmd/pull/4124) : \[doc] Fix typos in Java rule docs - [Piotrek ลปygieล‚o](https://github.com/pzygielo) (@pzygielo) {% endtocmaker %} From 491e8bec6ce72ecb91801d50e1537dd84b80ddff Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Sep 2022 16:21:02 +0200 Subject: [PATCH 75/96] Add @OlegAndreych as a contributor --- .all-contributorsrc | 9 +++ docs/pages/pmd/projectdocs/credits.md | 99 ++++++++++++++------------- 2 files changed, 59 insertions(+), 49 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 3120c1af00..5d3b45de5c 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -6816,6 +6816,15 @@ "contributions": [ "code" ] + }, + { + "login": "OlegAndreych", + "name": "Oleg Andreych", + "avatar_url": "https://avatars.githubusercontent.com/u/2041351?v=4", + "profile": "https://github.com/OlegAndreych", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index 53a6336d25..a5e8b64c45 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -530,444 +530,445 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Noam Tamim

๐Ÿ›
Noel Grandin

๐Ÿ›
Olaf Haalstra

๐Ÿ› +
Oleg Andreych

๐Ÿ’ป
Oleg Pavlenko

๐Ÿ›
Oleksii Dykov

๐Ÿ’ป
Oliver Eikemeier

๐Ÿ› -
Olivier Parent

๐Ÿ’ป ๐Ÿ› +
Olivier Parent

๐Ÿ’ป ๐Ÿ›
Ollie Abbey

๐Ÿ’ป ๐Ÿ›
OverDrone

๐Ÿ›
Ozan Gulle

๐Ÿ’ป ๐Ÿ›
PUNEET JAIN

๐Ÿ›
Parbati Bose

๐Ÿ›
Paul Berg

๐Ÿ› -
Pavel Bludov

๐Ÿ› +
Pavel Bludov

๐Ÿ›
Pavel Miฤka

๐Ÿ›
Pedro Nuno Santos

๐Ÿ›
Pedro Rijo

๐Ÿ›
Pelisse Romain

๐Ÿ’ป ๐Ÿ“– ๐Ÿ›
Per Abich

๐Ÿ’ป
Pete Davids

๐Ÿ› -
Peter Bruin

๐Ÿ› +
Peter Bruin

๐Ÿ›
Peter Chittum

๐Ÿ’ป ๐Ÿ›
Peter Cudmore

๐Ÿ›
Peter Kasson

๐Ÿ›
Peter Kofler

๐Ÿ›
Peter Paul Bakker

๐Ÿ’ป
Pham Hai Trung

๐Ÿ› -
Philip Graf

๐Ÿ’ป ๐Ÿ› +
Philip Graf

๐Ÿ’ป ๐Ÿ›
Philip Hachey

๐Ÿ›
Philippe Ozil

๐Ÿ›
Phinehas Artemix

๐Ÿ›
Phokham Nonava

๐Ÿ›
Piotr Szymaล„ski

๐Ÿ›
Piotrek ลปygieล‚o

๐Ÿ’ป ๐Ÿ› -
Pranay Jaiswal

๐Ÿ› +
Pranay Jaiswal

๐Ÿ›
Prasad Kamath

๐Ÿ›
Prasanna

๐Ÿ›
Presh-AR

๐Ÿ›
Puneet1726

๐Ÿ›
Rafael Cortรชs

๐Ÿ›
RaheemShaik999

๐Ÿ› -
RajeshR

๐Ÿ’ป ๐Ÿ› +
RajeshR

๐Ÿ’ป ๐Ÿ›
Ramachandra Mohan

๐Ÿ›
Ramel0921

๐Ÿ›
Raquel Pau

๐Ÿ›
Ravikiran Janardhana

๐Ÿ›
Reda Benhemmouche

๐Ÿ›
Renato Oliveira

๐Ÿ’ป ๐Ÿ› -
Rich DiCroce

๐Ÿ› +
Rich DiCroce

๐Ÿ›
Riot R1cket

๐Ÿ›
Rishabh Jain

๐Ÿ›
RishabhDeep Singh

๐Ÿ›
Robbie Martinus

๐Ÿ’ป ๐Ÿ›
Robert Henry

๐Ÿ›
Robert Painsi

๐Ÿ› -
Robert Russell

๐Ÿ› +
Robert Russell

๐Ÿ›
Robert Sรถsemann

๐Ÿ’ป ๐Ÿ“– ๐Ÿ“ข ๐Ÿ›
Robert Whitebit

๐Ÿ›
Robin Richtsfeld

๐Ÿ›
Robin Stocker

๐Ÿ’ป ๐Ÿ›
Robin Wils

๐Ÿ›
RochusOest

๐Ÿ› -
Rodolfo Noviski

๐Ÿ› +
Rodolfo Noviski

๐Ÿ›
Rodrigo Casara

๐Ÿ›
Rodrigo Fernandes

๐Ÿ›
Roman Salvador

๐Ÿ’ป ๐Ÿ›
Ronald Blaschke

๐Ÿ›
Rรณbert Papp

๐Ÿ›
Saikat Sengupta

๐Ÿ› -
Saksham Handu

๐Ÿ› +
Saksham Handu

๐Ÿ›
Saladoc

๐Ÿ›
Salesforce Bob Lightning

๐Ÿ›
Sam Carlberg

๐Ÿ›
Satoshi Kubo

๐Ÿ›
Scott Kennedy

๐Ÿ›
Scott Wells

๐Ÿ› ๐Ÿ’ป -
Scrsloota

๐Ÿ’ป +
Scrsloota

๐Ÿ’ป
Sebastian Bรถgl

๐Ÿ›
Sebastian Schuberth

๐Ÿ›
Sebastian Schwarz

๐Ÿ›
Sergey Gorbaty

๐Ÿ›
Sergey Kozlov

๐Ÿ›
Sergey Yanzin

๐Ÿ’ป ๐Ÿ› -
Seth Wilcox

๐Ÿ’ป +
Seth Wilcox

๐Ÿ’ป
Shubham

๐Ÿ’ป ๐Ÿ›
Simon Abykov

๐Ÿ’ป
Simon Xiao

๐Ÿ›
Srinivasan Venkatachalam

๐Ÿ›
Stanislav Gromov

๐Ÿ›
Stanislav Myachenkov

๐Ÿ’ป -
Stefan Birkner

๐Ÿ› +
Stefan Birkner

๐Ÿ›
Stefan Bohn

๐Ÿ›
Stefan Endrullis

๐Ÿ›
Stefan Klรถss-Schuster

๐Ÿ›
Stefan Wolf

๐Ÿ›
Stephan H. Wissel

๐Ÿ›
Stephen

๐Ÿ› -
Stephen Friedrich

๐Ÿ› +
Stephen Friedrich

๐Ÿ›
Steve Babula

๐Ÿ’ป
Stexxe

๐Ÿ›
Stian Lรฅgstad

๐Ÿ›
StuartClayton5

๐Ÿ›
Supun Arunoda

๐Ÿ›
Suren Abrahamyan

๐Ÿ› -
SwatiBGupta1110

๐Ÿ› +
SwatiBGupta1110

๐Ÿ›
SyedThoufich

๐Ÿ›
Szymon Sasin

๐Ÿ›
T-chuangxin

๐Ÿ›
TERAI Atsuhiro

๐Ÿ›
TIOBE Software

๐Ÿ’ป ๐Ÿ›
Taylor Smock

๐Ÿ› -
Techeira Damiรกn

๐Ÿ’ป ๐Ÿ› +
Techeira Damiรกn

๐Ÿ’ป ๐Ÿ›
Ted Husted

๐Ÿ›
TehBakker

๐Ÿ›
The Gitter Badger

๐Ÿ›
Theodoor

๐Ÿ›
Thiago Henrique Hรผpner

๐Ÿ›
Thibault Meyer

๐Ÿ› -
Thomas Gรผttler

๐Ÿ› +
Thomas Gรผttler

๐Ÿ›
Thomas Jones-Low

๐Ÿ›
Thomas Smith

๐Ÿ’ป ๐Ÿ›
ThrawnCA

๐Ÿ›
Thunderforge

๐Ÿ’ป ๐Ÿ›
Tim van der Lippe

๐Ÿ›
Tobias Weimer

๐Ÿ’ป ๐Ÿ› -
Tom Daly

๐Ÿ› +
Tom Daly

๐Ÿ›
Tomer Figenblat

๐Ÿ›
Tomi De Lucca

๐Ÿ’ป ๐Ÿ›
Torsten Kleiber

๐Ÿ›
TrackerSB

๐Ÿ›
Ullrich Hafner

๐Ÿ›
Utku Cuhadaroglu

๐Ÿ’ป ๐Ÿ› -
Valentin Brandl

๐Ÿ› +
Valentin Brandl

๐Ÿ›
Valeria

๐Ÿ›
Vasily Anisimov

๐Ÿ›
Vibhor Goyal

๐Ÿ›
Vickenty Fesunov

๐Ÿ›
Victor Noรซl

๐Ÿ›
Vincent Galloy

๐Ÿ’ป -
Vincent HUYNH

๐Ÿ› +
Vincent HUYNH

๐Ÿ›
Vincent Maurin

๐Ÿ›
Vincent Privat

๐Ÿ›
Vishhwas

๐Ÿ›
Vitaly

๐Ÿ›
Vitaly Polonetsky

๐Ÿ›
Vojtech Polivka

๐Ÿ› -
Vsevolod Zholobov

๐Ÿ› +
Vsevolod Zholobov

๐Ÿ›
Vyom Yadav

๐Ÿ’ป
Wang Shidong

๐Ÿ›
Waqas Ahmed

๐Ÿ›
Wayne J. Earl

๐Ÿ›
Wchenghui

๐Ÿ›
Will Winder

๐Ÿ› -
William Brockhus

๐Ÿ’ป ๐Ÿ› +
William Brockhus

๐Ÿ’ป ๐Ÿ›
Wilson Kurniawan

๐Ÿ›
Wim Deblauwe

๐Ÿ›
Woongsik Choi

๐Ÿ›
XenoAmess

๐Ÿ’ป ๐Ÿ›
Yang

๐Ÿ’ป
YaroslavTER

๐Ÿ› -
Young Chan

๐Ÿ’ป ๐Ÿ› +
Young Chan

๐Ÿ’ป ๐Ÿ›
YuJin Kim

๐Ÿ›
Yuri Dolzhenko

๐Ÿ›
Yurii Dubinka

๐Ÿ›
Zoltan Farkas

๐Ÿ›
Zustin

๐Ÿ›
aaronhurst-google

๐Ÿ› ๐Ÿ’ป -
alexmodis

๐Ÿ› +
alexmodis

๐Ÿ›
andreoss

๐Ÿ›
andrey81inmd

๐Ÿ’ป ๐Ÿ›
anicoara

๐Ÿ›
arunprasathav

๐Ÿ›
asiercamara

๐Ÿ›
astillich-igniti

๐Ÿ’ป -
avesolovksyy

๐Ÿ› +
avesolovksyy

๐Ÿ›
avishvat

๐Ÿ›
avivmu

๐Ÿ›
axelbarfod1

๐Ÿ›
b-3-n

๐Ÿ›
balbhadra9

๐Ÿ›
base23de

๐Ÿ› -
bergander

๐Ÿ› +
bergander

๐Ÿ›
berkam

๐Ÿ’ป ๐Ÿ›
breizh31

๐Ÿ›
caesarkim

๐Ÿ›
carolyujing

๐Ÿ›
cesares-basilico

๐Ÿ›
chrite

๐Ÿ› -
cobratbq

๐Ÿ› +
cobratbq

๐Ÿ›
coladict

๐Ÿ›
cosmoJFH

๐Ÿ›
cristalp

๐Ÿ›
crunsk

๐Ÿ›
cwholmes

๐Ÿ›
cyberjj999

๐Ÿ› -
cyw3

๐Ÿ› +
cyw3

๐Ÿ›
d1ss0nanz

๐Ÿ›
dalizi007

๐Ÿ’ป
danbrycefairsailcom

๐Ÿ›
dariansanity

๐Ÿ›
darrenmiliband

๐Ÿ›
davidburstrom

๐Ÿ› -
dbirkman-paloalto

๐Ÿ› +
dbirkman-paloalto

๐Ÿ›
deepak-patra

๐Ÿ›
dependabot[bot]

๐Ÿ’ป ๐Ÿ›
dinesh150

๐Ÿ›
diziaq

๐Ÿ›
dreaminpast123

๐Ÿ›
duanyanan

๐Ÿ› -
dutt-sanjay

๐Ÿ› +
dutt-sanjay

๐Ÿ›
dylanleung

๐Ÿ›
dzeigler

๐Ÿ›
ekkirala

๐Ÿ›
emersonmoura

๐Ÿ›
fairy

๐Ÿ›
filiprafalowicz

๐Ÿ’ป -
foxmason

๐Ÿ› +
foxmason

๐Ÿ›
frankegabor

๐Ÿ›
frankl

๐Ÿ›
freafrea

๐Ÿ›
fsapatin

๐Ÿ›
gracia19

๐Ÿ›
guo fei

๐Ÿ› -
gurmsc5

๐Ÿ› +
gurmsc5

๐Ÿ›
gwilymatgearset

๐Ÿ’ป ๐Ÿ›
haigsn

๐Ÿ›
hemanshu070

๐Ÿ›
henrik242

๐Ÿ›
hongpuwu

๐Ÿ›
hvbtup

๐Ÿ’ป ๐Ÿ› -
igniti GmbH

๐Ÿ› +
igniti GmbH

๐Ÿ›
ilovezfs

๐Ÿ›
itaigilo

๐Ÿ›
jakivey32

๐Ÿ›
jbennett2091

๐Ÿ›
jcamerin

๐Ÿ›
jkeener1

๐Ÿ› -
jmetertea

๐Ÿ› +
jmetertea

๐Ÿ›
johnra2

๐Ÿ’ป
josemanuelrolon

๐Ÿ’ป ๐Ÿ›
kabroxiko

๐Ÿ’ป ๐Ÿ›
karwer

๐Ÿ›
kaulonline

๐Ÿ›
kdaemonv

๐Ÿ› -
kenji21

๐Ÿ’ป ๐Ÿ› +
kenji21

๐Ÿ’ป ๐Ÿ›
kfranic

๐Ÿ›
khalidkh

๐Ÿ›
krzyk

๐Ÿ›
lasselindqvist

๐Ÿ›
lgemeinhardt

๐Ÿ›
lihuaib

๐Ÿ› -
lonelyma1021

๐Ÿ› +
lonelyma1021

๐Ÿ›
lpeddy

๐Ÿ›
lujiefsi

๐Ÿ’ป
lukelukes

๐Ÿ’ป
lyriccoder

๐Ÿ›
marcelmore

๐Ÿ›
matchbox

๐Ÿ› -
matthiaskraaz

๐Ÿ› +
matthiaskraaz

๐Ÿ›
meandonlyme

๐Ÿ›
mikesive

๐Ÿ›
milossesic

๐Ÿ›
mohan-chinnappan-n

๐Ÿ’ป
mriddell95

๐Ÿ›
mrlzh

๐Ÿ› -
msloan

๐Ÿ› +
msloan

๐Ÿ›
mucharlaravalika

๐Ÿ›
mvenneman

๐Ÿ›
nareshl119

๐Ÿ›
nicolas-harraudeau-sonarsource

๐Ÿ›
noerremark

๐Ÿ›
novsirion

๐Ÿ› -
oggboy

๐Ÿ› +
oggboy

๐Ÿ›
oinume

๐Ÿ›
orimarko

๐Ÿ’ป ๐Ÿ›
pacvz

๐Ÿ’ป
pallavi agarwal

๐Ÿ›
parksungrin

๐Ÿ›
patpatpat123

๐Ÿ› -
patriksevallius

๐Ÿ› +
patriksevallius

๐Ÿ›
pbrajesh1

๐Ÿ›
phoenix384

๐Ÿ›
piotrszymanski-sc

๐Ÿ’ป
plan3d

๐Ÿ›
poojasix

๐Ÿ›
prabhushrikant

๐Ÿ› -
pujitha8783

๐Ÿ› +
pujitha8783

๐Ÿ›
r-r-a-j

๐Ÿ›
raghujayjunk

๐Ÿ›
rajeshveera

๐Ÿ›
rajeswarreddy88

๐Ÿ›
recdevs

๐Ÿ›
reudismam

๐Ÿ’ป ๐Ÿ› -
rijkt

๐Ÿ› +
rijkt

๐Ÿ›
rillig-tk

๐Ÿ›
rmohan20

๐Ÿ’ป ๐Ÿ›
rxmicro

๐Ÿ›
ryan-gustafson

๐Ÿ’ป ๐Ÿ›
sabi0

๐Ÿ›
scais

๐Ÿ› -
sebbASF

๐Ÿ› +
sebbASF

๐Ÿ›
sergeygorbaty

๐Ÿ’ป
shilko2013

๐Ÿ›
shiomiyan

๐Ÿ“–
simeonKondr

๐Ÿ›
snajberk

๐Ÿ›
sniperrifle2004

๐Ÿ› -
snuyanzin

๐Ÿ› ๐Ÿ’ป +
snuyanzin

๐Ÿ› ๐Ÿ’ป
sratz

๐Ÿ›
stonio

๐Ÿ›
sturton

๐Ÿ’ป ๐Ÿ›
sudharmohan

๐Ÿ›
suruchidawar

๐Ÿ›
svenfinitiv

๐Ÿ› -
tashiscool

๐Ÿ› +
tashiscool

๐Ÿ›
test-git-hook

๐Ÿ›
testation21

๐Ÿ’ป ๐Ÿ›
thanosa

๐Ÿ›
tiandiyixian

๐Ÿ›
tobwoerk

๐Ÿ›
tprouvot

๐Ÿ› ๐Ÿ’ป -
trentchilders

๐Ÿ› +
trentchilders

๐Ÿ›
triandicAnt

๐Ÿ›
trishul14

๐Ÿ›
tsui

๐Ÿ›
winhkey

๐Ÿ›
witherspore

๐Ÿ›
wjljack

๐Ÿ› -
wuchiuwong

๐Ÿ› +
wuchiuwong

๐Ÿ›
xingsong

๐Ÿ›
xioayuge

๐Ÿ›
xnYi9wRezm

๐Ÿ’ป ๐Ÿ›
xuanuy

๐Ÿ›
xyf0921

๐Ÿ›
yalechen-cyw3

๐Ÿ› -
yasuharu-sato

๐Ÿ› +
yasuharu-sato

๐Ÿ›
zenglian

๐Ÿ›
zgrzyt93

๐Ÿ’ป ๐Ÿ›
zh3ng

๐Ÿ›
zt_soft

๐Ÿ›
ztt79

๐Ÿ›
zzzzfeng

๐Ÿ› -
รrpรกd Magosรกnyi

๐Ÿ› +
รrpรกd Magosรกnyi

๐Ÿ›
ไปป่ดตๆฐ

๐Ÿ›
่Œ…ๅปถๅฎ‰

๐Ÿ’ป From 94d343e63bfd93f89a58c72f3f557014f68b9c3d Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Sep 2022 16:21:32 +0200 Subject: [PATCH 76/96] [doc] Update release notes (#4085, #4128) --- 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 84d0bc0712..f966f06180 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -16,11 +16,14 @@ This is a {{ site.pmd.release_type }} release. ### Fixed Issues * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Missing --file arg in TreeExport CLI example +* java-codestyle + * [#4085](https://github.com/pmd/pmd/issues/4085): \[java] UnnecessaryFullyQualifiedName false positive when nested and non-nested classes with the same name and in the same package are used together ### API Changes ### External Contributions * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Fix missing --file arg in TreeExport CLI example - [@mohan-chinnappan-n](https://github.com/mohan-chinnappan-n) +* [#4128](https://github.com/pmd/pmd/pull/4128): \[java] Fix False-positive UnnecessaryFullyQualifiedName when nested and non-nestโ€ฆ #4103 - [Oleg Andreych](https://github.com/OlegAndreych) (@OlegAndreych) {% endtocmaker %} From ec97933e9954ddedb5fad99f3a74846c209b51cc Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Sep 2022 16:28:09 +0200 Subject: [PATCH 77/96] Remove old comment --- .../rule/codestyle/CommentDefaultAccessModifierRule.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/CommentDefaultAccessModifierRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/CommentDefaultAccessModifierRule.java index f859d2d6f5..f6f9fb0fbc 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/CommentDefaultAccessModifierRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/CommentDefaultAccessModifierRule.java @@ -81,11 +81,6 @@ public class CommentDefaultAccessModifierRule extends AbstractIgnoredAnnotationR return super.visit(node, data); } - /* - * The method determines is the method needs to be included in the violations report - * Also, the code needs to check that the method is not a Test from junit5 - * to avoid conflicts with JUnit5TestShouldBePackagePrivate - */ @Override public Object visit(final ASTMethodDeclaration decl, final Object data) { if (shouldReport(decl)) { From 38955b5c8d5967ef1e5e483bc5c0188641c3c338 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Sep 2022 16:28:43 +0200 Subject: [PATCH 78/96] Add @lfalcantar as a contributor --- .all-contributorsrc | 9 ++ docs/pages/pmd/projectdocs/credits.md | 123 +++++++++++++------------- 2 files changed, 71 insertions(+), 61 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index e29348424c..13290459cc 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -6825,6 +6825,15 @@ "contributions": [ "doc" ] + }, + { + "login": "lfalcantar", + "name": "Luis Alcantar", + "avatar_url": "https://avatars.githubusercontent.com/u/13026131?v=4", + "profile": "https://github.com/lfalcantar", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index 9f1604b29a..5a5d76c42a 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -419,555 +419,556 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Lucas Soncini

๐Ÿ’ป ๐Ÿ› +
Luis Alcantar

๐Ÿ’ป
Lukasz Slonina

๐Ÿ›
Lukebray

๐Ÿ›
Lyor Goldstein

๐Ÿ›
MCMicS

๐Ÿ›
Macarse

๐Ÿ›
Machine account for PMD

๐Ÿ’ป -
Maciek Siemczyk

๐Ÿ› +
Maciek Siemczyk

๐Ÿ›
Maikel Steneker

๐Ÿ’ป ๐Ÿ›
Maksim Moiseikin

๐Ÿ›
Manfred Koch

๐Ÿ›
Manuel Moya Ferrer

๐Ÿ’ป ๐Ÿ›
Manuel Ryan

๐Ÿ›
Marat Vyshegorodtsev

๐Ÿ› -
Marcel Hรคrle

๐Ÿ› +
Marcel Hรคrle

๐Ÿ›
Marcello Fialho

๐Ÿ›
Marcin Rataj

๐Ÿ›
Mark Adamcin

๐Ÿ›
Mark Hall

๐Ÿ’ป ๐Ÿ›
Mark Kolich

๐Ÿ›
Mark Pritchard

๐Ÿ› -
Markus Rathgeb

๐Ÿ› +
Markus Rathgeb

๐Ÿ›
Marquis Wang

๐Ÿ›
Martin Feldsztejn

๐Ÿ›
Martin Lehmann

๐Ÿ›
Martin Spamer

๐Ÿ›
Martin Tarjรกnyi

๐Ÿ›
MatFl

๐Ÿ› -
Mateusz Stefanski

๐Ÿ› +
Mateusz Stefanski

๐Ÿ›
Mathieu Gouin

๐Ÿ›
MatiasComercio

๐Ÿ’ป ๐Ÿ›
Matt Benson

๐Ÿ›
Matt De Poorter

๐Ÿ›
Matt Hargett

๐Ÿ’ป ๐Ÿ’ต
Matt Harrah

๐Ÿ› -
Matt Nelson

๐Ÿ› +
Matt Nelson

๐Ÿ›
Matthew Amos

๐Ÿ›
Matthew Duggan

๐Ÿ›
Matthew Hall

๐Ÿ›
Matรญas Fraga

๐Ÿ’ป ๐Ÿ›
Maxime Robert

๐Ÿ’ป ๐Ÿ›
MetaBF

๐Ÿ› -
Michael

๐Ÿ› +
Michael

๐Ÿ›
Michael Bell

๐Ÿ›
Michael Bernstein

๐Ÿ›
Michael Clay

๐Ÿ›
Michael Dombrowski

๐Ÿ›
Michael Hausegger

๐Ÿ›
Michael Hoefer

๐Ÿ› -
Michael Mรถbius

๐Ÿ› +
Michael Mรถbius

๐Ÿ›
Michael N. Lipp

๐Ÿ›
Michael Pellegrini

๐Ÿ›
Michal Kordas

๐Ÿ›
Michaล‚ Borek

๐Ÿ›
Michaล‚ Kuliล„ski

๐Ÿ›
Miguel Nรบรฑez Dรญaz-Montes

๐Ÿ› -
Mihai Ionut

๐Ÿ› +
Mihai Ionut

๐Ÿ›
Mirek Hankus

๐Ÿ›
Mladjan Gadzic

๐Ÿ›
MrAngry52

๐Ÿ›
Muminur Choudhury

๐Ÿ›
Mykhailo Palahuta

๐Ÿ’ป ๐Ÿ›
Nagendra Kumar Singh

๐Ÿ› -
Nahuel Barrios

๐Ÿ› +
Nahuel Barrios

๐Ÿ›
Nathan Braun

๐Ÿ›
Nathan Reynolds

๐Ÿ›
Nathan Reynolds

๐Ÿ›
Nathanaรซl

๐Ÿ›
Naveen

๐Ÿ’ป
Nazdravi

๐Ÿ› -
Neha-Dhonde

๐Ÿ› +
Neha-Dhonde

๐Ÿ›
Nicholas Doyle

๐Ÿ›
Nick Butcher

๐Ÿ›
Nico Gallinal

๐Ÿ›
Nicola Dal Maso

๐Ÿ›
Nicolas Filotto

๐Ÿ’ป
Nicolas Vuillamy

๐Ÿ“– -
Nikita Chursin

๐Ÿ› +
Nikita Chursin

๐Ÿ›
Niklas Baudy

๐Ÿ›
Nikolas Havrikov

๐Ÿ›
Nilesh Virkar

๐Ÿ›
Nimit Patel

๐Ÿ›
Niranjan Harpale

๐Ÿ›
Noah Sussman

๐Ÿ› -
Noah0120

๐Ÿ› +
Noah0120

๐Ÿ›
Noam Tamim

๐Ÿ›
Noel Grandin

๐Ÿ›
Olaf Haalstra

๐Ÿ›
Oleg Pavlenko

๐Ÿ›
Oleksii Dykov

๐Ÿ’ป
Oliver Eikemeier

๐Ÿ› -
Olivier Parent

๐Ÿ’ป ๐Ÿ› +
Olivier Parent

๐Ÿ’ป ๐Ÿ›
Ollie Abbey

๐Ÿ’ป ๐Ÿ›
OverDrone

๐Ÿ›
Ozan Gulle

๐Ÿ’ป ๐Ÿ›
PUNEET JAIN

๐Ÿ›
Parbati Bose

๐Ÿ›
Paul Berg

๐Ÿ› -
Pavel Bludov

๐Ÿ› +
Pavel Bludov

๐Ÿ›
Pavel Miฤka

๐Ÿ›
Pedro Nuno Santos

๐Ÿ›
Pedro Rijo

๐Ÿ›
Pelisse Romain

๐Ÿ’ป ๐Ÿ“– ๐Ÿ›
Per Abich

๐Ÿ’ป
Pete Davids

๐Ÿ› -
Peter Bruin

๐Ÿ› +
Peter Bruin

๐Ÿ›
Peter Chittum

๐Ÿ’ป ๐Ÿ›
Peter Cudmore

๐Ÿ›
Peter Kasson

๐Ÿ›
Peter Kofler

๐Ÿ›
Peter Paul Bakker

๐Ÿ’ป
Pham Hai Trung

๐Ÿ› -
Philip Graf

๐Ÿ’ป ๐Ÿ› +
Philip Graf

๐Ÿ’ป ๐Ÿ›
Philip Hachey

๐Ÿ›
Philippe Ozil

๐Ÿ›
Phinehas Artemix

๐Ÿ›
Phokham Nonava

๐Ÿ›
Piotr Szymaล„ski

๐Ÿ›
Piotrek ลปygieล‚o

๐Ÿ’ป ๐Ÿ› -
Pranay Jaiswal

๐Ÿ› +
Pranay Jaiswal

๐Ÿ›
Prasad Kamath

๐Ÿ›
Prasanna

๐Ÿ›
Presh-AR

๐Ÿ›
Puneet1726

๐Ÿ›
Rafael Cortรชs

๐Ÿ›
RaheemShaik999

๐Ÿ› -
RajeshR

๐Ÿ’ป ๐Ÿ› +
RajeshR

๐Ÿ’ป ๐Ÿ›
Ramachandra Mohan

๐Ÿ›
Ramel0921

๐Ÿ›
Raquel Pau

๐Ÿ›
Ravikiran Janardhana

๐Ÿ›
Reda Benhemmouche

๐Ÿ›
Renato Oliveira

๐Ÿ’ป ๐Ÿ› -
Rich DiCroce

๐Ÿ› +
Rich DiCroce

๐Ÿ›
Riot R1cket

๐Ÿ›
Rishabh Jain

๐Ÿ›
RishabhDeep Singh

๐Ÿ›
Robbie Martinus

๐Ÿ’ป ๐Ÿ›
Robert Henry

๐Ÿ›
Robert Painsi

๐Ÿ› -
Robert Russell

๐Ÿ› +
Robert Russell

๐Ÿ›
Robert Sรถsemann

๐Ÿ’ป ๐Ÿ“– ๐Ÿ“ข ๐Ÿ›
Robert Whitebit

๐Ÿ›
Robin Richtsfeld

๐Ÿ›
Robin Stocker

๐Ÿ’ป ๐Ÿ›
Robin Wils

๐Ÿ›
RochusOest

๐Ÿ› -
Rodolfo Noviski

๐Ÿ› +
Rodolfo Noviski

๐Ÿ›
Rodrigo Casara

๐Ÿ›
Rodrigo Fernandes

๐Ÿ›
Roman Salvador

๐Ÿ’ป ๐Ÿ›
Ronald Blaschke

๐Ÿ›
Rรณbert Papp

๐Ÿ›
Saikat Sengupta

๐Ÿ› -
Saksham Handu

๐Ÿ› +
Saksham Handu

๐Ÿ›
Saladoc

๐Ÿ›
Salesforce Bob Lightning

๐Ÿ›
Sam Carlberg

๐Ÿ›
Satoshi Kubo

๐Ÿ›
Scott Kennedy

๐Ÿ›
Scott Wells

๐Ÿ› ๐Ÿ’ป -
Scrsloota

๐Ÿ’ป +
Scrsloota

๐Ÿ’ป
Sebastian Bรถgl

๐Ÿ›
Sebastian Schuberth

๐Ÿ›
Sebastian Schwarz

๐Ÿ›
Sergey Gorbaty

๐Ÿ›
Sergey Kozlov

๐Ÿ›
Sergey Yanzin

๐Ÿ’ป ๐Ÿ› -
Seth Wilcox

๐Ÿ’ป +
Seth Wilcox

๐Ÿ’ป
Shubham

๐Ÿ’ป ๐Ÿ›
Simon Abykov

๐Ÿ’ป
Simon Xiao

๐Ÿ›
Srinivasan Venkatachalam

๐Ÿ›
Stanislav Gromov

๐Ÿ›
Stanislav Myachenkov

๐Ÿ’ป -
Stefan Birkner

๐Ÿ› +
Stefan Birkner

๐Ÿ›
Stefan Bohn

๐Ÿ›
Stefan Endrullis

๐Ÿ›
Stefan Klรถss-Schuster

๐Ÿ›
Stefan Wolf

๐Ÿ›
Stephan H. Wissel

๐Ÿ›
Stephen

๐Ÿ› -
Stephen Friedrich

๐Ÿ› +
Stephen Friedrich

๐Ÿ›
Steve Babula

๐Ÿ’ป
Stexxe

๐Ÿ›
Stian Lรฅgstad

๐Ÿ›
StuartClayton5

๐Ÿ›
Supun Arunoda

๐Ÿ›
Suren Abrahamyan

๐Ÿ› -
Suvashri

๐Ÿ“– +
Suvashri

๐Ÿ“–
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

๐Ÿ›
mohan-chinnappan-n

๐Ÿ’ป
mriddell95

๐Ÿ› -
mrlzh

๐Ÿ› +
mrlzh

๐Ÿ›
msloan

๐Ÿ›
mucharlaravalika

๐Ÿ›
mvenneman

๐Ÿ›
nareshl119

๐Ÿ›
nicolas-harraudeau-sonarsource

๐Ÿ›
noerremark

๐Ÿ› -
novsirion

๐Ÿ› +
novsirion

๐Ÿ›
oggboy

๐Ÿ›
oinume

๐Ÿ›
orimarko

๐Ÿ’ป ๐Ÿ›
pacvz

๐Ÿ’ป
pallavi agarwal

๐Ÿ›
parksungrin

๐Ÿ› -
patpatpat123

๐Ÿ› +
patpatpat123

๐Ÿ›
patriksevallius

๐Ÿ›
pbrajesh1

๐Ÿ›
phoenix384

๐Ÿ›
piotrszymanski-sc

๐Ÿ’ป
plan3d

๐Ÿ›
poojasix

๐Ÿ› -
prabhushrikant

๐Ÿ› +
prabhushrikant

๐Ÿ›
pujitha8783

๐Ÿ›
r-r-a-j

๐Ÿ›
raghujayjunk

๐Ÿ›
rajeshveera

๐Ÿ›
rajeswarreddy88

๐Ÿ›
recdevs

๐Ÿ› -
reudismam

๐Ÿ’ป ๐Ÿ› +
reudismam

๐Ÿ’ป ๐Ÿ›
rijkt

๐Ÿ›
rillig-tk

๐Ÿ›
rmohan20

๐Ÿ’ป ๐Ÿ›
rxmicro

๐Ÿ›
ryan-gustafson

๐Ÿ’ป ๐Ÿ›
sabi0

๐Ÿ› -
scais

๐Ÿ› +
scais

๐Ÿ›
sebbASF

๐Ÿ›
sergeygorbaty

๐Ÿ’ป
shilko2013

๐Ÿ›
shiomiyan

๐Ÿ“–
simeonKondr

๐Ÿ›
snajberk

๐Ÿ› -
sniperrifle2004

๐Ÿ› +
sniperrifle2004

๐Ÿ›
snuyanzin

๐Ÿ› ๐Ÿ’ป
sratz

๐Ÿ›
stonio

๐Ÿ›
sturton

๐Ÿ’ป ๐Ÿ›
sudharmohan

๐Ÿ›
suruchidawar

๐Ÿ› -
svenfinitiv

๐Ÿ› +
svenfinitiv

๐Ÿ›
tashiscool

๐Ÿ›
test-git-hook

๐Ÿ›
testation21

๐Ÿ’ป ๐Ÿ›
thanosa

๐Ÿ›
tiandiyixian

๐Ÿ›
tobwoerk

๐Ÿ› -
tprouvot

๐Ÿ› ๐Ÿ’ป +
tprouvot

๐Ÿ› ๐Ÿ’ป
trentchilders

๐Ÿ›
triandicAnt

๐Ÿ›
trishul14

๐Ÿ›
tsui

๐Ÿ›
winhkey

๐Ÿ›
witherspore

๐Ÿ› -
wjljack

๐Ÿ› +
wjljack

๐Ÿ›
wuchiuwong

๐Ÿ›
xingsong

๐Ÿ›
xioayuge

๐Ÿ›
xnYi9wRezm

๐Ÿ’ป ๐Ÿ›
xuanuy

๐Ÿ›
xyf0921

๐Ÿ› -
yalechen-cyw3

๐Ÿ› +
yalechen-cyw3

๐Ÿ›
yasuharu-sato

๐Ÿ›
zenglian

๐Ÿ›
zgrzyt93

๐Ÿ’ป ๐Ÿ›
zh3ng

๐Ÿ›
zt_soft

๐Ÿ›
ztt79

๐Ÿ› -
zzzzfeng

๐Ÿ› +
zzzzfeng

๐Ÿ›
รrpรกd Magosรกnyi

๐Ÿ›
ไปป่ดตๆฐ

๐Ÿ›
่Œ…ๅปถๅฎ‰

๐Ÿ’ป From 9c215e97222d5a42bb5407fbc99f66640f7097b5 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Sep 2022 16:41:59 +0200 Subject: [PATCH 79/96] [doc] Update release notes --- docs/pages/release_notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index bf54e794de..2da44b2235 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -53,7 +53,7 @@ Many thanks to our sponsors: ### External Contributions * [#4066](https://github.com/pmd/pmd/pull/4066): \[lua] Add support for Luau syntax and skipping literal sequences in CPD - [Matt Hargett](https://github.com/matthargett) (@matthargett) * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Fix missing --file arg in TreeExport CLI example - [mohan-chinnappan-n](https://github.com/mohan-chinnappan-n) (@mohan-chinnappan-n) -* [#4124](https://github.com/pmd/pmd/pull/4124) : \[doc] Fix typos in Java rule docs - [Piotrek ลปygieล‚o](https://github.com/pzygielo) (@pzygielo) +* [#4124](https://github.com/pmd/pmd/pull/4124): \[doc] Fix typos in Java rule docs - [Piotrek ลปygieล‚o](https://github.com/pzygielo) (@pzygielo) * [#4128](https://github.com/pmd/pmd/pull/4128): \[java] Fix False-positive UnnecessaryFullyQualifiedName when nested and non-nestโ€ฆ #4103 - [Oleg Andreych](https://github.com/OlegAndreych) (@OlegAndreych) * [#4131](https://github.com/pmd/pmd/pull/4131): \[doc] TooFewBranchesForASwitchStatement - Use "if-else" instead of "if-then" - [Suvashri](https://github.com/Suvashri) (@Suvashri) * [#4137](https://github.com/pmd/pmd/pull/4137): \[java] Fixes 3859: Exclude junit5 test methods from the commentDefaultAccessModifierRule - [Luis Alcantar](https://github.com/lfalcantar) (@lfalcantar) From 306db99400a5c5211e5e21b4fd1b11bf9b40add9 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Sep 2022 19:12:04 +0200 Subject: [PATCH 80/96] [java] UnusedPrivateField - ignore any annotations Deprecate "ignoreAnnotations" property --- .../bestpractices/UnusedPrivateFieldRule.java | 53 +++++++++++-------- .../resources/category/java/bestpractices.xml | 4 ++ .../bestpractices/xml/UnusedPrivateField.xml | 21 ++++++-- 3 files changed, 52 insertions(+), 26 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateFieldRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateFieldRule.java index 7d89eb19c5..171ad810b8 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateFieldRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateFieldRule.java @@ -4,11 +4,14 @@ package net.sourceforge.pmd.lang.java.rule.bestpractices; +import static net.sourceforge.pmd.properties.PropertyFactory.stringListProperty; + import java.util.ArrayList; -import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.logging.Logger; +import net.sourceforge.pmd.RuleContext; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceBody; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceBodyDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration; @@ -22,7 +25,7 @@ import net.sourceforge.pmd.lang.java.ast.AbstractJavaNode; import net.sourceforge.pmd.lang.java.ast.AccessNode; import net.sourceforge.pmd.lang.java.ast.Annotatable; import net.sourceforge.pmd.lang.java.ast.JavaNode; -import net.sourceforge.pmd.lang.java.rule.AbstractLombokAwareRule; +import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule; import net.sourceforge.pmd.lang.java.symboltable.JavaNameOccurrence; import net.sourceforge.pmd.lang.java.symboltable.VariableNameDeclaration; import net.sourceforge.pmd.lang.symboltable.NameDeclaration; @@ -30,8 +33,17 @@ import net.sourceforge.pmd.lang.symboltable.NameOccurrence; import net.sourceforge.pmd.properties.PropertyDescriptor; import net.sourceforge.pmd.properties.PropertyFactory; -public class UnusedPrivateFieldRule extends AbstractLombokAwareRule { +public class UnusedPrivateFieldRule extends AbstractJavaRule { + private static final Logger LOG = Logger.getLogger(UnusedPrivateFieldRule.class.getName()); + + private static final PropertyDescriptor> IGNORED_ANNOTATIONS_DESCRIPTOR + = stringListProperty("ignoredAnnotations") + .desc("deprecated! Fully qualified names of the annotation types that should be ignored by this rule. " + + "This property has been deprecated since PMD 6.50.0 and will be completely ignored.") + .defaultValue(new ArrayList()) + .build(); + private static boolean warnedAboutDeprecatedIgnoredAnnotationsProperty = false; private static final PropertyDescriptor> IGNORED_FIELD_NAMES = PropertyFactory.stringListProperty("ignoredFieldNames") .defaultValues("serialVersionUID", "serialPersistentFields") @@ -39,32 +51,25 @@ public class UnusedPrivateFieldRule extends AbstractLombokAwareRule { .build(); public UnusedPrivateFieldRule() { + definePropertyDescriptor(IGNORED_ANNOTATIONS_DESCRIPTOR); definePropertyDescriptor(IGNORED_FIELD_NAMES); } @Override - protected Collection defaultSuppressionAnnotations() { - Collection defaultValues = new ArrayList<>(super.defaultSuppressionAnnotations()); - defaultValues.add("java.lang.Deprecated"); - defaultValues.add("javafx.fxml.FXML"); - defaultValues.add("lombok.experimental.Delegate"); - defaultValues.add("lombok.EqualsAndHashCode"); - defaultValues.add("javax.persistence.Id"); - defaultValues.add("javax.persistence.EmbeddedId"); - defaultValues.add("javax.persistence.Version"); - defaultValues.add("jakarta.persistence.Id"); - defaultValues.add("jakarta.persistence.EmbeddedId"); - defaultValues.add("jakarta.persistence.Version"); - defaultValues.add("org.mockito.Mock"); - defaultValues.add("org.mockito.Spy"); - defaultValues.add("org.springframework.boot.test.mock.mockito.MockBean"); - defaultValues.add("org.springframework.boot.test.mock.mockito.SpyBean"); - return defaultValues; + public void start(RuleContext ctx) { + super.start(ctx); + List property = getProperty(IGNORED_ANNOTATIONS_DESCRIPTOR); + if (!warnedAboutDeprecatedIgnoredAnnotationsProperty && !property.equals(IGNORED_ANNOTATIONS_DESCRIPTOR.defaultValue())) { + LOG.warning("The property '" + IGNORED_ANNOTATIONS_DESCRIPTOR.name() + "' for rule '" + + this.getName() + "' is deprecated. The value is being ignored and the property will " + + "be removed with a future PMD version."); + warnedAboutDeprecatedIgnoredAnnotationsProperty = true; + } } @Override public Object visit(ASTClassOrInterfaceDeclaration node, Object data) { - if (hasIgnoredAnnotation(node)) { + if (hasAnyAnnotation(node)) { return super.visit(node, data); } @@ -75,7 +80,7 @@ public class UnusedPrivateFieldRule extends AbstractLombokAwareRule { AccessNode accessNodeParent = decl.getAccessNodeParent(); if (!accessNodeParent.isPrivate() || isOK(decl.getImage()) - || hasIgnoredAnnotation((Annotatable) accessNodeParent)) { + || hasAnyAnnotation((Annotatable) accessNodeParent)) { continue; } if (!actuallyUsed(entry.getValue())) { @@ -87,6 +92,10 @@ public class UnusedPrivateFieldRule extends AbstractLombokAwareRule { return super.visit(node, data); } + private boolean hasAnyAnnotation(Annotatable node) { + return !node.getDeclaredAnnotations().isEmpty(); + } + private boolean usedInOuterEnum(ASTClassOrInterfaceDeclaration node, NameDeclaration decl) { List outerEnums = node.getParentsOfType(ASTEnumDeclaration.class); for (ASTEnumDeclaration outerEnum : outerEnums) { diff --git a/pmd-java/src/main/resources/category/java/bestpractices.xml b/pmd-java/src/main/resources/category/java/bestpractices.xml index 122b0e4dc7..939d4ac72a 100644 --- a/pmd-java/src/main/resources/category/java/bestpractices.xml +++ b/pmd-java/src/main/resources/category/java/bestpractices.xml @@ -1722,6 +1722,10 @@ public class Foo { externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_bestpractices.html#unusedprivatefield"> Detects when a private field is declared and/or assigned a value, but not used. + +Since PMD 6.50.0 private fields are ignored, if the fields are annotated with any annotation or the +enclosing class has any annotation. Annotations often enable a framework (such as mocking or Lombok) +which use the fields by reflection, which can't be detected by static code analysis. 3 diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateField.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateField.xml index 3b6c0af121..b4f1be83f3 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateField.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateField.xml @@ -546,7 +546,7 @@ public class Foo { #907 UnusedPrivateField false-positive with @FXML - 3 javafx.fxml.FXML - 1 + 0 #1952 [java] UnusedPrivateField not triggering if @Value annotation present - 1 - 6 + 0 #2673 UnusedPrivateField false positive with lombok annotation EqualsAndHashCode lombok.Getter|lombok.Data - 1 + 0 + + + [java] UnusedPrivateField - false positive with Lombok @ToString.Include #4033 + 0 + + From 2f2b6a2476978bf989e2e9026628a9082793489f Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 30 Sep 2022 09:23:24 +0200 Subject: [PATCH 81/96] [scala] Bump scala-library from 2.13.3 to 2.13.9 Fixes https://github.com/pmd/pmd/security/dependabot/28 Fixes https://github.com/advisories/GHSA-8qv5-68g4-248j Fixes CVE-2022-36944 --- pmd-scala-modules/pmd-scala_2.13/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-scala-modules/pmd-scala_2.13/pom.xml b/pmd-scala-modules/pmd-scala_2.13/pom.xml index ae57caed29..41597fc0d3 100644 --- a/pmd-scala-modules/pmd-scala_2.13/pom.xml +++ b/pmd-scala-modules/pmd-scala_2.13/pom.xml @@ -28,7 +28,7 @@ org.scala-lang scala-library - ${scalaVersion}.3 + ${scalaVersion}.9 org.scalameta From 167dd635ede42f19917ded56f2ce960954c77eb9 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 30 Sep 2022 09:23:54 +0200 Subject: [PATCH 82/96] [scala] Bump scala-library from 2.12.10 to 2.12.17 --- pmd-scala-modules/pmd-scala_2.12/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-scala-modules/pmd-scala_2.12/pom.xml b/pmd-scala-modules/pmd-scala_2.12/pom.xml index 9d8b80cbbd..427a4fd367 100644 --- a/pmd-scala-modules/pmd-scala_2.12/pom.xml +++ b/pmd-scala-modules/pmd-scala_2.12/pom.xml @@ -28,7 +28,7 @@ org.scala-lang scala-library - ${scalaVersion}.10 + ${scalaVersion}.17 org.scalameta From 45f3f6e5bbb4f94fd0b9b59be145319144918f4f Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 30 Sep 2022 09:24:22 +0200 Subject: [PATCH 83/96] [scala] Bump scalameta from 4.2.0 to 4.6.0 --- pmd-scala-modules/pmd-scala-common/pom.xml | 2 +- .../pmd/lang/scala/ast/testdata/package.txt | 42 ++++++++++--------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/pmd-scala-modules/pmd-scala-common/pom.xml b/pmd-scala-modules/pmd-scala-common/pom.xml index 0997d90d5d..ec947f79b0 100644 --- a/pmd-scala-modules/pmd-scala-common/pom.xml +++ b/pmd-scala-modules/pmd-scala-common/pom.xml @@ -13,7 +13,7 @@ - 4.2.0 + 4.6.0 diff --git a/pmd-scala-modules/pmd-scala-common/src/test/resources/net/sourceforge/pmd/lang/scala/ast/testdata/package.txt b/pmd-scala-modules/pmd-scala-common/src/test/resources/net/sourceforge/pmd/lang/scala/ast/testdata/package.txt index 0a5eedd4b5..fc088d5b3e 100644 --- a/pmd-scala-modules/pmd-scala-common/src/test/resources/net/sourceforge/pmd/lang/scala/ast/testdata/package.txt +++ b/pmd-scala-modules/pmd-scala-common/src/test/resources/net/sourceforge/pmd/lang/scala/ast/testdata/package.txt @@ -11,10 +11,11 @@ +- DefnType | +- TypeName | +- TypeSelect - | +- TermSelect - | | +- TermName - | | +- TermName - | +- TypeName + | | +- TermSelect + | | | +- TermName + | | | +- TermName + | | +- TypeName + | +- TypeBounds +- DefnVal | +- PatVar | | +- TermName @@ -26,10 +27,11 @@ +- DefnType | +- TypeName | +- TypeSelect - | +- TermSelect - | | +- TermName - | | +- TermName - | +- TypeName + | | +- TermSelect + | | | +- TermName + | | | +- TermName + | | +- TypeName + | +- TypeBounds +- DefnVal | +- PatVar | | +- TermName @@ -51,8 +53,9 @@ | | +- TypeName | | +- TypeBounds | +- TypeApply - | +- TypeName - | +- TypeName + | | +- TypeName + | | +- TypeName + | +- TypeBounds +- DefnVal | +- ModAnnot | | +- Init @@ -79,12 +82,13 @@ | +- TypeName | +- TypeBounds +- TypeApply - +- TypeSelect - | +- TermSelect - | | +- TermSelect - | | | +- TermName - | | | +- TermName - | | +- TermName - | +- TypeName - +- TypeName - +- TypeName + | +- TypeSelect + | | +- TermSelect + | | | +- TermSelect + | | | | +- TermName + | | | | +- TermName + | | | +- TermName + | | +- TypeName + | +- TypeName + | +- TypeName + +- TypeBounds From e712b89fa0f3f7ba32a6a18d208346570cd6282b Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 30 Sep 2022 10:00:23 +0200 Subject: [PATCH 84/96] [java] UnusedPrivateFieldRule - improve rule doc --- docs/pages/release_notes.md | 11 +++++++++-- .../rule/bestpractices/UnusedPrivateFieldRule.java | 12 ++++++------ .../main/resources/category/java/bestpractices.xml | 6 ++++-- .../net/sourceforge/pmd/testframework/RuleTst.java | 6 ++++++ 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 2da44b2235..2354ce5f4b 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -21,8 +21,15 @@ from Lua. This means, that the Lua language in PMD can now parse both Lua and Lu #### Modified rules -* The Java rule {% rule java/codestyle/CommentDefaultAccessModifier %} now by default ignores JUnit5 annotated - methods. This behavior can be customized using the property `ignoredAnnotations`. +* The Java rule {% rule java/bestpractives/UnusedPrivateField %} now ignores private fields, if the fields are + annotated with any annotation or the enclosing class has any annotation. Annotations often enable a + framework (such as dependency injection, mocking or e.g. Lombok) which use the fields by reflection or other + means. This usage can't be detected by static code analysis. Previously these frameworks where explicitly allowed + by listing their annotations in the property "ignoredAnnotations", but that turned out to be prone of false + positive for any not explicitly considered framework. That's why the property "ignoredAnnotations" has been + deprecated for this rule. +* The Java rule {% rule java/codestyle/CommentDefaultAccessModifier %} now by default ignores JUnit5 annotated + methods. This behavior can be customized using the property `ignoredAnnotations`. ### Fixed Issues * cli diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateFieldRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateFieldRule.java index 171ad810b8..009bc3f486 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateFieldRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateFieldRule.java @@ -11,7 +11,7 @@ import java.util.List; import java.util.Map; import java.util.logging.Logger; -import net.sourceforge.pmd.RuleContext; +import net.sourceforge.pmd.PMDVersion; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceBody; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceBodyDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration; @@ -56,15 +56,15 @@ public class UnusedPrivateFieldRule extends AbstractJavaRule { } @Override - public void start(RuleContext ctx) { - super.start(ctx); - List property = getProperty(IGNORED_ANNOTATIONS_DESCRIPTOR); - if (!warnedAboutDeprecatedIgnoredAnnotationsProperty && !property.equals(IGNORED_ANNOTATIONS_DESCRIPTOR.defaultValue())) { + public String dysfunctionReason() { + List> overriddenPropertyDescriptors = getOverriddenPropertyDescriptors(); + if (!warnedAboutDeprecatedIgnoredAnnotationsProperty && overriddenPropertyDescriptors.contains(IGNORED_ANNOTATIONS_DESCRIPTOR)) { LOG.warning("The property '" + IGNORED_ANNOTATIONS_DESCRIPTOR.name() + "' for rule '" + this.getName() + "' is deprecated. The value is being ignored and the property will " - + "be removed with a future PMD version."); + + "be removed in PMD " + PMDVersion.getNextMajorRelease()); warnedAboutDeprecatedIgnoredAnnotationsProperty = true; } + return super.dysfunctionReason(); } @Override diff --git a/pmd-java/src/main/resources/category/java/bestpractices.xml b/pmd-java/src/main/resources/category/java/bestpractices.xml index 939d4ac72a..9eec8d4fd8 100644 --- a/pmd-java/src/main/resources/category/java/bestpractices.xml +++ b/pmd-java/src/main/resources/category/java/bestpractices.xml @@ -1724,8 +1724,10 @@ public class Foo { Detects when a private field is declared and/or assigned a value, but not used. Since PMD 6.50.0 private fields are ignored, if the fields are annotated with any annotation or the -enclosing class has any annotation. Annotations often enable a framework (such as mocking or Lombok) -which use the fields by reflection, which can't be detected by static code analysis. +enclosing class has any annotation. Annotations often enable a framework (such as dependency injection, mocking +or e.g. Lombok) which use the fields by reflection or other means. This usage can't be detected by static code analysis. +Previously these frameworks where explicitly allowed by listing their annotations in the property +"ignoredAnnotations", but that turned out to be prone of false positive for any not explicitly considered framework.
3 diff --git a/pmd-test/src/main/java/net/sourceforge/pmd/testframework/RuleTst.java b/pmd-test/src/main/java/net/sourceforge/pmd/testframework/RuleTst.java index 7768660bd7..9bd6b0a541 100644 --- a/pmd-test/src/main/java/net/sourceforge/pmd/testframework/RuleTst.java +++ b/pmd-test/src/main/java/net/sourceforge/pmd/testframework/RuleTst.java @@ -17,6 +17,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import org.apache.commons.lang3.StringUtils; import org.xml.sax.InputSource; import net.sourceforge.pmd.PMDConfiguration; @@ -104,6 +105,11 @@ public abstract class RuleTst { } } + String dysfunctionReason = rule.dysfunctionReason(); + if (StringUtils.isNotBlank(dysfunctionReason)) { + throw new RuntimeException("Rule is not configured correctly: " + dysfunctionReason); + } + report = processUsingStringReader(test, rule); res = report.size(); } catch (Exception e) { From 1cc0fbb04778f3029efa2ee9dc2767b3f0f58836 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 30 Sep 2022 10:03:11 +0200 Subject: [PATCH 85/96] [java] UnusedPrivateFieldRule - remove ignoredAnnotations from rule tests --- .../pmd/lang/java/rule/bestpractices/xml/UnusedPrivateField.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateField.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateField.xml index b4f1be83f3..b773a97ba6 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateField.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateField.xml @@ -545,7 +545,6 @@ public class Foo { #907 UnusedPrivateField false-positive with @FXML - 3 - javafx.fxml.FXML 0 #2673 UnusedPrivateField false positive with lombok annotation EqualsAndHashCode - lombok.Getter|lombok.Data 0 Date: Fri, 30 Sep 2022 10:21:25 +0200 Subject: [PATCH 86/96] [java] Fix rule tests with dysfunctional rule configurations --- .../bestpractices/xml/AvoidUsingHardCodedIP.xml | 7 ------- .../java/rule/design/xml/LoosePackageCoupling.xml | 13 +------------ .../lang/java/rule/design/xml/NPathComplexity.xml | 4 ++-- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/AvoidUsingHardCodedIP.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/AvoidUsingHardCodedIP.xml index 39afc069c1..66ad2f040c 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/AvoidUsingHardCodedIP.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/AvoidUsingHardCodedIP.xml @@ -120,13 +120,6 @@ public class Foo { - - Comprehensive, check for nothing - - 0 - - - Comprehensive, check for IPv4 IPv4 diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/LoosePackageCoupling.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/LoosePackageCoupling.xml index 871ad0543e..7a6a9dba22 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/LoosePackageCoupling.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/LoosePackageCoupling.xml @@ -25,12 +25,6 @@ public class Foo { } ]]> - - default package: nothing configured, ok - 0 - - - default package: unused package, ok nothing.used @@ -69,12 +63,6 @@ public class Foo { - - some package: nothing configured, ok - 0 - - - some package: unused package, ok nothing.used @@ -115,6 +103,7 @@ public class Foo { bug fix: annotation before package + javax.xml.ws.wsaddressing 0 Test default report level - report 200 - 0 + 1 1 - The method 'bar()' has an NPath complexity of 200, current threshold is 0 + The method 'bar()' has an NPath complexity of 200, current threshold is 1 Date: Fri, 30 Sep 2022 10:32:22 +0200 Subject: [PATCH 87/96] Fix release notes --- docs/pages/release_notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 2354ce5f4b..2abc79f726 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -21,7 +21,7 @@ from Lua. This means, that the Lua language in PMD can now parse both Lua and Lu #### Modified rules -* The Java rule {% rule java/bestpractives/UnusedPrivateField %} now ignores private fields, if the fields are +* The Java rule {% rule java/bestpractices/UnusedPrivateField %} now ignores private fields, if the fields are annotated with any annotation or the enclosing class has any annotation. Annotations often enable a framework (such as dependency injection, mocking or e.g. Lombok) which use the fields by reflection or other means. This usage can't be detected by static code analysis. Previously these frameworks where explicitly allowed From 81a8ba0c87f24add7609f1549cbfc065e6d62835 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 30 Sep 2022 10:48:42 +0200 Subject: [PATCH 88/96] [ci] Add permission contents:write for build job --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cb7a64a706..a2e4d53c90 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,11 @@ permissions: jobs: build: runs-on: ${{ matrix.os }} + permissions: + # read to fetch code (actions/checkout) + # write to push code to gh-pages, create releases + # note: forked repositories will have maximum read access + contents: write continue-on-error: false strategy: matrix: From d7de6f59d2d1d4a06c5c50ae18b09a57b983f556 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 30 Sep 2022 11:00:06 +0200 Subject: [PATCH 89/96] [doc] Accept ADR-1 and ADR-2 --- docs/pages/pmd/projectdocs/decisions/adr-1.md | 4 +++- docs/pages/pmd/projectdocs/decisions/adr-2.md | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/pages/pmd/projectdocs/decisions/adr-1.md b/docs/pages/pmd/projectdocs/decisions/adr-1.md index 07bf1f84fa..85d750b473 100644 --- a/docs/pages/pmd/projectdocs/decisions/adr-1.md +++ b/docs/pages/pmd/projectdocs/decisions/adr-1.md @@ -5,7 +5,7 @@ permalink: pmd_projectdocs_decisions_adr_1.html sidebaractiveurl: /pmd_projectdocs_decisions.html adr: true # Proposed / Accepted / Deprecated / Superseded -adr_status: "Proposed" +adr_status: "Accepted" last_updated: September 2022 --- @@ -63,6 +63,8 @@ However, this also adds additional tasks, and it takes time to write down and do # Change History +2022-09-30: Status changed to "Accepted". + 2022-09-06: Added section "Change History" to the template. Added "Last updated" to "Status" section. 2022-07-28: Proposed initial version. diff --git a/docs/pages/pmd/projectdocs/decisions/adr-2.md b/docs/pages/pmd/projectdocs/decisions/adr-2.md index 1e77d6af2c..b3f57efd4f 100644 --- a/docs/pages/pmd/projectdocs/decisions/adr-2.md +++ b/docs/pages/pmd/projectdocs/decisions/adr-2.md @@ -5,7 +5,7 @@ permalink: pmd_projectdocs_decisions_adr_2.html sidebaractiveurl: /pmd_projectdocs_decisions.html adr: true # Proposed / Accepted / Deprecated / Superseded -adr_status: "Proposed" +adr_status: "Accepted" last_updated: September 2022 --- @@ -66,4 +66,6 @@ Maintaining a polyglot code base with multiple languages is likely to be more ch # Change History +2022-09-30: Changed status to "Accepted". + 2022-07-28: Proposed initial version. From 9056204317ee2412a443917c0c3a90e103cdc919 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 30 Sep 2022 11:15:26 +0200 Subject: [PATCH 90/96] [ci] Execute danger and dogfood only for pull requests in our own repository --- .ci/build.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.ci/build.sh b/.ci/build.sh index 6c6b657654..499cafa39e 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -41,17 +41,20 @@ function build() { ./mvnw clean install --show-version --errors --batch-mode --no-transfer-progress "${PMD_MAVEN_EXTRA_OPTS[@]}" pmd_ci_log_group_end - # Danger is executed only on the linux runner - if [ "$(pmd_ci_utils_get_os)" = "linux" ]; then - pmd_ci_log_group_start "Executing danger" - regression_tester_setup_ci - regression_tester_executeDanger - pmd_ci_log_group_end + # Execute danger and dogfood only for pull requests in our own repository + if [[ "${PMD_CI_IS_FORK}" = "false" && -n "${PMD_CI_PULL_REQUEST_NUMBER}" ]]; then + # Danger is executed only on the linux runner + if [ "$(pmd_ci_utils_get_os)" = "linux" ]; then + pmd_ci_log_group_start "Executing danger" + regression_tester_setup_ci + regression_tester_executeDanger + pmd_ci_log_group_end - # also run dogfood for PRs (only on linux) - pmd_ci_log_group_start "Executing PMD dogfood test with ${PMD_CI_MAVEN_PROJECT_VERSION}" - pmd_ci_dogfood - pmd_ci_log_group_end + # also run dogfood for PRs (only on linux) + pmd_ci_log_group_start "Executing PMD dogfood test with ${PMD_CI_MAVEN_PROJECT_VERSION}" + pmd_ci_dogfood + pmd_ci_log_group_end + fi fi exit 0 From 1d6aeb0a951d0abffee750622fc8e4e58082d851 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 30 Sep 2022 11:20:23 +0200 Subject: [PATCH 91/96] Add @LynnBroe as a contributor --- .all-contributorsrc | 9 ++ docs/pages/pmd/projectdocs/credits.md | 123 +++++++++++++------------- 2 files changed, 71 insertions(+), 61 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 93ab44ab69..654d061385 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -6853,6 +6853,15 @@ "contributions": [ "code" ] + }, + { + "login": "LynnBroe", + "name": "Lynn", + "avatar_url": "https://avatars.githubusercontent.com/u/109954313?v=4", + "profile": "https://github.com/LynnBroe", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index 3f57f4b9f6..8ee820d405 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -422,552 +422,553 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Luis Alcantar

๐Ÿ’ป
Lukasz Slonina

๐Ÿ›
Lukebray

๐Ÿ› +
Lynn

๐Ÿ’ป
Lyor Goldstein

๐Ÿ›
MCMicS

๐Ÿ›
Macarse

๐Ÿ› -
Machine account for PMD

๐Ÿ’ป +
Machine account for PMD

๐Ÿ’ป
Maciek Siemczyk

๐Ÿ›
Maikel Steneker

๐Ÿ’ป ๐Ÿ›
Maksim Moiseikin

๐Ÿ›
Manfred Koch

๐Ÿ›
Manuel Moya Ferrer

๐Ÿ’ป ๐Ÿ›
Manuel Ryan

๐Ÿ› -
Marat Vyshegorodtsev

๐Ÿ› +
Marat Vyshegorodtsev

๐Ÿ›
Marcel Hรคrle

๐Ÿ›
Marcello Fialho

๐Ÿ›
Marcin Rataj

๐Ÿ›
Mark Adamcin

๐Ÿ›
Mark Hall

๐Ÿ’ป ๐Ÿ›
Mark Kolich

๐Ÿ› -
Mark Pritchard

๐Ÿ› +
Mark Pritchard

๐Ÿ›
Markus Rathgeb

๐Ÿ›
Marquis Wang

๐Ÿ›
Martin Feldsztejn

๐Ÿ›
Martin Lehmann

๐Ÿ›
Martin Spamer

๐Ÿ›
Martin Tarjรกnyi

๐Ÿ› -
MatFl

๐Ÿ› +
MatFl

๐Ÿ›
Mateusz Stefanski

๐Ÿ›
Mathieu Gouin

๐Ÿ›
MatiasComercio

๐Ÿ’ป ๐Ÿ›
Matt Benson

๐Ÿ›
Matt De Poorter

๐Ÿ›
Matt Hargett

๐Ÿ’ป ๐Ÿ’ต -
Matt Harrah

๐Ÿ› +
Matt Harrah

๐Ÿ›
Matt Nelson

๐Ÿ›
Matthew Amos

๐Ÿ›
Matthew Duggan

๐Ÿ›
Matthew Hall

๐Ÿ›
Matรญas Fraga

๐Ÿ’ป ๐Ÿ›
Maxime Robert

๐Ÿ’ป ๐Ÿ› -
MetaBF

๐Ÿ› +
MetaBF

๐Ÿ›
Michael

๐Ÿ›
Michael Bell

๐Ÿ›
Michael Bernstein

๐Ÿ›
Michael Clay

๐Ÿ›
Michael Dombrowski

๐Ÿ›
Michael Hausegger

๐Ÿ› -
Michael Hoefer

๐Ÿ› +
Michael Hoefer

๐Ÿ›
Michael Mรถbius

๐Ÿ›
Michael N. Lipp

๐Ÿ›
Michael Pellegrini

๐Ÿ›
Michal Kordas

๐Ÿ›
Michaล‚ Borek

๐Ÿ›
Michaล‚ Kuliล„ski

๐Ÿ› -
Miguel Nรบรฑez Dรญaz-Montes

๐Ÿ› +
Miguel Nรบรฑez Dรญaz-Montes

๐Ÿ›
Mihai Ionut

๐Ÿ›
Mirek Hankus

๐Ÿ›
Mladjan Gadzic

๐Ÿ›
MrAngry52

๐Ÿ›
Muminur Choudhury

๐Ÿ›
Mykhailo Palahuta

๐Ÿ’ป ๐Ÿ› -
Nagendra Kumar Singh

๐Ÿ› +
Nagendra Kumar Singh

๐Ÿ›
Nahuel Barrios

๐Ÿ›
Nathan Braun

๐Ÿ›
Nathan Reynolds

๐Ÿ›
Nathan Reynolds

๐Ÿ›
Nathanaรซl

๐Ÿ›
Naveen

๐Ÿ’ป -
Nazdravi

๐Ÿ› +
Nazdravi

๐Ÿ›
Neha-Dhonde

๐Ÿ›
Nicholas Doyle

๐Ÿ›
Nick Butcher

๐Ÿ›
Nico Gallinal

๐Ÿ›
Nicola Dal Maso

๐Ÿ›
Nicolas Filotto

๐Ÿ’ป -
Nicolas Vuillamy

๐Ÿ“– +
Nicolas Vuillamy

๐Ÿ“–
Nikita Chursin

๐Ÿ›
Niklas Baudy

๐Ÿ›
Nikolas Havrikov

๐Ÿ›
Nilesh Virkar

๐Ÿ›
Nimit Patel

๐Ÿ›
Niranjan Harpale

๐Ÿ› -
Noah Sussman

๐Ÿ› +
Noah Sussman

๐Ÿ›
Noah0120

๐Ÿ›
Noam Tamim

๐Ÿ›
Noel Grandin

๐Ÿ›
Olaf Haalstra

๐Ÿ›
Oleg Andreych

๐Ÿ’ป
Oleg Pavlenko

๐Ÿ› -
Oleksii Dykov

๐Ÿ’ป +
Oleksii Dykov

๐Ÿ’ป
Oliver Eikemeier

๐Ÿ›
Oliver Siegmar

๐Ÿ’ต
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

๐Ÿ›
Peter Paul Bakker

๐Ÿ’ป
Pham Hai Trung

๐Ÿ›
Philip Graf

๐Ÿ’ป ๐Ÿ›
Philip Hachey

๐Ÿ›
Philippe Ozil

๐Ÿ›
Phinehas Artemix

๐Ÿ› -
Phokham Nonava

๐Ÿ› +
Phokham Nonava

๐Ÿ›
Piotr Szymaล„ski

๐Ÿ›
Piotrek ลปygieล‚o

๐Ÿ’ป ๐Ÿ› ๐Ÿ“–
Pranay Jaiswal

๐Ÿ›
Prasad Kamath

๐Ÿ›
Prasanna

๐Ÿ›
Presh-AR

๐Ÿ› -
Puneet1726

๐Ÿ› +
Puneet1726

๐Ÿ›
Rafael Cortรชs

๐Ÿ›
RaheemShaik999

๐Ÿ›
RajeshR

๐Ÿ’ป ๐Ÿ›
Ramachandra Mohan

๐Ÿ›
Ramel0921

๐Ÿ›
Raquel Pau

๐Ÿ› -
Ravikiran Janardhana

๐Ÿ› +
Ravikiran Janardhana

๐Ÿ›
Reda Benhemmouche

๐Ÿ›
Renato Oliveira

๐Ÿ’ป ๐Ÿ›
Rich DiCroce

๐Ÿ›
Riot R1cket

๐Ÿ›
Rishabh Jain

๐Ÿ›
RishabhDeep Singh

๐Ÿ› -
Robbie Martinus

๐Ÿ’ป ๐Ÿ› +
Robbie Martinus

๐Ÿ’ป ๐Ÿ›
Robert Henry

๐Ÿ›
Robert Painsi

๐Ÿ›
Robert Russell

๐Ÿ›
Robert Sรถsemann

๐Ÿ’ป ๐Ÿ“– ๐Ÿ“ข ๐Ÿ›
Robert Whitebit

๐Ÿ›
Robin Richtsfeld

๐Ÿ› -
Robin Stocker

๐Ÿ’ป ๐Ÿ› +
Robin Stocker

๐Ÿ’ป ๐Ÿ›
Robin Wils

๐Ÿ›
RochusOest

๐Ÿ›
Rodolfo Noviski

๐Ÿ›
Rodrigo Casara

๐Ÿ›
Rodrigo Fernandes

๐Ÿ›
Roman Salvador

๐Ÿ’ป ๐Ÿ› -
Ronald Blaschke

๐Ÿ› +
Ronald Blaschke

๐Ÿ›
Rรณbert Papp

๐Ÿ›
Saikat Sengupta

๐Ÿ›
Saksham Handu

๐Ÿ›
Saladoc

๐Ÿ›
Salesforce Bob Lightning

๐Ÿ›
Sam Carlberg

๐Ÿ› -
Satoshi Kubo

๐Ÿ› +
Satoshi Kubo

๐Ÿ›
Scott Kennedy

๐Ÿ›
Scott Wells

๐Ÿ› ๐Ÿ’ป
Scrsloota

๐Ÿ’ป
Sebastian Bรถgl

๐Ÿ›
Sebastian Schuberth

๐Ÿ›
Sebastian Schwarz

๐Ÿ› -
Sergey Gorbaty

๐Ÿ› +
Sergey Gorbaty

๐Ÿ›
Sergey Kozlov

๐Ÿ›
Sergey Yanzin

๐Ÿ’ป ๐Ÿ›
Seth Wilcox

๐Ÿ’ป
Shubham

๐Ÿ’ป ๐Ÿ›
Simon Abykov

๐Ÿ’ป
Simon Xiao

๐Ÿ› -
Srinivasan Venkatachalam

๐Ÿ› +
Srinivasan Venkatachalam

๐Ÿ›
Stanislav Gromov

๐Ÿ›
Stanislav Myachenkov

๐Ÿ’ป
Stefan Birkner

๐Ÿ›
Stefan Bohn

๐Ÿ›
Stefan Endrullis

๐Ÿ›
Stefan Klรถss-Schuster

๐Ÿ› -
Stefan Wolf

๐Ÿ› +
Stefan Wolf

๐Ÿ›
Stephan H. Wissel

๐Ÿ›
Stephen

๐Ÿ›
Stephen Friedrich

๐Ÿ›
Steve Babula

๐Ÿ’ป
Stexxe

๐Ÿ›
Stian Lรฅgstad

๐Ÿ› -
StuartClayton5

๐Ÿ› +
StuartClayton5

๐Ÿ›
Supun Arunoda

๐Ÿ›
Suren Abrahamyan

๐Ÿ›
Suvashri

๐Ÿ“–
SwatiBGupta1110

๐Ÿ›
SyedThoufich

๐Ÿ›
Szymon Sasin

๐Ÿ› -
T-chuangxin

๐Ÿ› +
T-chuangxin

๐Ÿ›
TERAI Atsuhiro

๐Ÿ›
TIOBE Software

๐Ÿ’ป ๐Ÿ›
Taylor Smock

๐Ÿ›
Techeira Damiรกn

๐Ÿ’ป ๐Ÿ›
Ted Husted

๐Ÿ›
TehBakker

๐Ÿ› -
The Gitter Badger

๐Ÿ› +
The Gitter Badger

๐Ÿ›
Theodoor

๐Ÿ›
Thiago Henrique Hรผpner

๐Ÿ›
Thibault Meyer

๐Ÿ›
Thomas Gรผttler

๐Ÿ›
Thomas Jones-Low

๐Ÿ›
Thomas Smith

๐Ÿ’ป ๐Ÿ› -
ThrawnCA

๐Ÿ› +
ThrawnCA

๐Ÿ›
Thunderforge

๐Ÿ’ป ๐Ÿ›
Tim van der Lippe

๐Ÿ›
Tobias Weimer

๐Ÿ’ป ๐Ÿ›
Tom Daly

๐Ÿ›
Tomer Figenblat

๐Ÿ›
Tomi De Lucca

๐Ÿ’ป ๐Ÿ› -
Torsten Kleiber

๐Ÿ› +
Torsten Kleiber

๐Ÿ›
TrackerSB

๐Ÿ›
Ullrich Hafner

๐Ÿ›
Utku Cuhadaroglu

๐Ÿ’ป ๐Ÿ›
Valentin Brandl

๐Ÿ›
Valeria

๐Ÿ›
Vasily Anisimov

๐Ÿ› -
Vibhor Goyal

๐Ÿ› +
Vibhor Goyal

๐Ÿ›
Vickenty Fesunov

๐Ÿ›
Victor Noรซl

๐Ÿ›
Vincent Galloy

๐Ÿ’ป
Vincent HUYNH

๐Ÿ›
Vincent Maurin

๐Ÿ›
Vincent Privat

๐Ÿ› -
Vishhwas

๐Ÿ› +
Vishhwas

๐Ÿ›
Vitaly

๐Ÿ›
Vitaly Polonetsky

๐Ÿ›
Vojtech Polivka

๐Ÿ›
Vsevolod Zholobov

๐Ÿ›
Vyom Yadav

๐Ÿ’ป
Wang Shidong

๐Ÿ› -
Waqas Ahmed

๐Ÿ› +
Waqas Ahmed

๐Ÿ›
Wayne J. Earl

๐Ÿ›
Wchenghui

๐Ÿ›
Will Winder

๐Ÿ›
William Brockhus

๐Ÿ’ป ๐Ÿ›
Wilson Kurniawan

๐Ÿ›
Wim Deblauwe

๐Ÿ› -
Woongsik Choi

๐Ÿ› +
Woongsik Choi

๐Ÿ›
XenoAmess

๐Ÿ’ป ๐Ÿ›
Yang

๐Ÿ’ป
YaroslavTER

๐Ÿ›
Young Chan

๐Ÿ’ป ๐Ÿ›
YuJin Kim

๐Ÿ›
Yuri Dolzhenko

๐Ÿ› -
Yurii Dubinka

๐Ÿ› +
Yurii Dubinka

๐Ÿ›
Zoltan Farkas

๐Ÿ›
Zustin

๐Ÿ›
aaronhurst-google

๐Ÿ› ๐Ÿ’ป
alexmodis

๐Ÿ›
andreoss

๐Ÿ›
andrey81inmd

๐Ÿ’ป ๐Ÿ› -
anicoara

๐Ÿ› +
anicoara

๐Ÿ›
arunprasathav

๐Ÿ›
asiercamara

๐Ÿ›
astillich-igniti

๐Ÿ’ป
avesolovksyy

๐Ÿ›
avishvat

๐Ÿ›
avivmu

๐Ÿ› -
axelbarfod1

๐Ÿ› +
axelbarfod1

๐Ÿ›
b-3-n

๐Ÿ›
balbhadra9

๐Ÿ›
base23de

๐Ÿ›
bergander

๐Ÿ›
berkam

๐Ÿ’ป ๐Ÿ›
breizh31

๐Ÿ› -
caesarkim

๐Ÿ› +
caesarkim

๐Ÿ›
carolyujing

๐Ÿ›
cesares-basilico

๐Ÿ›
chrite

๐Ÿ›
cobratbq

๐Ÿ›
coladict

๐Ÿ›
cosmoJFH

๐Ÿ› -
cristalp

๐Ÿ› +
cristalp

๐Ÿ›
crunsk

๐Ÿ›
cwholmes

๐Ÿ›
cyberjj999

๐Ÿ›
cyw3

๐Ÿ›
d1ss0nanz

๐Ÿ›
dalizi007

๐Ÿ’ป -
danbrycefairsailcom

๐Ÿ› +
danbrycefairsailcom

๐Ÿ›
dariansanity

๐Ÿ›
darrenmiliband

๐Ÿ›
davidburstrom

๐Ÿ›
dbirkman-paloalto

๐Ÿ›
deepak-patra

๐Ÿ›
dependabot[bot]

๐Ÿ’ป ๐Ÿ› -
dinesh150

๐Ÿ› +
dinesh150

๐Ÿ›
diziaq

๐Ÿ›
dreaminpast123

๐Ÿ›
duanyanan

๐Ÿ›
dutt-sanjay

๐Ÿ›
dylanleung

๐Ÿ›
dzeigler

๐Ÿ› -
ekkirala

๐Ÿ› +
ekkirala

๐Ÿ›
emersonmoura

๐Ÿ›
fairy

๐Ÿ›
filiprafalowicz

๐Ÿ’ป
foxmason

๐Ÿ›
frankegabor

๐Ÿ›
frankl

๐Ÿ› -
freafrea

๐Ÿ› +
freafrea

๐Ÿ›
fsapatin

๐Ÿ›
gracia19

๐Ÿ›
guo fei

๐Ÿ›
gurmsc5

๐Ÿ›
gwilymatgearset

๐Ÿ’ป ๐Ÿ›
haigsn

๐Ÿ› -
hemanshu070

๐Ÿ› +
hemanshu070

๐Ÿ›
henrik242

๐Ÿ›
hongpuwu

๐Ÿ›
hvbtup

๐Ÿ’ป ๐Ÿ›
igniti GmbH

๐Ÿ›
ilovezfs

๐Ÿ›
itaigilo

๐Ÿ› -
jakivey32

๐Ÿ› +
jakivey32

๐Ÿ›
jbennett2091

๐Ÿ›
jcamerin

๐Ÿ›
jkeener1

๐Ÿ›
jmetertea

๐Ÿ›
johnra2

๐Ÿ’ป
josemanuelrolon

๐Ÿ’ป ๐Ÿ› -
kabroxiko

๐Ÿ’ป ๐Ÿ› +
kabroxiko

๐Ÿ’ป ๐Ÿ›
karwer

๐Ÿ›
kaulonline

๐Ÿ›
kdaemonv

๐Ÿ›
kenji21

๐Ÿ’ป ๐Ÿ›
kfranic

๐Ÿ›
khalidkh

๐Ÿ› -
krzyk

๐Ÿ› +
krzyk

๐Ÿ›
lasselindqvist

๐Ÿ›
lgemeinhardt

๐Ÿ›
lihuaib

๐Ÿ›
lonelyma1021

๐Ÿ›
lpeddy

๐Ÿ›
lujiefsi

๐Ÿ’ป -
lukelukes

๐Ÿ’ป +
lukelukes

๐Ÿ’ป
lyriccoder

๐Ÿ›
marcelmore

๐Ÿ›
matchbox

๐Ÿ›
matthiaskraaz

๐Ÿ›
meandonlyme

๐Ÿ›
mikesive

๐Ÿ› -
milossesic

๐Ÿ› +
milossesic

๐Ÿ›
mohan-chinnappan-n

๐Ÿ’ป
mriddell95

๐Ÿ›
mrlzh

๐Ÿ›
msloan

๐Ÿ›
mucharlaravalika

๐Ÿ›
mvenneman

๐Ÿ› -
nareshl119

๐Ÿ› +
nareshl119

๐Ÿ›
nicolas-harraudeau-sonarsource

๐Ÿ›
noerremark

๐Ÿ›
novsirion

๐Ÿ›
oggboy

๐Ÿ›
oinume

๐Ÿ›
orimarko

๐Ÿ’ป ๐Ÿ› -
pacvz

๐Ÿ’ป +
pacvz

๐Ÿ’ป
pallavi agarwal

๐Ÿ›
parksungrin

๐Ÿ›
patpatpat123

๐Ÿ›
patriksevallius

๐Ÿ›
pbrajesh1

๐Ÿ›
phoenix384

๐Ÿ› -
piotrszymanski-sc

๐Ÿ’ป +
piotrszymanski-sc

๐Ÿ’ป
plan3d

๐Ÿ›
poojasix

๐Ÿ›
prabhushrikant

๐Ÿ›
pujitha8783

๐Ÿ›
r-r-a-j

๐Ÿ›
raghujayjunk

๐Ÿ› -
rajeshveera

๐Ÿ› +
rajeshveera

๐Ÿ›
rajeswarreddy88

๐Ÿ›
recdevs

๐Ÿ›
reudismam

๐Ÿ’ป ๐Ÿ›
rijkt

๐Ÿ›
rillig-tk

๐Ÿ›
rmohan20

๐Ÿ’ป ๐Ÿ› -
rxmicro

๐Ÿ› +
rxmicro

๐Ÿ›
ryan-gustafson

๐Ÿ’ป ๐Ÿ›
sabi0

๐Ÿ›
scais

๐Ÿ›
sebbASF

๐Ÿ›
sergeygorbaty

๐Ÿ’ป
shilko2013

๐Ÿ› -
shiomiyan

๐Ÿ“– +
shiomiyan

๐Ÿ“–
simeonKondr

๐Ÿ›
snajberk

๐Ÿ›
sniperrifle2004

๐Ÿ›
snuyanzin

๐Ÿ› ๐Ÿ’ป
sratz

๐Ÿ›
stonio

๐Ÿ› -
sturton

๐Ÿ’ป ๐Ÿ› +
sturton

๐Ÿ’ป ๐Ÿ›
sudharmohan

๐Ÿ›
suruchidawar

๐Ÿ›
svenfinitiv

๐Ÿ›
tashiscool

๐Ÿ›
test-git-hook

๐Ÿ›
testation21

๐Ÿ’ป ๐Ÿ› -
thanosa

๐Ÿ› +
thanosa

๐Ÿ›
tiandiyixian

๐Ÿ›
tobwoerk

๐Ÿ›
tprouvot

๐Ÿ› ๐Ÿ’ป
trentchilders

๐Ÿ›
triandicAnt

๐Ÿ›
trishul14

๐Ÿ› -
tsui

๐Ÿ› +
tsui

๐Ÿ›
winhkey

๐Ÿ›
witherspore

๐Ÿ›
wjljack

๐Ÿ›
wuchiuwong

๐Ÿ›
xingsong

๐Ÿ›
xioayuge

๐Ÿ› -
xnYi9wRezm

๐Ÿ’ป ๐Ÿ› +
xnYi9wRezm

๐Ÿ’ป ๐Ÿ›
xuanuy

๐Ÿ›
xyf0921

๐Ÿ›
yalechen-cyw3

๐Ÿ›
yasuharu-sato

๐Ÿ›
zenglian

๐Ÿ›
zgrzyt93

๐Ÿ’ป ๐Ÿ› -
zh3ng

๐Ÿ› +
zh3ng

๐Ÿ›
zt_soft

๐Ÿ›
ztt79

๐Ÿ›
zzzzfeng

๐Ÿ› From 2105bde614e67698a58d2fbcc13015f1c385d60e Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 30 Sep 2022 11:20:51 +0200 Subject: [PATCH 92/96] [doc] Update release notes (#4100, #4033, #4037) --- docs/pages/release_notes.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 2abc79f726..76b5e75abc 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -39,6 +39,9 @@ from Lua. This means, that the Lua language in PMD can now parse both Lua and Lu * doc * [#4109](https://github.com/pmd/pmd/pull/4109): \[doc] Add page for 3rd party rulesets * [#4124](https://github.com/pmd/pmd/pull/4124): \[doc] Fix typos in Java rule docs +* java-bestpractices + * [#4033](https://github.com/pmd/pmd/issues/4033): \[java] UnusedPrivateField - false positive with Lombok @ToString.Include + * [#4037](https://github.com/pmd/pmd/issues/4037): \[java] UnusedPrivateField - false positive with Spring @SpyBean * java-codestyle * [#3859](https://github.com/pmd/pmd/issues/3859): \[java] CommentDefaultAccessModifier is triggered in JUnit5 test class * [#4085](https://github.com/pmd/pmd/issues/4085): \[java] UnnecessaryFullyQualifiedName false positive when nested and non-nested classes with the same name and in the same package are used together @@ -59,6 +62,7 @@ Many thanks to our sponsors: ### External Contributions * [#4066](https://github.com/pmd/pmd/pull/4066): \[lua] Add support for Luau syntax and skipping literal sequences in CPD - [Matt Hargett](https://github.com/matthargett) (@matthargett) +* [#4100](https://github.com/pmd/pmd/pull/4100): \[java] Update UnusedPrivateFieldRule - ignore any annotations - [Lynn](https://github.com/LynnBroe) (@LynnBroe) * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Fix missing --file arg in TreeExport CLI example - [mohan-chinnappan-n](https://github.com/mohan-chinnappan-n) (@mohan-chinnappan-n) * [#4124](https://github.com/pmd/pmd/pull/4124): \[doc] Fix typos in Java rule docs - [Piotrek ลปygieล‚o](https://github.com/pzygielo) (@pzygielo) * [#4128](https://github.com/pmd/pmd/pull/4128): \[java] Fix False-positive UnnecessaryFullyQualifiedName when nested and non-nestโ€ฆ #4103 - [Oleg Andreych](https://github.com/OlegAndreych) (@OlegAndreych) From c75a4795d33dfb811bde1e8ba333eaf1f9de6c9a Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 30 Sep 2022 11:25:01 +0200 Subject: [PATCH 93/96] Add @sashashura as a contributor --- .all-contributorsrc | 9 ++ docs/pages/pmd/projectdocs/credits.md | 209 +++++++++++++------------- 2 files changed, 114 insertions(+), 104 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 3120c1af00..2d0f3c7153 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -6816,6 +6816,15 @@ "contributions": [ "code" ] + }, + { + "login": "sashashura", + "name": "Alex", + "avatar_url": "https://avatars.githubusercontent.com/u/93376818?v=4", + "profile": "https://github.com/sashashura", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index 53a6336d25..d816964636 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -35,939 +35,940 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Alan Buttars

๐Ÿ›
Alan Hohn

๐Ÿ›
Alberto Fernรกndez

๐Ÿ’ป ๐Ÿ› +
Alex

๐Ÿ’ป
Alex Rentz

๐Ÿ›
Alex Saveau

๐Ÿ›
Alex Shesterov

๐Ÿ’ป ๐Ÿ› -
Alexey Markevich

๐Ÿ› +
Alexey Markevich

๐Ÿ›
Alexey Naumov

๐Ÿ›
Alexey Yudichev

๐Ÿ›
Alix

๐Ÿ›
Alix

๐Ÿ›
Amish Shah

๐Ÿ›
Amit Prasad

๐Ÿ› -
Amitosh Swain Mahapatra

๐Ÿ› +
Amitosh Swain Mahapatra

๐Ÿ›
Anand Subramanian

๐Ÿ’ป ๐Ÿ›
Anatoly Trosinenko

๐Ÿ’ป ๐Ÿ›
Andi Pabst

๐Ÿ’ป ๐Ÿ›
Andrea

๐Ÿ›
Andrea Aime

๐Ÿ›
Andreas Dangel

๐Ÿ’ป ๐Ÿ“– ๐Ÿ› ๐Ÿšง -
Andreas Markussen

๐Ÿ› +
Andreas Markussen

๐Ÿ›
Andreas Schmid

๐Ÿ›
Andreas Turban

๐Ÿ›
Andrei Paikin

๐Ÿ›
Andrew

๐Ÿ›
Andrew Green

๐Ÿ›
Andrey Fomin

๐Ÿ› -
Andrey Hitrin

๐Ÿ› +
Andrey Hitrin

๐Ÿ›
Andrey Mochalov

๐Ÿ’ป ๐Ÿ›
Andro72

๐Ÿ›
Andrwyw

๐Ÿ›
Andrรฉs Catalรกn

๐Ÿ›
Andy Pattenden

๐Ÿ›
Andy Ray

๐Ÿ› -
Andy Robinson

๐Ÿ› +
Andy Robinson

๐Ÿ›
Andy-2639

๐Ÿ›
Ankush Somani

๐Ÿ›
Anmol Kumar

๐Ÿ›
Anthony Whitford

๐Ÿ›
AnthonyKot

๐Ÿ›
Aravind Hegde

๐Ÿ› -
Arda Aslan

๐Ÿ› +
Arda Aslan

๐Ÿ›
Ari Fogel

๐Ÿ›
Arnaud Jeansen

๐Ÿ’ป ๐Ÿ›
Arpit Koolwal

๐Ÿ›
Artem

๐Ÿ’ป ๐Ÿ›
Artem

๐Ÿ›
Artem Sheremet

๐Ÿ› -
Artur

๐Ÿ› +
Artur

๐Ÿ›
Artur Bosch

๐Ÿ›
Artur Dryomov

๐Ÿ›
Artur Ossowski

๐Ÿ›
AshTheMash

๐Ÿ›
Ashish Rana

๐Ÿ›
Atul Kaushal

๐Ÿ› -
August Boland

๐Ÿ› +
August Boland

๐Ÿ›
Aurel Hudec

๐Ÿ›
Austin Shalit

๐Ÿ›
Austin Tice

๐Ÿ›
Ayoub Kaanich

๐Ÿ›
BBG

๐Ÿ’ป ๐Ÿ“– ๐Ÿ›
Bailey Tjiong

๐Ÿ’ป -
Barthรฉlemy L.

๐Ÿ› +
Barthรฉlemy L.

๐Ÿ›
Basavaraj K N

๐Ÿ›
Basil Peace

๐Ÿ›
Belle

๐Ÿ›
Ben Lerner

๐Ÿ›
Ben Manes

๐Ÿ›
Ben McCann

๐Ÿ› -
Bendegรบz Nagy

๐Ÿ› +
Bendegรบz Nagy

๐Ÿ›
Bennet S Yee

๐Ÿ›
Benoit Lacelle

๐Ÿ›
Bernardo Macรชdo

๐Ÿ›
Bernd Farka

๐Ÿ›
Betina Cynthia Mamani

๐Ÿ›
Bhanu Prakash Pamidi

๐Ÿ’ป ๐Ÿ› -
Bhargav Thanki

๐Ÿ› +
Bhargav Thanki

๐Ÿ›
Binu R J

๐Ÿ›
Bjรถrn Kautler

๐Ÿ’ป ๐Ÿ›
Blightbuster

๐Ÿ›
Bo Zhang

๐Ÿ›
Bob "Wombat" Hogg

๐Ÿ›
Bobby Wertman

๐Ÿ› -
Bolarinwa Saheed Olayemi

๐Ÿ’ป ๐Ÿ› +
Bolarinwa Saheed Olayemi

๐Ÿ’ป ๐Ÿ›
Boris Petrov

๐Ÿ›
Brad Kent

๐Ÿ›
Brandon Mikeska

๐Ÿ›
Brian Batronis

๐Ÿ›
Brian Johnson

๐Ÿ›
Brice Dutheil

๐Ÿ’ป ๐Ÿ› -
Bruno Ferreira

๐Ÿ› +
Bruno Ferreira

๐Ÿ›
Bruno Ritz

๐Ÿ›
Cameron Donaldson

๐Ÿ›
Carlos Macasaet

๐Ÿ›
Carsten Otto

๐Ÿ›
Charlie Housh

๐Ÿ›
Charlie Jonas

๐Ÿ› -
Chas Honton

๐Ÿ› +
Chas Honton

๐Ÿ›
Chen Yang

๐Ÿ›
Chotu

๐Ÿ›
Chris Smith

๐Ÿ›
Christian Hujer

๐Ÿ›
Christian Pontesegger

๐Ÿ›
ChristianWulf

๐Ÿ› -
Christofer Dutz

๐Ÿ’ป +
Christofer Dutz

๐Ÿ’ป
Christoffer Anselm

๐Ÿ›
Christophe Vidal

๐Ÿ›
Christopher Dancy

๐Ÿ›
Clemens Prill

๐Ÿ›
Clint Chester

๐Ÿ’ป ๐Ÿ›
Clรฉment Fournier

๐Ÿ’ป ๐Ÿ“– ๐Ÿ› ๐Ÿšง -
Codacy Badger

๐Ÿ› +
Codacy Badger

๐Ÿ›
Code-Nil

๐Ÿ›
ColColonCleaner

๐Ÿ›
Colin Ingarfield

๐Ÿ›
Craig Andrews

๐Ÿ›
Craig Muchinsky

๐Ÿ›
Cyril

๐Ÿ’ป ๐Ÿ› -
Dale

๐Ÿ’ป +
Dale

๐Ÿ’ป
Damien Jiang

๐Ÿ›
Dan Berindei

๐Ÿ›
Dan Rollo

๐Ÿ›
Dan Ziemba

๐Ÿ›
Daniel Gredler

๐Ÿ’ป
Daniel Jipa

๐Ÿ› -
Daniel Paul Searles

๐Ÿ’ป +
Daniel Paul Searles

๐Ÿ’ป
Daniel Reigada

๐Ÿ›
Danilo Pianini

๐Ÿ›
Darko

๐Ÿ›
David

๐Ÿ›
David Atkinson

๐Ÿ›
David Burstrรถm

๐Ÿ’ป ๐Ÿ› -
David Goatรฉ

๐Ÿ› +
David Goatรฉ

๐Ÿ›
David Golpira

๐Ÿ›
David Kovaล™รญk

๐Ÿ›
David M. Karr (fullname at gmail.com)

๐Ÿ›
David Renz

๐Ÿ’ป ๐Ÿ›
David Renz

๐Ÿ›
Deleted user

๐Ÿ› -
Dell Green

๐Ÿ› +
Dell Green

๐Ÿ›
Dem Pilafian

๐Ÿ›
Den

๐Ÿ›
Denis Borovikov

๐Ÿ’ป ๐Ÿ›
Dennie Reniers

๐Ÿ’ป ๐Ÿ›
Dennis Kieselhorst

๐Ÿ›
Derek P. Moore

๐Ÿ› -
Dichotomia

๐Ÿ› +
Dichotomia

๐Ÿ›
Dionisio Cortรฉs Fernรกndez

๐Ÿ’ป ๐Ÿ›
Dmitri Bourlatchkov

๐Ÿ›
Dmitriy Kuzmin

๐Ÿ›
Dmytro Dashenkov

๐Ÿ›
Drew Hall

๐Ÿ›
Dumitru Postoronca

๐Ÿ› -
Dylan Adams

๐Ÿ› +
Dylan Adams

๐Ÿ›
Eden Hao

๐Ÿ›
Edward Klimoshenko

๐Ÿ› ๐Ÿ’ป
Egor Bredikhin

๐Ÿ›
Elan P. Kugelmass

๐Ÿ›
Elder S.

๐Ÿ›
Emile

๐Ÿ› -
Eric

๐Ÿ› +
Eric

๐Ÿ›
Eric Kintzer

๐Ÿ›
Eric Perret

๐Ÿ›
Eric Squires

๐Ÿ›
Erich L Foster

๐Ÿ›
Erik Bleske

๐Ÿ›
Ernst Reissner

๐Ÿ› -
F.W. Dekker

๐Ÿ› +
F.W. Dekker

๐Ÿ›
FSchliephacke

๐Ÿ›
Facundo

๐Ÿ›
Federico Giust

๐Ÿ›
Fedor Sherstobitov

๐Ÿ›
Felix Lampe

๐Ÿ›
Filip Golonka

๐Ÿ› -
Filipe Esperandio

๐Ÿ’ป ๐Ÿ› +
Filipe Esperandio

๐Ÿ’ป ๐Ÿ›
Filippo Nova

๐Ÿ›
Francesco la Torre

๐Ÿ›
Francisco Duarte

๐Ÿ›
Frieder Bluemle

๐Ÿ›
Frits Jalvingh

๐Ÿ’ป ๐Ÿ›
G. Bazior

๐Ÿ› -
Gabe Henkes

๐Ÿ› +
Gabe Henkes

๐Ÿ›
Genoud Magloire

๐Ÿ›
Geoffrey555

๐Ÿ›
Georg Romstorfer

๐Ÿ›
Gio

๐Ÿ›
Gol

๐Ÿ›
Gonzalo Exequiel Ibars Ingman

๐Ÿ’ป ๐Ÿ› -
GooDer

๐Ÿ› +
GooDer

๐Ÿ›
Gregor Riegler

๐Ÿ›
Grzegorz Olszewski

๐Ÿ›
Gunther Schrijvers

๐Ÿ’ป ๐Ÿ›
Gustavo Krieger

๐Ÿ›
Guy Elsmore-Paddock

๐Ÿ›
Gรถrkem Mรผlayim

๐Ÿ› -
Hanzel Godinez

๐Ÿ› +
Hanzel Godinez

๐Ÿ›
Haoliang Chen

๐Ÿ›
Harsh Kukreja

๐Ÿ›
Heber

๐Ÿ›
Henning Schmiedehausen

๐Ÿ’ป ๐Ÿ›
Henning von Bargen

๐Ÿ’ป
Hervรฉ Boutemy

๐Ÿ› -
Himanshu Pandey

๐Ÿ› +
Himanshu Pandey

๐Ÿ›
Hokwang Lee

๐Ÿ›
Hooperbloob

๐Ÿ’ป
Hung PHAN

๐Ÿ›
IDoCodingStuffs

๐Ÿ’ป ๐Ÿ›
Iccen Gan

๐Ÿ›
Ignacio Mariano Tirabasso

๐Ÿ› -
Igor Melnichenko

๐Ÿ› +
Igor Melnichenko

๐Ÿ›
Igor Moreno

๐Ÿ›
Intelesis-MS

๐Ÿ›
Iroha_

๐Ÿ›
Ishan Srivastava

๐Ÿ›
Ivano Guerini

๐Ÿ›
Ivar Andreas Bonsaksen

๐Ÿ› -
Ivo ล mรญd

๐Ÿ› +
Ivo ล mรญd

๐Ÿ›
JJengility

๐Ÿ›
Jake Hemmerle

๐Ÿ›
James Harrison

๐Ÿ› ๐Ÿ’ป
Jan

๐Ÿ›
Jan Aertgeerts

๐Ÿ’ป ๐Ÿ›
Jan Brรผmmer

๐Ÿ› -
Jan Tล™รญska

๐Ÿ› +
Jan Tล™รญska

๐Ÿ›
Jan-Lukas Else

๐Ÿ›
Jason Qiu

๐Ÿ’ป ๐Ÿ“–
Jason Williams

๐Ÿ›
Jean-Paul Mayer

๐Ÿ›
Jean-Simon Larochelle

๐Ÿ›
Jeff Bartolotta

๐Ÿ’ป ๐Ÿ› -
Jeff Hube

๐Ÿ’ป ๐Ÿ› +
Jeff Hube

๐Ÿ’ป ๐Ÿ›
Jeff Jensen

๐Ÿ›
Jeff May

๐Ÿ›
Jens Gerdes

๐Ÿ›
Jeroen Borgers

๐Ÿ› ๐Ÿ’ป
Jerome Russ

๐Ÿ›
JerritEic

๐Ÿ’ป ๐Ÿ“– -
Jiri Pejchal

๐Ÿ› +
Jiri Pejchal

๐Ÿ›
Jithin Sunny

๐Ÿ›
Jiล™รญ ล korpil

๐Ÿ›
Joao Machado

๐Ÿ›
Jochen Krauss

๐Ÿ›
Johan Hammar

๐Ÿ›
John Karp

๐Ÿ› -
John Zhang

๐Ÿ› +
John Zhang

๐Ÿ›
John-Teng

๐Ÿ’ป ๐Ÿ›
Jon Moroney

๐Ÿ’ป ๐Ÿ›
Jonas Geiregat

๐Ÿ›
Jonathan Wiesel

๐Ÿ’ป ๐Ÿ›
Jordan

๐Ÿ›
Jordi Llach

๐Ÿ› -
Jorge Solรณrzano

๐Ÿ› +
Jorge Solรณrzano

๐Ÿ›
JorneVL

๐Ÿ›
Jose Palafox

๐Ÿ›
Jose Stovall

๐Ÿ›
Joseph

๐Ÿ’ป
Joseph Heenan

๐Ÿ›
Josh Feingold

๐Ÿ’ป ๐Ÿ› -
Josh Holthaus

๐Ÿ› +
Josh Holthaus

๐Ÿ›
Joshua S Arquilevich

๐Ÿ›
Joรฃo Ferreira

๐Ÿ’ป ๐Ÿ›
Joรฃo Pedro Schmitt

๐Ÿ›
Juan Martรญn Sotuyo Dodero

๐Ÿ’ป ๐Ÿ“– ๐Ÿ› ๐Ÿšง
Juan Pablo Civile

๐Ÿ›
Julian Voronetsky

๐Ÿ› -
Julien

๐Ÿ› +
Julien

๐Ÿ›
Julius

๐Ÿ›
JustPRV

๐Ÿ›
Jรถrn Huxhorn

๐Ÿ›
KThompso

๐Ÿ›
Kai Amundsen

๐Ÿ›
Karel Vervaeke

๐Ÿ› -
Karl-Andero Mere

๐Ÿ› +
Karl-Andero Mere

๐Ÿ›
Karl-Philipp Richter

๐Ÿ›
Karsten Silz

๐Ÿ›
Kazuma Watanabe

๐Ÿ›
Kev

๐Ÿ›
Keve Mรผller

๐Ÿ›
Kevin Guerra

๐Ÿ’ป -
Kevin Jones

๐Ÿ› +
Kevin Jones

๐Ÿ›
Kevin Wayne

๐Ÿ›
Kieran Black

๐Ÿ›
Kirill Zubov

๐Ÿ›
Kirk Clemens

๐Ÿ’ป ๐Ÿ›
Klaus Hartl

๐Ÿ›
Koen Van Looveren

๐Ÿ› -
Kris Scheibe

๐Ÿ’ป ๐Ÿ› +
Kris Scheibe

๐Ÿ’ป ๐Ÿ›
Kunal Thanki

๐Ÿ›
LaLucid

๐Ÿ’ป
Larry Diamond

๐Ÿ’ป ๐Ÿ›
Lars Knickrehm

๐Ÿ›
Leo Gutierrez

๐Ÿ›
LiGaOg

๐Ÿ’ป -
Lintsi

๐Ÿ› +
Lintsi

๐Ÿ›
Linus Fernandes

๐Ÿ›
Lixon Lookose

๐Ÿ›
Logesh

๐Ÿ›
Lorenzo Gabriele

๐Ÿ›
Loรฏc Ledoyen

๐Ÿ›
Lucas Silva

๐Ÿ› -
Lucas Soncini

๐Ÿ’ป ๐Ÿ› +
Lucas Soncini

๐Ÿ’ป ๐Ÿ›
Lukasz Slonina

๐Ÿ›
Lukebray

๐Ÿ›
Lyor Goldstein

๐Ÿ›
MCMicS

๐Ÿ›
Macarse

๐Ÿ›
Machine account for PMD

๐Ÿ’ป -
Maciek Siemczyk

๐Ÿ› +
Maciek Siemczyk

๐Ÿ›
Maikel Steneker

๐Ÿ’ป ๐Ÿ›
Maksim Moiseikin

๐Ÿ›
Manfred Koch

๐Ÿ›
Manuel Moya Ferrer

๐Ÿ’ป ๐Ÿ›
Manuel Ryan

๐Ÿ›
Marat Vyshegorodtsev

๐Ÿ› -
Marcel Hรคrle

๐Ÿ› +
Marcel Hรคrle

๐Ÿ›
Marcello Fialho

๐Ÿ›
Marcin Rataj

๐Ÿ›
Mark Adamcin

๐Ÿ›
Mark Hall

๐Ÿ’ป ๐Ÿ›
Mark Kolich

๐Ÿ›
Mark Pritchard

๐Ÿ› -
Markus Rathgeb

๐Ÿ› +
Markus Rathgeb

๐Ÿ›
Marquis Wang

๐Ÿ›
Martin Feldsztejn

๐Ÿ›
Martin Lehmann

๐Ÿ›
Martin Spamer

๐Ÿ›
Martin Tarjรกnyi

๐Ÿ›
MatFl

๐Ÿ› -
Mateusz Stefanski

๐Ÿ› +
Mateusz Stefanski

๐Ÿ›
Mathieu Gouin

๐Ÿ›
MatiasComercio

๐Ÿ’ป ๐Ÿ›
Matt Benson

๐Ÿ›
Matt De Poorter

๐Ÿ›
Matt Hargett

๐Ÿ’ป ๐Ÿ’ต
Matt Harrah

๐Ÿ› -
Matt Nelson

๐Ÿ› +
Matt Nelson

๐Ÿ›
Matthew Amos

๐Ÿ›
Matthew Duggan

๐Ÿ›
Matthew Hall

๐Ÿ›
Matรญas Fraga

๐Ÿ’ป ๐Ÿ›
Maxime Robert

๐Ÿ’ป ๐Ÿ›
MetaBF

๐Ÿ› -
Michael

๐Ÿ› +
Michael

๐Ÿ›
Michael Bell

๐Ÿ›
Michael Bernstein

๐Ÿ›
Michael Clay

๐Ÿ›
Michael Dombrowski

๐Ÿ›
Michael Hausegger

๐Ÿ›
Michael Hoefer

๐Ÿ› -
Michael Mรถbius

๐Ÿ› +
Michael Mรถbius

๐Ÿ›
Michael N. Lipp

๐Ÿ›
Michael Pellegrini

๐Ÿ›
Michal Kordas

๐Ÿ›
Michaล‚ Borek

๐Ÿ›
Michaล‚ Kuliล„ski

๐Ÿ›
Miguel Nรบรฑez Dรญaz-Montes

๐Ÿ› -
Mihai Ionut

๐Ÿ› +
Mihai Ionut

๐Ÿ›
Mirek Hankus

๐Ÿ›
Mladjan Gadzic

๐Ÿ›
MrAngry52

๐Ÿ›
Muminur Choudhury

๐Ÿ›
Mykhailo Palahuta

๐Ÿ’ป ๐Ÿ›
Nagendra Kumar Singh

๐Ÿ› -
Nahuel Barrios

๐Ÿ› +
Nahuel Barrios

๐Ÿ›
Nathan Braun

๐Ÿ›
Nathan Reynolds

๐Ÿ›
Nathan Reynolds

๐Ÿ›
Nathanaรซl

๐Ÿ›
Naveen

๐Ÿ’ป
Nazdravi

๐Ÿ› -
Neha-Dhonde

๐Ÿ› +
Neha-Dhonde

๐Ÿ›
Nicholas Doyle

๐Ÿ›
Nick Butcher

๐Ÿ›
Nico Gallinal

๐Ÿ›
Nicola Dal Maso

๐Ÿ›
Nicolas Filotto

๐Ÿ’ป
Nicolas Vuillamy

๐Ÿ“– -
Nikita Chursin

๐Ÿ› +
Nikita Chursin

๐Ÿ›
Niklas Baudy

๐Ÿ›
Nikolas Havrikov

๐Ÿ›
Nilesh Virkar

๐Ÿ›
Nimit Patel

๐Ÿ›
Niranjan Harpale

๐Ÿ›
Noah Sussman

๐Ÿ› -
Noah0120

๐Ÿ› +
Noah0120

๐Ÿ›
Noam Tamim

๐Ÿ›
Noel Grandin

๐Ÿ›
Olaf Haalstra

๐Ÿ›
Oleg Pavlenko

๐Ÿ›
Oleksii Dykov

๐Ÿ’ป
Oliver Eikemeier

๐Ÿ› -
Olivier Parent

๐Ÿ’ป ๐Ÿ› +
Olivier Parent

๐Ÿ’ป ๐Ÿ›
Ollie Abbey

๐Ÿ’ป ๐Ÿ›
OverDrone

๐Ÿ›
Ozan Gulle

๐Ÿ’ป ๐Ÿ›
PUNEET JAIN

๐Ÿ›
Parbati Bose

๐Ÿ›
Paul Berg

๐Ÿ› -
Pavel Bludov

๐Ÿ› +
Pavel Bludov

๐Ÿ›
Pavel Miฤka

๐Ÿ›
Pedro Nuno Santos

๐Ÿ›
Pedro Rijo

๐Ÿ›
Pelisse Romain

๐Ÿ’ป ๐Ÿ“– ๐Ÿ›
Per Abich

๐Ÿ’ป
Pete Davids

๐Ÿ› -
Peter Bruin

๐Ÿ› +
Peter Bruin

๐Ÿ›
Peter Chittum

๐Ÿ’ป ๐Ÿ›
Peter Cudmore

๐Ÿ›
Peter Kasson

๐Ÿ›
Peter Kofler

๐Ÿ›
Peter Paul Bakker

๐Ÿ’ป
Pham Hai Trung

๐Ÿ› -
Philip Graf

๐Ÿ’ป ๐Ÿ› +
Philip Graf

๐Ÿ’ป ๐Ÿ›
Philip Hachey

๐Ÿ›
Philippe Ozil

๐Ÿ›
Phinehas Artemix

๐Ÿ›
Phokham Nonava

๐Ÿ›
Piotr Szymaล„ski

๐Ÿ›
Piotrek ลปygieล‚o

๐Ÿ’ป ๐Ÿ› -
Pranay Jaiswal

๐Ÿ› +
Pranay Jaiswal

๐Ÿ›
Prasad Kamath

๐Ÿ›
Prasanna

๐Ÿ›
Presh-AR

๐Ÿ›
Puneet1726

๐Ÿ›
Rafael Cortรชs

๐Ÿ›
RaheemShaik999

๐Ÿ› -
RajeshR

๐Ÿ’ป ๐Ÿ› +
RajeshR

๐Ÿ’ป ๐Ÿ›
Ramachandra Mohan

๐Ÿ›
Ramel0921

๐Ÿ›
Raquel Pau

๐Ÿ›
Ravikiran Janardhana

๐Ÿ›
Reda Benhemmouche

๐Ÿ›
Renato Oliveira

๐Ÿ’ป ๐Ÿ› -
Rich DiCroce

๐Ÿ› +
Rich DiCroce

๐Ÿ›
Riot R1cket

๐Ÿ›
Rishabh Jain

๐Ÿ›
RishabhDeep Singh

๐Ÿ›
Robbie Martinus

๐Ÿ’ป ๐Ÿ›
Robert Henry

๐Ÿ›
Robert Painsi

๐Ÿ› -
Robert Russell

๐Ÿ› +
Robert Russell

๐Ÿ›
Robert Sรถsemann

๐Ÿ’ป ๐Ÿ“– ๐Ÿ“ข ๐Ÿ›
Robert Whitebit

๐Ÿ›
Robin Richtsfeld

๐Ÿ›
Robin Stocker

๐Ÿ’ป ๐Ÿ›
Robin Wils

๐Ÿ›
RochusOest

๐Ÿ› -
Rodolfo Noviski

๐Ÿ› +
Rodolfo Noviski

๐Ÿ›
Rodrigo Casara

๐Ÿ›
Rodrigo Fernandes

๐Ÿ›
Roman Salvador

๐Ÿ’ป ๐Ÿ›
Ronald Blaschke

๐Ÿ›
Rรณbert Papp

๐Ÿ›
Saikat Sengupta

๐Ÿ› -
Saksham Handu

๐Ÿ› +
Saksham Handu

๐Ÿ›
Saladoc

๐Ÿ›
Salesforce Bob Lightning

๐Ÿ›
Sam Carlberg

๐Ÿ›
Satoshi Kubo

๐Ÿ›
Scott Kennedy

๐Ÿ›
Scott Wells

๐Ÿ› ๐Ÿ’ป -
Scrsloota

๐Ÿ’ป +
Scrsloota

๐Ÿ’ป
Sebastian Bรถgl

๐Ÿ›
Sebastian Schuberth

๐Ÿ›
Sebastian Schwarz

๐Ÿ›
Sergey Gorbaty

๐Ÿ›
Sergey Kozlov

๐Ÿ›
Sergey Yanzin

๐Ÿ’ป ๐Ÿ› -
Seth Wilcox

๐Ÿ’ป +
Seth Wilcox

๐Ÿ’ป
Shubham

๐Ÿ’ป ๐Ÿ›
Simon Abykov

๐Ÿ’ป
Simon Xiao

๐Ÿ›
Srinivasan Venkatachalam

๐Ÿ›
Stanislav Gromov

๐Ÿ›
Stanislav Myachenkov

๐Ÿ’ป -
Stefan Birkner

๐Ÿ› +
Stefan Birkner

๐Ÿ›
Stefan Bohn

๐Ÿ›
Stefan Endrullis

๐Ÿ›
Stefan Klรถss-Schuster

๐Ÿ›
Stefan Wolf

๐Ÿ›
Stephan H. Wissel

๐Ÿ›
Stephen

๐Ÿ› -
Stephen Friedrich

๐Ÿ› +
Stephen Friedrich

๐Ÿ›
Steve Babula

๐Ÿ’ป
Stexxe

๐Ÿ›
Stian Lรฅgstad

๐Ÿ›
StuartClayton5

๐Ÿ›
Supun Arunoda

๐Ÿ›
Suren Abrahamyan

๐Ÿ› -
SwatiBGupta1110

๐Ÿ› +
SwatiBGupta1110

๐Ÿ›
SyedThoufich

๐Ÿ›
Szymon Sasin

๐Ÿ›
T-chuangxin

๐Ÿ›
TERAI Atsuhiro

๐Ÿ›
TIOBE Software

๐Ÿ’ป ๐Ÿ›
Taylor Smock

๐Ÿ› -
Techeira Damiรกn

๐Ÿ’ป ๐Ÿ› +
Techeira Damiรกn

๐Ÿ’ป ๐Ÿ›
Ted Husted

๐Ÿ›
TehBakker

๐Ÿ›
The Gitter Badger

๐Ÿ›
Theodoor

๐Ÿ›
Thiago Henrique Hรผpner

๐Ÿ›
Thibault Meyer

๐Ÿ› -
Thomas Gรผttler

๐Ÿ› +
Thomas Gรผttler

๐Ÿ›
Thomas Jones-Low

๐Ÿ›
Thomas Smith

๐Ÿ’ป ๐Ÿ›
ThrawnCA

๐Ÿ›
Thunderforge

๐Ÿ’ป ๐Ÿ›
Tim van der Lippe

๐Ÿ›
Tobias Weimer

๐Ÿ’ป ๐Ÿ› -
Tom Daly

๐Ÿ› +
Tom Daly

๐Ÿ›
Tomer Figenblat

๐Ÿ›
Tomi De Lucca

๐Ÿ’ป ๐Ÿ›
Torsten Kleiber

๐Ÿ›
TrackerSB

๐Ÿ›
Ullrich Hafner

๐Ÿ›
Utku Cuhadaroglu

๐Ÿ’ป ๐Ÿ› -
Valentin Brandl

๐Ÿ› +
Valentin Brandl

๐Ÿ›
Valeria

๐Ÿ›
Vasily Anisimov

๐Ÿ›
Vibhor Goyal

๐Ÿ›
Vickenty Fesunov

๐Ÿ›
Victor Noรซl

๐Ÿ›
Vincent Galloy

๐Ÿ’ป -
Vincent HUYNH

๐Ÿ› +
Vincent HUYNH

๐Ÿ›
Vincent Maurin

๐Ÿ›
Vincent Privat

๐Ÿ›
Vishhwas

๐Ÿ›
Vitaly

๐Ÿ›
Vitaly Polonetsky

๐Ÿ›
Vojtech Polivka

๐Ÿ› -
Vsevolod Zholobov

๐Ÿ› +
Vsevolod Zholobov

๐Ÿ›
Vyom Yadav

๐Ÿ’ป
Wang Shidong

๐Ÿ›
Waqas Ahmed

๐Ÿ›
Wayne J. Earl

๐Ÿ›
Wchenghui

๐Ÿ›
Will Winder

๐Ÿ› -
William Brockhus

๐Ÿ’ป ๐Ÿ› +
William Brockhus

๐Ÿ’ป ๐Ÿ›
Wilson Kurniawan

๐Ÿ›
Wim Deblauwe

๐Ÿ›
Woongsik Choi

๐Ÿ›
XenoAmess

๐Ÿ’ป ๐Ÿ›
Yang

๐Ÿ’ป
YaroslavTER

๐Ÿ› -
Young Chan

๐Ÿ’ป ๐Ÿ› +
Young Chan

๐Ÿ’ป ๐Ÿ›
YuJin Kim

๐Ÿ›
Yuri Dolzhenko

๐Ÿ›
Yurii Dubinka

๐Ÿ›
Zoltan Farkas

๐Ÿ›
Zustin

๐Ÿ›
aaronhurst-google

๐Ÿ› ๐Ÿ’ป -
alexmodis

๐Ÿ› +
alexmodis

๐Ÿ›
andreoss

๐Ÿ›
andrey81inmd

๐Ÿ’ป ๐Ÿ›
anicoara

๐Ÿ›
arunprasathav

๐Ÿ›
asiercamara

๐Ÿ›
astillich-igniti

๐Ÿ’ป -
avesolovksyy

๐Ÿ› +
avesolovksyy

๐Ÿ›
avishvat

๐Ÿ›
avivmu

๐Ÿ›
axelbarfod1

๐Ÿ›
b-3-n

๐Ÿ›
balbhadra9

๐Ÿ›
base23de

๐Ÿ› -
bergander

๐Ÿ› +
bergander

๐Ÿ›
berkam

๐Ÿ’ป ๐Ÿ›
breizh31

๐Ÿ›
caesarkim

๐Ÿ›
carolyujing

๐Ÿ›
cesares-basilico

๐Ÿ›
chrite

๐Ÿ› -
cobratbq

๐Ÿ› +
cobratbq

๐Ÿ›
coladict

๐Ÿ›
cosmoJFH

๐Ÿ›
cristalp

๐Ÿ›
crunsk

๐Ÿ›
cwholmes

๐Ÿ›
cyberjj999

๐Ÿ› -
cyw3

๐Ÿ› +
cyw3

๐Ÿ›
d1ss0nanz

๐Ÿ›
dalizi007

๐Ÿ’ป
danbrycefairsailcom

๐Ÿ›
dariansanity

๐Ÿ›
darrenmiliband

๐Ÿ›
davidburstrom

๐Ÿ› -
dbirkman-paloalto

๐Ÿ› +
dbirkman-paloalto

๐Ÿ›
deepak-patra

๐Ÿ›
dependabot[bot]

๐Ÿ’ป ๐Ÿ›
dinesh150

๐Ÿ›
diziaq

๐Ÿ›
dreaminpast123

๐Ÿ›
duanyanan

๐Ÿ› -
dutt-sanjay

๐Ÿ› +
dutt-sanjay

๐Ÿ›
dylanleung

๐Ÿ›
dzeigler

๐Ÿ›
ekkirala

๐Ÿ›
emersonmoura

๐Ÿ›
fairy

๐Ÿ›
filiprafalowicz

๐Ÿ’ป -
foxmason

๐Ÿ› +
foxmason

๐Ÿ›
frankegabor

๐Ÿ›
frankl

๐Ÿ›
freafrea

๐Ÿ›
fsapatin

๐Ÿ›
gracia19

๐Ÿ›
guo fei

๐Ÿ› -
gurmsc5

๐Ÿ› +
gurmsc5

๐Ÿ›
gwilymatgearset

๐Ÿ’ป ๐Ÿ›
haigsn

๐Ÿ›
hemanshu070

๐Ÿ›
henrik242

๐Ÿ›
hongpuwu

๐Ÿ›
hvbtup

๐Ÿ’ป ๐Ÿ› -
igniti GmbH

๐Ÿ› +
igniti GmbH

๐Ÿ›
ilovezfs

๐Ÿ›
itaigilo

๐Ÿ›
jakivey32

๐Ÿ›
jbennett2091

๐Ÿ›
jcamerin

๐Ÿ›
jkeener1

๐Ÿ› -
jmetertea

๐Ÿ› +
jmetertea

๐Ÿ›
johnra2

๐Ÿ’ป
josemanuelrolon

๐Ÿ’ป ๐Ÿ›
kabroxiko

๐Ÿ’ป ๐Ÿ›
karwer

๐Ÿ›
kaulonline

๐Ÿ›
kdaemonv

๐Ÿ› -
kenji21

๐Ÿ’ป ๐Ÿ› +
kenji21

๐Ÿ’ป ๐Ÿ›
kfranic

๐Ÿ›
khalidkh

๐Ÿ›
krzyk

๐Ÿ›
lasselindqvist

๐Ÿ›
lgemeinhardt

๐Ÿ›
lihuaib

๐Ÿ› -
lonelyma1021

๐Ÿ› +
lonelyma1021

๐Ÿ›
lpeddy

๐Ÿ›
lujiefsi

๐Ÿ’ป
lukelukes

๐Ÿ’ป
lyriccoder

๐Ÿ›
marcelmore

๐Ÿ›
matchbox

๐Ÿ› -
matthiaskraaz

๐Ÿ› +
matthiaskraaz

๐Ÿ›
meandonlyme

๐Ÿ›
mikesive

๐Ÿ›
milossesic

๐Ÿ›
mohan-chinnappan-n

๐Ÿ’ป
mriddell95

๐Ÿ›
mrlzh

๐Ÿ› -
msloan

๐Ÿ› +
msloan

๐Ÿ›
mucharlaravalika

๐Ÿ›
mvenneman

๐Ÿ›
nareshl119

๐Ÿ›
nicolas-harraudeau-sonarsource

๐Ÿ›
noerremark

๐Ÿ›
novsirion

๐Ÿ› -
oggboy

๐Ÿ› +
oggboy

๐Ÿ›
oinume

๐Ÿ›
orimarko

๐Ÿ’ป ๐Ÿ›
pacvz

๐Ÿ’ป
pallavi agarwal

๐Ÿ›
parksungrin

๐Ÿ›
patpatpat123

๐Ÿ› -
patriksevallius

๐Ÿ› +
patriksevallius

๐Ÿ›
pbrajesh1

๐Ÿ›
phoenix384

๐Ÿ›
piotrszymanski-sc

๐Ÿ’ป
plan3d

๐Ÿ›
poojasix

๐Ÿ›
prabhushrikant

๐Ÿ› -
pujitha8783

๐Ÿ› +
pujitha8783

๐Ÿ›
r-r-a-j

๐Ÿ›
raghujayjunk

๐Ÿ›
rajeshveera

๐Ÿ›
rajeswarreddy88

๐Ÿ›
recdevs

๐Ÿ›
reudismam

๐Ÿ’ป ๐Ÿ› -
rijkt

๐Ÿ› +
rijkt

๐Ÿ›
rillig-tk

๐Ÿ›
rmohan20

๐Ÿ’ป ๐Ÿ›
rxmicro

๐Ÿ›
ryan-gustafson

๐Ÿ’ป ๐Ÿ›
sabi0

๐Ÿ›
scais

๐Ÿ› -
sebbASF

๐Ÿ› +
sebbASF

๐Ÿ›
sergeygorbaty

๐Ÿ’ป
shilko2013

๐Ÿ›
shiomiyan

๐Ÿ“–
simeonKondr

๐Ÿ›
snajberk

๐Ÿ›
sniperrifle2004

๐Ÿ› -
snuyanzin

๐Ÿ› ๐Ÿ’ป +
snuyanzin

๐Ÿ› ๐Ÿ’ป
sratz

๐Ÿ›
stonio

๐Ÿ›
sturton

๐Ÿ’ป ๐Ÿ›
sudharmohan

๐Ÿ›
suruchidawar

๐Ÿ›
svenfinitiv

๐Ÿ› -
tashiscool

๐Ÿ› +
tashiscool

๐Ÿ›
test-git-hook

๐Ÿ›
testation21

๐Ÿ’ป ๐Ÿ›
thanosa

๐Ÿ›
tiandiyixian

๐Ÿ›
tobwoerk

๐Ÿ›
tprouvot

๐Ÿ› ๐Ÿ’ป -
trentchilders

๐Ÿ› +
trentchilders

๐Ÿ›
triandicAnt

๐Ÿ›
trishul14

๐Ÿ›
tsui

๐Ÿ›
winhkey

๐Ÿ›
witherspore

๐Ÿ›
wjljack

๐Ÿ› -
wuchiuwong

๐Ÿ› +
wuchiuwong

๐Ÿ›
xingsong

๐Ÿ›
xioayuge

๐Ÿ›
xnYi9wRezm

๐Ÿ’ป ๐Ÿ›
xuanuy

๐Ÿ›
xyf0921

๐Ÿ›
yalechen-cyw3

๐Ÿ› -
yasuharu-sato

๐Ÿ› +
yasuharu-sato

๐Ÿ›
zenglian

๐Ÿ›
zgrzyt93

๐Ÿ’ป ๐Ÿ›
zh3ng

๐Ÿ›
zt_soft

๐Ÿ›
ztt79

๐Ÿ›
zzzzfeng

๐Ÿ› -
รrpรกd Magosรกnyi

๐Ÿ› +
รrpรกd Magosรกnyi

๐Ÿ›
ไปป่ดตๆฐ

๐Ÿ›
่Œ…ๅปถๅฎ‰

๐Ÿ’ป From 8fa94cf2f59a83e2e585b8da350f826ad5f076df Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 30 Sep 2022 11:25:21 +0200 Subject: [PATCH 94/96] [doc] Update release notes (#4130) --- docs/pages/release_notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 84d0bc0712..6d58e865da 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -21,6 +21,7 @@ This is a {{ site.pmd.release_type }} release. ### External Contributions * [#4116](https://github.com/pmd/pmd/pull/4116): \[core] Fix missing --file arg in TreeExport CLI example - [@mohan-chinnappan-n](https://github.com/mohan-chinnappan-n) +* [#4130](https://github.com/pmd/pmd/pull/4130): \[ci] GitHub Workflows security hardening - [Alex](https://github.com/sashashura) (@sashashura) {% endtocmaker %} From 9e5efcb09d6433a8b3f4d9b80dc84f7c4f8f5d7d Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 30 Sep 2022 11:30:40 +0200 Subject: [PATCH 95/96] [doc] Update release notes (#4138) --- docs/pages/release_notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 2da44b2235..d5b7945569 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -37,6 +37,8 @@ from Lua. This means, that the Lua language in PMD can now parse both Lua and Lu * [#4085](https://github.com/pmd/pmd/issues/4085): \[java] UnnecessaryFullyQualifiedName false positive when nested and non-nested classes with the same name and in the same package are used together * java-design * [#4090](https://github.com/pmd/pmd/issues/4090): \[java] FinalFieldCouldBeStatic false positive with non-static synchronized block (regression in 6.48, worked with 6.47) +* scala + * [#4138](https://github.com/pmd/pmd/pull/4138): \[scala] Upgrade scala-library to 2.12.7 / 2.13.9 and scalameta to 4.6.0 ### API Changes From 398d05c3d3c4a4e51960116bb733792686bf512a Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 30 Sep 2022 11:33:09 +0200 Subject: [PATCH 96/96] [doc] Update release notes (#4072) --- docs/pages/release_notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index b45e8879f0..cc648801a9 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -48,6 +48,8 @@ Being based on a proper Antlr grammar, CPD can: * [#4031](https://github.com/pmd/pmd/issues/4031): \[core] If report is written to stdout, stdout should not be closed * [#4051](https://github.com/pmd/pmd/issues/4051): \[doc] Additional rulesets are not listed in documentation * [#4053](https://github.com/pmd/pmd/pull/4053): \[core] Allow building PMD under Java 18+ +* doc + * [#4072](https://github.com/pmd/pmd/pull/4072): \[doc] Add architecture decision records * java * [#4015](https://github.com/pmd/pmd/issues/4015): \[java] Support JDK 19 * java-bestpractices