npm-groovy-lint
Advanced tools
Comparing version 3.0.0-beta.2 to 3.0.0-beta.3
@@ -6,2 +6,3 @@ #! /usr/bin/env node | ||
const cliProgress = require("cli-progress"); | ||
const debug = require("debug")("npm-groovy-lint"); | ||
const { npmGroovyLintRules } = require("./groovy-lint-rules.js"); | ||
@@ -184,4 +185,4 @@ const { evaluateVariables, getSourceLines } = require("./utils.js"); | ||
if (this.verbose) { | ||
console.error(e.message); | ||
console.error(fixableError); | ||
debug(e.message); | ||
debug(fixableError); | ||
} | ||
@@ -209,4 +210,4 @@ return line; | ||
newLine = newLine.replace(strBefore, strAfter); | ||
} else if (this.verbose) { | ||
console.error("NGL: missing replacement variable(s):\n" + strBefore + "\n" + strAfter + "\n" + JSON.stringify(fixableError)); | ||
} else { | ||
debug("NGL: missing replacement variable(s):\n" + strBefore + "\n" + strAfter + "\n" + JSON.stringify(fixableError)); | ||
} | ||
@@ -219,5 +220,3 @@ } | ||
} catch (e) { | ||
if (this.verbose) { | ||
console.error("NGL: Function error: " + e.message + " / " + JSON.stringify(fixableError)); | ||
} | ||
debug("NGL: Function error: " + e.message + " / " + JSON.stringify(fixableError)); | ||
} | ||
@@ -224,0 +223,0 @@ } |
@@ -70,3 +70,2 @@ // Additional definition for codenarc rules ( get position & available fix) | ||
"NoTabCharacter", | ||
"TrailingWhitespace", | ||
"Indentation", | ||
@@ -81,2 +80,3 @@ "UnnecessaryGString", | ||
"UnnecessarySemicolon", | ||
"TrailingWhitespace", | ||
@@ -83,0 +83,0 @@ // Rule that can change the numbers of lines, so they must be processed after line scope rules |
#! /usr/bin/env node | ||
const DEFAULT_VERSION = "3.0.0-beta.2"; | ||
// Imports | ||
const c = require("ansi-colors"); | ||
const cliProgress = require("cli-progress"); | ||
const debug = require("debug")("npm-groovy-lint"); | ||
const fse = require("fs-extra"); | ||
@@ -19,2 +22,3 @@ const os = require("os"); | ||
const { evaluateRange, evaluateVariables, getSourceLines } = require("./utils.js"); | ||
class NpmGroovyLint { | ||
@@ -115,3 +119,3 @@ "use strict"; | ||
} catch { | ||
v = "3.0.0-beta.1"; | ||
v = DEFAULT_VERSION; | ||
} | ||
@@ -316,5 +320,3 @@ } | ||
// Start progress bar | ||
if (this.options.verbose) { | ||
console.log("NGL: running CodeNarc using " + jDeployCommand); | ||
} | ||
debug("NGL: running CodeNarc using " + jDeployCommand); | ||
this.bar = new cliProgress.SingleBar( | ||
@@ -336,3 +338,3 @@ { | ||
// originalJDeploy.js Execution using child process | ||
// originalJDeploy.js Execution using child process (or originaljdeployPlanB if originaljdeploy.js failed) | ||
let execRes; | ||
@@ -375,3 +377,3 @@ try { | ||
const start = performance.now(); | ||
await new Promise((resolve, reject) => { | ||
await new Promise(resolve => { | ||
interval = setInterval(() => { | ||
@@ -392,3 +394,3 @@ request | ||
); | ||
reject(); | ||
resolve(); | ||
} | ||
@@ -399,3 +401,3 @@ }) | ||
this.declareServerError(e, interval); | ||
reject(); | ||
resolve(); | ||
} | ||
@@ -409,6 +411,11 @@ }); | ||
} | ||
console.log(`NGL: Started CodeNarc Server after ${attempts} attempts`); | ||
return true; | ||
if (this.serverStatus === "running") { | ||
console.log(`NGL: Started CodeNarc Server after ${attempts} attempts`); | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
// Stop polling and log error | ||
declareServerError(e, interval) { | ||
@@ -420,5 +427,3 @@ this.serverStatus = "error"; | ||
console.log("NGL: Unable to start CodeNarc Server. Use --noserver if you do not even want to try"); | ||
if (this.verbose && e) { | ||
console.error(e.message); | ||
} | ||
debug(e.message); | ||
} | ||
@@ -425,0 +430,0 @@ |
@@ -0,0 +0,0 @@ ANTLR 2 License |
@@ -0,0 +0,0 @@ ANTLR 4 License |
@@ -0,0 +0,0 @@ ASM License |
@@ -0,0 +0,0 @@ BSD License |
@@ -0,0 +0,0 @@ Copyright (c) 2002-2012, the original author or authors. |
@@ -0,0 +0,0 @@ The person or persons who have associated work with this document (the |
@@ -0,0 +0,0 @@ Copyright (c) 2006, Sun Microsystems, Inc. |
@@ -0,0 +0,0 @@ Eclipse Public License - v 1.0 |
@@ -0,0 +0,0 @@ Eclipse Public License - v 2.0 |
@@ -0,0 +0,0 @@ Copyright (c) 2003-2006, Joe Walnes |
// Shared functions | ||
"use strict"; | ||
const debug = require("debug")("npm-groovy-lint"); | ||
const decodeHtml = require("decode-html"); | ||
@@ -17,3 +18,3 @@ const fse = require("fs-extra"); | ||
// Evaluate variables from messages | ||
function evaluateVariables(variableDefs, msg, optns = { verbose: false }) { | ||
function evaluateVariables(variableDefs, msg) { | ||
const evaluatedVars = []; | ||
@@ -31,4 +32,4 @@ for (const varDef of variableDefs || []) { | ||
}); | ||
} else if (optns.verbose) { | ||
console.error("NGL: Unable to match " + varDef.regex + " in " + msg); | ||
} else { | ||
debug("NGL: Unable to match " + varDef.regex + " in " + msg); | ||
} | ||
@@ -43,3 +44,3 @@ } else if (varDef.value) { | ||
// Get position to highlight in sources | ||
function evaluateRange(errItem, rule, evaluatedVars, errLine, allLines, optns = { verbose: false }) { | ||
function evaluateRange(errItem, rule, evaluatedVars, errLine, allLines) { | ||
let range; | ||
@@ -51,5 +52,3 @@ if (rule.range) { | ||
} catch (e) { | ||
if (optns.verbose) { | ||
console.error("NGL: Range function error: " + e.message + " / " + JSON.stringify(rule) + "\n" + JSON.stringify(errItem)); | ||
} | ||
debug("NGL: Range function error: " + e.message + " / " + JSON.stringify(rule) + "\n" + JSON.stringify(errItem)); | ||
} | ||
@@ -56,0 +55,0 @@ } |
{ | ||
"name": "npm-groovy-lint", | ||
"version": "3.0.0-beta.2", | ||
"version": "3.0.0-beta.3", | ||
"description": "NPM CodeNarc wrapper to easily lint Groovy files", | ||
@@ -47,2 +47,3 @@ "main": "index.js", | ||
"cli-progress": "^3.6.0", | ||
"debug": "^4.1.1", | ||
"decode-html": "^2.0.0", | ||
@@ -49,0 +50,0 @@ "fs-extra": "^8.1.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
16177324
60
2210
12
+ Addeddebug@^4.1.1
+ Addeddebug@4.4.0(transitive)
+ Addedms@2.1.3(transitive)