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 7.5.3 to 7.5.4

4

CHANGELOG.md
# Changelog
## [7.5.4] 2020-09-04
- Update frameworks detection
## [7.5.1] 2020-09-02

@@ -4,0 +8,0 @@

56

lib/analytics.js

@@ -10,2 +10,3 @@ const Amplitude = require("amplitude");

const AMPLITUDE_TOKEN = "2e52ce300e4bd3a76e97e27fe1bf31ad";
const STATS_VERSION = globalThis.NPM_GROOVY_LINT_TEST === true ? -1 : 2;

@@ -44,3 +45,4 @@ let amplitudeClient;

osRelease: os.release(),
ci: process.env.CI ? true : false // boolean
ci: process.env.CI ? true : false,
statsVersion: STATS_VERSION
};

@@ -201,5 +203,7 @@ // Status

fileStatEventProps.linesNumber = sourceLines.length;
fileStatEventProps.frameworks = listFileUsedFrameworks(file, source);
if (fileStatEventProps.frameworks.length > 0) {
fileStatEventProps.mainFramework = fileStatEventProps.frameworks[0];
fileStatEventProps.statsVersion = STATS_VERSION;
const { mainFrameworkKey, frameworkKeys } = listFileUsedFrameworks(file, source);
fileStatEventProps.frameworks = frameworkKeys;
if (mainFrameworkKey != null) {
fileStatEventProps.mainFramework = mainFrameworkKey;
}

@@ -214,3 +218,3 @@ for (const fwKey of fileStatEventProps.frameworks) {

{ name: "beakerx", priority: 3 }, // UNDEFINED
{ name: "codenarc", priority: 3, sourceIncludes: ["codenarc", "groovylint"] },
{ name: "codenarc", priority: 5, sourceIncludes: ["codenarc", "groovylint"] },
{ name: "dru", priority: 2, packages: ["com.agorapulse.dru"] },

@@ -220,16 +224,23 @@ { name: "ersatz", priority: 2, packages: ["com.stehno.ersatz"] },

{ name: "gaiden", priority: 3, packages: ["gaiden"] },
{ name: "gpars", priority: 2, packages: ["groovyx.gpars"] },
{ name: "gpars", priority: 5, packages: ["groovyx.gpars"] },
{ name: "geb", priority: 3, packages: ["geb"] },
{ name: "gperfutils", priority: 3, packages: ["groovyx.gbench", "groovyx.gprof"] },
{ name: "gperfutils", priority: 5, packages: ["groovyx.gbench", "groovyx.gprof"] },
{ name: "gradle", priority: 1, fileExtensions: [".gradle"] },
{ name: "grails", priority: 1, filePathIncludes: ["grails-app"] },
{ name: "grain", priority: 2, packages: ["com.sysgears"] },
{ name: "grapes", priority: 5, sourceIncludes: ["@Grab"] },
{ name: "griffon", priority: 2, sourceIncludes: ["griffon"] },
{ name: "groocss", priority: 2, packages: ["org.groocss"] },
{ name: "groovyant", priority: 5, packages: ["groovy.ant"] },
{ name: "groovymbean", priority: 5, sourceIncludes: ["GroovyMBean"] },
{ name: "groovysh", priority: 2, sourceIncludes: ["groovysh"] },
{ name: "groovysql", priority: 5, packages: ["groovy.sql"] },
{ name: "groovyswing", priority: 5, packages: ["groovy.swing"] },
{ name: "gru", priority: 2, packages: ["com.agorapulse.gru"] },
{ name: "httpbuilder", priority: 5, packages: ["groovyx.net.http"] },
{ name: "infrastructor", priority: 2, sourceIncludes: ["inlineInventory", "infrastructor"] },
{ name: "jenkinsjobdsl", priority: 1, sourceIncludes: ["job("] },
{ name: "jenkinspipeline", priority: 1, fileNameIncludes: ["Jenkinsfile"], sourceIncludes: ["pipeline {", "pipeline{"] },
{ name: "jenkinssharedlib", priority: 1, sourceIncludes: ["@NonCPS"] },
{ name: "jenkinsjobdsl", priority: 5, sourceIncludes: ["job("] },
{ name: "jenkinspipeline", priority: 5, fileNameIncludes: ["Jenkinsfile"], sourceIncludes: ["pipeline {", "pipeline{"] },
{ name: "jenkinssharedlib", priority: 5, sourceIncludes: ["@NonCPS"] },
{ name: "jenkins", priority: 1, frameworksUsesIncludes: ["jenkinsjobdsl", "jenkinspipeline", "jenkinssharedlib"] },
{ name: "jirascriptrunner", priority: 2, packages: ["com.atlassian.jira"] },

@@ -245,3 +256,3 @@ { name: "jmeter", priority: 2, packages: ["org.apache.jmeter"] },

{ name: "soapui", priority: 3 }, // UNDEFINED
{ name: "spock", priority: 2, packages: ["spock"] },
{ name: "spock", priority: 3, packages: ["spock"] },
{ name: "spreadsheetbuilder", priority: 2, packages: ["org.modelcatalogue.spreadsheet"] },

@@ -256,7 +267,9 @@ { name: "springboot", priority: 1, sourceIncludes: ["@SpringBootApplication"] },

const frameworksUsed = [];
const unorderedFrameworkKeys = [];
const fileBaseName = path.basename(file);
const fileExtname = path.extname(file);
for (const frameworkDef of frameworkDefs) {
if (isUsedFramework(frameworkDef, file, source, fileExtname, fileBaseName)) {
if (isUsedFramework(frameworkDef, file, source, fileExtname, fileBaseName, unorderedFrameworkKeys)) {
frameworksUsed.push(frameworkDef);
unorderedFrameworkKeys.push(frameworkDef.name);
}

@@ -266,8 +279,14 @@ }

frameworksUsed.sort((a, b) => a.priority - b.priority);
// Calculate main framework
let mainFrameworkKey = null;
const validMainFrameworks = frameworksUsed.filter(frameworkDef => frameworkDef.priority <= 3);
if (validMainFrameworks[0]) {
mainFrameworkKey = validMainFrameworks[0].name;
}
// Only return keys
const frameworkKeys = frameworksUsed.map(frameworkDef => frameworkDef.name);
return frameworkKeys;
return { mainFrameworkKey, frameworkKeys };
}
function isUsedFramework(frameworkDef, file, source, fileExtname, fileBaseName) {
function isUsedFramework(frameworkDef, file, source, fileExtname, fileBaseName, frameworksUsed) {
// Check file extension

@@ -281,2 +300,11 @@ if (frameworkDef.fileExtensions) {

}
// Check if another framework has been detected
if (frameworkDef.frameworksUsesIncludes) {
for (const fwKey of frameworkDef.frameworksUsesIncludes) {
if (frameworksUsed.includes(fwKey)) {
return true;
}
}
}
// Check use of package

@@ -283,0 +311,0 @@ if (frameworkDef.packages) {

@@ -15,3 +15,3 @@ #! /usr/bin/env node

globalThis.NPM_JAVA_CALLER_IS_INITIALIZED = false;
globalThis.NPM_GROOVY_LINT_TEST = true;
/*

@@ -18,0 +18,0 @@ // Kill server if already running

@@ -152,3 +152,2 @@ #! /usr/bin/env node

path: "./lib/example/",
files: "**/" + SAMPLE_FILE_SMALL,
returnrules: true,

@@ -162,13 +161,2 @@ output: "txt"

it("(API:source) send anonymous usage statistics (2)", async () => {
const npmGroovyLintConfig = {
path: "./lib/example/grails-app",
returnrules: true,
output: "txt"
};
const linter = await new NpmGroovyLint(npmGroovyLintConfig, {}).run();
assert(linter.status === 0, `Linter status is 0 (${linter.status} returned)`);
assert(linter.startElapse != null, "Anonymous stats has not been sent");
});
it("(API:source) should use a CodeNarc ruleset defined in groovylintrc.json", async () => {

@@ -175,0 +163,0 @@ const npmGroovyLintConfig = {

{
"name": "npm-groovy-lint",
"version": "7.5.3",
"version": "7.5.4",
"description": "Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle files",

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

@@ -69,3 +69,3 @@ <!-- markdownlint-disable MD033 -->

| --javaoptions | String | Override java options to use <br/>Default: "-Xms256m,-Xmx2048m" |
| --no-insight | Boolean | npm-groovy-lint collects anonymous usage statistics using [analytics](https://www.npmjs.com/package/analytics) & [@analytics-segment](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-segment), in order to make new improvements based on how users use this package. Analytics obviously does not receive sensitive information like your code, as you can see in [analytics.js](https://github.com/nvuillam/npm-groovy-lint/blob/master/src/analytics.js). If you want to disable anonymous usage statistics, use `--no-insight` option. |
| --no-insight | Boolean | npm-groovy-lint collects anonymous usage statistics using [amplitude](https://www.npmjs.com/package/amplitude), in order to make new improvements based on how users use this package. <br/> Summary charts are available at [https://tinyurl.com/groovy-stats](https://tinyurl.com/groovy-stats).<br/> Analytics obviously does not receive sensitive information like your code, as you can see in [analytics.js](https://github.com/nvuillam/npm-groovy-lint/blob/master/lib/analytics.js).<br/> If you want to disable anonymous usage statistics, use `--no-insight` option. |
| --codenarcargs | String | Use core CodeNarc arguments (all npm-groovy-lint arguments will be ignored)<br/> Doc: <http://codenarc.github.io/CodeNarc/codenarc-command-line.html><br/> Example: `npm-groovy-lint --codenarcargs -basedir="lib/example" -rulesetfiles="file:lib/example/RuleSet-Groovy.groovy" -maxPriority1Violations=0 -report="xml:ReportTestCodenarc.xml` |

@@ -401,2 +401,6 @@ | -h<br/> --help | Boolean | Show help (npm-groovy-lint -h OPTIONNAME to see option detail with examples) |

### [7.5.4] 2020-09-04
- Update frameworks detection
### [7.5.1] 2020-09-02

@@ -403,0 +407,0 @@

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