UNPKG

npm-groovy-lint

Version:

Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle files

47 lines (38 loc) 744 B
// Unused import import { getVariable } from "../utils.js"; const rule = { scope: "file", unitary: true, fix: { label: "Remove blank line before end of the block", type: "function", func: (allLines, variables) => { const lineNumber = getVariable(variables, "lineNb", { mandatory: true }); if (allLines[lineNumber].trim() === "") { allLines.splice(lineNumber, 1); } return allLines; }, }, tests: [ { sourceBefore: ` if (true) { def a = 1 } if (false) { def b = 2 } `, sourceAfter: ` if (true) { def a = 1 } if (false) { def b = 2 } `, }, ], }; export { rule };