Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

npm-groovy-lint

Package Overview
Dependencies
Maintainers
1
Versions
204
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-groovy-lint - npm Package Compare versions

Comparing version 14.0.1 to 14.1.1-beta202401152058.0

lib/java/commons-compiler-3.1.11.jar

74

lib/codenarc-caller.js

@@ -9,3 +9,2 @@ // Call CodeNarc by server or java

const { performance } = require("perf_hooks");
const { getSourceLines } = require("./utils");
const c = require("chalk");

@@ -72,5 +71,4 @@

codeNarcExcludes: this.execOpts.codeNarcExcludes,
parse: this.options.parse !== false && this.execOpts.onlyCodeNarc === false ? true : false,
file: this.execOpts.groovyFileName || null,
fileList: this.execOpts.inputFileList || null,
parse: this.options.parse !== false && this.execOpts.onlyCodeNarc === false,
fileList: this.execOpts.groovyFileName ? [this.execOpts.groovyFileName] : this.execOpts.inputFileList,
requestKey: this.execOpts.requestKey || null

@@ -98,5 +96,13 @@ },

}
}
// Cancelled codeNarcAction (duplicate)
else if (e.code && e.code === "ECONNRESET") {
} else if (e.code === "ERR_BAD_REQUEST") {
// Bad request.
return {
status: e.response.data.statusCode,
error: {
msg: `exception: ${e.response.data.exceptionType} message: ${e.response.data.errorMessage}`,
stack: e.stack,
responseData: e.response.data.errorDtl
}
};
} else if (e.code === "ECONNRESET") {
// The server was shutdown just retry.

@@ -116,8 +122,3 @@ if (startServerTried === false && (await this.startCodeNarcServer()) && this.serverStatus === "running") {

c.red(
"CodeNarcServer unexpected error:\n" +
JSON.stringify(e, null, 2) +
"\n" +
(e.response && e.response.data && e.response.data.errorDtl
? JSON.stringify(e.response.data.errorDtl, null, 2)
: undefined)
"CodeNarcServer unexpected error:\n" + JSON.stringify(e, null, 2) + "\n" + JSON.stringify(e.response?.data?.errorDtl, null, 2)
)

@@ -132,3 +133,3 @@ );

stack: e.stack,
responseData: e.response && e.response.data && e.response.data.errorDtl ? e.response.data.errorDtl : undefined
responseData: e.response?.data?.errorDtl
}

@@ -168,3 +169,3 @@ };

error: {
msg: `CodeNarc exception: ${response.data.exceptionType} message: ${response.data.errorMessage}`,
msg: `exception: ${response.data.exceptionType} message: ${response.data.errorMessage}`,
msgDtl: {

@@ -182,4 +183,16 @@ parseErrors: response.data.parseErrors,

// Build java codenarc command (request to launch server for next call except if --noserver is sent)
const scriptArgs = this.codenarcArgs;
const scriptArgs = [...this.codenarcArgs]; // Take a copy of the args so we can modify it.
if (this.options.parse !== false && this.execOpts.onlyCodeNarc === false) {
scriptArgs.unshift("--parse");
}
if (this.execOpts.groovyFileName) {
scriptArgs.unshift("--file", this.execOpts.groovyFileName);
} else if (this.execOpts.inputFileList) {
this.execOpts.inputFileList.forEach(file => {
scriptArgs.unshift("--file", file);
});
}
// Start progress bar

@@ -249,4 +262,7 @@ trace(`CALL CodeNarcJava with ${scriptArgs.join(" ")}`);

const response = await this.getCodeNarcServerJson(javaResult.stdout);
return {
codeNarcJsonResult: await this.getCodeNarcJsonResult(javaResult.stdout),
codeNarcJsonResult: response.jsonResult,
fileList: response.fileList,
parseErrors: response.parseErrors,
codeNarcStdOut: javaResult.stdout,

@@ -422,15 +438,15 @@ codeNarcStdErr: javaResult.stderr,

// Retrieve JSON result in CodeNarc stdout
async getCodeNarcJsonResult(response) {
const stdout = typeof response === "string" ? response : response && response.data && response.data.stdout ? response.data.stdout : null;
if (stdout) {
const outputLineLs = await getSourceLines(stdout);
const jsonLine = outputLineLs[1] && outputLineLs[1].startsWith("{") ? outputLineLs[1] : outputLineLs[0];
try {
return JSON.parse(jsonLine);
} catch (e) {
return { err: "Unable to parse " + stdout };
}
/**
* Parse JSON result from CodeNarcServer.
*
* @param {string} response the response from CodeNarcServer
* @returns {Promise<*>}
* @private
*/
async getCodeNarcServerJson(response) {
try {
return JSON.parse(response);
} catch (e) {
return { err: `Unable to parse ${response}` };
}
return {};
}

@@ -437,0 +453,0 @@ }

{
"name": "npm-groovy-lint",
"version": "14.0.1",
"version": "14.1.1-beta202401152058.0",
"description": "Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle files",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc