npm-groovy-lint 11.1.2-beta202310250645.0 → 11.1.2-beta202311021422.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.
@@ -1,394 +1,394 @@
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.UnnecessaryTernaryExpression": {},
384
- "unnecessary.UnnecessaryToString": {},
385
- "unnecessary.UnnecessaryTransientModifier": {},
386
- "unused.UnusedArray": {},
387
- "unused.UnusedMethodParameter": {},
388
- "unused.UnusedObject": {},
389
- "unused.UnusedPrivateField": {},
390
- "unused.UnusedPrivateMethod": {},
391
- "unused.UnusedPrivateMethodParameter": {},
392
- "unused.UnusedVariable": {}
393
- }
394
- }
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.UnnecessaryTernaryExpression": {},
384
+ "unnecessary.UnnecessaryToString": {},
385
+ "unnecessary.UnnecessaryTransientModifier": {},
386
+ "unused.UnusedArray": {},
387
+ "unused.UnusedMethodParameter": {},
388
+ "unused.UnusedObject": {},
389
+ "unused.UnusedPrivateField": {},
390
+ "unused.UnusedPrivateMethod": {},
391
+ "unused.UnusedPrivateMethodParameter": {},
392
+ "unused.UnusedVariable": {}
393
+ }
394
+ }
@@ -32,19 +32,16 @@ class CodeNarcCaller {
32
32
 
33
33
  javaCallerOptions = {
34
34
  codeNarcServer: {
35
- minimumJavaVersion: 8,
36
- maximumJavaVersion: 14,
35
+ minimumJavaVersion: 17,
36
+ maximumJavaVersion: 17,
37
37
  rootPath: __dirname,
38
- mainClass: "com.nvuillam.CodeNarcServer",
39
- classPath: "java/CodeNarcServer.jar:java/*"
38
+ jar: "java/CodeNarcServer.jar"
40
39
  },
41
40
  codeNarcJava: {
42
- minimumJavaVersion: 8,
43
- maximumJavaVersion: 14,
41
+ minimumJavaVersion: 17,
42
+ maximumJavaVersion: 17,
44
43
  rootPath: __dirname,
45
- mainClass: "org.codenarc.CodeNarc",
46
- classPath:
47
- "java/CodeNarc-3.1.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.18.0.jar:java/log4j-api-2.18.0.jar:java/log4j-core-2.18.0.jar:java/GMetrics-2.1.0.jar:java/*"
44
+ jar: "java/CodeNarcServer.jar"
48
45
  }
49
46
  };
50
47
 
@@ -111,6 +108,14 @@ class CodeNarcCaller {
111
108
  }
112
109
  // Cancelled codeNarcAction (duplicate)
113
110
  else if (e.code && e.code === "ECONNRESET") {
111
+ // The server was shutdown just retry.
112
+ if (startServerTried === false && (await this.startCodeNarcServer()) && this.serverStatus === "running") {
113
+ return await this.callCodeNarcServer(true);
114
+ }
115
+
116
+ // Should this really be cancelled, as the Groovy says it should return:
117
+ // respObj.status = 'cancelledByDuplicateRequest'
118
+ // respObj.statusCode = 444
114
119
  return {
115
120
  status: 9
116
121
  };
@@ -258,7 +263,7 @@ class CodeNarcCaller {
258
263
  // Start CodeNarc server so it can be called via Http just after
259
264
  async startCodeNarcServer() {
260
265
  this.serverStatus = "unknown";
261
- const maxAttemptTimeMs = 20000;
266
+ const maxAttemptTimeMs = 10000;
262
267
  const scriptArgs = ["--server"];
263
268
  const serverPingUri = this.getCodeNarcServerUri() + "/ping";
264
269
 
@@ -269,18 +274,20 @@ class CodeNarcCaller {
269
274
  javaCallerOpts.javaExecutable = this.javaExecutable;
270
275
  javaCallerOpts.additionalJavaArgs = this.additionalJavaArgs;
271
276
  const javaCaller = new JavaCaller(javaCallerOpts);
272
- const javaCallRes = await javaCaller.run(scriptArgs, { detached: true, waitForErrorMs: 500 });
277
+ const javaResult = await javaCaller.run(scriptArgs, { detached: true, waitForErrorMs: 500 });
273
278
 
274
- if ([666, 1].includes(javaCallRes.status)) {
275
- console.error(c.red(`Unable to start CodeNarc server: ${JSON.stringify(javaCallRes)}`));
279
+ // Store the process so we can stop it later.
280
+ this.codeNarcProcess = javaResult.childJavaProcess;
281
+
282
+ trace(`javaResult: ${JSON.stringify(javaResult)}`);
283
+
284
+ if ([666, 1].includes(javaResult.status)) {
285
+ console.error(c.red(`Unable to start CodeNarc server: ${JSON.stringify(javaResult)}`));
276
286
  console.error(c.grey(JSON.stringify(scriptArgs)));
277
287
  this.serverStatus = "error";
278
288
  return false;
279
289
  }
280
290
 
281
- // Store the process so we can stop it later.
282
- this.codeNarcProcess = javaCallRes.childJavaProcess;
283
-
284
291
  // Poll it until it is ready
285
292
  const start = performance.now();
286
293
  let notified = false;
@@ -328,9 +335,8 @@ class CodeNarcCaller {
328
335
  if (this.serverStatus === "running") {
329
336
  debug(c.green(`GroovyLint: Started CodeNarc Server`));
330
337
  return true;
331
- } else {
332
- return false;
333
338
  }
339
+ return false;
334
340
  }
335
341
 
336
342
  // Kill CodeNarc process if running.
@@ -367,9 +373,9 @@ class CodeNarcCaller {
367
373
  }
368
374
 
369
375
  // Process kill wasn't possible, so try sending a kill http request.
370
- const serverUri = this.getCodeNarcServerUri() + "/kill";
376
+ const killUri = this.getCodeNarcServerUri() + "/kill";
371
377
  try {
372
- const response = await axios.post(serverUri, { timeout: 5000 });
378
+ const response = await axios.post(killUri, { timeout: 1000 });
373
379
  if (response.data.status === "killed") {
374
380
  outputString = "CodeNarcServer terminated";
375
381
  } else {
@@ -384,6 +390,30 @@ class CodeNarcCaller {
384
390
  outputString = `CodeNarcServer was not running`;
385
391
  }
386
392
  }
393
+
394
+ // Wait for the server to stop otherwise when we try to start it
395
+ // again it it's likely to fail due to an port in use error.
396
+ const serverPingUri = this.getCodeNarcServerUri() + "/ping";
397
+
398
+ let interval;
399
+ await new Promise(resolve => {
400
+ interval = setInterval(() => {
401
+ debug(`pinging CodeNarcServer at ${serverPingUri} serverStatus: ${this.serverStatus}`);
402
+ axios
403
+ .get(serverPingUri)
404
+ .then(response => {
405
+ debug(`ping response: ${response.status}`);
406
+ })
407
+ .catch(e => {
408
+ debug(`Ping code: ${e.code} message: ${e.message}`);
409
+ clearInterval(interval);
410
+ resolve();
411
+ });
412
+ }, 400);
413
+ });
414
+
415
+ trace(`killCodeNarcServer: ${outputString}`);
416
+
387
417
  return outputString;
388
418
  }
389
419
 
@@ -49,7 +49,7 @@ class NpmGroovyLintFix {
49
49
  },
50
50
  cliProgress.Presets.shades_classic
51
51
  );
52
- this.bar.start(Object.keys(this.updatedLintResult.files).length, 0);
52
+ this.bar.start(Object.keys(this.updatedLintResult.files).length, 0, { file: "..." });
53
53
 
54
54
  // Parse fixes and process them
55
55
  await this.parseFixableErrors(optns.errorIds);
@@ -185,6 +185,9 @@ class NpmGroovyLintFix {
185
185
  fixSuccess = true;
186
186
  this.updateNextErrorsRanges(allLines, allLinesNew, fileFixableError.lineNb, fileNm);
187
187
  allLines = allLinesNew;
188
+ debug(`Fixed ${fileFixableError.ruleName} in file ${fileNm}`);
189
+ } else {
190
+ debug(`Skipping ${fileFixableError.ruleName} as no change in file ${fileNm}`);
188
191
  }
189
192
  }
190
193
  // Line scope violation
@@ -194,6 +197,8 @@ class NpmGroovyLintFix {
194
197
  if (fixedLine !== line) {
195
198
  fixSuccess = true;
196
199
  allLines[lineNb] = fixedLine;
200
+ } else {
201
+ debug(`Skipping ${fileFixableError.ruleName} as no change in line: ${line}`);
197
202
  }
198
203
  }
199
204
  // Update lint results
@@ -271,6 +276,8 @@ class NpmGroovyLintFix {
271
276
  trace(`ERROR: Fix function error: ${e.message} / ${JSON.stringify(fixableError)}`);
272
277
  throw e;
273
278
  }
279
+ } else {
280
+ debug(`Fix type not supported: ${fix.type} / ${JSON.stringify(fixableError)}`);
274
281
  }
275
282
  return newLine;
276
283
  }
@@ -117,6 +117,9 @@ class NpmGroovyLint {
117
117
 
118
118
  // Actions before call to CodeNarc
119
119
  async preProcess() {
120
+ // Reset status so we don't get stale results.
121
+ this.status = 0;
122
+
120
123
  // Manage when the user wants to use only codenarc args
121
124
  if (Array.isArray(this.args) && this.args.includes("--codenarcargs")) {
122
125
  this.codenarcArgs = this.args.slice(2).filter(userArg => userArg !== "--codenarcargs");
@@ -367,6 +370,7 @@ class NpmGroovyLint {
367
370
  await newLinter.run();
368
371
  // Merge new linter results in existing results
369
372
  this.lintResult = this.mergeResults(this.lintResult, newLinter.lintResult);
373
+ this.status = newLinter.status;
370
374
  }
371
375
 
372
376
  // Fix again after fix because fixed rules contained triggersAgainAfterFix property (for the moment, only Indentation rule)
@@ -489,32 +493,28 @@ class NpmGroovyLint {
489
493
  return;
490
494
  }
491
495
 
492
- const errorNb = this.lintResult.summary.totalFoundErrorNumber;
493
- const warningNb = this.lintResult.summary.totalFoundWarningNumber;
494
- const infoNb = this.lintResult.summary.totalFoundInfoNumber;
496
+ const errorNb = this.lintResult.summary.totalRemainingErrorNumber;
497
+ const warningNb = this.lintResult.summary.totalRemainingWarningNumber;
498
+ const infoNb = this.lintResult.summary.totalRemainingInfoNumber;
495
499
 
496
500
  // Fail on error
497
501
  if (failureLevel === "error" && errorNb > 0) {
498
502
  if (!["json", "sarif", "stdout"].includes(this.outputType)) {
499
- console.error(`Failure: ${this.lintResult.summary.totalFoundErrorNumber} error(s) have been found`);
503
+ console.error(`Failure summary: ${JSON.stringify(this.lintResult.summary, null, 2)}`);
500
504
  }
501
505
  this.status = 1;
502
506
  }
503
507
  // Fail on warning
504
508
  else if (failureLevel === "warning" && (errorNb > 0 || warningNb > 0)) {
505
509
  if (!["json", "sarif", "stdout"].includes(this.outputType)) {
506
- console.error(
507
- `Failure: ${this.lintResult.summary.totalFoundErrorNumber} error(s) have been found \n ${this.lintResult.summary.totalFoundWarningNumber} warning(s) have been found`
508
- );
510
+ console.error(`Failure summary: ${JSON.stringify(this.lintResult.summary, null, 2)}`);
509
511
  }
510
512
  this.status = 1;
511
513
  }
512
514
  // Fail on info
513
515
  else if (failureLevel === "info" && (errorNb > 0 || warningNb > 0 || infoNb > 0)) {
514
516
  if (!["json", "sarif", "stdout"].includes(this.outputType)) {
515
- console.error(
516
- `Failure: ${this.lintResult.summary.totalFoundErrorNumber} error(s) have been found \n ${this.lintResult.summary.totalFoundWarningNumber} warning(s) have been found \n ${this.lintResult.summary.totalFoundInfoNumber} info(s) have been found`
517
- );
517
+ console.error(`Failure summary: ${JSON.stringify(this.lintResult.summary, null, 2)}`);
518
518
  }
519
519
  this.status = 1;
520
520
  }
Binary file
Binary file
@@ -0,0 +1,34 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <!DOCTYPE configuration>
3
+
4
+ <configuration>
5
+ <import class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"/>
6
+ <import class="ch.qos.logback.core.ConsoleAppender"/>
7
+
8
+ <appender name="STDERR" class="ConsoleAppender">
9
+ <target>System.err</target>
10
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
11
+ <level>${logging.appender.console.level:-INFO}</level>
12
+ </filter>
13
+ <encoder class="PatternLayoutEncoder">
14
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%kvp- %msg%n</pattern>
15
+ </encoder>
16
+ </appender>
17
+
18
+ <appender name="FILE" class="ch.qos.logback.core.FileAppender">
19
+ <file>logback.log</file>
20
+ <append>true</append>
21
+ <immediateFlush>true</immediateFlush>
22
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
23
+ <level>${logging.appender.log.level:-OFF}</level>
24
+ </filter>
25
+ <encoder>
26
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
27
+ </encoder>
28
+ </appender>
29
+
30
+ <root>
31
+ <appender-ref ref="FILE"/>
32
+ <appender-ref ref="STDERR"/>
33
+ </root>
34
+ </configuration>
package/lib/options.js CHANGED
@@ -11,12 +11,13 @@
11
11
 
12
12
  const optionator = require("optionator");
13
13
 
14
+ const defaultServerPort = process.env.SERVER_PORT ? process.env.SERVER_PORT : "7484";
15
+
14
16
  //------------------------------------------------------------------------------
15
17
  // Initialization and Public Interface
16
18
  //------------------------------------------------------------------------------
17
19
 
18
- // exports "parse(args)", "generateHelp()", and "generateHelpForOption(optionName)"
19
- module.exports = optionator({
20
+ let options = optionator({
20
21
  prepend: "npm-groovy-lint [options]",
21
22
  defaults: {
22
23
  concatRepeatedArrays: true,
@@ -183,8 +184,8 @@ module.exports = optionator({
183
184
  {
184
185
  option: "serverport",
185
186
  type: "String",
186
- default: "7484",
187
- description: "If use of CodeNarc server, port of the CodeNarc server (default: 7484)",
187
+ default: defaultServerPort,
188
+ description: `If use of CodeNarc server, port of the CodeNarc server (default: ${defaultServerPort})`,
188
189
  example: ["2702"]
189
190
  },
190
191
  {
@@ -284,3 +285,12 @@ module.exports = optionator({
284
285
  ]
285
286
  ]
286
287
  });
288
+
289
+ options.defaultServerPort = defaultServerPort;
290
+
291
+ // Export:
292
+ // - parse(args)
293
+ // - generateHelp()
294
+ // - generateHelpForOption(optionName)
295
+ // - defaultServerPort
296
+ module.exports = options;
package/package.json CHANGED
@@ -1,19 +1,21 @@
1
1
  {
2
2
  "name": "npm-groovy-lint",
3
- "version": "11.1.2-beta202310250645.0",
3
+ "version": "11.1.2-beta202311021422.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}\" --tab-width 4 --print-width 150",
8
- "groovy:run-server-from-source": "npm run dev:kill-server && groovy -cp \"lib/java/*\" groovy/src/main/com/nvuillam/CodeNarcServer.groovy --server",
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
- "test": "npm run dev:kill-server && mocha \"test/**/*.test.js\"",
8
+ "server:run-from-source": "npm run server:kill && groovy -cp \"lib/java/*\" groovy/src/main/com/nvuillam/CodeNarcServer.groovy --server",
9
+ "server:run": "npm run server:kill && java -Xms256m -Xmx2048m -jar lib/java/CodeNarcServer.jar --server",
10
+ "server:build": "node scripts/build-server.js",
11
+ "server:kill": "npm-groovy-lint --killserver",
12
+ "test": "npm run server:kill && mocha \"test/**/*.test.js\"",
11
13
  "test:coverage": "nyc npm run test",
12
- "test:debug": "npm run dev:kill-server && mocha --reporter spec --inspect-brk \"test/**/*.test.js\"",
13
- "build": "node script-build-config-all.js && cp -f README.md docs/index.md && cp -f CHANGELOG.md docs/CHANGELOG.md",
14
- "dev:kill-server": "npm-groovy-lint --killserver",
15
- "dev:lint-install-local": "npm run dev:kill-server && npm run lint:fix && npm link --force",
16
- "dev:lint-install-local-copy-vscode": "npm run dev:lint-install-local && node script-deploy-in-vscode.js"
14
+ "test:debug": "npm run server:kill && mocha --reporter spec --inspect-brk \"test/**/*.test.js\"",
15
+ "build": "node scripts/build-config-all.js && cp -f README.md docs/index.md && cp -f CHANGELOG.md docs/CHANGELOG.md",
16
+ "dev:lint-install-local": "npm run server:kill && npm run lint:fix && npm link --force",
17
+ "dev:lint-install-local-copy-vscode": "npm run dev:lint-install-local && node scripts/deploy-in-vscode.js",
18
+ "dev:pre-commit": "npm-run-all lint:fix build server:build"
17
19
  },
18
20
  "repository": {
19
21
  "type": "git",
@@ -69,9 +71,12 @@
69
71
  "devDependencies": {
70
72
  "@babel/core": "^7.23.2",
71
73
  "@babel/eslint-parser": "^7.22.15",
74
+ "adm-zip": "^0.5.10",
72
75
  "diff": "^4.0.2",
73
76
  "eslint": "^8.52.0",
77
+ "handlebars": "^4.7.8",
74
78
  "mocha": "^10.2.0",
79
+ "npm-run-all": "^4.1.5",
75
80
  "nyc": "^15.1.0",
76
81
  "prettier": "^1.19.1",
77
82
  "rimraf": "^3.0.2",
Binary file