npm-groovy-lint 9.2.0 → 9.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  ## UNRELEASED
4
4
 
5
+ - Add your updates here :)
6
+
7
+ ## [9.4.0] 2022-01-11
8
+
9
+ - Add [SARIF](https://sarifweb.azurewebsites.net/) output format using [node-sarif-builder](https://github.com/nvuillam/node-sarif-builder)
10
+
11
+ ## [9.3.2] 2022-01-09
12
+
13
+ - Upgrade cli-progress to avoid [colors lib boring but harmless hack](https://github.com/Marak/colors.js/issues/285)
14
+
15
+ ## [9.3.1] 2022-01-06
16
+
17
+ - Fix issue when used as module and with file containing spaces ([VsCodeGroovyLint #137](https://github.com/nvuillam/vscode-groovy-lint/issues/137))
18
+
19
+ ## [9.3.0] 2021-12-29
20
+
21
+ - Upgrade log4j dependencies because of [security issue](https://nvd.nist.gov/vuln/detail/CVE-2021-44832).
22
+
5
23
  ## [9.2.0] 2021-12-23
6
24
 
7
25
  - Upgrade log4j dependencies because of (another) [security issue](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45105) (#196)
package/README.md CHANGED
@@ -47,7 +47,7 @@ Any **question**, **problem** or **enhancement request** ? Ask [**here**](https:
47
47
  |-------------------------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
48
48
  | -p<br/> --path | String | Directory containing the files to lint<br/> Example: `./path/to/my/groovy/files` |
49
49
  | -f<br/> --files | String | Comma-separated list of Ant-style file patterns specifying files that must be included.<br/> Default: `"**/*.groovy,**/Jenkinsfile,**/*.gradle"`<br/>Examples:<br/> - `"**/Jenkinsfile"`<br/> - `"**/*.groovy"`<br/> - `"**/*.gradle"`<br/> - `"**/mySingleFile.groovy"` |
50
- | -o<br/> --output | String | Output format (txt,json,html,xml), or path to a file with one of these extensions<br/> Default: `txt`<br/> Examples:<br/> - `"txt"`<br/> - `"json"`<br/> - `"./logs/myLintResults.txt"`<br/> - `"./logs/myLintResults.json"`<br/> - `"./logs/myLintResults.html"`<br/> - `"./logs/myLintResults.xml"` |
50
+ | -o<br/> --output | String | Output format (txt,json,sarif,html,xml), or path to a file with one of these extensions<br/> Default: `txt`<br/> Examples:<br/> - `"txt"`<br/> - `"json"`<br/> - `"./logs/myLintResults.txt"`<br/> - `"./logs/myLintResults.sarif"`<br/> - `"./logs/myLintResults.html"`<br/> - `"./logs/myLintResults.xml"` |
51
51
  | -l<br/> --loglevel | String | Log level (error,warning or info)<br/>Default: info |
52
52
  | --failon | String | Defines the error level where CLI will fail (return code = 1). error,warning,info or none. Each failure level includes the more critical ones. |
53
53
  | -c<br/> --config | String | Custom path to [GroovyLint config file](#Configuration), or preset config `recommended|recommended-jenkinsfile|all`<br/> Default: Browse current directory to find `.groovylintrc.json|js|yml|package.json` config file, or default npm-groovy-lint config if not defined.<br/>Note: command-line arguments have priority on config file properties |
@@ -1,395 +1,395 @@
1
1
  {
2
- "rules": {
3
- "basic.AssertWithinFinallyBlock": {},
4
- "basic.AssignmentInConditional": {},
5
- "basic.BigDecimalInstantiation": {},
6
- "basic.BitwiseOperatorInConditional": {},
7
- "basic.BooleanGetBoolean": {},
8
- "basic.BrokenNullCheck": {},
9
- "basic.BrokenOddnessCheck": {},
10
- "basic.ClassForName": {},
11
- "basic.ComparisonOfTwoConstants": {},
12
- "basic.ComparisonWithSelf": {},
13
- "basic.ConstantAssertExpression": {},
14
- "basic.ConstantIfExpression": {},
15
- "basic.ConstantTernaryExpression": {},
16
- "basic.DeadCode": {},
17
- "basic.DoubleNegative": {},
18
- "basic.DuplicateCaseStatement": {},
19
- "basic.DuplicateMapKey": {},
20
- "basic.DuplicateSetValue": {},
21
- "basic.EmptyCatchBlock": {},
22
- "basic.EmptyClass": {},
23
- "basic.EmptyElseBlock": {},
24
- "basic.EmptyFinallyBlock": {},
25
- "basic.EmptyForStatement": {},
26
- "basic.EmptyIfStatement": {},
27
- "basic.EmptyInstanceInitializer": {},
28
- "basic.EmptyMethod": {},
29
- "basic.EmptyStaticInitializer": {},
30
- "basic.EmptySwitchStatement": {},
31
- "basic.EmptySynchronizedStatement": {},
32
- "basic.EmptyTryBlock": {},
33
- "basic.EmptyWhileStatement": {},
34
- "basic.EqualsAndHashCode": {},
35
- "basic.EqualsOverloaded": {},
36
- "basic.ExplicitGarbageCollection": {},
37
- "basic.ForLoopShouldBeWhileLoop": {},
38
- "basic.HardCodedWindowsFileSeparator": {},
39
- "basic.HardCodedWindowsRootDirectory": {},
40
- "basic.IntegerGetInteger": {},
41
- "basic.MultipleUnaryOperators": {},
42
- "basic.ParameterAssignmentInFilterClosure": {},
43
- "basic.RandomDoubleCoercedToZero": {},
44
- "basic.RemoveAllOnSelf": {},
45
- "basic.ReturnFromFinallyBlock": {},
46
- "basic.ThrowExceptionFromFinallyBlock": {},
47
- "braces.ElseBlockBraces": {},
48
- "braces.ForStatementBraces": {},
49
- "braces.IfStatementBraces": {},
50
- "braces.WhileStatementBraces": {},
51
- "comments.ClassJavadoc": {},
52
- "comments.JavadocConsecutiveEmptyLines": {},
53
- "comments.JavadocEmptyAuthorTag": {},
54
- "comments.JavadocEmptyExceptionTag": {},
55
- "comments.JavadocEmptyFirstLine": {},
56
- "comments.JavadocEmptyLastLine": {},
57
- "comments.JavadocEmptyParamTag": {},
58
- "comments.JavadocEmptyReturnTag": {},
59
- "comments.JavadocEmptySeeTag": {},
60
- "comments.JavadocEmptySinceTag": {},
61
- "comments.JavadocEmptyThrowsTag": {},
62
- "comments.JavadocEmptyVersionTag": {},
63
- "comments.JavadocMissingExceptionDescription": {},
64
- "comments.JavadocMissingParamDescription": {},
65
- "comments.JavadocMissingThrowsDescription": {},
66
- "concurrency.BusyWait": {},
67
- "concurrency.DoubleCheckedLocking": {},
68
- "concurrency.InconsistentPropertyLocking": {},
69
- "concurrency.InconsistentPropertySynchronization": {},
70
- "concurrency.NestedSynchronization": {},
71
- "concurrency.StaticCalendarField": {},
72
- "concurrency.StaticConnection": {},
73
- "concurrency.StaticDateFormatField": {},
74
- "concurrency.StaticMatcherField": {},
75
- "concurrency.StaticSimpleDateFormatField": {},
76
- "concurrency.SynchronizedMethod": {},
77
- "concurrency.SynchronizedOnBoxedPrimitive": {},
78
- "concurrency.SynchronizedOnGetClass": {},
79
- "concurrency.SynchronizedOnReentrantLock": {},
80
- "concurrency.SynchronizedOnString": {},
81
- "concurrency.SynchronizedOnThis": {},
82
- "concurrency.SynchronizedReadObjectMethod": {},
83
- "concurrency.SystemRunFinalizersOnExit": {},
84
- "concurrency.ThisReferenceEscapesConstructor": {},
85
- "concurrency.ThreadGroup": {},
86
- "concurrency.ThreadLocalNotStaticFinal": {},
87
- "concurrency.ThreadYield": {},
88
- "concurrency.UseOfNotifyMethod": {},
89
- "concurrency.VolatileArrayField": {},
90
- "concurrency.VolatileLongOrDoubleField": {},
91
- "concurrency.WaitOutsideOfWhileLoop": {},
92
- "convention.CompileStatic": {},
93
- "convention.ConfusingTernary": {},
94
- "convention.CouldBeElvis": {},
95
- "convention.CouldBeSwitchStatement": {},
96
- "convention.FieldTypeRequired": {},
97
- "convention.HashtableIsObsolete": {},
98
- "convention.IfStatementCouldBeTernary": {},
99
- "convention.ImplicitClosureParameter": {},
100
- "convention.ImplicitReturnStatement": {},
101
- "convention.InvertedCondition": {},
102
- "convention.InvertedIfElse": {},
103
- "convention.LongLiteralWithLowerCaseL": {},
104
- "convention.MethodParameterTypeRequired": {},
105
- "convention.MethodReturnTypeRequired": {},
106
- "convention.NoDef": {},
107
- "convention.NoDouble": {},
108
- "convention.NoFloat": {},
109
- "convention.NoJavaUtilDate": {},
110
- "convention.NoTabCharacter": {},
111
- "convention.ParameterReassignment": {},
112
- "convention.PublicMethodsBeforeNonPublicMethods": {},
113
- "convention.StaticFieldsBeforeInstanceFields": {},
114
- "convention.StaticMethodsBeforeInstanceMethods": {},
115
- "convention.TernaryCouldBeElvis": {},
116
- "convention.TrailingComma": {},
117
- "convention.VariableTypeRequired": {},
118
- "convention.VectorIsObsolete": {},
119
- "design.AbstractClassWithPublicConstructor": {},
120
- "design.AbstractClassWithoutAbstractMethod": {},
121
- "design.AssignmentToStaticFieldFromInstanceMethod": {},
122
- "design.BooleanMethodReturnsNull": {},
123
- "design.BuilderMethodWithSideEffects": {},
124
- "design.CloneableWithoutClone": {},
125
- "design.CloseWithoutCloseable": {},
126
- "design.CompareToWithoutComparable": {},
127
- "design.ConstantsOnlyInterface": {},
128
- "design.EmptyMethodInAbstractClass": {},
129
- "design.FinalClassWithProtectedMember": {},
130
- "design.ImplementationAsType": {},
131
- "design.Instanceof": {},
132
- "design.LocaleSetDefault": {},
133
- "design.NestedForLoop": {},
134
- "design.OptionalCollectionReturnType": {},
135
- "design.OptionalField": {},
136
- "design.OptionalMethodParameter": {},
137
- "design.PrivateFieldCouldBeFinal": {},
138
- "design.PublicInstanceField": {},
139
- "design.ReturnsNullInsteadOfEmptyArray": {},
140
- "design.ReturnsNullInsteadOfEmptyCollection": {},
141
- "design.SimpleDateFormatMissingLocale": {},
142
- "design.StatelessSingleton": {},
143
- "design.ToStringReturnsNull": {},
144
- "dry.DuplicateListLiteral": {},
145
- "dry.DuplicateMapLiteral": {},
146
- "dry.DuplicateNumberLiteral": {},
147
- "dry.DuplicateStringLiteral": {},
148
- "enhanced.CloneWithoutCloneable": {},
149
- "enhanced.JUnitAssertEqualsConstantActualValue": {},
150
- "enhanced.MissingOverrideAnnotation": {},
151
- "enhanced.UnsafeImplementationAsMap": {},
152
- "exceptions.CatchArrayIndexOutOfBoundsException": {},
153
- "exceptions.CatchError": {},
154
- "exceptions.CatchException": {},
155
- "exceptions.CatchIllegalMonitorStateException": {},
156
- "exceptions.CatchIndexOutOfBoundsException": {},
157
- "exceptions.CatchNullPointerException": {},
158
- "exceptions.CatchRuntimeException": {},
159
- "exceptions.CatchThrowable": {},
160
- "exceptions.ConfusingClassNamedException": {},
161
- "exceptions.ExceptionExtendsError": {},
162
- "exceptions.ExceptionExtendsThrowable": {},
163
- "exceptions.ExceptionNotThrown": {},
164
- "exceptions.MissingNewInThrowStatement": {},
165
- "exceptions.ReturnNullFromCatchBlock": {},
166
- "exceptions.SwallowThreadDeath": {},
167
- "exceptions.ThrowError": {},
168
- "exceptions.ThrowException": {},
169
- "exceptions.ThrowNullPointerException": {},
170
- "exceptions.ThrowRuntimeException": {},
171
- "exceptions.ThrowThrowable": {},
172
- "formatting.BlankLineBeforePackage": {},
173
- "formatting.BlockEndsWithBlankLine": {},
174
- "formatting.BlockStartsWithBlankLine": {},
175
- "formatting.BracesForClass": {},
176
- "formatting.BracesForForLoop": {},
177
- "formatting.BracesForIfElse": {},
178
- "formatting.BracesForMethod": {},
179
- "formatting.BracesForTryCatchFinally": {},
180
- "formatting.ClassEndsWithBlankLine": {},
181
- "formatting.ClassStartsWithBlankLine": {},
182
- "formatting.ClosureStatementOnOpeningLineOfMultipleLineClosure": {},
183
- "formatting.ConsecutiveBlankLines": {},
184
- "formatting.FileEndsWithoutNewline": {},
185
- "formatting.Indentation": {},
186
- "formatting.LineLength": {},
187
- "formatting.MissingBlankLineAfterImports": {},
188
- "formatting.MissingBlankLineAfterPackage": {},
189
- "formatting.MissingBlankLineBeforeAnnotatedField": {},
190
- "formatting.SpaceAfterCatch": {},
191
- "formatting.SpaceAfterClosingBrace": {},
192
- "formatting.SpaceAfterComma": {},
193
- "formatting.SpaceAfterFor": {},
194
- "formatting.SpaceAfterIf": {},
195
- "formatting.SpaceAfterMethodCallName": {},
196
- "formatting.SpaceAfterMethodDeclarationName": {},
197
- "formatting.SpaceAfterNotOperator": {},
198
- "formatting.SpaceAfterOpeningBrace": {},
199
- "formatting.SpaceAfterSemicolon": {},
200
- "formatting.SpaceAfterSwitch": {},
201
- "formatting.SpaceAfterWhile": {},
202
- "formatting.SpaceAroundClosureArrow": {},
203
- "formatting.SpaceAroundMapEntryColon": {},
204
- "formatting.SpaceAroundOperator": {},
205
- "formatting.SpaceBeforeClosingBrace": {},
206
- "formatting.SpaceBeforeOpeningBrace": {},
207
- "formatting.SpaceInsideParentheses": {},
208
- "formatting.TrailingWhitespace": {},
209
- "generic.IllegalClassMember": {},
210
- "generic.IllegalClassReference": {},
211
- "generic.IllegalPackageReference": {},
212
- "generic.IllegalRegex": {},
213
- "generic.IllegalString": {},
214
- "generic.IllegalSubclass": {},
215
- "generic.RequiredRegex": {},
216
- "generic.RequiredString": {},
217
- "generic.StatelessClass": {},
218
- "grails.GrailsDomainGormMethods": {},
219
- "grails.GrailsDomainHasEquals": {},
220
- "grails.GrailsDomainHasToString": {},
221
- "grails.GrailsDomainReservedSqlKeywordName": {},
222
- "grails.GrailsDomainStringPropertyMaxSize": {},
223
- "grails.GrailsDomainWithServiceReference": {},
224
- "grails.GrailsDuplicateConstraint": {},
225
- "grails.GrailsDuplicateMapping": {},
226
- "grails.GrailsMassAssignment": {},
227
- "grails.GrailsPublicControllerMethod": {},
228
- "grails.GrailsServletContextReference": {},
229
- "grails.GrailsStatelessService": {},
230
- "groovyism.AssignCollectionSort": {},
231
- "groovyism.AssignCollectionUnique": {},
232
- "groovyism.ClosureAsLastMethodParameter": {},
233
- "groovyism.CollectAllIsDeprecated": {},
234
- "groovyism.ConfusingMultipleReturns": {},
235
- "groovyism.ExplicitArrayListInstantiation": {},
236
- "groovyism.ExplicitCallToAndMethod": {},
237
- "groovyism.ExplicitCallToCompareToMethod": {},
238
- "groovyism.ExplicitCallToDivMethod": {},
239
- "groovyism.ExplicitCallToEqualsMethod": {},
240
- "groovyism.ExplicitCallToGetAtMethod": {},
241
- "groovyism.ExplicitCallToLeftShiftMethod": {},
242
- "groovyism.ExplicitCallToMinusMethod": {},
243
- "groovyism.ExplicitCallToModMethod": {},
244
- "groovyism.ExplicitCallToMultiplyMethod": {},
245
- "groovyism.ExplicitCallToOrMethod": {},
246
- "groovyism.ExplicitCallToPlusMethod": {},
247
- "groovyism.ExplicitCallToPowerMethod": {},
248
- "groovyism.ExplicitCallToPutAtMethod": {},
249
- "groovyism.ExplicitCallToRightShiftMethod": {},
250
- "groovyism.ExplicitCallToXorMethod": {},
251
- "groovyism.ExplicitHashMapInstantiation": {},
252
- "groovyism.ExplicitHashSetInstantiation": {},
253
- "groovyism.ExplicitLinkedHashMapInstantiation": {},
254
- "groovyism.ExplicitLinkedListInstantiation": {},
255
- "groovyism.ExplicitStackInstantiation": {},
256
- "groovyism.ExplicitTreeSetInstantiation": {},
257
- "groovyism.GStringAsMapKey": {},
258
- "groovyism.GStringExpressionWithinString": {},
259
- "groovyism.GetterMethodCouldBeProperty": {},
260
- "groovyism.GroovyLangImmutable": {},
261
- "groovyism.UseCollectMany": {},
262
- "groovyism.UseCollectNested": {},
263
- "imports.DuplicateImport": {},
264
- "imports.ImportFromSamePackage": {},
265
- "imports.ImportFromSunPackages": {},
266
- "imports.MisorderedStaticImports": {},
267
- "imports.NoWildcardImports": {},
268
- "imports.UnnecessaryGroovyImport": {},
269
- "imports.UnusedImport": {},
270
- "jdbc.DirectConnectionManagement": {},
271
- "jdbc.JdbcConnectionReference": {},
272
- "jdbc.JdbcResultSetReference": {},
273
- "jdbc.JdbcStatementReference": {},
274
- "junit.ChainedTest": {},
275
- "junit.CoupledTestCase": {},
276
- "junit.JUnitAssertAlwaysFails": {},
277
- "junit.JUnitAssertAlwaysSucceeds": {},
278
- "junit.JUnitFailWithoutMessage": {},
279
- "junit.JUnitLostTest": {},
280
- "junit.JUnitPublicField": {},
281
- "junit.JUnitPublicNonTestMethod": {},
282
- "junit.JUnitPublicProperty": {},
283
- "junit.JUnitSetUpCallsSuper": {},
284
- "junit.JUnitStyleAssertions": {},
285
- "junit.JUnitTearDownCallsSuper": {},
286
- "junit.JUnitTestMethodWithoutAssert": {},
287
- "junit.JUnitUnnecessarySetUp": {},
288
- "junit.JUnitUnnecessaryTearDown": {},
289
- "junit.JUnitUnnecessaryThrowsException": {},
290
- "junit.SpockIgnoreRestUsed": {},
291
- "junit.UnnecessaryFail": {},
292
- "junit.UseAssertEqualsInsteadOfAssertTrue": {},
293
- "junit.UseAssertFalseInsteadOfNegation": {},
294
- "junit.UseAssertNullInsteadOfAssertEquals": {},
295
- "junit.UseAssertSameInsteadOfAssertTrue": {},
296
- "junit.UseAssertTrueInsteadOfAssertEquals": {},
297
- "junit.UseAssertTrueInsteadOfNegation": {},
298
- "logging.LoggerForDifferentClass": {},
299
- "logging.LoggerWithWrongModifiers": {},
300
- "logging.LoggingSwallowsStacktrace": {},
301
- "logging.MultipleLoggers": {},
302
- "logging.PrintStackTrace": {},
303
- "logging.Println": {},
304
- "logging.SystemErrPrint": {},
305
- "logging.SystemOutPrint": {},
306
- "naming.AbstractClassName": {},
307
- "naming.ClassName": {},
308
- "naming.ClassNameSameAsFilename": {},
309
- "naming.ClassNameSameAsSuperclass": {},
310
- "naming.ConfusingMethodName": {},
311
- "naming.FactoryMethodName": {},
312
- "naming.FieldName": {},
313
- "naming.InterfaceName": {},
314
- "naming.InterfaceNameSameAsSuperInterface": {},
315
- "naming.MethodName": {},
316
- "naming.ObjectOverrideMisspelledMethodName": {},
317
- "naming.PackageName": {},
318
- "naming.PackageNameMatchesFilePath": {},
319
- "naming.ParameterName": {},
320
- "naming.PropertyName": {},
321
- "naming.VariableName": {},
322
- "security.FileCreateTempFile": {},
323
- "security.InsecureRandom": {},
324
- "security.JavaIoPackageAccess": {},
325
- "security.NonFinalPublicField": {},
326
- "security.NonFinalSubclassOfSensitiveInterface": {},
327
- "security.ObjectFinalize": {},
328
- "security.PublicFinalizeMethod": {},
329
- "security.SystemExit": {},
330
- "security.UnsafeArrayDeclaration": {},
331
- "serialization.EnumCustomSerializationIgnored": {},
332
- "serialization.SerialPersistentFields": {},
333
- "serialization.SerialVersionUID": {},
334
- "serialization.SerializableClassMustDefineSerialVersionUID": {},
335
- "size.ClassSize": {},
336
- "size.MethodCount": {},
337
- "size.MethodSize": {},
338
- "size.NestedBlockDepth": {},
339
- "size.ParameterCount": {},
340
- "unnecessary.AddEmptyString": {},
341
- "unnecessary.ConsecutiveLiteralAppends": {},
342
- "unnecessary.ConsecutiveStringConcatenation": {},
343
- "unnecessary.UnnecessaryBigDecimalInstantiation": {},
344
- "unnecessary.UnnecessaryBigIntegerInstantiation": {},
345
- "unnecessary.UnnecessaryBooleanExpression": {},
346
- "unnecessary.UnnecessaryBooleanInstantiation": {},
347
- "unnecessary.UnnecessaryCallForLastElement": {},
348
- "unnecessary.UnnecessaryCallToSubstring": {},
349
- "unnecessary.UnnecessaryCast": {},
350
- "unnecessary.UnnecessaryCatchBlock": {},
351
- "unnecessary.UnnecessaryCollectCall": {},
352
- "unnecessary.UnnecessaryCollectionCall": {},
353
- "unnecessary.UnnecessaryConstructor": {},
354
- "unnecessary.UnnecessaryDefInFieldDeclaration": {},
355
- "unnecessary.UnnecessaryDefInMethodDeclaration": {},
356
- "unnecessary.UnnecessaryDefInVariableDeclaration": {},
357
- "unnecessary.UnnecessaryDotClass": {},
358
- "unnecessary.UnnecessaryDoubleInstantiation": {},
359
- "unnecessary.UnnecessaryElseStatement": {},
360
- "unnecessary.UnnecessaryFinalOnPrivateMethod": {},
361
- "unnecessary.UnnecessaryFloatInstantiation": {},
362
- "unnecessary.UnnecessaryGString": {},
363
- "unnecessary.UnnecessaryGetter": {},
364
- "unnecessary.UnnecessaryIfStatement": {},
365
- "unnecessary.UnnecessaryInstanceOfCheck": {},
366
- "unnecessary.UnnecessaryInstantiationToGetClass": {},
367
- "unnecessary.UnnecessaryIntegerInstantiation": {},
368
- "unnecessary.UnnecessaryLongInstantiation": {},
369
- "unnecessary.UnnecessaryModOne": {},
370
- "unnecessary.UnnecessaryNullCheck": {},
371
- "unnecessary.UnnecessaryNullCheckBeforeInstanceOf": {},
372
- "unnecessary.UnnecessaryObjectReferences": {},
373
- "unnecessary.UnnecessaryOverridingMethod": {},
374
- "unnecessary.UnnecessaryPackageReference": {},
375
- "unnecessary.UnnecessaryParenthesesForMethodCallWithClosure": {},
376
- "unnecessary.UnnecessaryPublicModifier": {},
377
- "unnecessary.UnnecessaryReturnKeyword": {},
378
- "unnecessary.UnnecessarySafeNavigationOperator": {},
379
- "unnecessary.UnnecessarySelfAssignment": {},
380
- "unnecessary.UnnecessarySemicolon": {},
381
- "unnecessary.UnnecessarySetter": {},
382
- "unnecessary.UnnecessaryStringInstantiation": {},
383
- "unnecessary.UnnecessarySubstring": {},
384
- "unnecessary.UnnecessaryTernaryExpression": {},
385
- "unnecessary.UnnecessaryToString": {},
386
- "unnecessary.UnnecessaryTransientModifier": {},
387
- "unused.UnusedArray": {},
388
- "unused.UnusedMethodParameter": {},
389
- "unused.UnusedObject": {},
390
- "unused.UnusedPrivateField": {},
391
- "unused.UnusedPrivateMethod": {},
392
- "unused.UnusedPrivateMethodParameter": {},
393
- "unused.UnusedVariable": {}
394
- }
395
- }
2
+ "rules": {
3
+ "basic.AssertWithinFinallyBlock": {},
4
+ "basic.AssignmentInConditional": {},
5
+ "basic.BigDecimalInstantiation": {},
6
+ "basic.BitwiseOperatorInConditional": {},
7
+ "basic.BooleanGetBoolean": {},
8
+ "basic.BrokenNullCheck": {},
9
+ "basic.BrokenOddnessCheck": {},
10
+ "basic.ClassForName": {},
11
+ "basic.ComparisonOfTwoConstants": {},
12
+ "basic.ComparisonWithSelf": {},
13
+ "basic.ConstantAssertExpression": {},
14
+ "basic.ConstantIfExpression": {},
15
+ "basic.ConstantTernaryExpression": {},
16
+ "basic.DeadCode": {},
17
+ "basic.DoubleNegative": {},
18
+ "basic.DuplicateCaseStatement": {},
19
+ "basic.DuplicateMapKey": {},
20
+ "basic.DuplicateSetValue": {},
21
+ "basic.EmptyCatchBlock": {},
22
+ "basic.EmptyClass": {},
23
+ "basic.EmptyElseBlock": {},
24
+ "basic.EmptyFinallyBlock": {},
25
+ "basic.EmptyForStatement": {},
26
+ "basic.EmptyIfStatement": {},
27
+ "basic.EmptyInstanceInitializer": {},
28
+ "basic.EmptyMethod": {},
29
+ "basic.EmptyStaticInitializer": {},
30
+ "basic.EmptySwitchStatement": {},
31
+ "basic.EmptySynchronizedStatement": {},
32
+ "basic.EmptyTryBlock": {},
33
+ "basic.EmptyWhileStatement": {},
34
+ "basic.EqualsAndHashCode": {},
35
+ "basic.EqualsOverloaded": {},
36
+ "basic.ExplicitGarbageCollection": {},
37
+ "basic.ForLoopShouldBeWhileLoop": {},
38
+ "basic.HardCodedWindowsFileSeparator": {},
39
+ "basic.HardCodedWindowsRootDirectory": {},
40
+ "basic.IntegerGetInteger": {},
41
+ "basic.MultipleUnaryOperators": {},
42
+ "basic.ParameterAssignmentInFilterClosure": {},
43
+ "basic.RandomDoubleCoercedToZero": {},
44
+ "basic.RemoveAllOnSelf": {},
45
+ "basic.ReturnFromFinallyBlock": {},
46
+ "basic.ThrowExceptionFromFinallyBlock": {},
47
+ "braces.ElseBlockBraces": {},
48
+ "braces.ForStatementBraces": {},
49
+ "braces.IfStatementBraces": {},
50
+ "braces.WhileStatementBraces": {},
51
+ "comments.ClassJavadoc": {},
52
+ "comments.JavadocConsecutiveEmptyLines": {},
53
+ "comments.JavadocEmptyAuthorTag": {},
54
+ "comments.JavadocEmptyExceptionTag": {},
55
+ "comments.JavadocEmptyFirstLine": {},
56
+ "comments.JavadocEmptyLastLine": {},
57
+ "comments.JavadocEmptyParamTag": {},
58
+ "comments.JavadocEmptyReturnTag": {},
59
+ "comments.JavadocEmptySeeTag": {},
60
+ "comments.JavadocEmptySinceTag": {},
61
+ "comments.JavadocEmptyThrowsTag": {},
62
+ "comments.JavadocEmptyVersionTag": {},
63
+ "comments.JavadocMissingExceptionDescription": {},
64
+ "comments.JavadocMissingParamDescription": {},
65
+ "comments.JavadocMissingThrowsDescription": {},
66
+ "concurrency.BusyWait": {},
67
+ "concurrency.DoubleCheckedLocking": {},
68
+ "concurrency.InconsistentPropertyLocking": {},
69
+ "concurrency.InconsistentPropertySynchronization": {},
70
+ "concurrency.NestedSynchronization": {},
71
+ "concurrency.StaticCalendarField": {},
72
+ "concurrency.StaticConnection": {},
73
+ "concurrency.StaticDateFormatField": {},
74
+ "concurrency.StaticMatcherField": {},
75
+ "concurrency.StaticSimpleDateFormatField": {},
76
+ "concurrency.SynchronizedMethod": {},
77
+ "concurrency.SynchronizedOnBoxedPrimitive": {},
78
+ "concurrency.SynchronizedOnGetClass": {},
79
+ "concurrency.SynchronizedOnReentrantLock": {},
80
+ "concurrency.SynchronizedOnString": {},
81
+ "concurrency.SynchronizedOnThis": {},
82
+ "concurrency.SynchronizedReadObjectMethod": {},
83
+ "concurrency.SystemRunFinalizersOnExit": {},
84
+ "concurrency.ThisReferenceEscapesConstructor": {},
85
+ "concurrency.ThreadGroup": {},
86
+ "concurrency.ThreadLocalNotStaticFinal": {},
87
+ "concurrency.ThreadYield": {},
88
+ "concurrency.UseOfNotifyMethod": {},
89
+ "concurrency.VolatileArrayField": {},
90
+ "concurrency.VolatileLongOrDoubleField": {},
91
+ "concurrency.WaitOutsideOfWhileLoop": {},
92
+ "convention.CompileStatic": {},
93
+ "convention.ConfusingTernary": {},
94
+ "convention.CouldBeElvis": {},
95
+ "convention.CouldBeSwitchStatement": {},
96
+ "convention.FieldTypeRequired": {},
97
+ "convention.HashtableIsObsolete": {},
98
+ "convention.IfStatementCouldBeTernary": {},
99
+ "convention.ImplicitClosureParameter": {},
100
+ "convention.ImplicitReturnStatement": {},
101
+ "convention.InvertedCondition": {},
102
+ "convention.InvertedIfElse": {},
103
+ "convention.LongLiteralWithLowerCaseL": {},
104
+ "convention.MethodParameterTypeRequired": {},
105
+ "convention.MethodReturnTypeRequired": {},
106
+ "convention.NoDef": {},
107
+ "convention.NoDouble": {},
108
+ "convention.NoFloat": {},
109
+ "convention.NoJavaUtilDate": {},
110
+ "convention.NoTabCharacter": {},
111
+ "convention.ParameterReassignment": {},
112
+ "convention.PublicMethodsBeforeNonPublicMethods": {},
113
+ "convention.StaticFieldsBeforeInstanceFields": {},
114
+ "convention.StaticMethodsBeforeInstanceMethods": {},
115
+ "convention.TernaryCouldBeElvis": {},
116
+ "convention.TrailingComma": {},
117
+ "convention.VariableTypeRequired": {},
118
+ "convention.VectorIsObsolete": {},
119
+ "design.AbstractClassWithPublicConstructor": {},
120
+ "design.AbstractClassWithoutAbstractMethod": {},
121
+ "design.AssignmentToStaticFieldFromInstanceMethod": {},
122
+ "design.BooleanMethodReturnsNull": {},
123
+ "design.BuilderMethodWithSideEffects": {},
124
+ "design.CloneableWithoutClone": {},
125
+ "design.CloseWithoutCloseable": {},
126
+ "design.CompareToWithoutComparable": {},
127
+ "design.ConstantsOnlyInterface": {},
128
+ "design.EmptyMethodInAbstractClass": {},
129
+ "design.FinalClassWithProtectedMember": {},
130
+ "design.ImplementationAsType": {},
131
+ "design.Instanceof": {},
132
+ "design.LocaleSetDefault": {},
133
+ "design.NestedForLoop": {},
134
+ "design.OptionalCollectionReturnType": {},
135
+ "design.OptionalField": {},
136
+ "design.OptionalMethodParameter": {},
137
+ "design.PrivateFieldCouldBeFinal": {},
138
+ "design.PublicInstanceField": {},
139
+ "design.ReturnsNullInsteadOfEmptyArray": {},
140
+ "design.ReturnsNullInsteadOfEmptyCollection": {},
141
+ "design.SimpleDateFormatMissingLocale": {},
142
+ "design.StatelessSingleton": {},
143
+ "design.ToStringReturnsNull": {},
144
+ "dry.DuplicateListLiteral": {},
145
+ "dry.DuplicateMapLiteral": {},
146
+ "dry.DuplicateNumberLiteral": {},
147
+ "dry.DuplicateStringLiteral": {},
148
+ "enhanced.CloneWithoutCloneable": {},
149
+ "enhanced.JUnitAssertEqualsConstantActualValue": {},
150
+ "enhanced.MissingOverrideAnnotation": {},
151
+ "enhanced.UnsafeImplementationAsMap": {},
152
+ "exceptions.CatchArrayIndexOutOfBoundsException": {},
153
+ "exceptions.CatchError": {},
154
+ "exceptions.CatchException": {},
155
+ "exceptions.CatchIllegalMonitorStateException": {},
156
+ "exceptions.CatchIndexOutOfBoundsException": {},
157
+ "exceptions.CatchNullPointerException": {},
158
+ "exceptions.CatchRuntimeException": {},
159
+ "exceptions.CatchThrowable": {},
160
+ "exceptions.ConfusingClassNamedException": {},
161
+ "exceptions.ExceptionExtendsError": {},
162
+ "exceptions.ExceptionExtendsThrowable": {},
163
+ "exceptions.ExceptionNotThrown": {},
164
+ "exceptions.MissingNewInThrowStatement": {},
165
+ "exceptions.ReturnNullFromCatchBlock": {},
166
+ "exceptions.SwallowThreadDeath": {},
167
+ "exceptions.ThrowError": {},
168
+ "exceptions.ThrowException": {},
169
+ "exceptions.ThrowNullPointerException": {},
170
+ "exceptions.ThrowRuntimeException": {},
171
+ "exceptions.ThrowThrowable": {},
172
+ "formatting.BlankLineBeforePackage": {},
173
+ "formatting.BlockEndsWithBlankLine": {},
174
+ "formatting.BlockStartsWithBlankLine": {},
175
+ "formatting.BracesForClass": {},
176
+ "formatting.BracesForForLoop": {},
177
+ "formatting.BracesForIfElse": {},
178
+ "formatting.BracesForMethod": {},
179
+ "formatting.BracesForTryCatchFinally": {},
180
+ "formatting.ClassEndsWithBlankLine": {},
181
+ "formatting.ClassStartsWithBlankLine": {},
182
+ "formatting.ClosureStatementOnOpeningLineOfMultipleLineClosure": {},
183
+ "formatting.ConsecutiveBlankLines": {},
184
+ "formatting.FileEndsWithoutNewline": {},
185
+ "formatting.Indentation": {},
186
+ "formatting.LineLength": {},
187
+ "formatting.MissingBlankLineAfterImports": {},
188
+ "formatting.MissingBlankLineAfterPackage": {},
189
+ "formatting.MissingBlankLineBeforeAnnotatedField": {},
190
+ "formatting.SpaceAfterCatch": {},
191
+ "formatting.SpaceAfterClosingBrace": {},
192
+ "formatting.SpaceAfterComma": {},
193
+ "formatting.SpaceAfterFor": {},
194
+ "formatting.SpaceAfterIf": {},
195
+ "formatting.SpaceAfterMethodCallName": {},
196
+ "formatting.SpaceAfterMethodDeclarationName": {},
197
+ "formatting.SpaceAfterNotOperator": {},
198
+ "formatting.SpaceAfterOpeningBrace": {},
199
+ "formatting.SpaceAfterSemicolon": {},
200
+ "formatting.SpaceAfterSwitch": {},
201
+ "formatting.SpaceAfterWhile": {},
202
+ "formatting.SpaceAroundClosureArrow": {},
203
+ "formatting.SpaceAroundMapEntryColon": {},
204
+ "formatting.SpaceAroundOperator": {},
205
+ "formatting.SpaceBeforeClosingBrace": {},
206
+ "formatting.SpaceBeforeOpeningBrace": {},
207
+ "formatting.SpaceInsideParentheses": {},
208
+ "formatting.TrailingWhitespace": {},
209
+ "generic.IllegalClassMember": {},
210
+ "generic.IllegalClassReference": {},
211
+ "generic.IllegalPackageReference": {},
212
+ "generic.IllegalRegex": {},
213
+ "generic.IllegalString": {},
214
+ "generic.IllegalSubclass": {},
215
+ "generic.RequiredRegex": {},
216
+ "generic.RequiredString": {},
217
+ "generic.StatelessClass": {},
218
+ "grails.GrailsDomainGormMethods": {},
219
+ "grails.GrailsDomainHasEquals": {},
220
+ "grails.GrailsDomainHasToString": {},
221
+ "grails.GrailsDomainReservedSqlKeywordName": {},
222
+ "grails.GrailsDomainStringPropertyMaxSize": {},
223
+ "grails.GrailsDomainWithServiceReference": {},
224
+ "grails.GrailsDuplicateConstraint": {},
225
+ "grails.GrailsDuplicateMapping": {},
226
+ "grails.GrailsMassAssignment": {},
227
+ "grails.GrailsPublicControllerMethod": {},
228
+ "grails.GrailsServletContextReference": {},
229
+ "grails.GrailsStatelessService": {},
230
+ "groovyism.AssignCollectionSort": {},
231
+ "groovyism.AssignCollectionUnique": {},
232
+ "groovyism.ClosureAsLastMethodParameter": {},
233
+ "groovyism.CollectAllIsDeprecated": {},
234
+ "groovyism.ConfusingMultipleReturns": {},
235
+ "groovyism.ExplicitArrayListInstantiation": {},
236
+ "groovyism.ExplicitCallToAndMethod": {},
237
+ "groovyism.ExplicitCallToCompareToMethod": {},
238
+ "groovyism.ExplicitCallToDivMethod": {},
239
+ "groovyism.ExplicitCallToEqualsMethod": {},
240
+ "groovyism.ExplicitCallToGetAtMethod": {},
241
+ "groovyism.ExplicitCallToLeftShiftMethod": {},
242
+ "groovyism.ExplicitCallToMinusMethod": {},
243
+ "groovyism.ExplicitCallToModMethod": {},
244
+ "groovyism.ExplicitCallToMultiplyMethod": {},
245
+ "groovyism.ExplicitCallToOrMethod": {},
246
+ "groovyism.ExplicitCallToPlusMethod": {},
247
+ "groovyism.ExplicitCallToPowerMethod": {},
248
+ "groovyism.ExplicitCallToPutAtMethod": {},
249
+ "groovyism.ExplicitCallToRightShiftMethod": {},
250
+ "groovyism.ExplicitCallToXorMethod": {},
251
+ "groovyism.ExplicitHashMapInstantiation": {},
252
+ "groovyism.ExplicitHashSetInstantiation": {},
253
+ "groovyism.ExplicitLinkedHashMapInstantiation": {},
254
+ "groovyism.ExplicitLinkedListInstantiation": {},
255
+ "groovyism.ExplicitStackInstantiation": {},
256
+ "groovyism.ExplicitTreeSetInstantiation": {},
257
+ "groovyism.GStringAsMapKey": {},
258
+ "groovyism.GStringExpressionWithinString": {},
259
+ "groovyism.GetterMethodCouldBeProperty": {},
260
+ "groovyism.GroovyLangImmutable": {},
261
+ "groovyism.UseCollectMany": {},
262
+ "groovyism.UseCollectNested": {},
263
+ "imports.DuplicateImport": {},
264
+ "imports.ImportFromSamePackage": {},
265
+ "imports.ImportFromSunPackages": {},
266
+ "imports.MisorderedStaticImports": {},
267
+ "imports.NoWildcardImports": {},
268
+ "imports.UnnecessaryGroovyImport": {},
269
+ "imports.UnusedImport": {},
270
+ "jdbc.DirectConnectionManagement": {},
271
+ "jdbc.JdbcConnectionReference": {},
272
+ "jdbc.JdbcResultSetReference": {},
273
+ "jdbc.JdbcStatementReference": {},
274
+ "junit.ChainedTest": {},
275
+ "junit.CoupledTestCase": {},
276
+ "junit.JUnitAssertAlwaysFails": {},
277
+ "junit.JUnitAssertAlwaysSucceeds": {},
278
+ "junit.JUnitFailWithoutMessage": {},
279
+ "junit.JUnitLostTest": {},
280
+ "junit.JUnitPublicField": {},
281
+ "junit.JUnitPublicNonTestMethod": {},
282
+ "junit.JUnitPublicProperty": {},
283
+ "junit.JUnitSetUpCallsSuper": {},
284
+ "junit.JUnitStyleAssertions": {},
285
+ "junit.JUnitTearDownCallsSuper": {},
286
+ "junit.JUnitTestMethodWithoutAssert": {},
287
+ "junit.JUnitUnnecessarySetUp": {},
288
+ "junit.JUnitUnnecessaryTearDown": {},
289
+ "junit.JUnitUnnecessaryThrowsException": {},
290
+ "junit.SpockIgnoreRestUsed": {},
291
+ "junit.UnnecessaryFail": {},
292
+ "junit.UseAssertEqualsInsteadOfAssertTrue": {},
293
+ "junit.UseAssertFalseInsteadOfNegation": {},
294
+ "junit.UseAssertNullInsteadOfAssertEquals": {},
295
+ "junit.UseAssertSameInsteadOfAssertTrue": {},
296
+ "junit.UseAssertTrueInsteadOfAssertEquals": {},
297
+ "junit.UseAssertTrueInsteadOfNegation": {},
298
+ "logging.LoggerForDifferentClass": {},
299
+ "logging.LoggerWithWrongModifiers": {},
300
+ "logging.LoggingSwallowsStacktrace": {},
301
+ "logging.MultipleLoggers": {},
302
+ "logging.PrintStackTrace": {},
303
+ "logging.Println": {},
304
+ "logging.SystemErrPrint": {},
305
+ "logging.SystemOutPrint": {},
306
+ "naming.AbstractClassName": {},
307
+ "naming.ClassName": {},
308
+ "naming.ClassNameSameAsFilename": {},
309
+ "naming.ClassNameSameAsSuperclass": {},
310
+ "naming.ConfusingMethodName": {},
311
+ "naming.FactoryMethodName": {},
312
+ "naming.FieldName": {},
313
+ "naming.InterfaceName": {},
314
+ "naming.InterfaceNameSameAsSuperInterface": {},
315
+ "naming.MethodName": {},
316
+ "naming.ObjectOverrideMisspelledMethodName": {},
317
+ "naming.PackageName": {},
318
+ "naming.PackageNameMatchesFilePath": {},
319
+ "naming.ParameterName": {},
320
+ "naming.PropertyName": {},
321
+ "naming.VariableName": {},
322
+ "security.FileCreateTempFile": {},
323
+ "security.InsecureRandom": {},
324
+ "security.JavaIoPackageAccess": {},
325
+ "security.NonFinalPublicField": {},
326
+ "security.NonFinalSubclassOfSensitiveInterface": {},
327
+ "security.ObjectFinalize": {},
328
+ "security.PublicFinalizeMethod": {},
329
+ "security.SystemExit": {},
330
+ "security.UnsafeArrayDeclaration": {},
331
+ "serialization.EnumCustomSerializationIgnored": {},
332
+ "serialization.SerialPersistentFields": {},
333
+ "serialization.SerialVersionUID": {},
334
+ "serialization.SerializableClassMustDefineSerialVersionUID": {},
335
+ "size.ClassSize": {},
336
+ "size.MethodCount": {},
337
+ "size.MethodSize": {},
338
+ "size.NestedBlockDepth": {},
339
+ "size.ParameterCount": {},
340
+ "unnecessary.AddEmptyString": {},
341
+ "unnecessary.ConsecutiveLiteralAppends": {},
342
+ "unnecessary.ConsecutiveStringConcatenation": {},
343
+ "unnecessary.UnnecessaryBigDecimalInstantiation": {},
344
+ "unnecessary.UnnecessaryBigIntegerInstantiation": {},
345
+ "unnecessary.UnnecessaryBooleanExpression": {},
346
+ "unnecessary.UnnecessaryBooleanInstantiation": {},
347
+ "unnecessary.UnnecessaryCallForLastElement": {},
348
+ "unnecessary.UnnecessaryCallToSubstring": {},
349
+ "unnecessary.UnnecessaryCast": {},
350
+ "unnecessary.UnnecessaryCatchBlock": {},
351
+ "unnecessary.UnnecessaryCollectCall": {},
352
+ "unnecessary.UnnecessaryCollectionCall": {},
353
+ "unnecessary.UnnecessaryConstructor": {},
354
+ "unnecessary.UnnecessaryDefInFieldDeclaration": {},
355
+ "unnecessary.UnnecessaryDefInMethodDeclaration": {},
356
+ "unnecessary.UnnecessaryDefInVariableDeclaration": {},
357
+ "unnecessary.UnnecessaryDotClass": {},
358
+ "unnecessary.UnnecessaryDoubleInstantiation": {},
359
+ "unnecessary.UnnecessaryElseStatement": {},
360
+ "unnecessary.UnnecessaryFinalOnPrivateMethod": {},
361
+ "unnecessary.UnnecessaryFloatInstantiation": {},
362
+ "unnecessary.UnnecessaryGString": {},
363
+ "unnecessary.UnnecessaryGetter": {},
364
+ "unnecessary.UnnecessaryIfStatement": {},
365
+ "unnecessary.UnnecessaryInstanceOfCheck": {},
366
+ "unnecessary.UnnecessaryInstantiationToGetClass": {},
367
+ "unnecessary.UnnecessaryIntegerInstantiation": {},
368
+ "unnecessary.UnnecessaryLongInstantiation": {},
369
+ "unnecessary.UnnecessaryModOne": {},
370
+ "unnecessary.UnnecessaryNullCheck": {},
371
+ "unnecessary.UnnecessaryNullCheckBeforeInstanceOf": {},
372
+ "unnecessary.UnnecessaryObjectReferences": {},
373
+ "unnecessary.UnnecessaryOverridingMethod": {},
374
+ "unnecessary.UnnecessaryPackageReference": {},
375
+ "unnecessary.UnnecessaryParenthesesForMethodCallWithClosure": {},
376
+ "unnecessary.UnnecessaryPublicModifier": {},
377
+ "unnecessary.UnnecessaryReturnKeyword": {},
378
+ "unnecessary.UnnecessarySafeNavigationOperator": {},
379
+ "unnecessary.UnnecessarySelfAssignment": {},
380
+ "unnecessary.UnnecessarySemicolon": {},
381
+ "unnecessary.UnnecessarySetter": {},
382
+ "unnecessary.UnnecessaryStringInstantiation": {},
383
+ "unnecessary.UnnecessarySubstring": {},
384
+ "unnecessary.UnnecessaryTernaryExpression": {},
385
+ "unnecessary.UnnecessaryToString": {},
386
+ "unnecessary.UnnecessaryTransientModifier": {},
387
+ "unused.UnusedArray": {},
388
+ "unused.UnusedMethodParameter": {},
389
+ "unused.UnusedObject": {},
390
+ "unused.UnusedPrivateField": {},
391
+ "unused.UnusedPrivateMethod": {},
392
+ "unused.UnusedPrivateMethodParameter": {},
393
+ "unused.UnusedVariable": {}
394
+ }
395
+ }
@@ -39,7 +39,7 @@ class CodeNarcCaller {
39
39
  rootPath: __dirname,
40
40
  mainClass: "org.codenarc.CodeNarc",
41
41
  classPath:
42
- "java/CodeNarc-2.2.0.jar:java/groovy/lib/groovy-3.0.9.jar:java/groovy/lib/groovy-templates-3.0.9.jar:java/groovy/lib/groovy-xml-3.0.9.jar:java/groovy/lib/groovy-json-3.0.9.jar:java/groovy/lib/groovy-ant-3.0.9.jar:java/groovy/lib/ant-1.10.11.jar:java/groovy/lib/ant-launcher-1.10.11.jar:java/slf4j-api-1.7.9.jar:java/log4j-slf4j-impl-2.17.0.jar:java/log4j-api-2.17.0.jar:java/log4j-core-2.17.0.jar:java/gmetrics-1.1.jar:java/*"
42
+ "java/CodeNarc-2.2.0.jar:java/groovy/lib/groovy-3.0.9.jar:java/groovy/lib/groovy-templates-3.0.9.jar:java/groovy/lib/groovy-xml-3.0.9.jar:java/groovy/lib/groovy-json-3.0.9.jar:java/groovy/lib/groovy-ant-3.0.9.jar:java/groovy/lib/ant-1.10.11.jar:java/groovy/lib/ant-launcher-1.10.11.jar:java/slf4j-api-1.7.9.jar:java/log4j-slf4j-impl-2.17.1.jar:java/log4j-api-2.17.1.jar:java/log4j-core-2.17.1.jar:java/gmetrics-1.1.jar:java/*"
43
43
  }
44
44
  };
45
45
 
@@ -304,7 +304,7 @@ class CodeNarcCaller {
304
304
  });
305
305
 
306
306
  if (this.serverStatus === "running") {
307
- console.log(c.green(`GroovyLint: Started CodeNarc Server`));
307
+ debug(c.green(`GroovyLint: Started CodeNarc Server`));
308
308
  return true;
309
309
  } else {
310
310
  return false;
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
 
4
4
  const debug = require("debug")("npm-groovy-lint");
5
- const fse = require("fs-extra");
5
+ const fs = require("fs-extra");
6
6
  const os = require("os");
7
7
  const path = require("path");
8
8
  const { getConfigFileName } = require("./config.js");
@@ -29,14 +29,15 @@ async function prepareCodeNarcCall(options) {
29
29
  // If source option, create a temporary Groovy file
30
30
  if (options.source) {
31
31
  cnPath = path.resolve(os.tmpdir() + "/npm-groovy-lint");
32
- await fse.ensureDir(cnPath, { mode: "0777" });
32
+ await fs.ensureDir(cnPath, { mode: "0777" });
33
33
  // File path is sent (recommended): use it to create temp file name
34
34
  if (options.sourcefilepath) {
35
35
  const pathParse = path.parse(options.sourcefilepath);
36
36
  cnPath = cnPath + "/codeNarcTmpDir_" + Math.random();
37
- await fse.ensureDir(cnPath, { mode: "0777" });
38
- result.tmpGroovyFileName = path.resolve(cnPath + "/" + pathParse.base);
39
- cnFiles = "**/" + pathParse.base;
37
+ await fs.ensureDir(cnPath, { mode: "0777" });
38
+ const pathBase = pathParse.base.replace(/ /g, "_");
39
+ result.tmpGroovyFileName = path.resolve(cnPath + "/" + pathBase);
40
+ cnFiles = "**/" + pathBase;
40
41
  }
41
42
  // Use default random file name
42
43
  else {
@@ -45,7 +46,7 @@ async function prepareCodeNarcCall(options) {
45
46
  cnFiles = "**/" + tmpFileNm;
46
47
  }
47
48
 
48
- await fse.writeFile(result.tmpGroovyFileName, normalizeNewLines(options.source));
49
+ await fs.writeFile(result.tmpGroovyFileName, normalizeNewLines(options.source));
49
50
  debug(`CREATE GROOVY temp file ${result.tmpGroovyFileName} with input source, as CodeNarc requires physical files`);
50
51
  }
51
52
 
@@ -90,8 +91,14 @@ async function prepareCodeNarcCall(options) {
90
91
 
91
92
  // Output
92
93
  result.output = options.output.replace(/^"(.*)"$/, "$1");
93
- if (["txt", "json", "none"].includes(result.output) || result.output.endsWith(".txt") || result.output.endsWith(".json")) {
94
- result.outputType = result.output.endsWith(".txt") ? "txt" : result.output.endsWith(".json") ? "json" : result.output;
94
+ if (["txt", "json", "sarif", "none"].includes(result.output) ||
95
+ result.output.endsWith(".txt") ||
96
+ result.output.endsWith(".sarif") ||
97
+ result.output.endsWith(".json")) {
98
+ result.outputType = result.output.endsWith(".txt") ? "txt"
99
+ : result.output.endsWith(".json") ? "json"
100
+ : result.output.endsWith(".sarif") ? "sarif"
101
+ : result.output;
95
102
  result.codenarcArgs.push(`-report=json:stdout`);
96
103
  } else if (["html", "xml"].includes(result.output.split(".").pop())) {
97
104
  result.outputType = result.output
@@ -100,11 +107,11 @@ async function prepareCodeNarcCall(options) {
100
107
  .endsWith("html")
101
108
  ? "html"
102
109
  : result.output
103
- .split(".")
104
- .pop()
105
- .endsWith("xml")
106
- ? "xml"
107
- : "";
110
+ .split(".")
111
+ .pop()
112
+ .endsWith("xml")
113
+ ? "xml"
114
+ : "";
108
115
  const ext = result.output.split(".").pop();
109
116
  result.codenarcArgs.push(`-report=${ext}:${result.output}`);
110
117
 
@@ -265,9 +272,9 @@ async function parseCodeNarcResult(options, codeNarcBaseDir, codeNarcJsonResult,
265
272
  }
266
273
 
267
274
  // Parse error definitions & build url if not already done and not noreturnrules option
268
- if (result.rules == null && options.returnrules === true) {
275
+ if (result.rules == null && (options.returnrules === true || options.output.includes("sarif"))) {
269
276
  const configAllFileName = await getConfigFileName(__dirname, null, [".groovylintrc-all.json"]);
270
- const grooylintrcAllRules = Object.keys(JSON.parse(fse.readFileSync(configAllFileName, "utf8").toString()).rules);
277
+ const grooylintrcAllRules = Object.keys(JSON.parse(fs.readFileSync(configAllFileName, "utf8").toString()).rules);
271
278
  const rules = {};
272
279
  for (const ruleDef of codeNarcJsonResult.rules) {
273
280
  const ruleName = ruleDef.name;
@@ -295,7 +302,7 @@ async function buildRuleSets(options) {
295
302
  const normalizedRulesets = rulesetSplits.map(rulesetFile => {
296
303
  const fullFile = path.resolve(rulesetFile);
297
304
  // Encode file name so CodeNarc understands it
298
- if (fse.exists(fullFile)) {
305
+ if (fs.existsSync(fullFile)) {
299
306
  return "file:" + encodeURIComponent(fullFile);
300
307
  }
301
308
  // File name has already been encoded: let it as it is (will make CodeNarc fail if file not existing)
@@ -337,8 +344,8 @@ async function buildRuleSets(options) {
337
344
  typeof ruleFromConfig === "object"
338
345
  ? Object.assign(ruleFromConfig, ruleOptions)
339
346
  : Object.keys(ruleOptions).length > 0
340
- ? ruleOptions
341
- : ruleFromConfig;
347
+ ? ruleOptions
348
+ : ruleFromConfig;
342
349
  const ruleDef = buildCodeNarcRule(ruleName, mergedRuleConfig);
343
350
  return ruleDef;
344
351
  });
@@ -355,8 +362,8 @@ async function buildRuleSets(options) {
355
362
  typeof ruleDef === "object"
356
363
  ? Object.assign(ruleDef, ruleFromRuleSetsArg)
357
364
  : Object.keys(ruleFromRuleSetsArg).length > 0
358
- ? ruleFromRuleSetsArg
359
- : ruleDef;
365
+ ? ruleFromRuleSetsArg
366
+ : ruleDef;
360
367
  }
361
368
  // Add in the list of rules to test , except if it is disabled
362
369
  if (!(ruleDef === "off" || ruleDef.disabled === true || ruleDef.enabled === false)) {
@@ -415,7 +422,7 @@ function getCodeNarcPriorityCode(ruleFromConfig) {
415
422
  async function manageDeleteTmpFiles(tmpGroovyFileName) {
416
423
  // Remove temporary groovy file created for source argument if provided
417
424
  if (tmpGroovyFileName) {
418
- await fse.remove(tmpGroovyFileName);
425
+ await fs.remove(tmpGroovyFileName);
419
426
  debug(`Removed temp file ${tmpGroovyFileName} as it is not longer used`);
420
427
  tmpGroovyFileName = null;
421
428
  }
@@ -0,0 +1,56 @@
1
+ import groovy.io.FileType
2
+ import groovy.json.*
3
+ import groovy.time.TimeCategory
4
+ import static groovyx.gpars.GParsPool.withPool
5
+
6
+ def script = new GroovyScriptEngine( "." ).with{
7
+ loadScriptByName( 'Utils.groovy' ) ;
8
+ }
9
+ this.metaClass.mixin script
10
+
11
+ def returnCode = 0
12
+ Exception eThrow = null ;
13
+ try {
14
+ initialize(args) ;
15
+ } catch (Exception e){
16
+ eThrow = e ;
17
+ returnCode = 1
18
+ }
19
+ if (eThrow == null){
20
+ return 0 ;
21
+ }
22
+ else {
23
+ throw eThrow ;
24
+ return 1 ;
25
+ }
26
+
27
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////
28
+ ///////////////////////////////////////////////// SCRIPT /////////////////////////////////////////////////
29
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////
30
+ def initialize(args3) { //
31
+ def executor = new TestExecutor(args3)
32
+ return executor
33
+ }
34
+
35
+ class TestExecutor {
36
+
37
+ public TestExecutor( args2) {
38
+ this.testExternalGlobalProps()
39
+ }
40
+
41
+ public testExternalGlobalProps() {
42
+ Utils.printlnLog( '########## testExternalGlobalProps')
43
+ def globalKeyName = new Random().with { (1..9).collect { (('a'..'z')).join()[ nextInt((('a'..'z')).join().length())]}.join()}
44
+ Utils.printlnLog( "Generated random key: ${globalKeyName}")
45
+ Utils.setExternalValue(globalKeyName , 'lelama' , 'nul')
46
+ def storedValue = Utils.getExternalValue(globalKeyName , 'lelama')
47
+ assert storedValue == 'nul' , 'Error in global prop key storage/ retrieval (1)'
48
+ Utils.setExternalValue(globalKeyName , 'lelama2' , 'nul2')
49
+ def storedValue2 = Utils.getExternalValue(globalKeyName , 'lelama2')
50
+ assert storedValue2 == 'nul2' , 'Error in global prop key storage/ retrieval (2)'
51
+ def storedValueBack = Utils.getExternalValue(globalKeyName , 'lelama')
52
+ assert storedValueBack == 'nul' , 'Error in global prop key storage/ retrieval (3)'
53
+ Utils.printlnLog( Utils.getExternalValue(globalKeyName))
54
+ }
55
+
56
+ }
package/lib/options.js CHANGED
@@ -119,8 +119,8 @@ module.exports = optionator({
119
119
  alias: "o",
120
120
  type: "String",
121
121
  default: "txt",
122
- description: "Output format (txt,json,html,xml), or path to a file with one of these extensions",
123
- example: ["txt", "json", "./logs/myLintResults.txt", "./logs/myLintResults.json", "./logs/myLintResults.html", "./logs/myLintResults.xml"]
122
+ description: "Output format (txt,json,sarif,html,xml), or path to a file with one of these extensions",
123
+ example: ["txt", "json", "sarif", "./logs/myLintResults.txt", "./logs/myLintResults.json","./logs/myLintResults.sarif", "./logs/myLintResults.html", "./logs/myLintResults.xml"]
124
124
  },
125
125
  {
126
126
  option: "loglevel",
package/lib/output.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // Output management
2
2
  const c = require("ansi-colors");
3
3
  const fse = require("fs-extra");
4
+ const { SarifBuilder, SarifRunBuilder, SarifResultBuilder, SarifRuleBuilder } = require("node-sarif-builder");
4
5
  const path = require("path");
5
6
  const { isErrorInLogLevelScope } = require("./utils");
6
7
 
@@ -204,8 +205,80 @@ async function processOutput(outputType, output, lintResult, options, fixer = nu
204
205
  outputString = JSON.stringify(lintResult);
205
206
  console.log(outputString);
206
207
  }
208
+ } else if (outputType === "sarif") {
209
+ const sarifJsonString = buildSarifResult(lintResult);
210
+ // SARIF file
211
+ if (output.endsWith(".sarif")) {
212
+ fse.writeFileSync(output, sarifJsonString);
213
+ const absolutePath = path.resolve(".", output);
214
+ outputString = "GroovyLint: Logged SARIF results in file " + absolutePath;
215
+ console.info(outputString);
216
+ } else {
217
+ // SARIF in stdout
218
+ outputString = sarifJsonString;
219
+ console.log(sarifJsonString);
220
+ }
207
221
  }
208
222
  return outputString;
209
223
  }
210
224
 
225
+ function buildSarifResult(lintResult) {
226
+ // SARIF builder
227
+ const sarifBuilder = new SarifBuilder();
228
+ // SARIF Run builder
229
+ const sarifRunBuilder = new SarifRunBuilder().initSimple({
230
+ name: "npm-groovy-lint",
231
+ url: "https://nvuillam.github.io/npm-groovy-lint/"
232
+ });
233
+ // SARIF rules
234
+ for (const ruleId of Object.keys(lintResult.rules || {})) {
235
+ const rule = lintResult.rules[ruleId];
236
+ const sarifRuleBuilder = new SarifRuleBuilder().initSimple({
237
+ ruleId: ruleId,
238
+ shortDescriptionText: rule.description,
239
+ helpUri: rule.docUrl
240
+ });
241
+ sarifRunBuilder.addRule(sarifRuleBuilder);
242
+ }
243
+ // Add SARIF results (individual errors)
244
+ for (const fileNm of Object.keys(lintResult.files)) {
245
+ const fileErrors = lintResult.files[fileNm].errors;
246
+ for (const err of fileErrors) {
247
+ const sarifResultBuilder = new SarifResultBuilder();
248
+ const sarifResultInit = {
249
+ level: err.severity === "info" ? "note" : err.severity, // Other values can be "warning" or "error"
250
+ messageText: err.msg,
251
+ ruleId: err.rule,
252
+ fileUri: process.env.SARIF_URI_ABSOLUTE
253
+ ? "file:///" + fileNm.replace(/\\/g, "/")
254
+ : path.relative(process.cwd(), fileNm)
255
+ };
256
+ if (err.range) {
257
+ sarifResultInit.startLine = fixLine(err.range.start.line);
258
+ sarifResultInit.startColumn = fixCol(err.range.start.character);
259
+ sarifResultInit.endLine = fixLine(err.range.end.line);
260
+ sarifResultInit.endColumn = fixCol(err.range.end.character);
261
+ }
262
+ sarifResultBuilder.initSimple(sarifResultInit);
263
+ sarifRunBuilder.addResult(sarifResultBuilder);
264
+ }
265
+ }
266
+ sarifBuilder.addRun(sarifRunBuilder);
267
+ return sarifBuilder.buildSarifJsonString({ indent: false });
268
+ }
269
+
270
+ function fixLine(val) {
271
+ if (val === null) {
272
+ return undefined;
273
+ }
274
+ return val === 0 ? 1 : val;
275
+ }
276
+
277
+ function fixCol(val) {
278
+ if (val === null) {
279
+ return undefined;
280
+ }
281
+ return val === 0 ? 1 : val + 1;
282
+ }
283
+
211
284
  module.exports = { computeStats, processOutput };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "npm-groovy-lint",
3
- "version": "9.2.0",
3
+ "version": "9.4.0",
4
4
  "description": "Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle files",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "lint:fix": "eslint **/*.js --fix && prettier --write \"./lib/**/*.{js,jsx,json}\" --tab-width 4 --print-width 150",
8
- "groovy:run-server-from-source": "npm run dev:kill-server && groovy -cp \"lib/java/CodeNarc-2.2.0.jar;lib/java/groovy/lib/groovy-3.0.9.jar;lib/java/groovy/lib/groovy-templates-3.0.9.jar;lib/java/groovy/lib/groovy-xml-3.0.9.jar;lib/java/groovy/lib/groovy-json-3.0.9.jar;lib/java/groovy/lib/groovy-ant-3.0.9.jar;lib/java/groovy/lib/ant-1.10.11.jar;lib/java/groovy/lib/ant-launcher-1.10.11.jar;lib/java/slf4j-api-1.7.9.jar;lib/java/log4j-slf4j-impl-2.17.0.jar;lib/java/log4j-api-2.17.0.jar;lib/java/log4j-core-2.17.0.jar;lib/java/gmetrics-1.1.jar\" groovy/src/main/com/nvuillam/CodeNarcServer.groovy --server",
8
+ "groovy:run-server-from-source": "npm run dev:kill-server && groovy -cp \"lib/java/CodeNarc-2.2.0.jar;lib/java/groovy/lib/groovy-3.0.9.jar;lib/java/groovy/lib/groovy-templates-3.0.9.jar;lib/java/groovy/lib/groovy-xml-3.0.9.jar;lib/java/groovy/lib/groovy-json-3.0.9.jar;lib/java/groovy/lib/groovy-ant-3.0.9.jar;lib/java/groovy/lib/ant-1.10.11.jar;lib/java/groovy/lib/ant-launcher-1.10.11.jar;lib/java/slf4j-api-1.7.9.jar;lib/java/log4j-slf4j-impl-2.17.1.jar;lib/java/log4j-api-2.17.1.jar;lib/java/log4j-core-2.17.1.jar;lib/java/gmetrics-1.1.jar\" groovy/src/main/com/nvuillam/CodeNarcServer.groovy --server",
9
9
  "groovy:build": "npm run dev:kill-server && groovyc -cp \"./lib/java*\" --encoding utf-8 ./groovy/src/main/com/nvuillam/CodeNarcServer.groovy -d ./tmp && cd ./tmp && jar -cvfm ./../lib/java/CodeNarcServer.jar ./../MANIFEST.txt ./com/nvuillam/*.class && cd ..",
10
10
  "test": "npm run dev:kill-server && mocha \"test/**/*.test.js\"",
11
11
  "test:coverage": "nyc npm run test",
@@ -48,7 +48,7 @@
48
48
  "ansi-colors": "^4.1.1",
49
49
  "axios": "^0.21.1",
50
50
  "chalk": "^4.1.2",
51
- "cli-progress": "^3.6.0",
51
+ "cli-progress": "^3.10.0",
52
52
  "debug": "^4.1.1",
53
53
  "decode-html": "^2.0.0",
54
54
  "find-java-home": "^1.1.0",
@@ -58,6 +58,7 @@
58
58
  "import-fresh": "^3.2.1",
59
59
  "ip": "^1.1.5",
60
60
  "java-caller": "^2.2.4",
61
+ "node-sarif-builder": "^1.0.0",
61
62
  "optionator": "^0.8.3",
62
63
  "semver": "^7.1.3",
63
64
  "strip-json-comments": "^3.0.1",
@@ -75,7 +76,7 @@
75
76
  "eslint-plugin-standard": "^5.0.0",
76
77
  "mocha": "^7.0.1",
77
78
  "nyc": "^15.1.0",
78
- "prettier": "1.19.1",
79
+ "prettier": "^1.19.1",
79
80
  "rimraf": "^3.0.2",
80
81
  "which": "^2.0.2"
81
82
  },