bpmnlint 11.4.0 → 11.4.2

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/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.4.0",
4
+ "version": "11.4.2",
5
5
  "main": "lib/index.js",
6
6
  "keywords": [
7
7
  "bpmnlint",
@@ -28,7 +28,7 @@ module.exports = function() {
28
28
  if (!isAny(node, [
29
29
  'bpmn:Process',
30
30
  'bpmn:SubProcess'
31
- ])) {
31
+ ]) || is(node, 'bpmn:AdHocSubProcess')) {
32
32
  return;
33
33
  }
34
34
 
@@ -35,12 +35,12 @@ module.exports = function() {
35
35
  const links = (node.flowElements || []).filter(isLinkEvent);
36
36
 
37
37
  for (const link of links) {
38
- if (!link.name) {
39
- reporter.report(link.id, 'Link event is missing name');
38
+ if (!getLinkName(link)) {
39
+ reporter.report(link.id, 'Link event is missing link name');
40
40
  }
41
41
  }
42
42
 
43
- const names = groupBy(links, (link) => link.name);
43
+ const names = groupBy(links, link => getLinkName(link));
44
44
 
45
45
  for (const [ name, events ] of Object.entries(names)) {
46
46
 
@@ -53,22 +53,20 @@ module.exports = function() {
53
53
  if (events.length === 1) {
54
54
  const event = events[0];
55
55
 
56
- reporter.report(event.id, `Link ${isThrowEvent(event) ? 'catch' : 'throw' } event with name <${ name }> missing in scope`);
57
- }
58
-
59
- const throwEvents = events.filter(isThrowEvent);
60
-
61
- if (throwEvents.length > 1) {
62
- for (const event of throwEvents) {
63
- reporter.report(event.id, `Duplicate link throw event with name <${name}> in scope`);
64
- }
56
+ reporter.report(event.id, `Link ${isThrowEvent(event) ? 'catch' : 'throw' } event with link name <${ name }> missing in scope`);
57
+ continue;
65
58
  }
66
59
 
67
60
  const catchEvents = events.filter(isCatchEvent);
68
-
69
61
  if (catchEvents.length > 1) {
70
62
  for (const event of catchEvents) {
71
- reporter.report(event.id, `Duplicate link catch event with name <${name}> in scope`);
63
+ reporter.report(event.id, `Duplicate link catch event with link name <${name}> in scope`);
64
+ }
65
+ } else if (catchEvents.length === 0) {
66
+
67
+ // all events in scope are throw events
68
+ for (const event of events) {
69
+ reporter.report(event.id, `Link catch event with link name <${ name }> missing in scope`);
72
70
  }
73
71
  }
74
72
  }
@@ -96,6 +94,10 @@ function isLinkEvent(node) {
96
94
  );
97
95
  }
98
96
 
97
+ function getLinkName(linkEvent) {
98
+ return linkEvent.get('eventDefinitions').find(def => is(def, 'bpmn:LinkEventDefinition')).name;
99
+ }
100
+
99
101
  function isThrowEvent(node) {
100
102
  return is(node, 'bpmn:ThrowEvent');
101
103
  }
@@ -28,7 +28,7 @@ module.exports = function() {
28
28
  if (!isAny(node, [
29
29
  'bpmn:Process',
30
30
  'bpmn:SubProcess'
31
- ])) {
31
+ ]) || is(node, 'bpmn:AdHocSubProcess')) {
32
32
  return;
33
33
  }
34
34