npm-groovy-lint 11.1.0 → 11.1.2-beta202310250645.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/README.md +16 -15
- package/lib/codenarc-caller.js +56 -17
- package/lib/codenarc-factory.js +23 -21
- package/lib/groovy-lint-fix.js +4 -3
- package/lib/groovy-lint.js +13 -13
- package/lib/index.js +0 -0
- package/lib/java/CodeNarcServer.jar +0 -0
- package/lib/java/slf4j-api-2.0.9.jar +0 -0
- package/lib/java/slf4j-simple-2.0.9.jar +0 -0
- package/lib/options.js +1 -1
- package/lib/output.js +3 -3
- package/lib/utils.js +5 -4
- package/package.json +10 -10
- package/CHANGELOG.md +0 -619
- package/lib/java/log4j-api-2.18.0.jar +0 -0
- package/lib/java/log4j-core-2.18.0.jar +0 -0
- package/lib/java/log4j-slf4j-impl-2.18.0.jar +0 -0
- package/lib/java/slf4j-api-1.7.9.jar +0 -0
package/README.md
CHANGED
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
|
|
17
17
|
## Groovy & Jenkinsfile Linter, Formatter and Auto-fixer
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
***New: The [article about the story of npm-groovy-lint](https://nicolas.vuillamy.fr/a-groovy-journey-to-open-source-during-covid-19-npm-groovy-lint-8d88c7eecebc), and why you should dive in open-source community !***
|
|
20
20
|
|
|
21
21
|
Based on [CodeNarc](http://codenarc.github.io/CodeNarc/) , this out of the box package allows to **track groovy errors** and **correct a part of them**
|
|
22
22
|
|
|
23
23
|
- Use option **--format** to format & prettify source code
|
|
24
24
|
- Use option **--fix** to activate autofixing of fixable rules
|
|
25
25
|
|
|
26
|
-
Easy to integrate in a CD
|
|
26
|
+
Easy to integrate in a CI/CD process (Jenkins Pipeline,CircleCI...) to lint your groovy or Jenkinsfile at each build :)
|
|
27
27
|
|
|
28
28
|
You can also use this package in :
|
|
29
29
|
|
|
@@ -45,14 +45,14 @@ Any **question**, **problem** or **enhancement request** ? Ask [**here**](https:
|
|
|
45
45
|
|
|
46
46
|
| Parameter | Type | Description |
|
|
47
47
|
|-------------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
48
|
-
| -o<br/> --output | String | Output format (txt,json,sarif,html,xml), or path to a file with one of these extensions<br/> Default: `txt`<br/> Examples:<br/> - `"txt"`<br/> - `"json"`<br/> - `"./logs/myLintResults.txt"`<br/> - `"./logs/myLintResults.sarif"`<br/> - `"./logs/myLintResults.html"`<br/> - `"./logs/myLintResults.xml"
|
|
48
|
+
| -o<br/> --output | String | Output format (txt,json,sarif,html,xml), or path to a file with one of these extensions<br/> Default: `txt`<br/> Examples:<br/> - `"txt"`<br/> - `"json"`<br/> - `"./logs/myLintResults.txt"`<br/> - `"./logs/myLintResults.sarif"`<br/> - `"./logs/myLintResults.html"`<br/> - `"./logs/myLintResults.xml"`<br/>Note: HTML and XML are directly from CodeNarc so using these formats will disable many npm-groovy-lint features |
|
|
49
49
|
| -l<br/> --loglevel | String | Log level (error,warning or info)<br/>Default: info |
|
|
50
50
|
| --failon | String | Defines the error level where CLI will fail (return code = 1). error,warning,info or none. Each failure level includes the more critical ones. |
|
|
51
|
-
| -c<br/> --config | String | Custom path to [GroovyLint config file](#
|
|
51
|
+
| -c<br/> --config | String | Custom path to [GroovyLint config file](#configuration), or preset config `recommended|recommended-jenkinsfile|all`<br/> Default: Browse current directory to find`.groovylintrc.json|js|yml|package.json` config file, or default npm-groovy-lint config if not defined.<br/>Note: command-line arguments have priority on config file properties |
|
|
52
52
|
| --parse | Boolean | Try to compile the source code and return parse errors (since v5.7.0, default to true, use --no-parse to deactivate) |
|
|
53
53
|
| --format | Boolean | Format source code |
|
|
54
|
-
| --fix | Boolean | Automatically fix problems when possible<br/> See [
|
|
55
|
-
| -x<br/> --fixrules | String | Option for --fix argument: List of rule identifiers to fix (if not specified, all available fixes will be applied). See [
|
|
54
|
+
| --fix | Boolean | Automatically fix problems when possible<br/> See [Auto-fixable rules](#auto-fixable-rules) |
|
|
55
|
+
| -x<br/> --fixrules | String | Option for --fix argument: List of rule identifiers to fix (if not specified, all available fixes will be applied). See [Auto-fixable rules](#auto-fixable-rules) <br/> Examples:<br/> - `"SpaceBeforeClosingBrace,SpaceAfterClosingBrace,UnusedImport"`<br/> - `"Indentation"`<br/> |
|
|
56
56
|
| --nolintafter | Boolean | When format or fix is called, a new lint is performed after the fixes to update the returned error list. If you just want the updated source code and do not care about the error logs, use this parameter to improve performances |
|
|
57
57
|
| -r<br/> --rulesets | String | [RuleSet file(s)](http://codenarc.github.io/CodeNarc/codenarc-creating-ruleset.html) to use for linting, if you do not want to use recommended rules or .groovylintrc.js defined rules.<br/>If list of comma separated strings corresponding to CodeNarc rules, a RuleSet file will be dynamically generated </br> Examples:<br/> - `"./config/codenarc/RuleSet-Custom.groovy"`<br/> - `"./path/to/my/ruleset/files"`<br/>- `Indentation{"spacesPerIndentLevel":2,"severity":"warning"},UnnecessarySemicolon,UnnecessaryGString` |
|
|
58
58
|
| --rulesetsoverridetype | String | If list of rules sent in rulesets option, defines if they replace rules defined in .groovylintrc.json, or if they are appended<br/> Values: `replaceConfig` (default), `appendConfig` |
|
|
@@ -137,6 +137,7 @@ Any **question**, **problem** or **enhancement request** ? Ask [**here**](https:
|
|
|
137
137
|
```shell
|
|
138
138
|
npm install -g npm-groovy-lint
|
|
139
139
|
```
|
|
140
|
+
|
|
140
141
|
- If you have issues with v9, install previous version with `npm install -g npm-groovy-lint@8.2.0`
|
|
141
142
|
- Node.js >= 12 is required to run this package. If you can't upgrade, you can use [nvm](https://github.com/nvm-sh/nvm) to have [different node versions on your computer](https://www.sitepoint.com/quick-tip-multiple-versions-node-nvm/)
|
|
142
143
|
- If you do not have java (from 8 to 14) installed on your computer npm-groovy-lint will install them for you, so the first run may be long.
|
|
@@ -152,16 +153,16 @@ Create a file named **.groovylintrc.json** in the current or any parent director
|
|
|
152
153
|
- groovy
|
|
153
154
|
- mygroovyfile.groovy
|
|
154
155
|
- Jenkinsfile
|
|
155
|
-
- **.groovylintrc.json**
|
|
156
|
+
- **.groovylintrc.json** *(do not forget the dot at the beginning of the file name)*
|
|
156
157
|
|
|
157
|
-
*If you are using [VsCode Groovy Lint extension](https://marketplace.visualstudio.com/items?itemName=NicolasVuillamy.vscode-groovy-lint), just use QuickFix
|
|
158
|
+
*If you are using [VsCode Groovy Lint extension](https://marketplace.visualstudio.com/items?itemName=NicolasVuillamy.vscode-groovy-lint), just use QuickFix **Ignore in all files** and it will generate groovylintrc.json file.*
|
|
158
159
|
|
|
159
160
|
### Format
|
|
160
161
|
|
|
161
162
|
- **extends**: Name of a base configuration ([`recommended`](https://github.com/nvuillam/npm-groovy-lint/blob/master/lib/.groovylintrc-recommended.json), [`recommended-jenkinsfile`](https://github.com/nvuillam/npm-groovy-lint/blob/master/lib/.groovylintrc-recommended-jenkinsfile.json), [`all`](https://github.com/nvuillam/npm-groovy-lint/blob/master/lib/.groovylintrc-all.json))
|
|
162
163
|
- **rules**: List of rules definition, following format `"RuleSection.RuleName": ruleParameters` or `"RuleName": ruleParameters`
|
|
163
|
-
-
|
|
164
|
-
-
|
|
164
|
+
- *RuleName*: any of the **[CodeNarc rules](https://codenarc.github.io/CodeNarc/codenarc-rule-index.html)**
|
|
165
|
+
- *ruleParameters*: can be just a severity override ( `"off"`, `"error"`, `"warning"`, `"info"` ) , or a property list :
|
|
165
166
|
- severity : off,error,warning,info
|
|
166
167
|
- enabled : true (default) or false
|
|
167
168
|
- any of the [rule advanced properties](https://codenarc.github.io/CodeNarc/codenarc-rule-index.html)
|
|
@@ -341,9 +342,9 @@ def variable = 1;
|
|
|
341
342
|
- UnnecessaryToString
|
|
342
343
|
- UnusedImport
|
|
343
344
|
|
|
344
|
-
[Contribute](#
|
|
345
|
+
[Contribute](#contribute) to add more [rules](http://codenarc.github.io/CodeNarc/codenarc-rule-index.html) fixes :)
|
|
345
346
|
|
|
346
|
-
## CD
|
|
347
|
+
## CI/CD
|
|
347
348
|
|
|
348
349
|
### Mega-Linter
|
|
349
350
|
|
|
@@ -445,9 +446,9 @@ Please follow [Contribution instructions](https://github.com/nvuillam/npm-groovy
|
|
|
445
446
|
|
|
446
447
|
### Contributors
|
|
447
448
|
|
|
448
|
-
[<img alt="nvuillam" src="https://avatars1.githubusercontent.com/u/17500430?v=4&s=50 width=50">](https://github.com/nvuillam) | [<img alt="Dave Gallant" src="https://avatars2.githubusercontent.com/u/4519234?v=4&s=50 width=50">](https://github.com/davegallant) | [<img alt="warhod" src="https://avatars1.githubusercontent.com/u/1305176?v=4&s=50 width=50">](https://github.com/warhod) | [<img alt="pawelkopka" src="https://avatars1.githubusercontent.com/u/17784034?v=4&s=50 width=50">](https://github.com/pawelkopka) | [<img alt="docwhat" src="https://avatars1.githubusercontent.com/u/40799?v=4&s=50 width=50">](https://github.com/docwhat) | [<img alt="CatSue" src="https://avatars3.githubusercontent.com/u/26134618?v=4&s=50 width=50">](https://github.com/CatSue)
|
|
449
|
-
|
|
450
|
-
|
|
449
|
+
| [<img alt="nvuillam" src="https://avatars1.githubusercontent.com/u/17500430?v=4&s=50 width=50">](https://github.com/nvuillam) | [<img alt="Dave Gallant" src="https://avatars2.githubusercontent.com/u/4519234?v=4&s=50 width=50">](https://github.com/davegallant) | [<img alt="warhod" src="https://avatars1.githubusercontent.com/u/1305176?v=4&s=50 width=50">](https://github.com/warhod) | [<img alt="pawelkopka" src="https://avatars1.githubusercontent.com/u/17784034?v=4&s=50 width=50">](https://github.com/pawelkopka) | [<img alt="docwhat" src="https://avatars1.githubusercontent.com/u/40799?v=4&s=50 width=50">](https://github.com/docwhat) | [<img alt="CatSue" src="https://avatars3.githubusercontent.com/u/26134618?v=4&s=50 width=50">](https://github.com/CatSue) |
|
|
450
|
+
|:-----------------------------------------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------:|
|
|
451
|
+
| [Nicolas Vuillamy](https://github.com/nvuillam) | [Dave Gallant](https://github.com/davegallant) | [Howard Lo](https://github.com/warhod) | [Pawel Kopka](https://github.com/pawelkopka) | [docwhat](https://github.com/docwhat) | [CatSue](https://github.com/CatSue) |
|
|
451
452
|
|
|
452
453
|
## Release notes
|
|
453
454
|
|
package/lib/codenarc-caller.js
CHANGED
|
@@ -2,12 +2,17 @@
|
|
|
2
2
|
const axios = require("axios").default;
|
|
3
3
|
const cliProgress = require("cli-progress");
|
|
4
4
|
const debug = require("debug")("npm-groovy-lint");
|
|
5
|
+
const trace = require("debug")("npm-groovy-lint-trace");
|
|
5
6
|
const { JavaCaller } = require("java-caller");
|
|
6
7
|
const optionsDefinition = require("./options");
|
|
7
8
|
const { performance } = require("perf_hooks");
|
|
8
9
|
const { getSourceLines } = require("./utils");
|
|
9
10
|
const c = require("chalk");
|
|
10
11
|
|
|
12
|
+
// Request over IPv4 because Java typically prefers it.
|
|
13
|
+
const http = require("http");
|
|
14
|
+
axios.defaults.httpAgent = new http.Agent({ family: 4, keepAlive: true });
|
|
15
|
+
|
|
11
16
|
class CodeNarcCaller {
|
|
12
17
|
"use strict";
|
|
13
18
|
|
|
@@ -85,16 +90,17 @@ class CodeNarcCaller {
|
|
|
85
90
|
},
|
|
86
91
|
timeout: 600000
|
|
87
92
|
};
|
|
88
|
-
|
|
93
|
+
trace(`CALL CodeNarcServer with ${JSON.stringify(axiosConfig, null, 2)}`);
|
|
89
94
|
let response;
|
|
90
95
|
try {
|
|
91
96
|
const startCodeNarc = performance.now();
|
|
92
97
|
response = await axios.request(axiosConfig);
|
|
93
98
|
this.serverStatus = "running";
|
|
94
99
|
const elapsed = parseInt(performance.now() - startCodeNarc, 10);
|
|
95
|
-
debug(`CodeNarcServer call result: (${response.status}) ${elapsed}ms
|
|
100
|
+
debug(`CodeNarcServer call result: (${response.status}) ${elapsed}ms`);
|
|
96
101
|
} catch (e) {
|
|
97
102
|
// If server not started , start it and try again
|
|
103
|
+
debug(`callCodeNarcServer code: ${e.code} error: ${e.message}`);
|
|
98
104
|
if (
|
|
99
105
|
(startServerTried === false,
|
|
100
106
|
e.code && ["ECONNREFUSED", "ETIMEDOUT"].includes(e.code) && ["unknown", "running"].includes(this.serverStatus)) // running is here in case the Server auto-killed itself at its expiration time
|
|
@@ -178,7 +184,7 @@ class CodeNarcCaller {
|
|
|
178
184
|
const scriptArgs = this.codenarcArgs;
|
|
179
185
|
|
|
180
186
|
// Start progress bar
|
|
181
|
-
|
|
187
|
+
trace(`CALL CodeNarcJava with ${scriptArgs.join(" ")}`);
|
|
182
188
|
this.bar = new cliProgress.SingleBar(
|
|
183
189
|
{
|
|
184
190
|
format: "[{bar}] Running CodeNarc for {duration_formatted}",
|
|
@@ -208,7 +214,7 @@ class CodeNarcCaller {
|
|
|
208
214
|
if ([666, 1].includes(javaResult.status)) {
|
|
209
215
|
if (!secondAttempt) {
|
|
210
216
|
// If failure (missing class com.nvuillam.CodeNarcServer for example, it can happen on Linux, let's try the original org.codenarc.CodeNarc class)
|
|
211
|
-
|
|
217
|
+
trace(`Error calling CodeNarcServer via java: ${JSON.stringify(javaResult)}`);
|
|
212
218
|
return await this.callCodeNarcJava(true);
|
|
213
219
|
} else {
|
|
214
220
|
let reason = "Reason: unknown";
|
|
@@ -272,12 +278,20 @@ class CodeNarcCaller {
|
|
|
272
278
|
return false;
|
|
273
279
|
}
|
|
274
280
|
|
|
281
|
+
// Store the process so we can stop it later.
|
|
282
|
+
this.codeNarcProcess = javaCallRes.childJavaProcess;
|
|
283
|
+
|
|
275
284
|
// Poll it until it is ready
|
|
276
285
|
const start = performance.now();
|
|
277
286
|
let notified = false;
|
|
278
287
|
let interval;
|
|
279
288
|
await new Promise(resolve => {
|
|
280
289
|
interval = setInterval(() => {
|
|
290
|
+
debug(
|
|
291
|
+
`pinging CodeNarcServer at ${serverPingUri} notified: ${notified}, serverStatus: ${
|
|
292
|
+
this.serverStatus
|
|
293
|
+
}, since: ${performance.now() - start}, maxAttemptTimeMs: ${maxAttemptTimeMs}`
|
|
294
|
+
);
|
|
281
295
|
axios
|
|
282
296
|
.get(serverPingUri)
|
|
283
297
|
.then(response => {
|
|
@@ -291,18 +305,22 @@ class CodeNarcCaller {
|
|
|
291
305
|
resolve();
|
|
292
306
|
}
|
|
293
307
|
} else if (notified === false && this.serverStatus === "unknown" && performance.now() - start > maxAttemptTimeMs) {
|
|
294
|
-
// Timeout has been reached
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
},
|
|
299
|
-
interval
|
|
300
|
-
);
|
|
308
|
+
// Timeout has been reached.
|
|
309
|
+
let since = performance.now() - start;
|
|
310
|
+
debug(`Ping timeout after ${since}ms status: ${response.status}`);
|
|
311
|
+
this.declareServerError({ message: `Timeout after ${since}ms} status: ${response.status}` }, interval);
|
|
301
312
|
resolve();
|
|
302
313
|
}
|
|
303
314
|
})
|
|
304
|
-
.catch(
|
|
305
|
-
|
|
315
|
+
.catch(e => {
|
|
316
|
+
debug(`Ping code: ${e.code} message: ${e.message}`);
|
|
317
|
+
let since = performance.now() - start;
|
|
318
|
+
if (notified === false && this.serverStatus === "unknown" && since > maxAttemptTimeMs) {
|
|
319
|
+
// Timeout has been reached
|
|
320
|
+
debug(`Ping timeout after ${maxAttemptTimeMs}ms`);
|
|
321
|
+
this.declareServerError({ message: `Timeout after ${since}ms error: ${e}` }, interval);
|
|
322
|
+
resolve();
|
|
323
|
+
}
|
|
306
324
|
});
|
|
307
325
|
}, 400);
|
|
308
326
|
});
|
|
@@ -315,8 +333,21 @@ class CodeNarcCaller {
|
|
|
315
333
|
}
|
|
316
334
|
}
|
|
317
335
|
|
|
336
|
+
// Kill CodeNarc process if running.
|
|
337
|
+
killCodeNarcProcess() {
|
|
338
|
+
if (this.codeNarcProcess) {
|
|
339
|
+
this.codeNarcProcess.kill("SIGKILL");
|
|
340
|
+
delete this.codeNarcProcess;
|
|
341
|
+
return "CodeNarcServer killed";
|
|
342
|
+
}
|
|
343
|
+
return "";
|
|
344
|
+
}
|
|
345
|
+
|
|
318
346
|
// Stop polling and log error
|
|
319
347
|
declareServerError(e, interval) {
|
|
348
|
+
// Kill off the process as it is not responding.
|
|
349
|
+
this.killCodeNarcProcess();
|
|
350
|
+
|
|
320
351
|
this.serverStatus = "error";
|
|
321
352
|
if (interval) {
|
|
322
353
|
clearInterval(interval);
|
|
@@ -327,10 +358,16 @@ class CodeNarcCaller {
|
|
|
327
358
|
console.error(c.grey(errMsg));
|
|
328
359
|
}
|
|
329
360
|
|
|
330
|
-
// Kill CodeNarc server
|
|
361
|
+
// Kill CodeNarc server.
|
|
331
362
|
async killCodeNarcServer() {
|
|
363
|
+
// Try by process first as it's more reliable.
|
|
364
|
+
let outputString = this.killCodeNarcProcess();
|
|
365
|
+
if (outputString) {
|
|
366
|
+
return outputString;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// Process kill wasn't possible, so try sending a kill http request.
|
|
332
370
|
const serverUri = this.getCodeNarcServerUri() + "/kill";
|
|
333
|
-
let outputString = "";
|
|
334
371
|
try {
|
|
335
372
|
const response = await axios.post(serverUri, { timeout: 5000 });
|
|
336
373
|
if (response.data.status === "killed") {
|
|
@@ -339,10 +376,12 @@ class CodeNarcCaller {
|
|
|
339
376
|
outputString = "Error killing CodeNarcServer";
|
|
340
377
|
}
|
|
341
378
|
} catch (e) {
|
|
342
|
-
if (e.stack.includes("connResetException")) {
|
|
379
|
+
if (e.stack.includes("connResetException") || e.message.includes("socket hang up")) {
|
|
343
380
|
outputString = "CodeNarcServer terminated";
|
|
344
381
|
} else {
|
|
345
|
-
|
|
382
|
+
// This should be ECONNREFUSED.
|
|
383
|
+
debug(`CodeNarcServer kill request failed: ${e}`);
|
|
384
|
+
outputString = `CodeNarcServer was not running`;
|
|
346
385
|
}
|
|
347
386
|
}
|
|
348
387
|
return outputString;
|
package/lib/codenarc-factory.js
CHANGED
|
@@ -56,10 +56,12 @@ async function prepareCodeNarcCall(options) {
|
|
|
56
56
|
|
|
57
57
|
// Define base directory
|
|
58
58
|
const baseBefore = (cnPath !== "." && cnPath.startsWith("/")) || cnPath.includes(":/") || cnPath.includes(":\\") ? "" : process.cwd() + "/";
|
|
59
|
-
const codeNarcBaseDir =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
const codeNarcBaseDir =
|
|
60
|
+
positionalArgs.length > 0
|
|
61
|
+
? await getCodeNarcBaseDirFromFiles(positionalArgs)
|
|
62
|
+
: cnPath !== "."
|
|
63
|
+
? baseBefore + cnPath.replace(/^"(.*)"$/, "$1")
|
|
64
|
+
: process.cwd();
|
|
63
65
|
result.codeNarcBaseDir = path.resolve(codeNarcBaseDir);
|
|
64
66
|
result.codenarcArgs.push(`-basedir=${result.codeNarcBaseDir}`);
|
|
65
67
|
|
|
@@ -144,10 +146,10 @@ async function prepareCodeNarcCall(options) {
|
|
|
144
146
|
result.outputType = result.output.endsWith(".txt")
|
|
145
147
|
? "txt"
|
|
146
148
|
: result.output.endsWith(".json")
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
? "json"
|
|
150
|
+
: result.output.endsWith(".sarif")
|
|
151
|
+
? "sarif"
|
|
152
|
+
: result.output;
|
|
151
153
|
result.codenarcArgs.push(`-report=json:stdout`);
|
|
152
154
|
} else if (["html", "xml"].includes(result.output.split(".").pop())) {
|
|
153
155
|
result.outputType = result.output
|
|
@@ -156,11 +158,11 @@ async function prepareCodeNarcCall(options) {
|
|
|
156
158
|
.endsWith("html")
|
|
157
159
|
? "html"
|
|
158
160
|
: result.output
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
.split(".")
|
|
162
|
+
.pop()
|
|
163
|
+
.endsWith("xml")
|
|
164
|
+
? "xml"
|
|
165
|
+
: "";
|
|
164
166
|
const ext = result.output.split(".").pop();
|
|
165
167
|
result.codenarcArgs.push(`-report=${ext}:${result.output}`);
|
|
166
168
|
|
|
@@ -183,9 +185,9 @@ async function prepareCodeNarcCall(options) {
|
|
|
183
185
|
async function getCodeNarcBaseDirFromFiles(positionalArgs) {
|
|
184
186
|
// All arguments are not files
|
|
185
187
|
if (!positionalArgs.every(fileOrDirOrPattern => fs.existsSync(fileOrDirOrPattern) || directoryExists(fileOrDirOrPattern))) {
|
|
186
|
-
return process.cwd()
|
|
188
|
+
return process.cwd();
|
|
187
189
|
}
|
|
188
|
-
const folders = positionalArgs.map(
|
|
190
|
+
const folders = positionalArgs.map(fileOrDir => {
|
|
189
191
|
// Dir
|
|
190
192
|
if (directoryExists(fileOrDir)) {
|
|
191
193
|
return path.resolve(fileOrDir);
|
|
@@ -195,7 +197,7 @@ async function getCodeNarcBaseDirFromFiles(positionalArgs) {
|
|
|
195
197
|
return path.dirname(fileAbsolute);
|
|
196
198
|
});
|
|
197
199
|
const baseDirFromFiles = commondir(folders);
|
|
198
|
-
return baseDirFromFiles
|
|
200
|
+
return baseDirFromFiles;
|
|
199
201
|
}
|
|
200
202
|
|
|
201
203
|
// Parse XML result file as js object
|
|
@@ -327,7 +329,7 @@ async function parseCodeNarcResult(options, codeNarcBaseDir, codeNarcJsonResult,
|
|
|
327
329
|
}
|
|
328
330
|
// Add unprecise range based on line when range function has not been defined on rule
|
|
329
331
|
else if (errItem.line > 0) {
|
|
330
|
-
const range = evaluateRangeFromLine(errItem,
|
|
332
|
+
const range = evaluateRangeFromLine(errItem, allLines);
|
|
331
333
|
if (range && range.start.character > -1) {
|
|
332
334
|
errItem.range = range;
|
|
333
335
|
}
|
|
@@ -419,8 +421,8 @@ async function buildRuleSets(options) {
|
|
|
419
421
|
typeof ruleFromConfig === "object"
|
|
420
422
|
? Object.assign(ruleFromConfig, ruleOptions)
|
|
421
423
|
: Object.keys(ruleOptions).length > 0
|
|
422
|
-
|
|
423
|
-
|
|
424
|
+
? ruleOptions
|
|
425
|
+
: ruleFromConfig;
|
|
424
426
|
const ruleDef = buildCodeNarcRule(ruleName, mergedRuleConfig);
|
|
425
427
|
// If rule has been sent as argument, enable it by default
|
|
426
428
|
if (ruleDef.enabled === false) {
|
|
@@ -441,8 +443,8 @@ async function buildRuleSets(options) {
|
|
|
441
443
|
typeof ruleDef === "object"
|
|
442
444
|
? Object.assign(ruleDef, ruleFromRuleSetsArg)
|
|
443
445
|
: Object.keys(ruleFromRuleSetsArg).length > 0
|
|
444
|
-
|
|
445
|
-
|
|
446
|
+
? ruleFromRuleSetsArg
|
|
447
|
+
: ruleDef;
|
|
446
448
|
}
|
|
447
449
|
// Add in the list of rules to test , except if it is disabled
|
|
448
450
|
if (!(ruleDef === "off" || ruleDef.disabled === true || ruleDef.enabled === false)) {
|
package/lib/groovy-lint-fix.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const fse = require("fs-extra");
|
|
3
3
|
const cliProgress = require("cli-progress");
|
|
4
4
|
const debug = require("debug")("npm-groovy-lint");
|
|
5
|
+
const trace = require("debug")("npm-groovy-lint-trace");
|
|
5
6
|
const os = require("os");
|
|
6
7
|
const { getNpmGroovyLintRules, getFormattingRulesToAlwaysRun } = require("./groovy-lint-rules.js");
|
|
7
8
|
const { evaluateVariables, getSourceLines } = require("./utils.js");
|
|
@@ -135,7 +136,7 @@ class NpmGroovyLintFix {
|
|
|
135
136
|
return a.rule.priority > b.rule.priority ? 1 : a.rule.priority < b.rule.priority ? -1 : 0;
|
|
136
137
|
});
|
|
137
138
|
}
|
|
138
|
-
|
|
139
|
+
trace(`Parsed fixable errors: ${JSON.stringify(this.fixableErrors)}`);
|
|
139
140
|
}
|
|
140
141
|
|
|
141
142
|
// Add fixable error but do not add twice if scope if the full file
|
|
@@ -256,7 +257,7 @@ class NpmGroovyLintFix {
|
|
|
256
257
|
if (strBefore instanceof RegExp || (!strBefore.includes("{{") && !strAfter.includes("{{"))) {
|
|
257
258
|
newLine = newLine.replace(strBefore, strAfter);
|
|
258
259
|
} else {
|
|
259
|
-
|
|
260
|
+
trace(`GroovyLint: missing replacement variable(s):\n${strBefore}\n${strAfter}\n${JSON.stringify(fixableError)}`);
|
|
260
261
|
}
|
|
261
262
|
}
|
|
262
263
|
// Function defined in rule
|
|
@@ -267,7 +268,7 @@ class NpmGroovyLintFix {
|
|
|
267
268
|
}
|
|
268
269
|
newLine = fix.func(newLine, evaluatedVars, fixableError);
|
|
269
270
|
} catch (e) {
|
|
270
|
-
|
|
271
|
+
trace(`ERROR: Fix function error: ${e.message} / ${JSON.stringify(fixableError)}`);
|
|
271
272
|
throw e;
|
|
272
273
|
}
|
|
273
274
|
}
|
package/lib/groovy-lint.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Imports
|
|
2
2
|
const debug = require("debug")("npm-groovy-lint");
|
|
3
|
+
const trace = require("debug")("npm-groovy-lint-trace");
|
|
3
4
|
const fs = require("fs-extra");
|
|
4
5
|
const os = require("os");
|
|
5
6
|
const performance = require("perf_hooks").performance;
|
|
@@ -139,16 +140,15 @@ class NpmGroovyLint {
|
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
142
|
// Try to catch input from stdin. if found, use it as groovy source
|
|
142
|
-
if (this.options._ && this.options._[0] ===
|
|
143
|
-
const stdInData = fs.readFileSync(0,
|
|
143
|
+
if (this.options._ && this.options._[0] === "-") {
|
|
144
|
+
const stdInData = fs.readFileSync(0, "utf-8");
|
|
144
145
|
this.options.source = stdInData;
|
|
145
146
|
this.options._ = [];
|
|
146
147
|
this.options.sourcefilepath = this.options.sourcefilepath || process.cwd();
|
|
147
148
|
if (this.options.format || this.options.fix) {
|
|
148
|
-
this.options.output =
|
|
149
|
+
this.options.output = "stdout";
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
|
-
|
|
152
152
|
} catch (err) {
|
|
153
153
|
this.status = 2;
|
|
154
154
|
this.error = {
|
|
@@ -231,7 +231,7 @@ class NpmGroovyLint {
|
|
|
231
231
|
- Call CodeNarcServer via Http (except if --noserver)
|
|
232
232
|
- Launch CodeNarcServer using com.nvuillam.CodeNarcServer, then call CodeNarcServer via Http (except if --noserver)
|
|
233
233
|
- Call CodeNarc java using com.nvuillam.CodeNarcServer (without launching server)
|
|
234
|
-
- Call CodeNarc java using org.codenarc.CodeNarc
|
|
234
|
+
- Call CodeNarc java using org.codenarc.CodeNarc
|
|
235
235
|
*/
|
|
236
236
|
async callCodeNarc() {
|
|
237
237
|
const startPerf = performance.now();
|
|
@@ -358,7 +358,7 @@ class NpmGroovyLint {
|
|
|
358
358
|
}
|
|
359
359
|
lintAgainOptions.fix = false;
|
|
360
360
|
lintAgainOptions.output = "none";
|
|
361
|
-
|
|
361
|
+
trace(`Fix is done, lint again with options ${JSON.stringify(lintAgainOptions)}`);
|
|
362
362
|
const newLinter = new NpmGroovyLint(lintAgainOptions, {
|
|
363
363
|
parseOptions: false,
|
|
364
364
|
origin: "lintAgainAfterFix"
|
|
@@ -469,18 +469,18 @@ class NpmGroovyLint {
|
|
|
469
469
|
manageReturnCode() {
|
|
470
470
|
if (this.status > 1) {
|
|
471
471
|
// There has been a fatal error before, so there are no results
|
|
472
|
-
return
|
|
472
|
+
return;
|
|
473
473
|
}
|
|
474
474
|
const failureLevel =
|
|
475
475
|
this.options.failon && this.options.failon !== "none"
|
|
476
476
|
? this.options.failon
|
|
477
477
|
: this.options.failonerror
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
478
|
+
? "error"
|
|
479
|
+
: this.options.failonwarning
|
|
480
|
+
? "warning"
|
|
481
|
+
: this.options.failoninfo
|
|
482
|
+
? "info"
|
|
483
|
+
: "none";
|
|
484
484
|
if (failureLevel === "none") {
|
|
485
485
|
return;
|
|
486
486
|
}
|
package/lib/index.js
CHANGED
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/options.js
CHANGED
|
@@ -177,7 +177,7 @@ module.exports = optionator({
|
|
|
177
177
|
{
|
|
178
178
|
option: "serverhost",
|
|
179
179
|
type: "String",
|
|
180
|
-
default: "http://localhost",
|
|
180
|
+
default: "http://localhost",
|
|
181
181
|
description: "If use of CodeNarc server, host where is the CodeNarc server (default: localhost)"
|
|
182
182
|
},
|
|
183
183
|
{
|
package/lib/output.js
CHANGED
|
@@ -109,12 +109,12 @@ async function processOutput(outputType, output, lintResult, options, fixer = nu
|
|
|
109
109
|
for (const fileNm of Object.keys(lintResult.files)) {
|
|
110
110
|
const fileErrors = lintResult.files[fileNm].errors;
|
|
111
111
|
let fileOutputString = c.underline(fileNm) + "\n";
|
|
112
|
-
let showFileInOutput = false
|
|
112
|
+
let showFileInOutput = false;
|
|
113
113
|
for (const err of fileErrors) {
|
|
114
114
|
if (!isErrorInLogLevelScope(err.severity, options.loglevel)) {
|
|
115
115
|
continue;
|
|
116
116
|
}
|
|
117
|
-
showFileInOutput = true
|
|
117
|
+
showFileInOutput = true;
|
|
118
118
|
let color = "grey";
|
|
119
119
|
switch (err.severity) {
|
|
120
120
|
case "error":
|
|
@@ -150,7 +150,7 @@ async function processOutput(outputType, output, lintResult, options, fixer = nu
|
|
|
150
150
|
}
|
|
151
151
|
fileOutputString += "\n";
|
|
152
152
|
if (showFileInOutput || options.verbose) {
|
|
153
|
-
outputString += fileOutputString
|
|
153
|
+
outputString += fileOutputString;
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
outputString += "\nnpm-groovy-lint results in " + c.bold(lintResult.summary.totalFilesLinted) + " linted files:";
|
package/lib/utils.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
const debug = require("debug")("npm-groovy-lint");
|
|
5
|
+
const trace = require("debug")("npm-groovy-lint-trace");
|
|
5
6
|
const decodeHtml = require("decode-html");
|
|
6
7
|
const fse = require("fs-extra");
|
|
7
8
|
const os = require("os");
|
|
@@ -124,7 +125,7 @@ function evaluateRange(errItem, rule, evaluatedVars, errLine, allLines) {
|
|
|
124
125
|
|
|
125
126
|
// Get position to highlight in sources
|
|
126
127
|
function evaluateRangeFromLine(errItem, allLines) {
|
|
127
|
-
return getDefaultRange(allLines, errItem)
|
|
128
|
+
return getDefaultRange(allLines, errItem);
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
// Evaluate variables from messages
|
|
@@ -142,14 +143,14 @@ function evaluateVariables(variableDefs, msg) {
|
|
|
142
143
|
varDef.type && varDef.type === "number"
|
|
143
144
|
? parseInt(value, 10)
|
|
144
145
|
: varDef.type && varDef.type === "array"
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
? JSON.parse(value)
|
|
147
|
+
: value;
|
|
147
148
|
evaluatedVars.push({
|
|
148
149
|
name: varDef.name,
|
|
149
150
|
value: varValue
|
|
150
151
|
});
|
|
151
152
|
} else {
|
|
152
|
-
|
|
153
|
+
trace(`GroovyLint: Unable to match ${varDef.regex} in ${msg}`);
|
|
153
154
|
}
|
|
154
155
|
}
|
|
155
156
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-groovy-lint",
|
|
3
|
-
"version": "11.1.0",
|
|
3
|
+
"version": "11.1.2-beta202310250645.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
|
|
9
|
-
"groovy:build": "npm run dev:kill-server && groovyc -cp \"
|
|
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
10
|
"test": "npm run dev:kill-server && mocha \"test/**/*.test.js\"",
|
|
11
11
|
"test:coverage": "nyc npm run test",
|
|
12
12
|
"test:debug": "npm run dev:kill-server && mocha --reporter spec --inspect-brk \"test/**/*.test.js\"",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"ansi-colors": "^4.1.1",
|
|
49
49
|
"axios": "^0.21.1",
|
|
50
50
|
"chalk": "^4.1.2",
|
|
51
|
-
"cli-progress": "^3.
|
|
51
|
+
"cli-progress": "^3.12.0",
|
|
52
52
|
"commondir": "^1.0.1",
|
|
53
53
|
"debug": "^4.1.1",
|
|
54
54
|
"decode-html": "^2.0.0",
|
|
@@ -60,25 +60,25 @@
|
|
|
60
60
|
"ip": "^1.1.5",
|
|
61
61
|
"java-caller": "^2.2.4",
|
|
62
62
|
"js-yaml": "^4.1.0",
|
|
63
|
-
"node-sarif-builder": "^2.0.
|
|
63
|
+
"node-sarif-builder": "^2.0.3",
|
|
64
64
|
"optionator": "^0.8.3",
|
|
65
65
|
"semver": "^7.1.3",
|
|
66
66
|
"strip-json-comments": "^3.0.1",
|
|
67
67
|
"uuid": "^8.2.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@babel/core": "^7.
|
|
71
|
-
"@babel/eslint-parser": "^7.
|
|
70
|
+
"@babel/core": "^7.23.2",
|
|
71
|
+
"@babel/eslint-parser": "^7.22.15",
|
|
72
72
|
"diff": "^4.0.2",
|
|
73
|
-
"eslint": "^8.
|
|
74
|
-
"mocha": "^
|
|
73
|
+
"eslint": "^8.52.0",
|
|
74
|
+
"mocha": "^10.2.0",
|
|
75
75
|
"nyc": "^15.1.0",
|
|
76
76
|
"prettier": "^1.19.1",
|
|
77
77
|
"rimraf": "^3.0.2",
|
|
78
78
|
"which": "^2.0.2"
|
|
79
79
|
},
|
|
80
80
|
"engines": {
|
|
81
|
-
"node": ">=
|
|
81
|
+
"node": ">=18.0.0"
|
|
82
82
|
},
|
|
83
83
|
"mocha": {
|
|
84
84
|
"require": [
|
package/CHANGELOG.md
DELETED
|
@@ -1,619 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## UNRELEASED
|
|
4
|
-
|
|
5
|
-
## [11.1.0] 2022-10-31
|
|
6
|
-
|
|
7
|
-
- Provide default range when only information available is a line number ([#248](https://github.com/nvuillam/npm-groovy-lint/issues/248))
|
|
8
|
-
- New CodeNarc issues definition to calculate range in file
|
|
9
|
-
- GStringExpressionWithinString
|
|
10
|
-
- VariableName
|
|
11
|
-
|
|
12
|
-
## [11.0.0] 2022-10-07
|
|
13
|
-
|
|
14
|
-
- **BREAKING CHANGE**:`--failon` is now `ìnfo` by default, meaning exit code will be `1` if there is at least an info issue found. To have previous behaviour, use `--failon none`.
|
|
15
|
-
- Display all files in console log only if `--verbose` is used ([#243](https://github.com/nvuillam/npm-groovy-lint/issues/243))
|
|
16
|
-
|
|
17
|
-
## [10.1.0] 2022-08-15
|
|
18
|
-
|
|
19
|
-
- Allow to send groovy sources as input from stdin
|
|
20
|
-
- If `--format` or `--fix` option is used when source is sent as stdin, the result is output as stdout
|
|
21
|
-
|
|
22
|
-
Example: `cat path/to/my/Jenkinsfile | npm-groovy-lint --format -`
|
|
23
|
-
|
|
24
|
-
## [10.0.3] 2022-08-15
|
|
25
|
-
|
|
26
|
-
- Do not output results summary in console logs when output is json or sarif
|
|
27
|
-
- Add test methods for SARIF called by CLI
|
|
28
|
-
|
|
29
|
-
## [10.0.2] 2022-08-15
|
|
30
|
-
|
|
31
|
-
- Fix error when absolute files sent as positional arguments on a linux system ([#232](https://github.com/nvuillam/npm-groovy-lint/issues/232))
|
|
32
|
-
- Improve performances by calculating the longest command directory to send as base path to CodeNarc
|
|
33
|
-
|
|
34
|
-
## [10.0.1] 2022-08-14
|
|
35
|
-
|
|
36
|
-
- Fix error when files sent as positional arguments ([#232](https://github.com/nvuillam/npm-groovy-lint/issues/232))
|
|
37
|
-
|
|
38
|
-
## [10.0.0] 2022-08-13
|
|
39
|
-
|
|
40
|
-
- Core
|
|
41
|
-
- Upgrade to [CodeNarc v3.1.0](https://github.com/CodeNarc/CodeNarc/blob/master/CHANGELOG.md#version-310----jun-2022)
|
|
42
|
-
- Accept list of directories / files as arguments (`--path` and `--files` become deprecated but are still usable)
|
|
43
|
-
- Examples
|
|
44
|
-
- Multiple files: `npm-groovy-lint path/to/file1.groovy path/to/file2.groovy`
|
|
45
|
-
- Directory: `npm groovy-lint path/to`
|
|
46
|
-
- Single file: `npm-groovy-lint Jenkinsfile`
|
|
47
|
-
- Ant pattern(s): `npm-groovy-lint path/to/**/*.groovy`
|
|
48
|
-
- Upgrade npm dependencies
|
|
49
|
-
- CI: Upgrade [MegaLinter](https://oxsecurity.github.io/megalinter/latest/) to v6
|
|
50
|
-
- Test classes for collecting error ranges
|
|
51
|
-
|
|
52
|
-
- New error ranges rules
|
|
53
|
-
- DuplicateNumberLiteral
|
|
54
|
-
- DuplicateStringLiteral
|
|
55
|
-
- MethodParameterTypeRequired
|
|
56
|
-
- NoDef
|
|
57
|
-
- SimpleDateFormatMissingLocale
|
|
58
|
-
- SpaceInsideParenthesis
|
|
59
|
-
- UnnecessaryPublicModifier
|
|
60
|
-
- VariableTypeRequired
|
|
61
|
-
|
|
62
|
-
- New fix rules
|
|
63
|
-
- SpaceAfterMethodCallName
|
|
64
|
-
- SpaceInsideParentheses
|
|
65
|
-
|
|
66
|
-
- Bug Fixes
|
|
67
|
-
- Wrongly calculated ranges are no more returned
|
|
68
|
-
|
|
69
|
-
## [9.5.0] 2022-04-12
|
|
70
|
-
|
|
71
|
-
- Disable Amplitude anonymous stats by default (use `--insight` to enable them)
|
|
72
|
-
|
|
73
|
-
## [9.4.1] 2022-01-12
|
|
74
|
-
|
|
75
|
-
- Upgrade node-sarif-builder to 2.0.1 and send npm-groovy-lint version in SARIF logs
|
|
76
|
-
- New range detection for rules:
|
|
77
|
-
- MethodReturnTypeRequired
|
|
78
|
-
- UnusedImport
|
|
79
|
-
|
|
80
|
-
## [9.4.0] 2022-01-11
|
|
81
|
-
|
|
82
|
-
- Add [SARIF](https://sarifweb.azurewebsites.net/) output format using [node-sarif-builder](https://github.com/nvuillam/node-sarif-builder)
|
|
83
|
-
|
|
84
|
-
## [9.3.2] 2022-01-09
|
|
85
|
-
|
|
86
|
-
- Upgrade cli-progress to avoid [colors lib boring but harmless hack](https://github.com/Marak/colors.js/issues/285)
|
|
87
|
-
|
|
88
|
-
## [9.3.1] 2022-01-06
|
|
89
|
-
|
|
90
|
-
- Fix issue when used as module and with file containing spaces ([VsCodeGroovyLint #137](https://github.com/nvuillam/vscode-groovy-lint/issues/137))
|
|
91
|
-
|
|
92
|
-
## [9.3.0] 2021-12-29
|
|
93
|
-
|
|
94
|
-
- Upgrade log4j dependencies because of [security issue](https://nvd.nist.gov/vuln/detail/CVE-2021-44832).
|
|
95
|
-
|
|
96
|
-
## [9.2.0] 2021-12-23
|
|
97
|
-
|
|
98
|
-
- Upgrade log4j dependencies because of (another) [security issue](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45105) (#196)
|
|
99
|
-
|
|
100
|
-
## [9.1.0] 2021-12-14
|
|
101
|
-
|
|
102
|
-
- Upgrade log4j dependencies because of [security issue](https://unit42.paloaltonetworks.com/apache-log4j-vulnerability-cve-2021-44228/) (#194)
|
|
103
|
-
|
|
104
|
-
## [9.0.0] 2021-09-30
|
|
105
|
-
|
|
106
|
-
- Upgrade to [CodeNarc v2.2.0](https://github.com/CodeNarc/CodeNarc/releases/tag/v2.2.0)
|
|
107
|
-
- Upgrade to [Groovy v3.0.9](https://groovy-lang.org/)
|
|
108
|
-
- Reorganize sources test folder
|
|
109
|
-
- Use java from 8 to 14 (install it if a later version is found)
|
|
110
|
-
- Add timeouts in CI jobs
|
|
111
|
-
- Add colors in error logs
|
|
112
|
-
|
|
113
|
-
## [8.2.0] 2021-06-11
|
|
114
|
-
|
|
115
|
-
- Upgrade dependencies advised by dependabot
|
|
116
|
-
- Fix Mega-Linter errors found
|
|
117
|
-
|
|
118
|
-
## [8.1.0] 2020-12-14
|
|
119
|
-
|
|
120
|
-
- Exclude `UnnecessaryGetter`, `FactoryMethodName`, `MethodReturnTypeRequired`, and `GStringExpressionWithinString` in `recommended-jenkinsfile` ([#140](https://github.com/nvuillam/npm-groovy-lint/pull/140)) ([Felipe Santos](https://github.com/felipecrs))
|
|
121
|
-
|
|
122
|
-
## [8.0.2] 2020-11-26
|
|
123
|
-
|
|
124
|
-
- Fix documentation about --verbose and --version options
|
|
125
|
-
- Use GitHub action to deploy to NPM
|
|
126
|
-
|
|
127
|
-
## [8.0.1] 2020-11-19
|
|
128
|
-
|
|
129
|
-
- Add a test case where variable includes if in its name for fix of rule SpaceAfterIf ([Behlül Uçar](https://github.com/ucarbehlul))
|
|
130
|
-
|
|
131
|
-
## [8.0.0] 2020-11-15
|
|
132
|
-
|
|
133
|
-
- Upgrade to CodeNarc 2.0.0
|
|
134
|
-
- Upgrade jars
|
|
135
|
-
- Adapt Indentation rule to new behaviour
|
|
136
|
-
- Use codenarc --ruleset argument instead of temp ruleset file
|
|
137
|
-
- Replace super-linter by [Mega-Linter](https://nvuillam.github.io/mega-linter/)
|
|
138
|
-
- Fixes
|
|
139
|
-
- [(#127)](https://github.com/nvuillam/npm-groovy-lint/issues/127) Formatting breaks code, converting `else if` into `elseif` in some cases
|
|
140
|
-
- Apply formatting rules also for --fix mode
|
|
141
|
-
- Fix Markdown dead links
|
|
142
|
-
- CI
|
|
143
|
-
- Migrate from CircleCI to GitHub Actions: now tests are on Linux, Windows & MacOs
|
|
144
|
-
- Activate spelling linter of Mega-Linter (+ `.cspell.json` file)
|
|
145
|
-
- Add test cases for format and fix using CLI
|
|
146
|
-
|
|
147
|
-
## [7.6.2] 2020-09-09
|
|
148
|
-
|
|
149
|
-
- Disable TrailingComma rule by default until crash is solved in [CodeNarc](https://codenarc.github.io/CodeNarc) ([#75@vscode-groovy-lint](https://github.com/nvuillam/vscode-groovy-lint/issues/75))
|
|
150
|
-
|
|
151
|
-
## [7.6.0] 2020-09-08
|
|
152
|
-
|
|
153
|
-
- Add GitHub Action [GitHub Super-Linter](https://github.com/marketplace/actions/super-linter) to the repository
|
|
154
|
-
- Update Dockerfile to pass Docker lint rules
|
|
155
|
-
|
|
156
|
-
## [7.5.5] 2020-09-05
|
|
157
|
-
|
|
158
|
-
- Upgrade [java-caller](https://github.com/nvuillam/node-java-caller) to v2.2.3
|
|
159
|
-
- Fix Java 8 detection ([#101](https://github.com/nvuillam/npm-groovy-lint/issues/101))
|
|
160
|
-
|
|
161
|
-
## [7.5.4] 2020-09-04
|
|
162
|
-
|
|
163
|
-
- Update frameworks detection
|
|
164
|
-
|
|
165
|
-
## [7.5.1] 2020-09-02
|
|
166
|
-
|
|
167
|
-
- Fix [(#96)](https://github.com/nvuillam/npm-groovy-lint/issues/96) --fix adds redundant space into `${VARIABLE}` (SpaceBeforeOpeningBrace fix rule error)
|
|
168
|
-
- Fix grails framework detection
|
|
169
|
-
- Fix Groovy parsing parsing when multiple files
|
|
170
|
-
- Add `.gvy` and `.nf` in default browsed files extensions
|
|
171
|
-
|
|
172
|
-
## [7.5.0] 2020-09-02
|
|
173
|
-
|
|
174
|
-
- Add anonymous framework usage stats for Groovy core Team
|
|
175
|
-
|
|
176
|
-
## [7.4.3] 2020-08-29
|
|
177
|
-
|
|
178
|
-
- Upgrade [java-caller](https://github.com/nvuillam/node-java-caller) to v2.2.0
|
|
179
|
-
- Fix CLASSPATH on windows in case there are spaces in paths
|
|
180
|
-
|
|
181
|
-
## [7.4.2] 2020-08-26
|
|
182
|
-
|
|
183
|
-
- Fix [(#90)](https://github.com/nvuillam/npm-groovy-lint/issues/90) When log level is specified number of linted files appear to be off
|
|
184
|
-
|
|
185
|
-
## [7.4.1] 2020-08-23
|
|
186
|
-
|
|
187
|
-
- [(#88)](https://github.com/nvuillam/npm-groovy-lint/pull/88) Fix Docker image to allow to use extra parameters (by [Howard Lo](https://github.com/warhod))
|
|
188
|
-
|
|
189
|
-
## [7.4.0] 2020-08-17
|
|
190
|
-
|
|
191
|
-
- [(#87)](https://github.com/nvuillam/npm-groovy-lint/pull/87) update to openjdk 11 in [official Docker image](https://hub.docker.com/r/nvuillam/npm-groovy-lint) (by [Pawel Kopka](https://github.com/pawelkopka))
|
|
192
|
-
|
|
193
|
-
## [7.3.1] 2020-08-16
|
|
194
|
-
|
|
195
|
-
- Add number of lines & reorganize anonymous statistics
|
|
196
|
-
- Fix error type counters in anonymous statistics
|
|
197
|
-
|
|
198
|
-
## [7.3.0] 2020-08-15
|
|
199
|
-
|
|
200
|
-
- Allow to link to [CodeNarc RuleSet files](https://codenarc.github.io/CodeNarc/codenarc-creating-ruleset.html) from `.groovylintrc.json`, using property `"codenarcRulesets"`. Warning: doing so means that all other properties of config file will be ignored.
|
|
201
|
-
|
|
202
|
-
## [7.1.1] 2020-08-11
|
|
203
|
-
|
|
204
|
-
- Upgrade [java-caller](https://www.npmjs.com/package/java-caller) to v2.0.0
|
|
205
|
-
|
|
206
|
-
## [7.1.0] 2020-08-10
|
|
207
|
-
|
|
208
|
-
- Externalize JavaCaller class into a separate package [java-caller](https://www.npmjs.com/package/java-caller) and use it
|
|
209
|
-
|
|
210
|
-
## [7.0.0] 2020-08-07
|
|
211
|
-
|
|
212
|
-
- New default recommended rules (activate/deactivate/change severity)
|
|
213
|
-
- Allow to call `--config recommended-jenkinsfile` to use delivered .groovylintrc-recommended-jenkinsfile.json
|
|
214
|
-
|
|
215
|
-
## [6.1.1] 2020-08-04
|
|
216
|
-
|
|
217
|
-
- Fix SpaceAfterComma auto-fixing rule
|
|
218
|
-
|
|
219
|
-
## [6.1.0] 2020-08-04
|
|
220
|
-
|
|
221
|
-
- Java 14 compatibility (Closes [#77](https://github.com/nvuillam/npm-groovy-lint/issues/7))
|
|
222
|
-
|
|
223
|
-
## [6.0.0] 2020-08-03
|
|
224
|
-
|
|
225
|
-
- Upgrade to [CodeNarc v1.6.1](https://github.com/CodeNarc/CodeNarc/blob/v1.6-patch-releases/CHANGELOG.md#version-161----aug-2020)
|
|
226
|
-
- Update list of rules
|
|
227
|
-
- Use new CodeNarc JSON console Output instead of temporary XML files
|
|
228
|
-
- Call CodeNarc to get its version instead of using npm-groovy-lint hardcoded value
|
|
229
|
-
- Upgrade to [GMetrics v1.1](https://github.com/dx42/gmetrics/blob/master/CHANGELOG.md#version-11-may-2020)
|
|
230
|
-
- Upgrade to [Groovy v3.0.5](https://groovy-lang.org/)
|
|
231
|
-
- Add anonymous usage stats on types of errors found and fixed
|
|
232
|
-
|
|
233
|
-
## [5.8.0] 2020-08-01
|
|
234
|
-
|
|
235
|
-
- Fix & enhance anonymous statistics
|
|
236
|
-
|
|
237
|
-
## [5.7.0] 2020-07-23
|
|
238
|
-
|
|
239
|
-
- [(#62)](https://github.com/nvuillam/npm-groovy-lint/pull/74) Check parse error in all files when called via CLI . Closes [#69](https://github.com/nvuillam/npm-groovy-lint/issues/69)
|
|
240
|
-
|
|
241
|
-
## [5.6.1] 2020-07-20
|
|
242
|
-
|
|
243
|
-
Fixes:
|
|
244
|
-
|
|
245
|
-
- [(#62)](https://github.com/nvuillam/npm-groovy-lint/issues/62) using a codenarc ruleset file seems to fail / groovylintrc is not codenarc compatible
|
|
246
|
-
|
|
247
|
-
## [5.6.0] 2020-07-20
|
|
248
|
-
|
|
249
|
-
- [(#68)](https://github.com/nvuillam/npm-groovy-lint/pull/68) Generate a [ready-to-use docker image](https://hub.docker.com/r/nvuillam/npm-groovy-lint) when publishing new npm-groovy-lint version (by [Dave Gallant](https://github.com/davegallant))
|
|
250
|
-
|
|
251
|
-
## [5.5.1] 2020-07-15
|
|
252
|
-
|
|
253
|
-
- Fixes
|
|
254
|
-
- [(#64)](https://github.com/nvuillam/vscode-groovy-lint/issues/64) The contents of a string gets formatted unexpectedly
|
|
255
|
-
|
|
256
|
-
## [5.5.0] 2020-07-09
|
|
257
|
-
|
|
258
|
-
- Allow to override java executable and options [(#54)](https://github.com/nvuillam/vscode-groovy-lint/issues/54)
|
|
259
|
-
|
|
260
|
-
## [5.4.2] 2020-07-09
|
|
261
|
-
|
|
262
|
-
- Use os.EOL [(#65)](https://github.com/nvuillam/npm-groovy-lint/pull/65) solving [(#63)](https://github.com/nvuillam/npm-groovy-lint/issues/63) --fix for indentation adds CRLF line-endings to all files it touches
|
|
263
|
-
|
|
264
|
-
## [5.4.1] 2020-07-01
|
|
265
|
-
|
|
266
|
-
- CodeNarcServer listens to localhost only [(#59)](https://github.com/nvuillam/npm-groovy-lint/pull/59) solving [(#56)](https://github.com/nvuillam/npm-groovy-lint/issues/56)
|
|
267
|
-
- Replace @analytics/segment with @amplitude/node for anonymous stats
|
|
268
|
-
|
|
269
|
-
## [5.3.0] 2020-06-29
|
|
270
|
-
|
|
271
|
-
- New option **--failon** , replacing `--failonerror`,`--failonwarning` and `--failoninfo`. It can take error, warning or info values (default: none). Previous options remain working but are deprecated and will be removed in a future major version
|
|
272
|
-
- Update help for `--fixrules` option
|
|
273
|
-
|
|
274
|
-
## [5.1.0] 2020-06-04
|
|
275
|
-
|
|
276
|
-
- Install Java 8 using node-jre in case java version found is higher than Java 11 (CodeNarc compatibility is Java 8 to 11)
|
|
277
|
-
|
|
278
|
-
## [5.0.3] 2020-05-30
|
|
279
|
-
|
|
280
|
-
- Updated fix rules
|
|
281
|
-
- Indentation
|
|
282
|
-
- IndentationClosingBrace
|
|
283
|
-
|
|
284
|
-
## [5.0.2] 2020-05-27
|
|
285
|
-
|
|
286
|
-
- Avoid to apply wrong fix in case of CodeNarc false positive
|
|
287
|
-
- New fix rules
|
|
288
|
-
- BlankLineBeforePackage
|
|
289
|
-
- Updated fix rules
|
|
290
|
-
- BracesForIfElse
|
|
291
|
-
- BracesForMethod
|
|
292
|
-
- BracesForTryCatchFinally
|
|
293
|
-
- ClassEndsWithBlankLine
|
|
294
|
-
- ClassStartsWithBlankLine
|
|
295
|
-
- MissingBlankLineAfterImports
|
|
296
|
-
- MissingBlankLineAfterPackage
|
|
297
|
-
- UnnecessaryGroovyImport
|
|
298
|
-
- UnusedImport
|
|
299
|
-
|
|
300
|
-
## [5.0.0] 2020-05-25
|
|
301
|
-
|
|
302
|
-
- **BIG BANG**: Improve performances, compatibility, architecture and delivery
|
|
303
|
-
- Get rid of [jDeploy](https://github.com/shannah/jdeploy) dependency
|
|
304
|
-
- Use own **java-caller.js** for java commands
|
|
305
|
-
- Update CircleCI config to use `npm link`instead of `jdeploy install`
|
|
306
|
-
- Get rid of [request](https://github.com/request/request) dependency
|
|
307
|
-
- Use [axios](https://github.com/axios/axios) for promisified http calls
|
|
308
|
-
|
|
309
|
-
## [4.14.0] 2020-05-22
|
|
310
|
-
|
|
311
|
-
- Send rule configuration to fix functions
|
|
312
|
-
- Add `.gradle` files in default linted files
|
|
313
|
-
- Fixes:
|
|
314
|
-
- Missing number of linted files returned in summary
|
|
315
|
-
- Try to call CodeNarcJava in case there is an error with CodeNarcServer call
|
|
316
|
-
|
|
317
|
-
## [4.13.0] 2020-05-20
|
|
318
|
-
|
|
319
|
-
- Manage to send options for rules sent in `rulesets`: Ex: `Indentation{"spacesPerIndentLevel":2,"severity":"warning"},UnnecessarySemicolon`
|
|
320
|
-
- New parameter `--rulesetsoverridetype` : If list of rules sent in rulesets option, defines if they replace rules defined in .groovylintrc.json, or if they are appended
|
|
321
|
-
|
|
322
|
-
## [4.12.0] 2020-05-18
|
|
323
|
-
|
|
324
|
-
- Improve performances and avoid `Unknown command: node` error by using childProcess.fork to call CodeNarcServer
|
|
325
|
-
|
|
326
|
-
## [4.11.1] 2020-05-16
|
|
327
|
-
|
|
328
|
-
- Detect when crash is related to "node" or "java" command not found and return a human readable error message
|
|
329
|
-
|
|
330
|
-
## [4.11.0] 2020-05-13
|
|
331
|
-
|
|
332
|
-
- Add CI , rule overrides and crashes in anonymous insights for debugging investigation
|
|
333
|
-
- When used as a module, **never crash intentionally with throw**, so when called by module, check linter.status and linter.error instead of try/catch
|
|
334
|
-
- 0: ok
|
|
335
|
-
- 1: expected error
|
|
336
|
-
- 2: unexpected error
|
|
337
|
-
- 9: if cancelled request
|
|
338
|
-
|
|
339
|
-
## [4.10.0] 2020-05-12
|
|
340
|
-
|
|
341
|
-
- Update analytics to use [analytics](https://www.npmjs.com/package/analytics) & [@analytics-segment](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-segment) instead of [insight](https://www.npmjs.com/package/insight). If you want to disable anonymous usage stats, you can still use `--no-insight` option.
|
|
342
|
-
|
|
343
|
-
## [4.9.0] 2020-05-10
|
|
344
|
-
|
|
345
|
-
- Add anonymous usage statistics using [insight](https://www.npmjs.com/package/insight), in order to make new improvements based on how users use this package.
|
|
346
|
-
- Note: Analytics obviously does not receive sensitive information like your code, as you can see in [analytics.js](https://github.com/nvuillam/npm-groovy-lint/blob/master/lib/analytics.js). If you want to disable anonymous usage stats, use `--no-insight` option.
|
|
347
|
-
|
|
348
|
-
## [4.8.0] 2020-05-08
|
|
349
|
-
|
|
350
|
-
- New fix rules
|
|
351
|
-
- AssignmentInConditional
|
|
352
|
-
- DuplicateImport
|
|
353
|
-
- ExplicitLinkedListInstantiation
|
|
354
|
-
- InsecureRandom
|
|
355
|
-
- UnnecessaryDefInVariableDeclaration
|
|
356
|
-
- UnnecessaryDotClass
|
|
357
|
-
- UnnecessaryFinalOnPrivateMethod
|
|
358
|
-
- UnnecessaryInstantiationToGetClass
|
|
359
|
-
|
|
360
|
-
- Updated fix rules
|
|
361
|
-
- BracesForForLoop: False positive triggering messy code after fixing
|
|
362
|
-
- UnnecessaryGString: Fix multiline replacements ( `"""` by `'''` )
|
|
363
|
-
|
|
364
|
-
- Fixes :
|
|
365
|
-
- Launch JVM with high memory (`-Xms256m -Xmx2048m`) to improve performances on big files
|
|
366
|
-
- Increase CodeNarcServ call timeout (+ Manage ETIMEOUT as result, not only ECONNREFUSED )
|
|
367
|
-
|
|
368
|
-
- Utils
|
|
369
|
-
- Allow regex in range functions
|
|
370
|
-
|
|
371
|
-
## [4.7.0] 2020-05-06
|
|
372
|
-
|
|
373
|
-
- New fix rules
|
|
374
|
-
- BracesForClass
|
|
375
|
-
- BracesForForLoop
|
|
376
|
-
- BracesForIfElse
|
|
377
|
-
- BracesForMethod
|
|
378
|
-
- BracesForTryCatchFinally
|
|
379
|
-
- ExplicitArrayListInstantiation
|
|
380
|
-
- MissingBlankLineAfterImports
|
|
381
|
-
- MissingBlankLineAfterPackage
|
|
382
|
-
|
|
383
|
-
- Updated fix rules
|
|
384
|
-
- UnnecessaryGString: Fix replacements containing `\n` and `\r`
|
|
385
|
-
|
|
386
|
-
## [4.6.0] 2020-05-01
|
|
387
|
-
|
|
388
|
-
- New fix rules
|
|
389
|
-
- SpaceBeforeClosingBrace
|
|
390
|
-
- UnnecessaryDefInMethodDeclaration
|
|
391
|
-
- UnnecessaryPackageReference
|
|
392
|
-
- UnnecessaryParenthesesForMethodCallWithClosure
|
|
393
|
-
|
|
394
|
-
- Updated fix rules
|
|
395
|
-
- MisorderedStaticImports: Fix `@Grapes` killer fixing rule
|
|
396
|
-
- ElseBlockBrace :issue when instruction is on the same line than `else`
|
|
397
|
-
|
|
398
|
-
## [4.5.5] 2020-04-30
|
|
399
|
-
|
|
400
|
-
- Fixes
|
|
401
|
-
- ignorepattern option not working [#34](https://github.com/nvuillam/npm-groovy-lint/issues/34)
|
|
402
|
-
|
|
403
|
-
## [4.5.2] 2020-04-29
|
|
404
|
-
|
|
405
|
-
- Expose `loadConfig()` method to load rules when npm-groovy-lint is used as a library
|
|
406
|
-
- Fixes
|
|
407
|
-
- Missing temporary rulesets file missing
|
|
408
|
-
- Handle better CodeNarcServer concurrent calls
|
|
409
|
-
|
|
410
|
-
## [4.5.1] 2020-04-28
|
|
411
|
-
|
|
412
|
-
- Fixes
|
|
413
|
-
- Take in account user overridden indentation space (and other rules) when using --format option [#31](https://github.com/nvuillam/npm-groovy-lint/issues/31)
|
|
414
|
-
|
|
415
|
-
## [4.5.0] 2020-04-24
|
|
416
|
-
|
|
417
|
-
- Configuration updates ([#29](https://github.com/nvuillam/npm-groovy-lint/issues/29)):
|
|
418
|
-
- New default config "recommended-jenkinsfile". Use it with argument `--config recommended-jenkinsfile`
|
|
419
|
-
- Allow to directly target a config file name. Use it with argument `--config /my/custom/path/.groovylintrc-custom-name.json`
|
|
420
|
-
- Allow to send a string key that will be used to find config file `--config custom-name`
|
|
421
|
-
- Updated fix rules:
|
|
422
|
-
- IfStatementBraces
|
|
423
|
-
- ElseStatementBraces
|
|
424
|
-
|
|
425
|
-
## [4.4.1] 2020-04-16
|
|
426
|
-
|
|
427
|
-
- Fixes:
|
|
428
|
-
- CodeNarcServer: Use cachedThreadPool instead of fixedThreadPool
|
|
429
|
-
|
|
430
|
-
## [4.4.0] 2020-04-16
|
|
431
|
-
|
|
432
|
-
- Cancel a CodeNarc Lint when a similar CodeNarcServer request is received (allowing onType mode for language servers)
|
|
433
|
-
|
|
434
|
-
## [4.3.0] 2020-04-14
|
|
435
|
-
|
|
436
|
-
- Allow to disable rules using comments in source in [eslint style](https://eslint.org/docs/user-guide/configuring#disabling-rules-with-inline-comments)
|
|
437
|
-
|
|
438
|
-
## [4.2.0] 2020-04-13
|
|
439
|
-
|
|
440
|
-
- New option **--parse**: Capability to parse source code and return compilation errors
|
|
441
|
-
- New fix rules (thanks [CatSue](https://github.com/CatSue) !):
|
|
442
|
-
- SpaceAfterSemicolon
|
|
443
|
-
- SpaceAfterWhile
|
|
444
|
-
|
|
445
|
-
## [4.1.0] 2020-04-12
|
|
446
|
-
|
|
447
|
-
- Upgrade to [Groovy 3.0.3](https://dl.bintray.com/groovy/maven/apache-groovy-binary-3.0.3.zip)
|
|
448
|
-
- Automatic generation of fixable rules list for README
|
|
449
|
-
- Refactor CodeNarcServer.groovy
|
|
450
|
-
|
|
451
|
-
## [4.0.0] 2020-04-09
|
|
452
|
-
|
|
453
|
-
- Fix [issue](https://github.com/nvuillam/vscode-groovy-lint/issues/16) affecting performances on Linux and MacOs
|
|
454
|
-
|
|
455
|
-
## [3.3.0] 2020-04-06
|
|
456
|
-
|
|
457
|
-
- When formatting, always run some custom npm-groovy-lint fix rules not corresponding to CodeNarc violations
|
|
458
|
-
- Return CodeNarc and Groovy versions when --version options is called
|
|
459
|
-
- Fixes
|
|
460
|
-
- Lost indentation when applying some fix rules
|
|
461
|
-
- Updated fix rules:
|
|
462
|
-
- IndentationClosingBraces
|
|
463
|
-
- IndentationComments
|
|
464
|
-
- SpaceAfterCatch
|
|
465
|
-
- SpaceAfterIf
|
|
466
|
-
- New fix rules:
|
|
467
|
-
- ClassEndsWithBlankLine
|
|
468
|
-
- ClassStartsWithNewLine
|
|
469
|
-
- SpaceAfterFor
|
|
470
|
-
- SpaceAfterSwitch
|
|
471
|
-
|
|
472
|
-
## [3.2.4] 2020-04-03
|
|
473
|
-
|
|
474
|
-
- Error message in postinstall if env Node.js is lower than the minimal required (12)
|
|
475
|
-
|
|
476
|
-
## [3.2.3] 2020-04-02
|
|
477
|
-
|
|
478
|
-
- When If or Else brackets are fixed,trigger another rule lint & fix only with Indentation rules so CodeNarc recalculate them correctly
|
|
479
|
-
- New option `nolintafter`: When format or fix is called, a new lint is performed after the fixes to update the error list. If you just want the updated source code and do not care about the error logs, use this parameter to improve performances
|
|
480
|
-
- Fixes
|
|
481
|
-
- Manage correctly options `failonerror`, `failonwarning` and `failoninfo`
|
|
482
|
-
- `npm-groovy-lint -version` now returns version from package.json
|
|
483
|
-
- Mocha tests updates:
|
|
484
|
-
- Add stats on calls to CodeNarc (`globalThis.codeNarcCallsCounter` and `globalThis.codeNarcCalls`, activated if `globalThis.codeNarcCallsCounter` is set to 0 before calling NmpGroovyLint)
|
|
485
|
-
- Factorize test classes common code in module helper/common.js
|
|
486
|
-
- Use a smaller groovy file for test classes when not impacting the tests quality
|
|
487
|
-
|
|
488
|
-
## [3.2.2] 2020-03-31
|
|
489
|
-
|
|
490
|
-
- New option **returnrules** if you want to return rules descriptions and documentation url in results
|
|
491
|
-
- Use npm ci instead of npm install in CircleCI build
|
|
492
|
-
|
|
493
|
-
## [3.2.1] 2020-03-29
|
|
494
|
-
|
|
495
|
-
- Return rules descriptions in results
|
|
496
|
-
- New option **nolintafter**: do not lint again a format or a fix, as the client prefers to request it
|
|
497
|
-
- Fixes
|
|
498
|
-
- [Issue #13](https://github.com/nvuillam/npm-groovy-lint/issues/13): False positive error ClassNameSameAsFileName
|
|
499
|
-
- Sometimes returning wrong .groovylint.json config file
|
|
500
|
-
|
|
501
|
-
## [3.2.0] 2020-03-26
|
|
502
|
-
|
|
503
|
-
- New option "--format", allowing to reformat source code (using .groovylintrc-format.json)
|
|
504
|
-
- Update default recommended rules
|
|
505
|
-
|
|
506
|
-
## [3.1.3] 2020-03-22
|
|
507
|
-
|
|
508
|
-
- README: Link to [Visual Studio Code Groovy Lint extension](https://marketplace.visualstudio.com/items?itemName=NicolasVuillamy.vscode-groovy-lint)
|
|
509
|
-
|
|
510
|
-
## [3.1.2] 2020-03-22
|
|
511
|
-
|
|
512
|
-
- New Fix rules:
|
|
513
|
-
- BlockEndsWithBlankLine
|
|
514
|
-
- BlockStartsWithBlankLine
|
|
515
|
-
- MisorderedStaticImports
|
|
516
|
-
- SpaceAfterIf
|
|
517
|
-
- Fix: Update correctly the lineNb & ranges of next errors after an error has been fixed
|
|
518
|
-
- Do not return rules tests if call is not from a test file
|
|
519
|
-
- Fix rules:
|
|
520
|
-
- ElseBlockBraces
|
|
521
|
-
- IfStatementBraces
|
|
522
|
-
- SpaceAroundOperator
|
|
523
|
-
- UnusedImport
|
|
524
|
-
|
|
525
|
-
## [3.1.1] 2020-03-20
|
|
526
|
-
|
|
527
|
-
- New Fix rules:
|
|
528
|
-
- BlockEndsWithBlankLine
|
|
529
|
-
- BlockStartsWithBlankLine
|
|
530
|
-
- MisorderedStaticImports
|
|
531
|
-
- SpaceAfterIf
|
|
532
|
-
- Updated Fix rules:
|
|
533
|
-
- SpaceAroundOperator
|
|
534
|
-
|
|
535
|
-
## [3.1.0] 2020-03-18
|
|
536
|
-
|
|
537
|
-
- Test suites: Improve reliability & logs for rule fixes tests (detected numerous bugs, now corrected)
|
|
538
|
-
- Send computed range to fix functions
|
|
539
|
-
- Updated Fix rules:
|
|
540
|
-
- ClosingBraceNotAlone
|
|
541
|
-
- ElseBlockBraces
|
|
542
|
-
- IfStatementBraces
|
|
543
|
-
- NoTabCharacter
|
|
544
|
-
- SpaceAfterComma
|
|
545
|
-
- SystemExit
|
|
546
|
-
- TrailingWhitespace
|
|
547
|
-
- UnnecessaryGroovyImport
|
|
548
|
-
- UnusedImport
|
|
549
|
-
|
|
550
|
-
## [3.0.1] 2020-03-17
|
|
551
|
-
|
|
552
|
-
- Add new test suites: errors.test.js and miscellaneous.test.js
|
|
553
|
-
- Use JSON as default GroovyLint configuration file type
|
|
554
|
-
- Order of fixable rules must be defined in groovy-lint-rules.js
|
|
555
|
-
- Do not load rules test data except during tests
|
|
556
|
-
- Do not lint again after a call to fixErrors on an existing NpmGroovyLint instance (except if lintAgainAfterFix : true is sent in options)
|
|
557
|
-
- Fix: Deletion of temp RuleSite file
|
|
558
|
-
- Fix: UnnecessarySemiColon rule
|
|
559
|
-
- Fix: ClosingBraceNotAlone rule
|
|
560
|
-
|
|
561
|
-
## [3.0.0] 2020-03-15
|
|
562
|
-
|
|
563
|
-
- Local microservice "CodeNarcServer" called via Http by npm-groovy-lint, to avoid loading all groovy/java classes at each lint request. This microservice auto-kills itself after one hour idle.
|
|
564
|
-
- Capability to define RuleSets in argument or js/json/yml config file formats instead of groovy/xml RuleSet format
|
|
565
|
-
- Test classes for rules fix (before / after fix defined in rule definitions)
|
|
566
|
-
- Add debug logs (use it by setting DEBUG env variable , ex: `DEBUG=npm-groovy-lint npm-groovy-lint args...`)
|
|
567
|
-
- Update lines and ranges of other errors after a fix updated the number of lines
|
|
568
|
-
- Generate automatically .groovylintrc-all.js during build
|
|
569
|
-
- Split rules definition into files instead of all in a huge single file
|
|
570
|
-
- Reorganize groovy-lint.js code, using codenarc-factory.js and codenarc-caller.js
|
|
571
|
-
- New lib utils.js that can be used by rules definition
|
|
572
|
-
- Fix: Crash when there was no error found in a file
|
|
573
|
-
- Fix: Remove Promise error display in log after launching CodeNarcServer
|
|
574
|
-
- Fix: Add more options exclusivity arguments rules
|
|
575
|
-
- Removed "Groovy", "Jenkinsfile" and "All" identifiers for --rulesets arguments. Please now use .groovylintrc.js configuration
|
|
576
|
-
|
|
577
|
-
## [2.2.0] 2020-02-28
|
|
578
|
-
|
|
579
|
-
- Capability to call NpmGroovyLint with options as object, not only command line arguments
|
|
580
|
-
- New option "source", allowing to call NpmGroovyLint with the groovy code as a string , not only path & files pattern
|
|
581
|
-
- Run lint again after fix all errors, to get updated lintResult
|
|
582
|
-
- Add gitattributes to normalized line-endings (thanks [docwhat](https://github.com/docwhat))
|
|
583
|
-
- API: fix only some errors after an initial lint (better performances)
|
|
584
|
-
- Return error range in files for some rules in JSON or API result (will be useful for the VsCode extension currently developed)
|
|
585
|
-
- Define range function for existing rules, new fixable rules
|
|
586
|
-
|
|
587
|
-
## [2.0.1] - 2020-02-21
|
|
588
|
-
|
|
589
|
-
- Capability to fix errors
|
|
590
|
-
- ConsecutiveBlankLines
|
|
591
|
-
- Indentation (IfStatementBraces and ElseIfStatementBraces must be manually fixed to have correct indentation)
|
|
592
|
-
- IndentationComments (custom npm-groovy-rule triggered by Indentation rule)
|
|
593
|
-
- IndentationClosingBrace (custom npm-groovy-rule triggered by Indentation rule)
|
|
594
|
-
- NoTabCharacter
|
|
595
|
-
- SpaceAfterCatch
|
|
596
|
-
- SpaceAfterOpeningBrace
|
|
597
|
-
- SpaceAroundOperator
|
|
598
|
-
- SpaceAfterComma
|
|
599
|
-
- SpaceBeforeOpeningBrace
|
|
600
|
-
- UnnecessaryDefInFieldDeclaration
|
|
601
|
-
- UnnecessaryGString
|
|
602
|
-
- UnnecessaryPublicModifier
|
|
603
|
-
- UnnecessarySemicolon
|
|
604
|
-
- TrailingWhitespace
|
|
605
|
-
- Log formatting with severity colors and summary table
|
|
606
|
-
- Default recommended RuleSets for Groovy and Jenkins
|
|
607
|
-
- Progress bar in console
|
|
608
|
-
- More code coverage with test campaigns
|
|
609
|
-
- New Capability to call NpmGroovyLint from another package (VsCode extension development in progress ^^)
|
|
610
|
-
- Refactored command line arguments ( simpler, but different from CodeNarc ones : retro-compatibility with CodeNarc arguments assured if you add --codenarcargs)
|
|
611
|
-
- Upgrade to CodeNarc v1.5
|
|
612
|
-
- Upgrade to Groovy v3.0.1
|
|
613
|
-
- Refactored documentation with detailed arguments description & examples
|
|
614
|
-
|
|
615
|
-
___
|
|
616
|
-
|
|
617
|
-
## Before
|
|
618
|
-
|
|
619
|
-
- I wasn't serious enough to keep a changelog, sorry !
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|