npm-groovy-lint
Advanced tools
Comparing version 11.1.2-beta202311021422.0 to 11.1.2-beta202311021635.0
@@ -11,3 +11,3 @@ // Unnecessary Groovy String | ||
name: "STRING", | ||
regex: /The String '(.*)' can be wrapped in single quotes instead of double quotes/ | ||
regex: /The String '([\s\S]*)' can be wrapped in single quotes instead of double quotes/ | ||
} | ||
@@ -14,0 +14,0 @@ ], |
@@ -131,2 +131,19 @@ // Shared functions | ||
// escapeMessage escapes a value as retrieved from CodeNarc | ||
// from the "display name" so it matches the original source. | ||
// See issue: https://github.com/CodeNarc/CodeNarc/issues/749 | ||
// Escaping as per: https://groovy-lang.org/syntax.html#_escaping_special_characters | ||
function escapeValue(s) { | ||
return s | ||
.replace(/\\/g, "\\\\") | ||
.replace(/[\b]/g, "\\b") // Class so \b is not a word boundary. | ||
.replace(/\f/g, "\\f") | ||
.replace(/\n/g, "\\n") | ||
.replace(/\r/g, "\\r") | ||
.replace(/\t/g, "\\t") | ||
.replace(/\v/g, "\\v") | ||
.replace(/'/g, "\\'") | ||
.replace(/"/g, '\\"'); | ||
} | ||
// Evaluate variables from messages | ||
@@ -138,7 +155,7 @@ function evaluateVariables(variableDefs, msg) { | ||
if (varDef.regex) { | ||
msg = msg.replace(/\n/g, "\\n").replace(/\r/g, "\\r"); | ||
const regexRes = msg.match(varDef.regex); | ||
if (regexRes && regexRes.length > 1) { | ||
const regexPos = varDef.regexPos || 1; | ||
const value = decodeHtml(regexRes[regexPos]); | ||
let value = decodeHtml(regexRes[regexPos]); | ||
value = escapeValue(value); | ||
const varValue = | ||
@@ -145,0 +162,0 @@ varDef.type && varDef.type === "number" |
{ | ||
"name": "npm-groovy-lint", | ||
"version": "11.1.2-beta202311021422.0", | ||
"version": "11.1.2-beta202311021635.0", | ||
"description": "Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle files", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15844902
7472