bpmnlint-plugin-camunda-compat 0.15.0 → 0.15.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmnlint-plugin-camunda-compat",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "A bpmnlint plug-in for Camunda Platform compatibility",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -11,27 +11,52 @@ module.exports = function() {
11
11
  }
12
12
 
13
13
  const rootElements = node.get('rootElements'),
14
+ collaboration = rootElements.find(rootElement => is(rootElement, 'bpmn:Collaboration')),
14
15
  processes = rootElements.filter(rootElement => is(rootElement, 'bpmn:Process'));
15
16
 
16
17
  let errors = [];
17
18
 
18
19
  for (const process of processes) {
20
+ const parentNode = getParentNode(process, collaboration);
21
+
19
22
  errors = [
20
23
  ...errors,
21
24
  ...hasProperties(process, {
22
25
  isExecutable: {
23
26
  value: true
24
27
  }
25
- }, process)
28
+ }, parentNode)
26
29
  ];
27
30
  }
28
31
 
29
32
  if (errors.length > processes.length - 1) {
30
- reportErrors(errors[ 0 ].data.node, reporter, errors[ 0 ]);
33
+ errors.forEach(error => {
34
+ const { data } = error;
35
+
36
+ const { node: process } = data;
37
+
38
+ reportErrors(getParentNode(process, collaboration), reporter, error);
39
+ });
31
40
  }
32
41
  }
33
42
 
34
43
  return {
35
44
  check
36
45
  };
37
- };
46
+ };
47
+
48
+ function getParentNode(process, collaboration) {
49
+ if (!collaboration) {
50
+ return process;
51
+ }
52
+
53
+ const participants = collaboration.get('participants');
54
+
55
+ const participant = participants.find(participant => participant.get('processRef') === process);
56
+
57
+ if (participant) {
58
+ return participant;
59
+ }
60
+
61
+ return process;
62
+ }