bpmnlint-plugin-camunda-compat 0.1.1 → 0.4.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 CHANGED
@@ -1,15 +1,34 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to [bpmnlint-plugin-example](https://github.com/camunda/bpmnlint-plugin-camunda-compat) are documented here. We use [semantic versioning](http://semver.org/) for releases.
3
+ All notable changes to [bpmnlint-plugin-camunda-compat](https://github.com/camunda/bpmnlint-plugin-camunda-compat) are documented here. We use [semantic versioning](http://semver.org/) for releases.
4
4
 
5
5
  ## Unreleased
6
6
 
7
7
  ___Note:__ Yet to be released changes appear here._
8
8
 
9
- ## 0.0.1
9
+ ## 0.4.0
10
+ * `CHORE`: rename `Cloud` `1.4` to `8.0` ([#14](https://github.com/camunda/bpmnlint-plugin-camunda-compat/pull/14))
11
+ * `CHORE`: rename `Cloud` to `Platform`/`Zeebe` ([#15](https://github.com/camunda/bpmnlint-plugin-camunda-compat/pull/15))
12
+
13
+ ## 0.3.0
14
+ * `FEAT`: support multiInstance for subprocesses with cloud 1.0 ([#6](https://github.com/camunda/bpmnlint-plugin-camunda-compat/pull/6))
15
+ * `FEAT`: add Camunda Platform rules ([#5](https://github.com/camunda/bpmnlint-plugin-camunda-compat/pull/5))
16
+ * `FEAT`: add Camunda Cloud 1.4 rule ([#5](https://github.com/camunda/bpmnlint-plugin-camunda-compat/pull/5))
17
+ * `TEST`: add Cloud 1.1, 1.2, 1.3 integration tests ([#4](https://github.com/camunda/bpmnlint-plugin-camunda-compat/pull/4))
18
+ * `TEST`: verify exported configs ([#5](https://github.com/camunda/bpmnlint-plugin-camunda-compat/pull/5))
19
+ * `DEPS`: fix security audit warnings ([#6](https://github.com/camunda/bpmnlint-plugin-camunda-compat/pull/6))
20
+ * `DOCS`: update link to documentation
21
+ * `DOCS`: link Camunda Cloud and Platform BPMN coverage
22
+
23
+ ## 0.2.0
24
+
25
+ * `FEAT`: early return if execution platform does not match
26
+ * `FIX`: correct check for `bpmn:BaseElement`
27
+
28
+ ## 0.1.1
10
29
 
11
30
  * `FEAT`: initial support for Camunda Cloud 1.0, 1.1, 1.2, and 1.3
12
31
 
13
32
  ## ...
14
33
 
15
- Check `git log` for earlier history.
34
+ Check `git log` for earlier history.
package/README.md CHANGED
@@ -23,8 +23,8 @@ To validate a diagram it must be pinned to a particular execution platform via t
23
23
 
24
24
  ## Resources
25
25
 
26
- * [Documentation](https://github.com/camunda/bpmnlint-plugin-camunda-compat/tree/master/docs/rules)
27
26
  * [Issues](https://github.com/camunda/bpmnlint-plugin-camunda-compat/issues)
27
+ * BPMN coverage for [Camunda Cloud](https://docs.camunda.io/docs/reference/bpmn-processes/bpmn-coverage/) and [Camunda Platform](https://docs.camunda.org/manual/latest/reference/bpmn20/)
28
28
 
29
29
 
30
30
  ## License
package/index.js CHANGED
@@ -1,19 +1,43 @@
1
1
  module.exports = {
2
2
  configs: {
3
+ all: {
4
+ rules: {
5
+ 'camunda-cloud-1-0': 'error',
6
+ 'camunda-cloud-1-1': 'error',
7
+ 'camunda-cloud-1-2': 'error',
8
+ 'camunda-cloud-1-3': 'error',
9
+ 'camunda-cloud-8-0': 'error',
10
+ 'camunda-platform-7-15': 'error',
11
+ 'camunda-platform-7-16': 'error',
12
+ 'camunda-platform-7-17': 'error'
13
+ }
14
+ },
3
15
  recommended: {
4
16
  rules: {
5
17
  'camunda-cloud-1-0': 'error',
6
18
  'camunda-cloud-1-1': 'error',
7
19
  'camunda-cloud-1-2': 'error',
8
- 'camunda-cloud-1-3': 'error'
20
+ 'camunda-cloud-1-3': 'error',
21
+ 'camunda-cloud-8-0': 'error',
22
+ 'camunda-platform-7-15': 'error',
23
+ 'camunda-platform-7-16': 'error',
24
+ 'camunda-platform-7-17': 'error'
9
25
  }
10
26
  },
11
- all: {
27
+ cloud: {
28
+ rules: {
29
+ 'camunda-cloud-1-0': 'error',
30
+ 'camunda-cloud-1-1': 'error',
31
+ 'camunda-cloud-1-2': 'error',
32
+ 'camunda-cloud-1-3': 'error',
33
+ 'camunda-cloud-8-0': 'error'
34
+ }
35
+ },
36
+ platform: {
12
37
  rules: {
13
- 'camunda-cloud-1-0': 'warn',
14
- 'camunda-cloud-1-1': 'warn',
15
- 'camunda-cloud-1-2': 'warn',
16
- 'camunda-cloud-1-3': 'warn'
38
+ 'camunda-platform-7-15': 'error',
39
+ 'camunda-platform-7-16': 'error',
40
+ 'camunda-platform-7-17': 'error'
17
41
  }
18
42
  }
19
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmnlint-plugin-camunda-compat",
3
- "version": "0.1.1",
3
+ "version": "0.4.0",
4
4
  "description": "A bpmnlint plug-in for Camunda Cloud and Platform compatibility",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -23,7 +23,7 @@
23
23
  "devDependencies": {
24
24
  "bpmn-moddle": "^7.1.2",
25
25
  "bpmnlint": "^6.1.0",
26
- "chai": "^4.2.0",
26
+ "chai": "^4.3.5",
27
27
  "mocha": "^5.2.0",
28
28
  "modeler-moddle": "^0.1.0",
29
29
  "zeebe-bpmn-moddle": "^0.10.0"
@@ -82,7 +82,10 @@ module.exports = [
82
82
  },
83
83
  {
84
84
  type: 'bpmn:SubProcess',
85
- check: hasNoLoopCharacteristics
85
+ check: checkSome(
86
+ hasNoLoopCharacteristics,
87
+ hasLoopCharacteristicsOfType('bpmn:MultiInstanceLoopCharacteristics')
88
+ )
86
89
  },
87
90
  {
88
91
  type: 'bpmn:UserTask',
@@ -91,4 +94,4 @@ module.exports = [
91
94
  hasLoopCharacteristicsOfType('bpmn:MultiInstanceLoopCharacteristics')
92
95
  )
93
96
  }
94
- ];
97
+ ];
@@ -2,4 +2,4 @@ const { createRule } = require('./utils/rule');
2
2
 
3
3
  const checks = require('./camunda-cloud-1-0-checks');
4
4
 
5
- module.exports = createRule('1.0', checks);
5
+ module.exports = createRule('Camunda Cloud', '1.0', checks, 'Zeebe');
@@ -2,4 +2,4 @@ const { createRule } = require('./utils/rule');
2
2
 
3
3
  const checks = require('./camunda-cloud-1-1-checks');
4
4
 
5
- module.exports = createRule('1.1', checks);
5
+ module.exports = createRule('Camunda Cloud', '1.1', checks, 'Zeebe');
@@ -2,4 +2,4 @@ const { createRule } = require('./utils/rule');
2
2
 
3
3
  const checks = require('./camunda-cloud-1-2-checks');
4
4
 
5
- module.exports = createRule('1.2', checks);
5
+ module.exports = createRule('Camunda Cloud', '1.2', checks, 'Zeebe');
@@ -2,4 +2,4 @@ const { createRule } = require('./utils/rule');
2
2
 
3
3
  const checks = require('./camunda-cloud-1-3-checks');
4
4
 
5
- module.exports = createRule('1.3', checks);
5
+ module.exports = createRule('Camunda Cloud', '1.3', checks, 'Zeebe');
@@ -0,0 +1,5 @@
1
+ const camundaCloud13Checks = require('./camunda-cloud-1-3-checks');
2
+
3
+ module.exports = [
4
+ ...camundaCloud13Checks
5
+ ];
@@ -0,0 +1,5 @@
1
+ const { createRule } = require('./utils/rule');
2
+
3
+ const checks = require('./camunda-cloud-8-0-checks');
4
+
5
+ module.exports = createRule('Camunda Cloud', '8.0', checks, 'Camunda Platform');
@@ -0,0 +1,3 @@
1
+ const { createNoopRule } = require('./utils/rule');
2
+
3
+ module.exports = createNoopRule();
@@ -0,0 +1,3 @@
1
+ const { createNoopRule } = require('./utils/rule');
2
+
3
+ module.exports = createNoopRule();
@@ -0,0 +1,3 @@
1
+ const { createNoopRule } = require('./utils/rule');
2
+
3
+ module.exports = createNoopRule();
@@ -11,78 +11,45 @@ const {
11
11
 
12
12
  const { toSemverMinor } = require('./engine-profile');
13
13
 
14
- module.exports.createRule = function(version, checks) {
14
+ module.exports.createRule = function(ruleExecutionPlatform, ruleExecutionPlatformVersion, checks, executionPlatformLabel) {
15
15
  return () => {
16
16
  return {
17
17
  check: (node, reporter) => {
18
-
19
- // do not lint properties (yet)
20
- if (!isAny(node, [ 'bpmn:FlowElement', 'bpmn:FlowElementsContainer' ])) {
21
- return;
22
- }
23
-
24
- const engineProfile = getEngineProfile(node);
25
-
26
- if (!engineProfile) {
27
- return;
28
- }
29
-
30
- const {
31
- executionPlatform,
32
- executionPlatformVersion
33
- } = engineProfile;
34
-
35
- if (!executionPlatformVersion || toSemverMinor(executionPlatformVersion) !== version) {
18
+ if (is(node, 'bpmn:Definitions')) {
19
+ executionPlatform = node.get('modeler:executionPlatform');
20
+ executionPlatformVersion = node.get('modeler:executionPlatformVersion');
21
+
22
+ if (!executionPlatform
23
+ || executionPlatform !== ruleExecutionPlatform
24
+ || !executionPlatformVersion
25
+ || toSemverMinor(executionPlatformVersion) !== ruleExecutionPlatformVersion) {
26
+ return false;
27
+ }
28
+ } else if (!isAny(node, [ 'bpmn:FlowElement', 'bpmn:FlowElementsContainer' ])) {
36
29
  return;
37
30
  }
38
31
 
39
32
  const result = checkNode(node, checks);
40
33
 
41
34
  if (result === false) {
42
- reporter.report(node.get('id') || '', `Element of type <${ node.$type }> not supported by ${ executionPlatform } ${ toSemverMinor(executionPlatformVersion) }`);
35
+ reporter.report(node.get('id') || '', `Element of type <${ node.$type }> not supported by ${ executionPlatformLabel || ruleExecutionPlatform } ${ toSemverMinor(ruleExecutionPlatformVersion) }`);
43
36
  }
44
37
 
45
38
  if (isString(result)) {
46
- reporter.report(node.get('id') || '', `Element of type <${ result }> not supported by ${ executionPlatform } ${ toSemverMinor(executionPlatformVersion) }`);
39
+ reporter.report(node.get('id') || '', `Element of type <${ result }> not supported by ${ executionPlatformLabel || ruleExecutionPlatform } ${ toSemverMinor(ruleExecutionPlatformVersion) }`);
47
40
  }
48
41
  }
49
42
  };
50
43
  };
51
- }
52
-
53
- function getDefinitions(node) {
54
- if (is(node, 'bpmn:Definitions')) {
55
- return node;
56
- }
57
-
58
- const parent = node.$parent;
59
-
60
- if (!parent) {
61
- return null;
62
- }
44
+ };
63
45
 
64
- return getDefinitions(parent);
65
- }
66
-
67
- function getEngineProfile(node) {
68
- const definitions = getDefinitions(node);
69
-
70
- if (!definitions) {
71
- return null;
72
- }
73
-
74
- const executionPlatform = definitions.get('modeler:executionPlatform'),
75
- executionPlatformVersion = definitions.get('modeler:executionPlatformVersion');
76
-
77
- if (!executionPlatform) {
78
- return null;
79
- }
80
-
81
- return {
82
- executionPlatform,
83
- executionPlatformVersion
46
+ module.exports.createNoopRule = function() {
47
+ return () => {
48
+ return {
49
+ check: () => false
50
+ };
84
51
  };
85
- }
52
+ };
86
53
 
87
54
  /**
88
55
  * @param {ModdleElement} node
@@ -226,11 +193,5 @@ module.exports.hasLoopCharacteristicsOfType = function(type) {
226
193
  }
227
194
 
228
195
  module.exports.isNotBpmn = function(node) {
229
- const { $descriptor: descriptor } = node;
230
-
231
- const { $pkg: package } = descriptor;
232
-
233
- const { uri } = package;
234
-
235
- return uri !== 'http://www.omg.org/spec/BPMN/20100524/MODEL';
196
+ return !is(node, 'bpmn:BaseElement');
236
197
  }