npm-groovy-lint 11.1.2-beta202311021422.0 → 12.0.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 +1 -1
- package/lib/rules/UnnecessaryGString.js +1 -1
- package/lib/utils.js +19 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ You can also use this package in :
|
|
|
31
31
|
- [Mega-Linter](https://nvuillam.github.io/mega-linter/) (can be used as GitHub Action, and lints all other languages and formats)
|
|
32
32
|
- [Docker Image](#other)
|
|
33
33
|
|
|
34
|
-

|
|
35
35
|
|
|
36
36
|
See [CHANGELOG](https://github.com/nvuillam/npm-groovy-lint/blob/master/CHANGELOG.md)
|
|
37
37
|
|
package/lib/utils.js
CHANGED
|
@@ -128,17 +128,34 @@ function evaluateRangeFromLine(errItem, allLines) {
|
|
|
128
128
|
return getDefaultRange(allLines, errItem);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
// escapeMessage escapes a value as retrieved from CodeNarc
|
|
132
|
+
// from the "display name" so it matches the original source.
|
|
133
|
+
// See issue: https://github.com/CodeNarc/CodeNarc/issues/749
|
|
134
|
+
// Escaping as per: https://groovy-lang.org/syntax.html#_escaping_special_characters
|
|
135
|
+
function escapeValue(s) {
|
|
136
|
+
return s
|
|
137
|
+
.replace(/\\/g, "\\\\")
|
|
138
|
+
.replace(/[\b]/g, "\\b") // Class so \b is not a word boundary.
|
|
139
|
+
.replace(/\f/g, "\\f")
|
|
140
|
+
.replace(/\n/g, "\\n")
|
|
141
|
+
.replace(/\r/g, "\\r")
|
|
142
|
+
.replace(/\t/g, "\\t")
|
|
143
|
+
.replace(/\v/g, "\\v")
|
|
144
|
+
.replace(/'/g, "\\'")
|
|
145
|
+
.replace(/"/g, '\\"');
|
|
146
|
+
}
|
|
147
|
+
|
|
131
148
|
// Evaluate variables from messages
|
|
132
149
|
function evaluateVariables(variableDefs, msg) {
|
|
133
150
|
const evaluatedVars = [];
|
|
134
151
|
for (const varDef of variableDefs || []) {
|
|
135
152
|
// regex
|
|
136
153
|
if (varDef.regex) {
|
|
137
|
-
msg = msg.replace(/\n/g, "\\n").replace(/\r/g, "\\r");
|
|
138
154
|
const regexRes = msg.match(varDef.regex);
|
|
139
155
|
if (regexRes && regexRes.length > 1) {
|
|
140
156
|
const regexPos = varDef.regexPos || 1;
|
|
141
|
-
|
|
157
|
+
let value = decodeHtml(regexRes[regexPos]);
|
|
158
|
+
value = escapeValue(value);
|
|
142
159
|
const varValue =
|
|
143
160
|
varDef.type && varDef.type === "number"
|
|
144
161
|
? parseInt(value, 10)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-groovy-lint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle files",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"amplitude": "^5.1.6",
|
|
50
50
|
"ansi-colors": "^4.1.1",
|
|
51
|
-
"axios": "^0.21.
|
|
51
|
+
"axios": "^0.21.4",
|
|
52
52
|
"chalk": "^4.1.2",
|
|
53
53
|
"cli-progress": "^3.12.0",
|
|
54
54
|
"commondir": "^1.0.1",
|