bpmnlint 11.6.0 → 11.7.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/README.md +21 -0
- package/config/all.js +1 -0
- package/config/correctness.js +1 -0
- package/config/recommended.js +1 -0
- package/package.json +1 -1
- package/rules/ad-hoc-sub-process.js +0 -7
- package/rules/event-based-gateway.js +45 -0
- package/rules/no-gateway-join-fork.js +1 -1
package/README.md
CHANGED
|
@@ -75,12 +75,33 @@ You may also extend from multiple configurations, including those provided by [c
|
|
|
75
75
|
|
|
76
76
|
This will amend core `recommended` rules with `recommended` rulesets provided by `bpmnlint-plugin-foo` and `@bar/bpmnlint-plugin-bar`, respectively.
|
|
77
77
|
|
|
78
|
+
Plug-ins will be resolved relative to the configuration file location, using [node module resolution](https://nodejs.org/api/modules.html#loading-from-node_modules-folders).
|
|
79
|
+
|
|
80
|
+
|
|
78
81
|
### Available Configurations
|
|
79
82
|
|
|
80
83
|
* [`bpmnlint:all`](./config/all.js) - all rules as errors
|
|
81
84
|
* [`bpmnlint:recommended`](./config/recommended.js) - opinionated rules ("best practices") and rules enforcing BPMN compliance
|
|
82
85
|
* [`bpmnlint:correctness`](./config/correctness.js) - rules enforcing BPMN compliance
|
|
83
86
|
|
|
87
|
+
### Moddle extensions
|
|
88
|
+
|
|
89
|
+
To validate your diagrams with custom [moddle](https://github.com/bpmn-io/moddle) extensions, add `moddleExtensions` to the root configuration file:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"extends": [
|
|
94
|
+
"bpmnlint:recommended",
|
|
95
|
+
"plugin:custom/recommended"
|
|
96
|
+
],
|
|
97
|
+
"moddleExtensions": {
|
|
98
|
+
"custom": "custom-bpmn-moddle/resources/custom.json"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The extension will be resolved relative to the configuration file location, using [node module resolution](https://nodejs.org/api/modules.html#loading-from-node_modules-folders).
|
|
104
|
+
|
|
84
105
|
## API
|
|
85
106
|
|
|
86
107
|
Invoke the tool directly from [NodeJS](https://nodejs.org/en):
|
package/config/all.js
CHANGED
package/config/correctness.js
CHANGED
package/config/recommended.js
CHANGED
package/package.json
CHANGED
|
@@ -34,13 +34,6 @@ module.exports = function() {
|
|
|
34
34
|
if (is(flowElement, 'bpmn:EndEvent')) {
|
|
35
35
|
reporter.report(flowElement.id, 'An <End Event> is not allowed in <Ad Hoc Sub Process>');
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
if (is(flowElement, 'bpmn:IntermediateCatchEvent')) {
|
|
39
|
-
if (!flowElement.outgoing || flowElement.outgoing.length === 0) {
|
|
40
|
-
reporter.report(flowElement.id, 'An intermediate catch event inside <Ad Hoc Sub Process> must have an outgoing sequence flow');
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
37
|
});
|
|
45
38
|
}
|
|
46
39
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const {
|
|
2
|
+
is
|
|
3
|
+
} = require('bpmnlint-utils');
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
annotateRule
|
|
7
|
+
} = require('./helper');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A rule that checks, whether an event-based gateway:
|
|
12
|
+
* - has at least two outgoing sequence flows
|
|
13
|
+
* - the outgoing sequence flows are not conditional
|
|
14
|
+
*
|
|
15
|
+
* @type { import('../lib/types.js').RuleFactory }
|
|
16
|
+
*/
|
|
17
|
+
module.exports = function() {
|
|
18
|
+
|
|
19
|
+
function check(node, reporter) {
|
|
20
|
+
|
|
21
|
+
if (!is(node, 'bpmn:EventBasedGateway')) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const outgoing = node.outgoing || [];
|
|
26
|
+
|
|
27
|
+
if (outgoing.length < 2) {
|
|
28
|
+
reporter.report(node.id, 'An <Event-based Gateway> must have at least 2 outgoing <Sequence Flow>');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
outgoing.forEach((flow) => {
|
|
32
|
+
if (hasCondition(flow)) {
|
|
33
|
+
reporter.report(flow.id, 'A <Sequence Flow> outgoing from an <Event-based Gateway> must not be conditional');
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return annotateRule('event-based-gateway', {
|
|
39
|
+
check
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
function hasCondition(flow) {
|
|
44
|
+
return !!flow.conditionExpression;
|
|
45
|
+
}
|