npm-groovy-lint
Advanced tools
Comparing version 5.0.2 to 5.0.3
# Changelog | ||
## [5.0.3] 2020-05-30 | ||
- Updated fix rules | ||
- Indentation | ||
- IndentationClosingBrace | ||
## [5.0.2] 2020-05-27 | ||
@@ -4,0 +10,0 @@ |
@@ -57,3 +57,41 @@ // Indentation | ||
}` | ||
}, | ||
{ | ||
sourceBefore: ` | ||
docker.withRegistry("https://"+ envVars.GetDockerRegistry(), envVars.GetDockerRegistryCredsId()) { | ||
docker.image(envVars.GetFullImageName()).inside("--entrypoint=''") { | ||
withCredentials(credentials) { | ||
if (deploy == 'yes'){ | ||
// Send start build notification | ||
if( it.config.containsKey("notifChannelCredsId")) { | ||
p.k8sStage("\${it.config['name']} - Send notification",it, { | ||
withCredentials([string(credentialsId: it.config['notifChannelCredsId'], variable: 'TEAMS_WEBHOOK')]) { | ||
office365ConnectorSend message : "\${env.JOB_BASE_NAME}", status :"Started", webhookUrl: "\${env.TEAMS_WEBHOOK}" | ||
} | ||
}) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`, | ||
sourceAfter: ` | ||
docker.withRegistry("https://"+ envVars.GetDockerRegistry(), envVars.GetDockerRegistryCredsId()) { | ||
docker.image(envVars.GetFullImageName()).inside("--entrypoint=''") { | ||
withCredentials(credentials) { | ||
if (deploy == 'yes'){ | ||
// Send start build notification | ||
if( it.config.containsKey("notifChannelCredsId")) { | ||
p.k8sStage("\${it.config['name']} - Send notification",it, { | ||
withCredentials([string(credentialsId: it.config['notifChannelCredsId'], variable: 'TEAMS_WEBHOOK')]) { | ||
office365ConnectorSend message : "\${env.JOB_BASE_NAME}", status :"Started", webhookUrl: "\${env.TEAMS_WEBHOOK}" | ||
} | ||
}) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
` | ||
} | ||
] | ||
@@ -60,0 +98,0 @@ }; |
@@ -0,1 +1,3 @@ | ||
const { containsExceptInsideString } = require("../utils"); | ||
// Indentation closing braces | ||
@@ -13,3 +15,3 @@ const rule = { | ||
// Detect closing brace line | ||
if (line.trim() === "}") { | ||
if (["}", "})", "});"].includes(line.trim())) { | ||
// Find indentation of matching brace (CodeNarc Indentation rule does not always work well :/ ) | ||
@@ -21,6 +23,8 @@ let j = 1; | ||
const prevLine = allLines[i - j]; | ||
if (prevLine.includes("}") && !prevLine.includes("${")) { | ||
if (containsExceptInsideString(prevLine, "}")) { | ||
//if (prevLine.includes("}") && !prevLine.includes("${")) { | ||
level++; | ||
} | ||
if (prevLine.includes("{") && !prevLine.includes("${")) { | ||
//if (prevLine.includes("{") && !prevLine.includes("${")) { | ||
if (containsExceptInsideString(prevLine, "{")) { | ||
level--; | ||
@@ -60,3 +64,42 @@ if (level === 0) { | ||
` | ||
}, | ||
{ | ||
sourceBefore: ` | ||
docker.withRegistry("https://"+ envVars.GetDockerRegistry(), envVars.GetDockerRegistryCredsId()) { | ||
docker.image(envVars.GetFullImageName()).inside("--entrypoint=''") { | ||
withCredentials(credentials) { | ||
if (deploy == 'yes'){ | ||
// Send start build notification | ||
if( it.config.containsKey("notifChannelCredsId")){ | ||
p.k8sStage("\${it.config['name']} - Send notification",it, { | ||
withCredentials([string(credentialsId: it.config['notifChannelCredsId'], variable: 'TEAMS_WEBHOOK')]) | ||
{ | ||
office365ConnectorSend message : "\${env.JOB_BASE_NAME}", status :"Started", webhookUrl: "\${env.TEAMS_WEBHOOK}" | ||
} | ||
}) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`, | ||
sourceAfter: ` | ||
docker.withRegistry("https://"+ envVars.GetDockerRegistry(), envVars.GetDockerRegistryCredsId()) { | ||
docker.image(envVars.GetFullImageName()).inside("--entrypoint=''") { | ||
withCredentials(credentials) { | ||
if (deploy == 'yes'){ | ||
// Send start build notification | ||
if( it.config.containsKey("notifChannelCredsId")) { | ||
p.k8sStage("\${it.config['name']} - Send notification",it, { | ||
withCredentials([string(credentialsId: it.config['notifChannelCredsId'], variable: 'TEAMS_WEBHOOK')]) { | ||
office365ConnectorSend message : "\${env.JOB_BASE_NAME}", status :"Started", webhookUrl: "\${env.TEAMS_WEBHOOK}" | ||
} | ||
}) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
` | ||
} | ||
] | ||
@@ -63,0 +106,0 @@ }; |
@@ -348,2 +348,11 @@ // Shared functions | ||
function containsExceptInsideString(line, subString) { | ||
const subStringPos = line.indexOf(subString); | ||
if (subStringPos === -1) { | ||
return false; | ||
} | ||
const lineWithoutQuotedStuff = line.replace(/(["'])(?:(?=(\\?))\2.)*?\1/g, ""); // Remove content inside quotes | ||
return lineWithoutQuotedStuff.includes(subString); | ||
} | ||
// Split with multiple characters | ||
@@ -364,2 +373,3 @@ function splitMulti(str, tokens) { | ||
containsOtherThan, | ||
containsExceptInsideString, | ||
evaluateRange, | ||
@@ -366,0 +376,0 @@ evaluateVariables, |
{ | ||
"name": "npm-groovy-lint", | ||
"version": "5.0.2", | ||
"version": "5.0.3", | ||
"description": "Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle files", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -323,6 +323,16 @@ # NPM GROOVY LINT (+ Format & Auto-fix) | ||
[<img alt="nvuillam" src="https://avatars1.githubusercontent.com/u/17500430?v=4&s=117 width=117">](https://github.com/nvuillam) |[<img alt="docwhat" src="https://avatars1.githubusercontent.com/u/40799?v=4&s=117 width=117">](https://github.com/docwhat) |[<img alt="CatSue" src="https://avatars3.githubusercontent.com/u/26134618?v=4&s=117 width=117">](https://github.com/CatSue) |[<img alt="dependabot[bot]" src="https://avatars0.githubusercontent.com/in/29110?v=4&s=117 width=117">](https://github.com/apps/dependabot) | | ||
:---:|:---:|:---:|:---:| | ||
[nvuillam](https://github.com/nvuillam)|[docwhat](https://github.com/docwhat)|[CatSue](https://github.com/CatSue)|[dependabot[bot]](https://github.com/apps/dependabot)| | ||
## RELEASE NOTES | ||
## [5.0.2] 2020-05-27 | ||
### [5.0.3] 2020-05-30 | ||
- Updated fix rules | ||
- Indentation | ||
- IndentationClosingBrace | ||
### [5.0.2] 2020-05-27 | ||
- Avoid to apply wrong fix in case of CodeNarc false positive | ||
@@ -329,0 +339,0 @@ - New fix rules |
16412916
7824
393