@codacy/tools-scalastyle-1 0.3.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/LICENSE +21 -0
- package/README.md +82 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1440 -0
- package/package.json +32 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1440 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
default: () => index_default
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(index_exports);
|
|
36
|
+
var import_tooling2 = require("@codacy/tooling");
|
|
37
|
+
|
|
38
|
+
// src/adapter.ts
|
|
39
|
+
var import_tooling = require("@codacy/tooling");
|
|
40
|
+
var import_fast_xml_parser = require("fast-xml-parser");
|
|
41
|
+
var import_path = __toESM(require("path"));
|
|
42
|
+
var import_promises = __toESM(require("fs/promises"));
|
|
43
|
+
var import_os = __toESM(require("os"));
|
|
44
|
+
|
|
45
|
+
// src/patterns.json
|
|
46
|
+
var patterns_default = [
|
|
47
|
+
{
|
|
48
|
+
id: "ScalaStyle_BlockImportChecker",
|
|
49
|
+
category: "BestPractice",
|
|
50
|
+
severityLevel: "Info",
|
|
51
|
+
title: "Avoid Block Imports",
|
|
52
|
+
enabled: true,
|
|
53
|
+
parameters: []
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: "ScalaStyle_CaseBraceChecker",
|
|
57
|
+
category: "CodeStyle",
|
|
58
|
+
severityLevel: "Info",
|
|
59
|
+
title: "Avoid Braces in Case Clauses",
|
|
60
|
+
enabled: true,
|
|
61
|
+
parameters: []
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "ScalaStyle_ClassNamesChecker",
|
|
65
|
+
category: "CodeStyle",
|
|
66
|
+
severityLevel: "Info",
|
|
67
|
+
title: "Enforce Class Naming Conventions",
|
|
68
|
+
enabled: true,
|
|
69
|
+
parameters: [
|
|
70
|
+
{
|
|
71
|
+
name: "regex",
|
|
72
|
+
default: "^[A-Z][A-Za-z]*$",
|
|
73
|
+
description: "regex"
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: "ScalaStyle_ClassTypeParameterChecker",
|
|
79
|
+
category: "CodeStyle",
|
|
80
|
+
severityLevel: "Info",
|
|
81
|
+
title: "Enforce Class Type Parameter Naming Convention",
|
|
82
|
+
enabled: true,
|
|
83
|
+
parameters: [
|
|
84
|
+
{
|
|
85
|
+
name: "regex",
|
|
86
|
+
default: "^[A-Z_]$",
|
|
87
|
+
description: "regex"
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: "ScalaStyle_CovariantEqualsChecker",
|
|
93
|
+
category: "ErrorProne",
|
|
94
|
+
severityLevel: "High",
|
|
95
|
+
title: "Avoid Covariant Equals Method Without Proper Override",
|
|
96
|
+
enabled: true,
|
|
97
|
+
parameters: []
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "ScalaStyle_CurliesImportChecker",
|
|
101
|
+
category: "BestPractice",
|
|
102
|
+
severityLevel: "Info",
|
|
103
|
+
title: "Avoid Curlies Imports",
|
|
104
|
+
enabled: true,
|
|
105
|
+
parameters: []
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: "ScalaStyle_CyclomaticComplexityChecker",
|
|
109
|
+
category: "Complexity",
|
|
110
|
+
severityLevel: "Warning",
|
|
111
|
+
title: "Enforce Cyclomatic Complexity Limits",
|
|
112
|
+
enabled: true,
|
|
113
|
+
parameters: [
|
|
114
|
+
{
|
|
115
|
+
name: "countCases",
|
|
116
|
+
default: "true",
|
|
117
|
+
description: "countCases"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: "maximum",
|
|
121
|
+
default: "10",
|
|
122
|
+
description: "maximum"
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: "ScalaStyle_DeprecatedJavaChecker",
|
|
128
|
+
category: "BestPractice",
|
|
129
|
+
severityLevel: "Info",
|
|
130
|
+
title: "Avoid Using Deprecated Java Annotations",
|
|
131
|
+
enabled: true,
|
|
132
|
+
parameters: []
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: "ScalaStyle_DisallowSpaceAfterTokenChecker",
|
|
136
|
+
category: "CodeStyle",
|
|
137
|
+
severityLevel: "Info",
|
|
138
|
+
title: "Disallow Space After Token",
|
|
139
|
+
enabled: true,
|
|
140
|
+
parameters: []
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
id: "ScalaStyle_DisallowSpaceBeforeTokenChecker",
|
|
144
|
+
category: "CodeStyle",
|
|
145
|
+
severityLevel: "Info",
|
|
146
|
+
title: "Disallow Space Before Token",
|
|
147
|
+
enabled: true,
|
|
148
|
+
parameters: []
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: "ScalaStyle_EmptyClassChecker",
|
|
152
|
+
category: "CodeStyle",
|
|
153
|
+
severityLevel: "Info",
|
|
154
|
+
title: "Avoid Empty Class Braces",
|
|
155
|
+
enabled: true,
|
|
156
|
+
parameters: []
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: "ScalaStyle_EmptyInterpolatedStringChecker",
|
|
160
|
+
category: "CodeStyle",
|
|
161
|
+
severityLevel: "Info",
|
|
162
|
+
title: "Avoid Empty Interpolated Strings",
|
|
163
|
+
enabled: true,
|
|
164
|
+
parameters: []
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
id: "ScalaStyle_EnsureSingleSpaceAfterTokenChecker",
|
|
168
|
+
category: "CodeStyle",
|
|
169
|
+
severityLevel: "Info",
|
|
170
|
+
title: "Ensure Single Space After Token",
|
|
171
|
+
enabled: true,
|
|
172
|
+
parameters: []
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
id: "ScalaStyle_EnsureSingleSpaceBeforeTokenChecker",
|
|
176
|
+
category: "CodeStyle",
|
|
177
|
+
severityLevel: "Info",
|
|
178
|
+
title: "Ensure Single Space Before Token",
|
|
179
|
+
enabled: true,
|
|
180
|
+
parameters: []
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: "ScalaStyle_EqualsHashCodeChecker",
|
|
184
|
+
category: "ErrorProne",
|
|
185
|
+
severityLevel: "High",
|
|
186
|
+
title: "Ensure equals and hashCode are both defined",
|
|
187
|
+
enabled: true,
|
|
188
|
+
parameters: []
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
id: "ScalaStyle_FieldNamesChecker",
|
|
192
|
+
category: "CodeStyle",
|
|
193
|
+
severityLevel: "Info",
|
|
194
|
+
title: "Enforce Consistent Field Names",
|
|
195
|
+
enabled: true,
|
|
196
|
+
parameters: [
|
|
197
|
+
{
|
|
198
|
+
name: "objectFieldRegex",
|
|
199
|
+
default: "^[A-Z][A-Za-z0-9]*$",
|
|
200
|
+
description: "objectFieldRegex"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
name: "regex",
|
|
204
|
+
default: "^[a-z][A-Za-z0-9]*$",
|
|
205
|
+
description: "regex"
|
|
206
|
+
}
|
|
207
|
+
]
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
id: "ScalaStyle_FileLengthChecker",
|
|
211
|
+
category: "Complexity",
|
|
212
|
+
severityLevel: "Info",
|
|
213
|
+
title: "Enforce File Length Limit",
|
|
214
|
+
enabled: true,
|
|
215
|
+
parameters: [
|
|
216
|
+
{
|
|
217
|
+
name: "maxFileLength",
|
|
218
|
+
default: "1500",
|
|
219
|
+
description: "maxFileLength"
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
id: "ScalaStyle_FileLineLengthChecker",
|
|
225
|
+
category: "CodeStyle",
|
|
226
|
+
severityLevel: "Info",
|
|
227
|
+
title: "Enforce File Line Length Limit",
|
|
228
|
+
enabled: true,
|
|
229
|
+
parameters: [
|
|
230
|
+
{
|
|
231
|
+
name: "ignoreImports",
|
|
232
|
+
default: "false",
|
|
233
|
+
description: "ignoreImports"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: "maxLineLength",
|
|
237
|
+
default: "160",
|
|
238
|
+
description: "maxLineLength"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
name: "tabSize",
|
|
242
|
+
default: "4",
|
|
243
|
+
description: "tabSize"
|
|
244
|
+
}
|
|
245
|
+
]
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
id: "ScalaStyle_FileTabChecker",
|
|
249
|
+
category: "CodeStyle",
|
|
250
|
+
severityLevel: "Info",
|
|
251
|
+
title: "Avoid Tabs in File",
|
|
252
|
+
enabled: true,
|
|
253
|
+
parameters: []
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
id: "ScalaStyle_ForBraceChecker",
|
|
257
|
+
category: "CodeStyle",
|
|
258
|
+
severityLevel: "Info",
|
|
259
|
+
title: "Enforce Braces in For Comprehensions",
|
|
260
|
+
enabled: true,
|
|
261
|
+
parameters: [
|
|
262
|
+
{
|
|
263
|
+
name: "singleLineAllowed",
|
|
264
|
+
default: "false",
|
|
265
|
+
description: "singleLineAllowed"
|
|
266
|
+
}
|
|
267
|
+
]
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
id: "ScalaStyle_ForLoopChecker",
|
|
271
|
+
category: "CodeStyle",
|
|
272
|
+
severityLevel: "Info",
|
|
273
|
+
title: "Enforce Readable For Loop Syntax",
|
|
274
|
+
enabled: true,
|
|
275
|
+
parameters: []
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
id: "ScalaStyle_HeaderMatchesChecker",
|
|
279
|
+
category: "BestPractice",
|
|
280
|
+
severityLevel: "Warning",
|
|
281
|
+
title: "Enforce File Header Matches",
|
|
282
|
+
enabled: true,
|
|
283
|
+
parameters: [
|
|
284
|
+
{
|
|
285
|
+
name: "header",
|
|
286
|
+
default: "",
|
|
287
|
+
description: "header"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
name: "regex",
|
|
291
|
+
default: "false",
|
|
292
|
+
description: "regex"
|
|
293
|
+
}
|
|
294
|
+
]
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
id: "ScalaStyle_IfBraceChecker",
|
|
298
|
+
category: "CodeStyle",
|
|
299
|
+
severityLevel: "Info",
|
|
300
|
+
title: "Enforce If Statement Braces",
|
|
301
|
+
enabled: true,
|
|
302
|
+
parameters: [
|
|
303
|
+
{
|
|
304
|
+
name: "doubleLineAllowed",
|
|
305
|
+
default: "false",
|
|
306
|
+
description: "doubleLineAllowed"
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
name: "singleLineAllowed",
|
|
310
|
+
default: "true",
|
|
311
|
+
description: "singleLineAllowed"
|
|
312
|
+
}
|
|
313
|
+
]
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
id: "ScalaStyle_IllegalImportsChecker",
|
|
317
|
+
category: "Compatibility",
|
|
318
|
+
severityLevel: "Warning",
|
|
319
|
+
title: "Disallow Illegal Imports",
|
|
320
|
+
enabled: true,
|
|
321
|
+
parameters: [
|
|
322
|
+
{
|
|
323
|
+
name: "illegalImports",
|
|
324
|
+
default: "sun._,java.awt._",
|
|
325
|
+
description: "illegalImports"
|
|
326
|
+
}
|
|
327
|
+
]
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
id: "ScalaStyle_ImportGroupingChecker",
|
|
331
|
+
category: "Comprehensibility",
|
|
332
|
+
severityLevel: "Info",
|
|
333
|
+
title: "Enforce Import Grouping",
|
|
334
|
+
enabled: true,
|
|
335
|
+
parameters: []
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
id: "ScalaStyle_ImportOrderChecker",
|
|
339
|
+
category: "CodeStyle",
|
|
340
|
+
severityLevel: "Info",
|
|
341
|
+
title: "Enforce Import Order",
|
|
342
|
+
enabled: true,
|
|
343
|
+
parameters: []
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
id: "ScalaStyle_IndentationChecker",
|
|
347
|
+
category: "CodeStyle",
|
|
348
|
+
severityLevel: "Info",
|
|
349
|
+
title: "Enforce Consistent Indentation",
|
|
350
|
+
enabled: true,
|
|
351
|
+
parameters: [
|
|
352
|
+
{
|
|
353
|
+
name: "classParamIndentSize",
|
|
354
|
+
default: "4",
|
|
355
|
+
description: "classParamIndentSize"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
name: "methodParamIndentSize",
|
|
359
|
+
default: "2",
|
|
360
|
+
description: "methodParamIndentSize"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
name: "tabSize",
|
|
364
|
+
default: "2",
|
|
365
|
+
description: "tabSize"
|
|
366
|
+
}
|
|
367
|
+
]
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
id: "ScalaStyle_LowercasePatternMatchChecker",
|
|
371
|
+
category: "ErrorProne",
|
|
372
|
+
severityLevel: "Warning",
|
|
373
|
+
title: "Avoid Lowercase Pattern Match Variable",
|
|
374
|
+
enabled: true,
|
|
375
|
+
parameters: []
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
id: "ScalaStyle_MagicNumberChecker",
|
|
379
|
+
category: "BestPractice",
|
|
380
|
+
severityLevel: "Info",
|
|
381
|
+
title: "Avoid Magic Numbers",
|
|
382
|
+
enabled: true,
|
|
383
|
+
parameters: [
|
|
384
|
+
{
|
|
385
|
+
name: "ignore",
|
|
386
|
+
default: "-1,0,1,2",
|
|
387
|
+
description: "ignore"
|
|
388
|
+
}
|
|
389
|
+
]
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
id: "ScalaStyle_MethodArgumentNamesChecker",
|
|
393
|
+
category: "CodeStyle",
|
|
394
|
+
severityLevel: "Info",
|
|
395
|
+
title: "Enforce Method Argument Names Style",
|
|
396
|
+
enabled: true,
|
|
397
|
+
parameters: [
|
|
398
|
+
{
|
|
399
|
+
name: "ignoreRegex",
|
|
400
|
+
default: "^$",
|
|
401
|
+
description: "ignoreRegex"
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
name: "regex",
|
|
405
|
+
default: "^[a-z][A-Za-z0-9]*$",
|
|
406
|
+
description: "regex"
|
|
407
|
+
}
|
|
408
|
+
]
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
id: "ScalaStyle_MethodLengthChecker",
|
|
412
|
+
category: "Comprehensibility",
|
|
413
|
+
severityLevel: "Info",
|
|
414
|
+
title: "Avoid Long Methods",
|
|
415
|
+
enabled: true,
|
|
416
|
+
parameters: [
|
|
417
|
+
{
|
|
418
|
+
name: "ignoreComments",
|
|
419
|
+
default: "false",
|
|
420
|
+
description: "ignoreComments"
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
name: "ignoreEmpty",
|
|
424
|
+
default: "false",
|
|
425
|
+
description: "ignoreEmpty"
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
name: "maxLength",
|
|
429
|
+
default: "50",
|
|
430
|
+
description: "maxLength"
|
|
431
|
+
}
|
|
432
|
+
]
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
id: "ScalaStyle_MethodNamesChecker",
|
|
436
|
+
category: "CodeStyle",
|
|
437
|
+
severityLevel: "Info",
|
|
438
|
+
title: "Enforce Method Naming Conventions",
|
|
439
|
+
enabled: true,
|
|
440
|
+
parameters: [
|
|
441
|
+
{
|
|
442
|
+
name: "ignoreOverride",
|
|
443
|
+
default: "false",
|
|
444
|
+
description: "ignoreOverride"
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
name: "ignoreRegex",
|
|
448
|
+
default: "^$",
|
|
449
|
+
description: "ignoreRegex"
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
name: "regex",
|
|
453
|
+
default: "^[a-z][A-Za-z0-9]*(_=)?$",
|
|
454
|
+
description: "regex"
|
|
455
|
+
}
|
|
456
|
+
]
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
id: "ScalaStyle_MultipleStringLiteralsChecker",
|
|
460
|
+
category: "BestPractice",
|
|
461
|
+
severityLevel: "Warning",
|
|
462
|
+
title: "Avoid Multiple String Literals",
|
|
463
|
+
enabled: true,
|
|
464
|
+
parameters: [
|
|
465
|
+
{
|
|
466
|
+
name: "allowed",
|
|
467
|
+
default: "1",
|
|
468
|
+
description: "allowed"
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
name: "ignoreRegex",
|
|
472
|
+
default: '^""$',
|
|
473
|
+
description: "ignoreRegex"
|
|
474
|
+
}
|
|
475
|
+
]
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
id: "ScalaStyle_NamedArgumentChecker",
|
|
479
|
+
category: "Comprehensibility",
|
|
480
|
+
severityLevel: "Info",
|
|
481
|
+
title: "Enforce Named Arguments",
|
|
482
|
+
enabled: true,
|
|
483
|
+
parameters: [
|
|
484
|
+
{
|
|
485
|
+
name: "checkString",
|
|
486
|
+
default: "false",
|
|
487
|
+
description: "checkString"
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
name: "ignoreMethod",
|
|
491
|
+
default: "^set.+$",
|
|
492
|
+
description: "ignoreMethod"
|
|
493
|
+
}
|
|
494
|
+
]
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
id: "ScalaStyle_NewLineAtEofChecker",
|
|
498
|
+
category: "Compatibility",
|
|
499
|
+
severityLevel: "Info",
|
|
500
|
+
title: "Enforce New Line At End Of File",
|
|
501
|
+
enabled: true,
|
|
502
|
+
parameters: []
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
id: "ScalaStyle_NoCloneChecker",
|
|
506
|
+
category: "BestPractice",
|
|
507
|
+
severityLevel: "Warning",
|
|
508
|
+
title: "Avoid Using Clone Method",
|
|
509
|
+
enabled: true,
|
|
510
|
+
parameters: []
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
id: "ScalaStyle_NoFinalizeChecker",
|
|
514
|
+
category: "BestPractice",
|
|
515
|
+
severityLevel: "Warning",
|
|
516
|
+
title: "Avoid Using finalize Method",
|
|
517
|
+
enabled: true,
|
|
518
|
+
parameters: []
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
id: "ScalaStyle_NonASCIICharacterChecker",
|
|
522
|
+
category: "CodeStyle",
|
|
523
|
+
severityLevel: "Info",
|
|
524
|
+
title: "Avoid Non-ASCII Characters",
|
|
525
|
+
enabled: true,
|
|
526
|
+
parameters: [
|
|
527
|
+
{
|
|
528
|
+
name: "allowStringLiterals",
|
|
529
|
+
default: "false",
|
|
530
|
+
description: "allowStringLiterals"
|
|
531
|
+
}
|
|
532
|
+
]
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
id: "ScalaStyle_NoNewLineAtEofChecker",
|
|
536
|
+
category: "CodeStyle",
|
|
537
|
+
severityLevel: "Info",
|
|
538
|
+
title: "Disallow New Line at End of File",
|
|
539
|
+
enabled: true,
|
|
540
|
+
parameters: []
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
id: "ScalaStyle_NotImplementedErrorUsage",
|
|
544
|
+
category: "ErrorProne",
|
|
545
|
+
severityLevel: "High",
|
|
546
|
+
title: "Avoid Not Implemented Error Usage",
|
|
547
|
+
enabled: true,
|
|
548
|
+
parameters: []
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
id: "ScalaStyle_NoWhitespaceAfterLeftBracketChecker",
|
|
552
|
+
category: "CodeStyle",
|
|
553
|
+
severityLevel: "Info",
|
|
554
|
+
title: "Disallow Whitespace After Left Bracket",
|
|
555
|
+
enabled: true,
|
|
556
|
+
parameters: []
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
id: "ScalaStyle_NoWhitespaceBeforeLeftBracketChecker",
|
|
560
|
+
category: "CodeStyle",
|
|
561
|
+
severityLevel: "Info",
|
|
562
|
+
title: "Avoid Whitespace Before Left Bracket",
|
|
563
|
+
enabled: true,
|
|
564
|
+
parameters: []
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
id: "ScalaStyle_NoWhitespaceBeforeRightBracketChecker",
|
|
568
|
+
category: "CodeStyle",
|
|
569
|
+
severityLevel: "Info",
|
|
570
|
+
title: "Disallow Whitespace Before Right Bracket",
|
|
571
|
+
enabled: true,
|
|
572
|
+
parameters: []
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
id: "ScalaStyle_NullChecker",
|
|
576
|
+
category: "BestPractice",
|
|
577
|
+
severityLevel: "Warning",
|
|
578
|
+
title: "Avoid Using Null",
|
|
579
|
+
enabled: true,
|
|
580
|
+
parameters: [
|
|
581
|
+
{
|
|
582
|
+
name: "allowNullChecks",
|
|
583
|
+
default: "true",
|
|
584
|
+
description: "allowNullChecks"
|
|
585
|
+
}
|
|
586
|
+
]
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
id: "ScalaStyle_NumberOfMethodsInTypeChecker",
|
|
590
|
+
category: "Complexity",
|
|
591
|
+
severityLevel: "Warning",
|
|
592
|
+
title: "Enforce Limit on Number of Methods in Type",
|
|
593
|
+
enabled: true,
|
|
594
|
+
parameters: [
|
|
595
|
+
{
|
|
596
|
+
name: "maxMethods",
|
|
597
|
+
default: "30",
|
|
598
|
+
description: "maxMethods"
|
|
599
|
+
}
|
|
600
|
+
]
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
id: "ScalaStyle_NumberOfTypesChecker",
|
|
604
|
+
category: "Complexity",
|
|
605
|
+
severityLevel: "Warning",
|
|
606
|
+
title: "Limit Number of Types per File",
|
|
607
|
+
enabled: true,
|
|
608
|
+
parameters: [
|
|
609
|
+
{
|
|
610
|
+
name: "maxTypes",
|
|
611
|
+
default: "20",
|
|
612
|
+
description: "maxTypes"
|
|
613
|
+
}
|
|
614
|
+
]
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
id: "ScalaStyle_ObjectNamesChecker",
|
|
618
|
+
category: "CodeStyle",
|
|
619
|
+
severityLevel: "Info",
|
|
620
|
+
title: "Enforce Object Naming Conventions",
|
|
621
|
+
enabled: true,
|
|
622
|
+
parameters: [
|
|
623
|
+
{
|
|
624
|
+
name: "regex",
|
|
625
|
+
default: "^[A-Z][A-Za-z]*$",
|
|
626
|
+
description: "regex"
|
|
627
|
+
}
|
|
628
|
+
]
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
id: "ScalaStyle_OverrideJavaChecker",
|
|
632
|
+
category: "BestPractice",
|
|
633
|
+
severityLevel: "Info",
|
|
634
|
+
title: "Enforce use of Scala override keyword",
|
|
635
|
+
enabled: true,
|
|
636
|
+
parameters: []
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
id: "ScalaStyle_PackageNamesChecker",
|
|
640
|
+
category: "CodeStyle",
|
|
641
|
+
severityLevel: "Info",
|
|
642
|
+
title: "Enforce Package Naming Conventions",
|
|
643
|
+
enabled: true,
|
|
644
|
+
parameters: [
|
|
645
|
+
{
|
|
646
|
+
name: "regex",
|
|
647
|
+
default: "^[a-z]+$",
|
|
648
|
+
description: "regex"
|
|
649
|
+
}
|
|
650
|
+
]
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
id: "ScalaStyle_PackageObjectNamesChecker",
|
|
654
|
+
category: "CodeStyle",
|
|
655
|
+
severityLevel: "Info",
|
|
656
|
+
title: "Enforce Package Object Naming Conventions",
|
|
657
|
+
enabled: true,
|
|
658
|
+
parameters: [
|
|
659
|
+
{
|
|
660
|
+
name: "regex",
|
|
661
|
+
default: "^[a-z][A-Za-z]*$",
|
|
662
|
+
description: "regex"
|
|
663
|
+
}
|
|
664
|
+
]
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
id: "ScalaStyle_ParameterNumberChecker",
|
|
668
|
+
category: "Complexity",
|
|
669
|
+
severityLevel: "Warning",
|
|
670
|
+
title: "Avoid Methods with Too Many Parameters",
|
|
671
|
+
enabled: true,
|
|
672
|
+
parameters: [
|
|
673
|
+
{
|
|
674
|
+
name: "maxParameters",
|
|
675
|
+
default: "8",
|
|
676
|
+
description: "maxParameters"
|
|
677
|
+
}
|
|
678
|
+
]
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
id: "ScalaStyle_PatternMatchAlignChecker",
|
|
682
|
+
category: "CodeStyle",
|
|
683
|
+
severityLevel: "Info",
|
|
684
|
+
title: "Enforce Pattern Match Alignment",
|
|
685
|
+
enabled: true,
|
|
686
|
+
parameters: []
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
id: "ScalaStyle_ProcedureDeclarationChecker",
|
|
690
|
+
category: "ErrorProne",
|
|
691
|
+
severityLevel: "Warning",
|
|
692
|
+
title: "Avoid Procedure Style Declarations",
|
|
693
|
+
enabled: true,
|
|
694
|
+
parameters: []
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
id: "ScalaStyle_PublicMethodsHaveTypeChecker",
|
|
698
|
+
category: "BestPractice",
|
|
699
|
+
severityLevel: "Warning",
|
|
700
|
+
title: "Enforce Public Methods Have Explicit Return Type",
|
|
701
|
+
enabled: true,
|
|
702
|
+
parameters: [
|
|
703
|
+
{
|
|
704
|
+
name: "ignoreOverride",
|
|
705
|
+
default: "false",
|
|
706
|
+
description: "ignoreOverride"
|
|
707
|
+
}
|
|
708
|
+
]
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
id: "ScalaStyle_RedundantIfChecker",
|
|
712
|
+
category: "CodeStyle",
|
|
713
|
+
severityLevel: "Info",
|
|
714
|
+
title: "Avoid Redundant If Expressions",
|
|
715
|
+
enabled: true,
|
|
716
|
+
parameters: []
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
id: "ScalaStyle_RegexChecker",
|
|
720
|
+
category: "CodeStyle",
|
|
721
|
+
severityLevel: "Info",
|
|
722
|
+
title: "Enforce Custom Checks Using Regular Expressions",
|
|
723
|
+
enabled: true,
|
|
724
|
+
parameters: [
|
|
725
|
+
{
|
|
726
|
+
name: "line",
|
|
727
|
+
default: "false",
|
|
728
|
+
description: "line"
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
name: "regex",
|
|
732
|
+
default: "",
|
|
733
|
+
description: "regex"
|
|
734
|
+
}
|
|
735
|
+
]
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
id: "ScalaStyle_ReturnChecker",
|
|
739
|
+
category: "BestPractice",
|
|
740
|
+
severityLevel: "Info",
|
|
741
|
+
title: "Avoid Use of Return",
|
|
742
|
+
enabled: true,
|
|
743
|
+
parameters: []
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
id: "ScalaStyle_ScalaDocChecker",
|
|
747
|
+
category: "Documentation",
|
|
748
|
+
severityLevel: "Info",
|
|
749
|
+
title: "Enforce ScalaDoc Usage",
|
|
750
|
+
enabled: true,
|
|
751
|
+
parameters: [
|
|
752
|
+
{
|
|
753
|
+
name: "ignoreOverride",
|
|
754
|
+
default: "false",
|
|
755
|
+
description: "ignoreOverride"
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
name: "ignoreRegex",
|
|
759
|
+
default: "^$",
|
|
760
|
+
description: "ignoreRegex"
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
name: "ignoreTokenTypes",
|
|
764
|
+
default: "^$",
|
|
765
|
+
description: "ignoreTokenTypes"
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
name: "indentStyle",
|
|
769
|
+
default: "anydoc",
|
|
770
|
+
description: "indentStyle"
|
|
771
|
+
}
|
|
772
|
+
]
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
id: "ScalaStyle_SimplifyBooleanExpressionChecker",
|
|
776
|
+
category: "Comprehensibility",
|
|
777
|
+
severityLevel: "Info",
|
|
778
|
+
title: "Simplify Boolean Expression",
|
|
779
|
+
enabled: true,
|
|
780
|
+
parameters: []
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
id: "ScalaStyle_SpaceAfterCommentStartChecker",
|
|
784
|
+
category: "CodeStyle",
|
|
785
|
+
severityLevel: "Info",
|
|
786
|
+
title: "Enforce Space After Comment Start",
|
|
787
|
+
enabled: true,
|
|
788
|
+
parameters: []
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
id: "ScalaStyle_SpacesAfterPlusChecker",
|
|
792
|
+
category: "CodeStyle",
|
|
793
|
+
severityLevel: "Info",
|
|
794
|
+
title: "Enforce Spaces Around Plus Operator",
|
|
795
|
+
enabled: true,
|
|
796
|
+
parameters: []
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
id: "ScalaStyle_SpacesBeforePlusChecker",
|
|
800
|
+
category: "CodeStyle",
|
|
801
|
+
severityLevel: "Info",
|
|
802
|
+
title: "Enforce Spaces Before Plus Operator",
|
|
803
|
+
enabled: true,
|
|
804
|
+
parameters: []
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
id: "ScalaStyle_StructuralTypeChecker",
|
|
808
|
+
category: "Performance",
|
|
809
|
+
severityLevel: "Warning",
|
|
810
|
+
title: "Avoid Structural Types",
|
|
811
|
+
enabled: true,
|
|
812
|
+
parameters: []
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
id: "ScalaStyle_ThrowChecker",
|
|
816
|
+
category: "BestPractice",
|
|
817
|
+
severityLevel: "Warning",
|
|
818
|
+
title: "Avoid Throw Statements",
|
|
819
|
+
enabled: true,
|
|
820
|
+
parameters: []
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
id: "ScalaStyle_TodoCommentChecker",
|
|
824
|
+
category: "CodeStyle",
|
|
825
|
+
severityLevel: "Info",
|
|
826
|
+
title: "Avoid Todo and Fixme Comments",
|
|
827
|
+
enabled: true,
|
|
828
|
+
parameters: [
|
|
829
|
+
{
|
|
830
|
+
name: "words",
|
|
831
|
+
default: "TODO|FIXME",
|
|
832
|
+
description: "words"
|
|
833
|
+
}
|
|
834
|
+
]
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
id: "ScalaStyle_TokenChecker",
|
|
838
|
+
category: "CodeStyle",
|
|
839
|
+
severityLevel: "Info",
|
|
840
|
+
title: "Check Presence of Specific Token",
|
|
841
|
+
enabled: true,
|
|
842
|
+
parameters: [
|
|
843
|
+
{
|
|
844
|
+
name: "regex",
|
|
845
|
+
default: "^$",
|
|
846
|
+
description: "regex"
|
|
847
|
+
}
|
|
848
|
+
]
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
id: "ScalaStyle_UnderscoreImportChecker",
|
|
852
|
+
category: "BestPractice",
|
|
853
|
+
severityLevel: "Warning",
|
|
854
|
+
title: "Avoid Underscore Imports",
|
|
855
|
+
enabled: true,
|
|
856
|
+
parameters: []
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
id: "ScalaStyle_UppercaseLChecker",
|
|
860
|
+
category: "Comprehensibility",
|
|
861
|
+
severityLevel: "Info",
|
|
862
|
+
title: "Avoid Lowercase L in Identifiers",
|
|
863
|
+
enabled: true,
|
|
864
|
+
parameters: []
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
id: "ScalaStyle_VarFieldChecker",
|
|
868
|
+
category: "BestPractice",
|
|
869
|
+
severityLevel: "Info",
|
|
870
|
+
title: "Avoid Using Var Fields",
|
|
871
|
+
enabled: true,
|
|
872
|
+
parameters: []
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
id: "ScalaStyle_VarLocalChecker",
|
|
876
|
+
category: "BestPractice",
|
|
877
|
+
severityLevel: "Warning",
|
|
878
|
+
title: "Avoid Mutable Local Variables (var Local)",
|
|
879
|
+
enabled: true,
|
|
880
|
+
parameters: []
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
id: "ScalaStyle_WhileBraceChecker",
|
|
884
|
+
category: "BestPractice",
|
|
885
|
+
severityLevel: "Info",
|
|
886
|
+
title: "Enforce Braces for While Loops",
|
|
887
|
+
enabled: true,
|
|
888
|
+
parameters: []
|
|
889
|
+
},
|
|
890
|
+
{
|
|
891
|
+
id: "ScalaStyle_WhileChecker",
|
|
892
|
+
category: "BestPractice",
|
|
893
|
+
severityLevel: "Info",
|
|
894
|
+
title: "Avoid Using While Loops",
|
|
895
|
+
enabled: true,
|
|
896
|
+
parameters: []
|
|
897
|
+
},
|
|
898
|
+
{
|
|
899
|
+
id: "ScalaStyle_WhitespaceEndOfLineChecker",
|
|
900
|
+
category: "CodeStyle",
|
|
901
|
+
severityLevel: "Info",
|
|
902
|
+
title: "Avoid Whitespace at End of Line",
|
|
903
|
+
enabled: true,
|
|
904
|
+
parameters: [
|
|
905
|
+
{
|
|
906
|
+
name: "ignoreWhitespaceLines",
|
|
907
|
+
default: "false",
|
|
908
|
+
description: "ignoreWhitespaceLines"
|
|
909
|
+
}
|
|
910
|
+
]
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
id: "ScalaStyle_XmlLiteralChecker",
|
|
914
|
+
category: "BestPractice",
|
|
915
|
+
severityLevel: "Info",
|
|
916
|
+
title: "Avoid XML Literals",
|
|
917
|
+
enabled: true,
|
|
918
|
+
parameters: []
|
|
919
|
+
}
|
|
920
|
+
];
|
|
921
|
+
|
|
922
|
+
// src/adapter.ts
|
|
923
|
+
var TOOL_ID = "ScalaStyle";
|
|
924
|
+
var SCALASTYLE_VERSION = "1.5.1";
|
|
925
|
+
var JAR_NAME = "scalastyle.jar";
|
|
926
|
+
var JAR_URL = "https://repo1.maven.org/maven2/com/beautiful-scala/scalastyle_2.13/1.5.1/scalastyle_2.13-1.5.1-assembly.jar";
|
|
927
|
+
var JAVA_VERSION_RANGE = ">=8";
|
|
928
|
+
var FILE_LEVEL_CHECKERS = /* @__PURE__ */ new Set([
|
|
929
|
+
"FileLengthChecker",
|
|
930
|
+
"FileLineLengthChecker",
|
|
931
|
+
"FileTabChecker",
|
|
932
|
+
"HeaderMatchesChecker",
|
|
933
|
+
"IndentationChecker",
|
|
934
|
+
"NewLineAtEofChecker",
|
|
935
|
+
"RegexChecker",
|
|
936
|
+
"WhitespaceEndOfLineChecker"
|
|
937
|
+
]);
|
|
938
|
+
var VALID_CATEGORIES = /* @__PURE__ */ new Set([
|
|
939
|
+
"Security",
|
|
940
|
+
"ErrorProne",
|
|
941
|
+
"CodeStyle",
|
|
942
|
+
"Compatibility",
|
|
943
|
+
"Performance",
|
|
944
|
+
"UnusedCode",
|
|
945
|
+
"Complexity",
|
|
946
|
+
"BestPractice",
|
|
947
|
+
"Documentation"
|
|
948
|
+
]);
|
|
949
|
+
var PATTERN_META = new Map(
|
|
950
|
+
patterns_default.map((p) => [
|
|
951
|
+
p.id,
|
|
952
|
+
{
|
|
953
|
+
category: VALID_CATEGORIES.has(p.category) ? p.category : "BestPractice",
|
|
954
|
+
severity: p.severityLevel ?? "Info"
|
|
955
|
+
}
|
|
956
|
+
])
|
|
957
|
+
);
|
|
958
|
+
function ruleMetadata(patternId) {
|
|
959
|
+
return PATTERN_META.get(patternId) ?? { category: "CodeStyle", severity: "Info" };
|
|
960
|
+
}
|
|
961
|
+
var xmlParser = new import_fast_xml_parser.XMLParser({
|
|
962
|
+
ignoreAttributes: false,
|
|
963
|
+
attributeNamePrefix: "@_",
|
|
964
|
+
isArray: (name) => name === "file" || name === "error",
|
|
965
|
+
processEntities: {
|
|
966
|
+
enabled: true,
|
|
967
|
+
maxTotalExpansions: 1e5
|
|
968
|
+
}
|
|
969
|
+
});
|
|
970
|
+
function getLineContent(lines, lineNumber) {
|
|
971
|
+
return lines[lineNumber - 1] ?? "";
|
|
972
|
+
}
|
|
973
|
+
async function readFileLines(filePath) {
|
|
974
|
+
try {
|
|
975
|
+
const content = await import_promises.default.readFile(filePath, "utf-8");
|
|
976
|
+
return content.split("\n");
|
|
977
|
+
} catch {
|
|
978
|
+
return [];
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
function buildResult(startedAt, completedAt, issues, errors, filesAnalyzed) {
|
|
982
|
+
const durationMs = completedAt.getTime() - startedAt.getTime();
|
|
983
|
+
return {
|
|
984
|
+
metadata: {
|
|
985
|
+
startedAt: startedAt.toISOString(),
|
|
986
|
+
completedAt: completedAt.toISOString(),
|
|
987
|
+
durationMs
|
|
988
|
+
},
|
|
989
|
+
issues,
|
|
990
|
+
errors,
|
|
991
|
+
summary: {
|
|
992
|
+
toolId: TOOL_ID,
|
|
993
|
+
status: errors.some((e) => e.level === "error") ? "partial" : "success",
|
|
994
|
+
issueCount: issues.length,
|
|
995
|
+
errorCount: errors.length,
|
|
996
|
+
durationMs,
|
|
997
|
+
filesAnalyzed
|
|
998
|
+
}
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
function derivePatternId(source) {
|
|
1002
|
+
const lastDot = source.lastIndexOf(".");
|
|
1003
|
+
const checkerName = lastDot >= 0 ? source.substring(lastDot + 1) : source;
|
|
1004
|
+
return `${TOOL_ID}_${checkerName}`;
|
|
1005
|
+
}
|
|
1006
|
+
function checkerNameToFqcn(checkerName) {
|
|
1007
|
+
const namespace = FILE_LEVEL_CHECKERS.has(checkerName) ? "org.scalastyle.file" : "org.scalastyle.scalariform";
|
|
1008
|
+
return `${namespace}.${checkerName}`;
|
|
1009
|
+
}
|
|
1010
|
+
async function resolveJarPath(ctx) {
|
|
1011
|
+
const jarPath = import_path.default.join(ctx.toolInstallDir, JAR_NAME);
|
|
1012
|
+
try {
|
|
1013
|
+
await import_promises.default.access(jarPath);
|
|
1014
|
+
return jarPath;
|
|
1015
|
+
} catch {
|
|
1016
|
+
return null;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
async function resolveJavaBinary(ctx) {
|
|
1020
|
+
const jreDir = import_path.default.join(ctx.globalDir, "runtimes", "java-17");
|
|
1021
|
+
const javaBin = import_path.default.join(jreDir, "bin", "java");
|
|
1022
|
+
try {
|
|
1023
|
+
await import_promises.default.access(javaBin);
|
|
1024
|
+
return javaBin;
|
|
1025
|
+
} catch {
|
|
1026
|
+
}
|
|
1027
|
+
if (process.env.JAVA_HOME) {
|
|
1028
|
+
const javaHome = import_path.default.join(process.env.JAVA_HOME, "bin", "java");
|
|
1029
|
+
try {
|
|
1030
|
+
await import_promises.default.access(javaHome);
|
|
1031
|
+
return javaHome;
|
|
1032
|
+
} catch {
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
return "java";
|
|
1036
|
+
}
|
|
1037
|
+
function generateScalastyleConfig(patterns) {
|
|
1038
|
+
const checks = [];
|
|
1039
|
+
for (const pattern of patterns) {
|
|
1040
|
+
const prefix = `${TOOL_ID}_`;
|
|
1041
|
+
if (!pattern.patternId.startsWith(prefix)) continue;
|
|
1042
|
+
const checkerName = pattern.patternId.slice(prefix.length);
|
|
1043
|
+
const fqcn = checkerNameToFqcn(checkerName);
|
|
1044
|
+
const params = pattern.parameters ?? {};
|
|
1045
|
+
const mergedParams = Object.entries(params).map(
|
|
1046
|
+
([key, val]) => ({ name: key, value: val })
|
|
1047
|
+
);
|
|
1048
|
+
if (REQUIRES_USER_PARAMS.has(checkerName) && mergedParams.length === 0) {
|
|
1049
|
+
continue;
|
|
1050
|
+
}
|
|
1051
|
+
if (mergedParams.length > 0) {
|
|
1052
|
+
const paramLines = mergedParams.map(
|
|
1053
|
+
(p) => ` <parameter name="${escapeXml(p.name)}">${escapeXml(p.value)}</parameter>`
|
|
1054
|
+
).join("\n");
|
|
1055
|
+
checks.push(
|
|
1056
|
+
` <check level="warning" class="${fqcn}" enabled="true">
|
|
1057
|
+
<parameters>
|
|
1058
|
+
${paramLines}
|
|
1059
|
+
</parameters>
|
|
1060
|
+
</check>`
|
|
1061
|
+
);
|
|
1062
|
+
} else {
|
|
1063
|
+
checks.push(` <check level="warning" class="${fqcn}" enabled="true" />`);
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
const lines = [
|
|
1067
|
+
`<scalastyle>`,
|
|
1068
|
+
` <name>Generated configuration</name>`,
|
|
1069
|
+
...checks,
|
|
1070
|
+
`</scalastyle>`
|
|
1071
|
+
];
|
|
1072
|
+
return lines.join("\n") + "\n";
|
|
1073
|
+
}
|
|
1074
|
+
function escapeXml(str) {
|
|
1075
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1076
|
+
}
|
|
1077
|
+
var REQUIRES_USER_PARAMS = /* @__PURE__ */ new Set([
|
|
1078
|
+
"HeaderMatchesChecker",
|
|
1079
|
+
// needs `header` parameter
|
|
1080
|
+
"RegexChecker",
|
|
1081
|
+
// needs `regex` parameter
|
|
1082
|
+
"TokenChecker"
|
|
1083
|
+
// needs `regex` parameter
|
|
1084
|
+
]);
|
|
1085
|
+
var CONFIG_FILE_CANDIDATES = ["scalastyle_config.xml", "scalastyle-config.xml"];
|
|
1086
|
+
var adapter = {
|
|
1087
|
+
id: TOOL_ID,
|
|
1088
|
+
displayName: "Scalastyle",
|
|
1089
|
+
preferredVersion: SCALASTYLE_VERSION,
|
|
1090
|
+
compatibleVersions: ">=1.0.0",
|
|
1091
|
+
website: "http://www.scalastyle.org/",
|
|
1092
|
+
languages: ["Scala"],
|
|
1093
|
+
filePatterns: ["**/*.scala"],
|
|
1094
|
+
supportedOS: ["linux", "darwin", "win32"],
|
|
1095
|
+
supportedArch: ["x64", "arm64"],
|
|
1096
|
+
supportedRunners: ["local", "container"],
|
|
1097
|
+
prerequisites: [
|
|
1098
|
+
{
|
|
1099
|
+
name: "Java",
|
|
1100
|
+
versionRange: JAVA_VERSION_RANGE,
|
|
1101
|
+
preferredVersion: "17",
|
|
1102
|
+
checkCommand: "java -version"
|
|
1103
|
+
}
|
|
1104
|
+
],
|
|
1105
|
+
/**
|
|
1106
|
+
* Checks whether Scalastyle is available by detecting Java and the JAR.
|
|
1107
|
+
*
|
|
1108
|
+
* Reports Java as a dependency. Scalastyle is considered available if:
|
|
1109
|
+
* 1. Java 8+ is found on the system or in the Codacy-managed JRE
|
|
1110
|
+
* 2. The Scalastyle assembly JAR exists in the tool install directory
|
|
1111
|
+
*/
|
|
1112
|
+
async checkAvailability(ctx) {
|
|
1113
|
+
ctx.logger.debug("Checking availability", { toolId: TOOL_ID });
|
|
1114
|
+
const javaInfo = await (0, import_tooling.findJava)(JAVA_VERSION_RANGE, ctx.logger).catch(() => null);
|
|
1115
|
+
const dependencies = javaInfo ? [{ name: "Java", available: true, version: javaInfo.version, installation: "global" }] : [{ name: "Java", available: false, reason: `Java (${JAVA_VERSION_RANGE}) not found` }];
|
|
1116
|
+
if (!javaInfo) {
|
|
1117
|
+
const jreDir = import_path.default.join(ctx.globalDir, "runtimes", "java-17");
|
|
1118
|
+
const javaBin = import_path.default.join(jreDir, "bin", "java");
|
|
1119
|
+
try {
|
|
1120
|
+
await import_promises.default.access(javaBin);
|
|
1121
|
+
dependencies[0] = {
|
|
1122
|
+
name: "Java",
|
|
1123
|
+
available: true,
|
|
1124
|
+
version: "17",
|
|
1125
|
+
installation: "codacy"
|
|
1126
|
+
};
|
|
1127
|
+
} catch {
|
|
1128
|
+
return {
|
|
1129
|
+
available: false,
|
|
1130
|
+
reason: "Java runtime not found (required for Scalastyle)",
|
|
1131
|
+
installHint: "Install JDK 8+, or run with --install-dependencies for auto-download",
|
|
1132
|
+
dependencies
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
const jarPath = await resolveJarPath(ctx);
|
|
1137
|
+
if (jarPath) {
|
|
1138
|
+
ctx.logger.debug("Scalastyle available", { toolId: TOOL_ID, version: SCALASTYLE_VERSION });
|
|
1139
|
+
return {
|
|
1140
|
+
available: true,
|
|
1141
|
+
version: SCALASTYLE_VERSION,
|
|
1142
|
+
path: jarPath,
|
|
1143
|
+
installation: "codacy",
|
|
1144
|
+
dependencies
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
ctx.logger.debug("Scalastyle JAR not found", { toolId: TOOL_ID });
|
|
1148
|
+
return {
|
|
1149
|
+
available: false,
|
|
1150
|
+
reason: `Scalastyle JAR not found at ${import_path.default.join(ctx.toolInstallDir, JAR_NAME)}`,
|
|
1151
|
+
installHint: "Run with --install-dependencies to auto-download, or manually place the JAR",
|
|
1152
|
+
dependencies
|
|
1153
|
+
};
|
|
1154
|
+
},
|
|
1155
|
+
/**
|
|
1156
|
+
* Installs Scalastyle by ensuring a JRE is available and downloading
|
|
1157
|
+
* the assembly JAR from Maven Central.
|
|
1158
|
+
*
|
|
1159
|
+
* Uses ensureJre() to download Adoptium Temurin JDK 17 if no system Java
|
|
1160
|
+
* is found, then downloads the Scalastyle assembly JAR.
|
|
1161
|
+
*/
|
|
1162
|
+
async install(ctx) {
|
|
1163
|
+
ctx.logger.info("Starting install", { toolId: TOOL_ID });
|
|
1164
|
+
const java = await (0, import_tooling.ensureJre)(ctx.globalDir, JAVA_VERSION_RANGE, ctx.logger);
|
|
1165
|
+
if (!java) {
|
|
1166
|
+
return {
|
|
1167
|
+
success: false,
|
|
1168
|
+
error: {
|
|
1169
|
+
toolId: TOOL_ID,
|
|
1170
|
+
phase: "requirementCheck",
|
|
1171
|
+
kind: "MissingPrerequisite",
|
|
1172
|
+
message: `Java (${JAVA_VERSION_RANGE}) could not be found or downloaded. Scalastyle requires a JDK/JRE.`,
|
|
1173
|
+
level: "error"
|
|
1174
|
+
}
|
|
1175
|
+
};
|
|
1176
|
+
}
|
|
1177
|
+
try {
|
|
1178
|
+
ctx.logger.info(`Downloading Scalastyle ${SCALASTYLE_VERSION} JAR...`);
|
|
1179
|
+
const jarPath = await (0, import_tooling.downloadJar)(JAR_URL, ctx.toolInstallDir, JAR_NAME, ctx.logger);
|
|
1180
|
+
ctx.logger.info(`Downloaded Scalastyle to ${jarPath}`);
|
|
1181
|
+
return { success: true, installedPath: jarPath, installedVersion: SCALASTYLE_VERSION };
|
|
1182
|
+
} catch (err) {
|
|
1183
|
+
return {
|
|
1184
|
+
success: false,
|
|
1185
|
+
error: {
|
|
1186
|
+
toolId: TOOL_ID,
|
|
1187
|
+
phase: "toolInstall",
|
|
1188
|
+
kind: "InstallError",
|
|
1189
|
+
message: `Failed to download Scalastyle JAR: ${err instanceof Error ? err.message : String(err)}`,
|
|
1190
|
+
level: "error"
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
}
|
|
1194
|
+
},
|
|
1195
|
+
/**
|
|
1196
|
+
* Checks for Scalastyle configuration files in the repository root.
|
|
1197
|
+
*
|
|
1198
|
+
* Looks for `scalastyle_config.xml` or `scalastyle-config.xml` (in that order).
|
|
1199
|
+
* Returns the first found file.
|
|
1200
|
+
*/
|
|
1201
|
+
async checkLocalConfigurationFile(ctx) {
|
|
1202
|
+
ctx.logger.debug("Checking for local config", { toolId: TOOL_ID });
|
|
1203
|
+
for (const candidate of CONFIG_FILE_CANDIDATES) {
|
|
1204
|
+
const candidatePath = import_path.default.join(ctx.repositoryRoot, candidate);
|
|
1205
|
+
try {
|
|
1206
|
+
await import_promises.default.access(candidatePath);
|
|
1207
|
+
ctx.logger.debug("Local config found", { toolId: TOOL_ID, path: candidatePath });
|
|
1208
|
+
return { found: true, path: candidatePath };
|
|
1209
|
+
} catch {
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
return { found: false };
|
|
1213
|
+
},
|
|
1214
|
+
/**
|
|
1215
|
+
* Runs Scalastyle via `java -cp scalastyle.jar org.scalastyle.Main` against
|
|
1216
|
+
* the target files and converts the Checkstyle XML output into Codacy Issue objects.
|
|
1217
|
+
*
|
|
1218
|
+
* Config resolution:
|
|
1219
|
+
* - If `useLocalConfigurationFile` is true and a local config is found,
|
|
1220
|
+
* passes `--config <path>` to use the project's scalastyle config.
|
|
1221
|
+
* - If patterns are specified and no local config is in use, generates
|
|
1222
|
+
* a temporary `scalastyle_config.xml` with the enabled checks.
|
|
1223
|
+
* - Otherwise (no local config and no patterns), skips execution.
|
|
1224
|
+
*
|
|
1225
|
+
* Key details:
|
|
1226
|
+
* - Scalastyle takes directories (not file lists) as source input.
|
|
1227
|
+
* We pass the repository root and then filter the output by targetFiles.
|
|
1228
|
+
* - `--xmlOutput <tmpFile>` writes Checkstyle-format XML to a temp file.
|
|
1229
|
+
* - The `source` attribute in XML is an FQCN like
|
|
1230
|
+
* `org.scalastyle.scalariform.MagicNumberChecker`.
|
|
1231
|
+
* We extract the last segment and prefix with `ScalaStyle_`.
|
|
1232
|
+
*
|
|
1233
|
+
* Exit codes: 0 = success, 1 = violations or error.
|
|
1234
|
+
*
|
|
1235
|
+
* Never throws — all errors are captured in the returned `errors` array.
|
|
1236
|
+
*/
|
|
1237
|
+
async analyze(ctx, codacyConfig) {
|
|
1238
|
+
const startMs = Date.now();
|
|
1239
|
+
ctx.logger.info("Starting analysis", { toolId: TOOL_ID, fileCount: ctx.targetFiles.length });
|
|
1240
|
+
const startedAt = /* @__PURE__ */ new Date();
|
|
1241
|
+
const issues = [];
|
|
1242
|
+
const errors = [];
|
|
1243
|
+
if (ctx.targetFiles.length === 0) {
|
|
1244
|
+
return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, 0);
|
|
1245
|
+
}
|
|
1246
|
+
const useLocal = codacyConfig.useLocalConfigurationFile && codacyConfig.localConfigurationFile;
|
|
1247
|
+
if (!useLocal && codacyConfig.patterns.length === 0) {
|
|
1248
|
+
ctx.logger.info("Skipping analysis: no local config and no patterns enabled", {
|
|
1249
|
+
toolId: TOOL_ID
|
|
1250
|
+
});
|
|
1251
|
+
return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
|
|
1252
|
+
}
|
|
1253
|
+
const javaBin = await resolveJavaBinary(ctx);
|
|
1254
|
+
const jarPath = await resolveJarPath(ctx);
|
|
1255
|
+
if (!jarPath) {
|
|
1256
|
+
errors.push({
|
|
1257
|
+
toolId: TOOL_ID,
|
|
1258
|
+
phase: "toolInvoke",
|
|
1259
|
+
kind: "MissingPrerequisite",
|
|
1260
|
+
message: `Scalastyle JAR not found at ${import_path.default.join(ctx.toolInstallDir, JAR_NAME)}. Run install first.`,
|
|
1261
|
+
level: "error"
|
|
1262
|
+
});
|
|
1263
|
+
return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
|
|
1264
|
+
}
|
|
1265
|
+
const tmpDir = await import_promises.default.mkdtemp(import_path.default.join(import_os.default.tmpdir(), "scalastyle-"));
|
|
1266
|
+
const reportFile = import_path.default.join(tmpDir, "scalastyle-output.xml");
|
|
1267
|
+
let generatedConfigPath = null;
|
|
1268
|
+
let configPath;
|
|
1269
|
+
if (useLocal) {
|
|
1270
|
+
configPath = codacyConfig.localConfigurationFile;
|
|
1271
|
+
} else if (codacyConfig.patterns.length > 0) {
|
|
1272
|
+
const configXml = generateScalastyleConfig(codacyConfig.patterns);
|
|
1273
|
+
generatedConfigPath = import_path.default.join(ctx.generatedConfigDir, "scalastyle_config.xml");
|
|
1274
|
+
await import_promises.default.mkdir(ctx.generatedConfigDir, { recursive: true });
|
|
1275
|
+
await import_promises.default.writeFile(generatedConfigPath, configXml, "utf-8");
|
|
1276
|
+
configPath = generatedConfigPath;
|
|
1277
|
+
ctx.logger.debug("Generated Scalastyle config", {
|
|
1278
|
+
configPath: generatedConfigPath,
|
|
1279
|
+
checksCount: configXml.split("<check ").length - 1
|
|
1280
|
+
});
|
|
1281
|
+
} else {
|
|
1282
|
+
await cleanupTmpDir(tmpDir);
|
|
1283
|
+
return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
|
|
1284
|
+
}
|
|
1285
|
+
const args = [
|
|
1286
|
+
"-cp",
|
|
1287
|
+
jarPath,
|
|
1288
|
+
"org.scalastyle.Main",
|
|
1289
|
+
"--config",
|
|
1290
|
+
configPath,
|
|
1291
|
+
"--xmlOutput",
|
|
1292
|
+
reportFile,
|
|
1293
|
+
ctx.repositoryRoot
|
|
1294
|
+
];
|
|
1295
|
+
const targetFileSet = new Set(ctx.targetFiles.map((f) => import_path.default.normalize(f)));
|
|
1296
|
+
try {
|
|
1297
|
+
const { stderr, exitCode } = await (0, import_tooling.spawnTool)(javaBin, args, {
|
|
1298
|
+
cwd: ctx.repositoryRoot,
|
|
1299
|
+
logger: ctx.logger
|
|
1300
|
+
});
|
|
1301
|
+
if (exitCode > 1) {
|
|
1302
|
+
errors.push({
|
|
1303
|
+
toolId: TOOL_ID,
|
|
1304
|
+
phase: "toolInvoke",
|
|
1305
|
+
kind: "NonZeroExit",
|
|
1306
|
+
message: `Scalastyle exited with code ${exitCode}${stderr ? `: ${stderr.trim()}` : ""}`,
|
|
1307
|
+
level: "error"
|
|
1308
|
+
});
|
|
1309
|
+
await cleanupTmpDir(tmpDir);
|
|
1310
|
+
if (generatedConfigPath) await import_promises.default.unlink(generatedConfigPath).catch(() => {
|
|
1311
|
+
});
|
|
1312
|
+
return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
|
|
1313
|
+
}
|
|
1314
|
+
let xmlContent;
|
|
1315
|
+
try {
|
|
1316
|
+
xmlContent = await import_promises.default.readFile(reportFile, "utf-8");
|
|
1317
|
+
} catch {
|
|
1318
|
+
if (stderr && stderr.trim()) {
|
|
1319
|
+
errors.push({
|
|
1320
|
+
toolId: TOOL_ID,
|
|
1321
|
+
phase: "outputParse",
|
|
1322
|
+
kind: "ParseWarning",
|
|
1323
|
+
message: `Scalastyle stderr: ${stderr.trim()}`,
|
|
1324
|
+
level: "warning"
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
await cleanupTmpDir(tmpDir);
|
|
1328
|
+
if (generatedConfigPath) await import_promises.default.unlink(generatedConfigPath).catch(() => {
|
|
1329
|
+
});
|
|
1330
|
+
return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
|
|
1331
|
+
}
|
|
1332
|
+
if (!xmlContent.trim()) {
|
|
1333
|
+
await cleanupTmpDir(tmpDir);
|
|
1334
|
+
if (generatedConfigPath) await import_promises.default.unlink(generatedConfigPath).catch(() => {
|
|
1335
|
+
});
|
|
1336
|
+
return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
|
|
1337
|
+
}
|
|
1338
|
+
let files;
|
|
1339
|
+
try {
|
|
1340
|
+
const parsed = xmlParser.parse(xmlContent);
|
|
1341
|
+
const rawFiles = parsed?.checkstyle?.file;
|
|
1342
|
+
files = rawFiles ? Array.isArray(rawFiles) ? rawFiles : [rawFiles] : [];
|
|
1343
|
+
} catch (err) {
|
|
1344
|
+
errors.push({
|
|
1345
|
+
toolId: TOOL_ID,
|
|
1346
|
+
phase: "outputParse",
|
|
1347
|
+
kind: "MalformedOutput",
|
|
1348
|
+
message: `Failed to parse Scalastyle XML output: ${err instanceof Error ? err.message : String(err)}`,
|
|
1349
|
+
level: "error"
|
|
1350
|
+
});
|
|
1351
|
+
await cleanupTmpDir(tmpDir);
|
|
1352
|
+
if (generatedConfigPath) await import_promises.default.unlink(generatedConfigPath).catch(() => {
|
|
1353
|
+
});
|
|
1354
|
+
return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
|
|
1355
|
+
}
|
|
1356
|
+
const enabledPatterns = new Set(codacyConfig.patterns.map((p) => p.patternId));
|
|
1357
|
+
for (const file of files) {
|
|
1358
|
+
const filePath = file["@_name"];
|
|
1359
|
+
if (!filePath) continue;
|
|
1360
|
+
const rawErrors = file.error;
|
|
1361
|
+
const fileErrors = rawErrors ? Array.isArray(rawErrors) ? rawErrors : [rawErrors] : [];
|
|
1362
|
+
if (fileErrors.length === 0) continue;
|
|
1363
|
+
const relPath = import_path.default.isAbsolute(filePath) ? import_path.default.relative(ctx.repositoryRoot, filePath) : filePath;
|
|
1364
|
+
if (!targetFileSet.has(import_path.default.normalize(relPath))) continue;
|
|
1365
|
+
const absolutePath = import_path.default.resolve(ctx.repositoryRoot, relPath);
|
|
1366
|
+
const lines = await readFileLines(absolutePath);
|
|
1367
|
+
for (const error of fileErrors) {
|
|
1368
|
+
const source = error["@_source"] ?? "";
|
|
1369
|
+
if (!source) continue;
|
|
1370
|
+
const patternId = derivePatternId(source);
|
|
1371
|
+
if (enabledPatterns.size > 0 && !enabledPatterns.has(patternId)) {
|
|
1372
|
+
continue;
|
|
1373
|
+
}
|
|
1374
|
+
const line = parseInt(error["@_line"], 10) || 1;
|
|
1375
|
+
const column = parseInt(error["@_column"] ?? "1", 10) || 1;
|
|
1376
|
+
const meta = ruleMetadata(patternId);
|
|
1377
|
+
issues.push({
|
|
1378
|
+
filePath: relPath,
|
|
1379
|
+
patternId,
|
|
1380
|
+
toolId: TOOL_ID,
|
|
1381
|
+
line,
|
|
1382
|
+
column,
|
|
1383
|
+
message: error["@_message"],
|
|
1384
|
+
lineContent: getLineContent(lines, line),
|
|
1385
|
+
category: meta.category,
|
|
1386
|
+
severity: meta.severity
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
const stderrFiltered = stderr.split("\n").filter((line) => {
|
|
1391
|
+
const trimmed = line.trim();
|
|
1392
|
+
if (!trimmed) return false;
|
|
1393
|
+
if (trimmed.startsWith("Processed")) return false;
|
|
1394
|
+
if (trimmed.startsWith("Found")) return false;
|
|
1395
|
+
return true;
|
|
1396
|
+
}).join("\n").trim();
|
|
1397
|
+
if (stderrFiltered) {
|
|
1398
|
+
errors.push({
|
|
1399
|
+
toolId: TOOL_ID,
|
|
1400
|
+
phase: "outputParse",
|
|
1401
|
+
kind: "ParseWarning",
|
|
1402
|
+
message: `Scalastyle stderr: ${stderrFiltered}`,
|
|
1403
|
+
level: "warning"
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
1406
|
+
await cleanupTmpDir(tmpDir);
|
|
1407
|
+
} catch (invokeErr) {
|
|
1408
|
+
errors.push({
|
|
1409
|
+
toolId: TOOL_ID,
|
|
1410
|
+
phase: "toolInvoke",
|
|
1411
|
+
kind: "InvocationError",
|
|
1412
|
+
message: `Failed to run Scalastyle: ${invokeErr instanceof Error ? invokeErr.message : String(invokeErr)}`,
|
|
1413
|
+
level: "error"
|
|
1414
|
+
});
|
|
1415
|
+
await cleanupTmpDir(tmpDir);
|
|
1416
|
+
} finally {
|
|
1417
|
+
if (generatedConfigPath) {
|
|
1418
|
+
await import_promises.default.unlink(generatedConfigPath).catch(() => {
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
const durationMs = Date.now() - startMs;
|
|
1423
|
+
ctx.logger.info("Analysis complete", {
|
|
1424
|
+
toolId: TOOL_ID,
|
|
1425
|
+
issueCount: issues.length,
|
|
1426
|
+
errorCount: errors.length,
|
|
1427
|
+
durationMs
|
|
1428
|
+
});
|
|
1429
|
+
return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
|
|
1430
|
+
}
|
|
1431
|
+
};
|
|
1432
|
+
async function cleanupTmpDir(tmpDir) {
|
|
1433
|
+
try {
|
|
1434
|
+
await import_promises.default.rm(tmpDir, { recursive: true });
|
|
1435
|
+
} catch {
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
// src/index.ts
|
|
1440
|
+
var index_default = (0, import_tooling2.defineToolAdapter)(adapter);
|