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 11.1.2-beta202310271757.0 to 11.1.2-beta202311021422.0

lib/java/groovy/lib/groovy-dateutil-3.0.9.jar

63

lib/codenarc-caller.js

@@ -35,4 +35,4 @@ // Call CodeNarc by server or java

codeNarcServer: {
minimumJavaVersion: 8,
maximumJavaVersion: 14,
minimumJavaVersion: 17,
maximumJavaVersion: 17,
rootPath: __dirname,

@@ -42,4 +42,4 @@ jar: "java/CodeNarcServer.jar"

codeNarcJava: {
minimumJavaVersion: 8,
maximumJavaVersion: 14,
minimumJavaVersion: 17,
maximumJavaVersion: 17,
rootPath: __dirname,

@@ -113,2 +113,10 @@ jar: "java/CodeNarcServer.jar"

else if (e.code && e.code === "ECONNRESET") {
// The server was shutdown just retry.
if (startServerTried === false && (await this.startCodeNarcServer()) && this.serverStatus === "running") {
return await this.callCodeNarcServer(true);
}
// Should this really be cancelled, as the Groovy says it should return:
// respObj.status = 'cancelledByDuplicateRequest'
// respObj.statusCode = 444
return {

@@ -261,3 +269,3 @@ status: 9

this.serverStatus = "unknown";
const maxAttemptTimeMs = 20000;
const maxAttemptTimeMs = 10000;
const scriptArgs = ["--server"];

@@ -273,6 +281,11 @@ const serverPingUri = this.getCodeNarcServerUri() + "/ping";

const javaCaller = new JavaCaller(javaCallerOpts);
const javaCallRes = await javaCaller.run(scriptArgs, { detached: true, waitForErrorMs: 500 });
const javaResult = await javaCaller.run(scriptArgs, { detached: true, waitForErrorMs: 500 });
if ([666, 1].includes(javaCallRes.status)) {
console.error(c.red(`Unable to start CodeNarc server: ${JSON.stringify(javaCallRes)}`));
// Store the process so we can stop it later.
this.codeNarcProcess = javaResult.childJavaProcess;
trace(`javaResult: ${JSON.stringify(javaResult)}`);
if ([666, 1].includes(javaResult.status)) {
console.error(c.red(`Unable to start CodeNarc server: ${JSON.stringify(javaResult)}`));
console.error(c.grey(JSON.stringify(scriptArgs)));

@@ -283,5 +296,2 @@ this.serverStatus = "error";

// Store the process so we can stop it later.
this.codeNarcProcess = javaCallRes.childJavaProcess;
// Poll it until it is ready

@@ -334,5 +344,4 @@ const start = performance.now();

return true;
} else {
return false;
}
return false;
}

@@ -374,5 +383,5 @@

// Process kill wasn't possible, so try sending a kill http request.
const serverUri = this.getCodeNarcServerUri() + "/kill";
const killUri = this.getCodeNarcServerUri() + "/kill";
try {
const response = await axios.post(serverUri, { timeout: 5000 });
const response = await axios.post(killUri, { timeout: 1000 });
if (response.data.status === "killed") {

@@ -392,2 +401,26 @@ outputString = "CodeNarcServer terminated";

}
// Wait for the server to stop otherwise when we try to start it
// again it it's likely to fail due to an port in use error.
const serverPingUri = this.getCodeNarcServerUri() + "/ping";
let interval;
await new Promise(resolve => {
interval = setInterval(() => {
debug(`pinging CodeNarcServer at ${serverPingUri} serverStatus: ${this.serverStatus}`);
axios
.get(serverPingUri)
.then(response => {
debug(`ping response: ${response.status}`);
})
.catch(e => {
debug(`Ping code: ${e.code} message: ${e.message}`);
clearInterval(interval);
resolve();
});
}, 400);
});
trace(`killCodeNarcServer: ${outputString}`);
return outputString;

@@ -394,0 +427,0 @@ }

@@ -120,2 +120,5 @@ // Imports

async preProcess() {
// Reset status so we don't get stale results.
this.status = 0;
// Manage when the user wants to use only codenarc args

@@ -371,2 +374,3 @@ if (Array.isArray(this.args) && this.args.includes("--codenarcargs")) {

this.lintResult = this.mergeResults(this.lintResult, newLinter.lintResult);
this.status = newLinter.status;
}

@@ -494,5 +498,5 @@

const errorNb = this.lintResult.summary.totalFoundErrorNumber;
const warningNb = this.lintResult.summary.totalFoundWarningNumber;
const infoNb = this.lintResult.summary.totalFoundInfoNumber;
const errorNb = this.lintResult.summary.totalRemainingErrorNumber;
const warningNb = this.lintResult.summary.totalRemainingWarningNumber;
const infoNb = this.lintResult.summary.totalRemainingInfoNumber;

@@ -502,3 +506,3 @@ // Fail on error

if (!["json", "sarif", "stdout"].includes(this.outputType)) {
console.error(`Failure: ${this.lintResult.summary.totalFoundErrorNumber} error(s) have been found`);
console.error(`Failure summary: ${JSON.stringify(this.lintResult.summary, null, 2)}`);
}

@@ -510,5 +514,3 @@ this.status = 1;

if (!["json", "sarif", "stdout"].includes(this.outputType)) {
console.error(
`Failure: ${this.lintResult.summary.totalFoundErrorNumber} error(s) have been found \n ${this.lintResult.summary.totalFoundWarningNumber} warning(s) have been found`
);
console.error(`Failure summary: ${JSON.stringify(this.lintResult.summary, null, 2)}`);
}

@@ -520,5 +522,3 @@ this.status = 1;

if (!["json", "sarif", "stdout"].includes(this.outputType)) {
console.error(
`Failure: ${this.lintResult.summary.totalFoundErrorNumber} error(s) have been found \n ${this.lintResult.summary.totalFoundWarningNumber} warning(s) have been found \n ${this.lintResult.summary.totalFoundInfoNumber} info(s) have been found`
);
console.error(`Failure summary: ${JSON.stringify(this.lintResult.summary, null, 2)}`);
}

@@ -525,0 +525,0 @@ this.status = 1;

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

@@ -8,11 +8,11 @@ "main": "index.js",

"lint:fix": "eslint **/*.js --fix && prettier --write \"./lib/**/*.{js,jsx}\" --tab-width 4 --print-width 150",
"server:run-from-source": "npm run dev:kill-server && groovy -cp \"lib/java/*\" groovy/src/main/com/nvuillam/CodeNarcServer.groovy --server",
"server:run": "npm run dev:kill-server && java -Xms256m -Xmx2048m -jar lib/java/CodeNarcServer.jar --server",
"server:run-from-source": "npm run server:kill && groovy -cp \"lib/java/*\" groovy/src/main/com/nvuillam/CodeNarcServer.groovy --server",
"server:run": "npm run server:kill && java -Xms256m -Xmx2048m -jar lib/java/CodeNarcServer.jar --server",
"server:build": "node scripts/build-server.js",
"test": "npm run dev:kill-server && mocha \"test/**/*.test.js\"",
"server:kill": "npm-groovy-lint --killserver",
"test": "npm run server:kill && mocha \"test/**/*.test.js\"",
"test:coverage": "nyc npm run test",
"test:debug": "npm run dev:kill-server && mocha --reporter spec --inspect-brk \"test/**/*.test.js\"",
"test:debug": "npm run server:kill && mocha --reporter spec --inspect-brk \"test/**/*.test.js\"",
"build": "node scripts/build-config-all.js && cp -f README.md docs/index.md && cp -f CHANGELOG.md docs/CHANGELOG.md",
"dev:kill-server": "npm-groovy-lint --killserver",
"dev:lint-install-local": "npm run dev:kill-server && npm run lint:fix && npm link --force",
"dev:lint-install-local": "npm run server:kill && npm run lint:fix && npm link --force",
"dev:lint-install-local-copy-vscode": "npm run dev:lint-install-local && node scripts/deploy-in-vscode.js",

@@ -19,0 +19,0 @@ "dev:pre-commit": "npm-run-all lint:fix build server:build"

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