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 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
@@ -2,6 +2,7 @@ const allRules = [
2
2
  'ad-hoc-sub-process',
3
3
  'conditional-flows',
4
4
  'end-event-required',
5
+ 'event-based-gateway',
5
6
  'event-sub-process-typed-start-event',
6
7
  'fake-join',
7
8
  'global',
@@ -1,6 +1,7 @@
1
1
  module.exports = {
2
2
  rules: {
3
3
  'ad-hoc-sub-process': 'error',
4
+ 'event-based-gateway': 'error',
4
5
  'event-sub-process-typed-start-event': 'error',
5
6
  'link-event': 'error',
6
7
  'no-duplicate-sequence-flows': 'warn',
@@ -3,6 +3,7 @@ module.exports = {
3
3
  'ad-hoc-sub-process': 'error',
4
4
  'conditional-flows': 'error',
5
5
  'end-event-required': 'error',
6
+ 'event-based-gateway': 'error',
6
7
  'event-sub-process-typed-start-event': 'error',
7
8
  'fake-join': 'warn',
8
9
  'global': 'warn',
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": "11.6.0",
4
+ "version": "11.7.0",
5
5
  "main": "lib/index.js",
6
6
  "keywords": [
7
7
  "bpmnlint",
@@ -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
+ }
@@ -29,7 +29,7 @@ module.exports = function() {
29
29
  }
30
30
  }
31
31
 
32
- return annotateRule('no-gateway-fork-join', {
32
+ return annotateRule('no-gateway-join-fork', {
33
33
  check
34
34
  });
35
35