UNPKG

npm-groovy-lint

Version:

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

31 lines (29 loc) 654 B
// Explicit LinkedList instantiation const rule = { fix: { label: "Replace LinkedList declaration by [] as Queue", type: "function", func: (line) => { return line.replace(/new LinkedList(.*)\)/gi, "[] as Queue"); }, }, tests: [ { sourceBefore: ` List<String> printList = new LinkedList<String>() `, sourceAfter: ` List<String> printList = [] as Queue `, }, { sourceBefore: ` List<String> printList=new LinkedList<String>() `, sourceAfter: ` List<String> printList=[] as Queue `, }, ], }; export { rule };