npm-groovy-lint
Version:
Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle files
37 lines (32 loc) • 739 B
JavaScript
// Missing blank lines after package
import { getVariable } from "../utils.js";
const rule = {
scope: "file",
unitary: true,
fix: {
label: "Add blank line after package",
type: "function",
func: (allLines, variables) => {
const lineNumber = getVariable(variables, "lineNb", { mandatory: true });
allLines.splice(lineNumber + 1, 0, "");
return allLines;
},
},
tests: [
{
sourceBefore: `
package com.lelama.nul
import a.b.c.D
import g.eeee.f.g.Hhhhh
import g.eeee.f.g.Iiii
`,
sourceAfter: `
package com.lelama.nul
import a.b.c.D
import g.eeee.f.g.Hhhhh
import g.eeee.f.g.Iiii
`,
},
],
};
export { rule };