bpmnlint 7.4.0 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +3 -1
- package/bin/bpmnlint.js +14 -2
- package/lib/test-rule.js +14 -2
- package/lib/testers/rule-tester.js +9 -5
- package/package.json +11 -10
- package/rules/conditional-flows.js +1 -1
- package/rules/event-sub-process-typed-start-event.js +1 -1
- package/rules/label-required.js +1 -1
- package/rules/single-event-definition.js +1 -1
- package/rules/sub-process-blank-start-event.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@ All notable changes to [bpmnlint](https://github.com/bpmn-io/bpmnlint) are docum
|
|
|
6
6
|
|
|
7
7
|
___Note:__ Yet to be released changes appear here._
|
|
8
8
|
|
|
9
|
+
## 7.5.0
|
|
10
|
+
|
|
11
|
+
* `FEAT`: add optional `path` parameter to `Reporter#report` ([#73](https://github.com/bpmn-io/bpmnlint/pull/73))
|
|
12
|
+
* `FEAT`: add optional `name` parameter to `RuleTester#verify` ([#68](https://github.com/bpmn-io/bpmnlint/pull/68))
|
|
13
|
+
* `CHORE`: update to `bpmn-moddle@7.1.2`
|
|
14
|
+
|
|
9
15
|
## 7.4.0
|
|
10
16
|
|
|
11
17
|
* `FEAT`: resolve local package by name ([#64](https://github.com/bpmn-io/bpmnlint/pull/64))
|
package/README.md
CHANGED
|
@@ -73,7 +73,9 @@ To try out visual validation, checkout the [bpmnlint playground](https://github.
|
|
|
73
73
|
|
|
74
74
|
Use the [bpmnlint playground](https://github.com/bpmn-io/bpmnlint-playground) to implement new rules with quick visual feedback.
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
Create your first plug-in using the [plugin creator](https://github.com/nikku/create-bpmnlint-plugin).
|
|
77
|
+
|
|
78
|
+
Checkout the [bpmnlint-plugin-example](https://github.com/bpmn-io/bpmnlint-plugin-example) for details on how to define, test, and consume custom lint rules.
|
|
77
79
|
|
|
78
80
|
|
|
79
81
|
## License
|
package/bin/bpmnlint.js
CHANGED
|
@@ -28,6 +28,8 @@ const Table = require('cli-table');
|
|
|
28
28
|
|
|
29
29
|
const pluralize = require('pluralize');
|
|
30
30
|
|
|
31
|
+
const { pathStringify } = require('@philippfromme/moddle-helpers');
|
|
32
|
+
|
|
31
33
|
const CONFIG_NAME = '.bpmnlintrc';
|
|
32
34
|
|
|
33
35
|
const DEFAULT_CONFIG_CONTENTS = `{
|
|
@@ -107,11 +109,21 @@ const categoryMap = {
|
|
|
107
109
|
* Logs a formatted message
|
|
108
110
|
*/
|
|
109
111
|
function tableEntry(report) {
|
|
110
|
-
|
|
112
|
+
let {
|
|
113
|
+
category,
|
|
114
|
+
id = '',
|
|
115
|
+
message,
|
|
116
|
+
name = '',
|
|
117
|
+
path
|
|
118
|
+
} = report;
|
|
119
|
+
|
|
120
|
+
if (path) {
|
|
121
|
+
id = `${ id }#${ pathStringify(path) }`;
|
|
122
|
+
}
|
|
111
123
|
|
|
112
124
|
const color = category === 'error' ? red : yellow;
|
|
113
125
|
|
|
114
|
-
return [
|
|
126
|
+
return [ id, color(categoryMap[ category ] || category), message, name ];
|
|
115
127
|
}
|
|
116
128
|
|
|
117
129
|
function createTable() {
|
package/lib/test-rule.js
CHANGED
|
@@ -8,8 +8,20 @@ class Reporter {
|
|
|
8
8
|
this.report = this.report.bind(this);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
report(id, message) {
|
|
12
|
-
|
|
11
|
+
report(id, message, path) {
|
|
12
|
+
let report = {
|
|
13
|
+
id,
|
|
14
|
+
message
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
if (path) {
|
|
18
|
+
report = {
|
|
19
|
+
...report,
|
|
20
|
+
path
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
this.messages.push(report);
|
|
13
25
|
}
|
|
14
26
|
}
|
|
15
27
|
|
|
@@ -33,9 +33,9 @@ function verify(ruleName, rule, testCases) {
|
|
|
33
33
|
|
|
34
34
|
describe('should lint valid', function() {
|
|
35
35
|
|
|
36
|
-
testCases.valid.forEach(({ moddleElement, it: _it }, idx) => (
|
|
36
|
+
testCases.valid.forEach(({ moddleElement, name, it: _it }, idx) => (
|
|
37
37
|
|
|
38
|
-
(_it || it)(
|
|
38
|
+
(_it || it)(getTitle(idx, name), function() {
|
|
39
39
|
return (
|
|
40
40
|
Promise.resolve(moddleElement)
|
|
41
41
|
.then(moddleRoot => {
|
|
@@ -54,9 +54,9 @@ function verify(ruleName, rule, testCases) {
|
|
|
54
54
|
|
|
55
55
|
describe('should lint invalid', function() {
|
|
56
56
|
|
|
57
|
-
testCases.invalid.forEach(({ moddleElement, report, it: _it }, idx) => (
|
|
57
|
+
testCases.invalid.forEach(({ moddleElement, name, report, it: _it }, idx) => (
|
|
58
58
|
|
|
59
|
-
(_it || it)(
|
|
59
|
+
(_it || it)(getTitle(idx, name), function() {
|
|
60
60
|
|
|
61
61
|
if (!Array.isArray(report)) {
|
|
62
62
|
report = [
|
|
@@ -94,7 +94,11 @@ function verify(ruleName, rule, testCases) {
|
|
|
94
94
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
function getTitle(idx, name) {
|
|
98
|
+
return `test case #${ idx + 1 }${ name ? ` ${ name }`: '' }`;
|
|
99
|
+
}
|
|
97
100
|
|
|
98
101
|
module.exports = {
|
|
99
|
-
verify
|
|
102
|
+
verify,
|
|
103
|
+
getTitle
|
|
100
104
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpmnlint",
|
|
3
3
|
"description": "Validate your BPMN diagrams based on configurable lint rules",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.5.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"bpmnlint",
|
|
@@ -37,24 +37,25 @@
|
|
|
37
37
|
"bpmnlint": "./bin/bpmnlint.js"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
+
"@philippfromme/moddle-helpers": "^0.1.0",
|
|
40
41
|
"ansi-colors": "^4.1.1",
|
|
41
|
-
"bpmn-moddle": "^7.
|
|
42
|
+
"bpmn-moddle": "^7.1.2",
|
|
42
43
|
"bpmnlint-utils": "^1.0.2",
|
|
43
|
-
"cli-table": "^0.3.
|
|
44
|
+
"cli-table": "^0.3.9",
|
|
44
45
|
"color-support": "^1.1.3",
|
|
45
|
-
"min-dash": "^3.
|
|
46
|
-
"mri": "^1.
|
|
46
|
+
"min-dash": "^3.8.0",
|
|
47
|
+
"mri": "^1.2.0",
|
|
47
48
|
"pluralize": "^7.0.0",
|
|
48
|
-
"tiny-glob": "^0.2.
|
|
49
|
+
"tiny-glob": "^0.2.9"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
|
-
"chai": "^4.
|
|
52
|
-
"eslint": "^7.
|
|
52
|
+
"chai": "^4.3.4",
|
|
53
|
+
"eslint": "^7.32.0",
|
|
53
54
|
"eslint-plugin-bpmn-io": "^0.11.0",
|
|
54
55
|
"esm": "^3.2.25",
|
|
55
|
-
"execa": "^2.0
|
|
56
|
+
"execa": "^2.1.0",
|
|
56
57
|
"install-local": "^1.0.0",
|
|
57
|
-
"mocha": "^8.
|
|
58
|
+
"mocha": "^8.4.0",
|
|
58
59
|
"npm-run-all": "^4.1.5",
|
|
59
60
|
"nyc": "^15.1.0",
|
|
60
61
|
"strip-indent": "^2.0.0"
|
|
@@ -25,7 +25,7 @@ module.exports = function() {
|
|
|
25
25
|
const eventDefinitions = flowElement.eventDefinitions || [];
|
|
26
26
|
|
|
27
27
|
if (eventDefinitions.length === 0) {
|
|
28
|
-
reporter.report(flowElement.id, 'Start event is missing event definition');
|
|
28
|
+
reporter.report(flowElement.id, 'Start event is missing event definition', [ 'eventDefinitions' ]);
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
}
|
package/rules/label-required.js
CHANGED
|
@@ -17,7 +17,7 @@ module.exports = function() {
|
|
|
17
17
|
const eventDefinitions = node.eventDefinitions || [];
|
|
18
18
|
|
|
19
19
|
if (eventDefinitions.length > 1) {
|
|
20
|
-
reporter.report(node.id, 'Event has multiple event definitions');
|
|
20
|
+
reporter.report(node.id, 'Event has multiple event definitions', [ 'eventDefinitions' ]);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -26,7 +26,7 @@ module.exports = function() {
|
|
|
26
26
|
const eventDefinitions = flowElement.eventDefinitions || [];
|
|
27
27
|
|
|
28
28
|
if (eventDefinitions.length > 0) {
|
|
29
|
-
reporter.report(flowElement.id, 'Start event must be blank');
|
|
29
|
+
reporter.report(flowElement.id, 'Start event must be blank', [ 'eventDefinitions' ]);
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
}
|