Socket
Socket
Sign inDemoInstall

bpmnlint

Package Overview
Dependencies
3
Maintainers
3
Versions
60
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 2.0.0

lib/index.js

37

bin/bpmnlint.js

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

const { red, yellow, underline } = require('chalk');
const BpmnModdle = require('bpmn-moddle');

@@ -12,8 +11,10 @@ const { promisify } = require('util');

const readFile = promisify(fs.readFile);
const BpmnModdle = require('bpmn-moddle');
const Linter = require('../lib/linter');
const NodeResolver = require('../lib/resolver/node-resolver');
const moddle = new BpmnModdle();
const nodeResolver = require('../lib/resolver/nodeResolver');
/**

@@ -108,3 +109,2 @@ * Reads XML form path and return moddle object

const { config: configFlag } = cli.flags;

@@ -143,3 +143,3 @@ if (cli.input.length !== 1) {

const linter = new Linter({
resolver: nodeResolver
resolver: new NodeResolver()
});

@@ -155,18 +155,15 @@

if (configFlag) {
fs.readFile(configFlag, 'utf-8', (error, config) => {
if (error) {
return logAndExit('Error: Could not read specified config file', error);
}
const { config } = cli.flags;
handleConfig(config);
});
} else {
fs.readFile(path.resolve('.bpmnlintrc'), 'utf-8', (error, config) => {
if (error) {
return logAndExit('Error: Configuration file missing', error);
}
const configPath = config || '.bpmnlintrc';
handleConfig(config);
});
}
readFile(configPath, 'utf-8').then(handleConfig, (error) => {
const message = (
config
? `Error: Could not read ${ config }`
: 'Error: Could not locate configuration'
);
logAndExit(message, error);
}).catch(logAndExit);
# Changelog
All notable changes to [bpmn-js](https://github.com/bpmn-io/bpmnlinter) are documented here. We use [semantic versioning](http://semver.org/) for releases.
All notable changes to [bpmnlint](https://github.com/bpmn-io/bpmnlint) are documented here. We use [semantic versioning](http://semver.org/) for releases.

@@ -9,2 +9,17 @@ ## Unreleased

## 2.0.0
#### Breaking Changes
* `CHORE`: make `NodeResolver` a constructor
* `CHORE`: unify file names to `dashed-case`
* `CHORE`: rework `Resolver` APIs
#### Other Enhancements
* `FEAT`: add `StaticResolver` to load cached resources
* `FEAT`: add `{ Linter }` as a library export
* `CHORE`: move rule and config name resolution to linter
* `CHORE`: catch all cli errors and exit accordingly
## 1.0.0

@@ -27,3 +42,3 @@

__Initial stable release.__
_Initial stable release._

@@ -41,2 +56,2 @@ * `FEAT`: configure, resolve and execute local and external rules

Check `git log` for earlier history.
Check `git log` for earlier history.

@@ -1,2 +0,2 @@

const testRule = require('./testRule');
const testRule = require('./test-rule');
const utils = require('./utils');

@@ -52,4 +52,11 @@

const rule = this.cachedRules[name];
const {
pkg,
ruleName
} = this.parseRuleName(name);
const id = `${pkg}-${ruleName}`;
const rule = this.cachedRules[id];
if (rule) {

@@ -59,3 +66,3 @@ return Promise.resolve(rule);

return Promise.resolve(this.resolver.resolveRule(name)).then((ruleFactory) => {
return Promise.resolve(this.resolver.resolveRule(pkg, ruleName)).then((ruleFactory) => {

@@ -66,3 +73,3 @@ if (!ruleFactory) {

const rule = this.cachedRules[name] = ruleFactory(utils);
const rule = this.cachedRules[id] = ruleFactory(utils);

@@ -75,4 +82,11 @@ return rule;

const config = this.cachedConfigs[name];
const {
pkg,
configName
} = this.parseConfigName(name);
const id = `${pkg}-${configName}`;
const config = this.cachedConfigs[id];
if (config) {

@@ -82,3 +96,3 @@ return Promise.resolve(config);

return Promise.resolve(this.resolver.resolveConfig(name)).then((config) => {
return Promise.resolve(this.resolver.resolveConfig(pkg, configName)).then((config) => {

@@ -89,3 +103,3 @@ if (!config) {

const actualConfig = this.cachedConfigs[name] = prefix(config, name);
const actualConfig = this.cachedConfigs[id] = prefix(config, name);

@@ -224,3 +238,55 @@ return actualConfig;

Linter.prototype.parseRuleName = function(name) {
const slashIdx = name.indexOf('/');
// resolve rule as built-in, if unprefixed
if (slashIdx === -1) {
return {
pkg: 'bpmnlint',
ruleName: name
};
}
const pkg = name.substring(0, slashIdx);
const ruleName = name.substring(slashIdx + 1);
if (pkg === 'bpmnlint') {
return {
pkg: 'bpmnlint',
ruleName
};
} else {
return {
pkg: 'bpmnlint-plugin-' + pkg,
ruleName
};
}
};
Linter.prototype.parseConfigName = function(name) {
const localMatch = /^bpmnlint:(.*)$/.exec(name);
if (localMatch) {
return {
pkg: 'bpmnlint',
configName: localMatch[1]
};
}
const pluginMatch = /^plugin:([^/]+)\/(.+)$/.exec(name);
if (!pluginMatch) {
throw new Error(`invalid config name <${ name }>`);
}
return {
pkg: 'bpmnlint-plugin-' + pluginMatch[1],
configName: pluginMatch[2]
};
};
// helpers ///////////////////////////

@@ -227,0 +293,0 @@

{
"name": "bpmnlint",
"version": "1.0.1",
"main": "index.js",
"version": "2.0.0",
"main": "lib/index.js",
"keywords": [

@@ -6,0 +6,0 @@ "bpmnlint",

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc