bpmnlint-plugin-camunda-compat 2.44.0 → 2.45.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/index.js +2 -0
- package/package.json +1 -1
- package/rules/camunda-cloud/variable-name.js +108 -0
package/index.js
CHANGED
|
@@ -32,6 +32,7 @@ const camundaCloud10Rules = withConfig({
|
|
|
32
32
|
'timer': 'error',
|
|
33
33
|
'user-task-definition': 'warn',
|
|
34
34
|
'user-task-form': 'error',
|
|
35
|
+
'variable-name': 'error',
|
|
35
36
|
'feel': 'error',
|
|
36
37
|
'bpmnlint/start-event-required': 'error',
|
|
37
38
|
}, { version: '1.0' });
|
|
@@ -196,6 +197,7 @@ const rules = {
|
|
|
196
197
|
'timer': './rules/camunda-cloud/timer',
|
|
197
198
|
'user-task-definition': './rules/camunda-cloud/user-task-definition',
|
|
198
199
|
'user-task-form': './rules/camunda-cloud/user-task-form',
|
|
200
|
+
'variable-name': './rules/camunda-cloud/variable-name',
|
|
199
201
|
'version-tag': './rules/camunda-cloud/version-tag',
|
|
200
202
|
'wait-for-completion': './rules/camunda-cloud/wait-for-completion',
|
|
201
203
|
...bpmnlintRules.reduce((rules, rule) => {
|
package/package.json
CHANGED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
const { is } = require('bpmnlint-utils');
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
findExtensionElement,
|
|
5
|
+
hasProperties
|
|
6
|
+
} = require('../utils/element');
|
|
7
|
+
|
|
8
|
+
const { reportErrors } = require('../utils/reporter');
|
|
9
|
+
|
|
10
|
+
const { skipInNonExecutableProcess } = require('../utils/rule');
|
|
11
|
+
|
|
12
|
+
const VARIABLE_NAME_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*$/;
|
|
13
|
+
|
|
14
|
+
function isValidVariableName(value) {
|
|
15
|
+
return VARIABLE_NAME_PATTERN.test(value);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
module.exports = skipInNonExecutableProcess(function() {
|
|
19
|
+
function check(node, reporter) {
|
|
20
|
+
const errors = [];
|
|
21
|
+
|
|
22
|
+
// zeebe:IoMapping#inputParameters/outputParameters
|
|
23
|
+
const ioMapping = findExtensionElement(node, 'zeebe:IoMapping');
|
|
24
|
+
if (ioMapping) {
|
|
25
|
+
const inputParameters = ioMapping.get('inputParameters') || [];
|
|
26
|
+
const outputParameters = ioMapping.get('outputParameters') || [];
|
|
27
|
+
|
|
28
|
+
inputParameters.forEach((input) => {
|
|
29
|
+
errors.push(...hasProperties(input, {
|
|
30
|
+
target: {
|
|
31
|
+
allowed: isValidVariableName
|
|
32
|
+
}
|
|
33
|
+
}, node));
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
outputParameters.forEach((output) => {
|
|
37
|
+
errors.push(...hasProperties(output, {
|
|
38
|
+
target: {
|
|
39
|
+
allowed: isValidVariableName
|
|
40
|
+
}
|
|
41
|
+
}, node));
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const loopCharacteristics = node.get('loopCharacteristics');
|
|
46
|
+
if (loopCharacteristics && is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')) {
|
|
47
|
+
const zeebeLoopCharacteristics = findExtensionElement(loopCharacteristics, 'zeebe:LoopCharacteristics');
|
|
48
|
+
|
|
49
|
+
if (zeebeLoopCharacteristics) {
|
|
50
|
+
errors.push(...hasProperties(zeebeLoopCharacteristics, {
|
|
51
|
+
inputElement: {
|
|
52
|
+
allowed: isValidVariableName
|
|
53
|
+
},
|
|
54
|
+
outputCollection: {
|
|
55
|
+
allowed: isValidVariableName
|
|
56
|
+
}
|
|
57
|
+
}, node));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// zeebe:Script#resultVariable
|
|
62
|
+
if (is(node, 'bpmn:ScriptTask')) {
|
|
63
|
+
const script = findExtensionElement(node, 'zeebe:Script');
|
|
64
|
+
|
|
65
|
+
if (script) {
|
|
66
|
+
errors.push(...hasProperties(script, {
|
|
67
|
+
resultVariable: {
|
|
68
|
+
allowed: isValidVariableName
|
|
69
|
+
}
|
|
70
|
+
}, node));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// zeebe:CalledDecision#resultVariable)
|
|
75
|
+
if (is(node, 'bpmn:BusinessRuleTask')) {
|
|
76
|
+
const calledDecision = findExtensionElement(node, 'zeebe:CalledDecision');
|
|
77
|
+
|
|
78
|
+
if (calledDecision) {
|
|
79
|
+
errors.push(...hasProperties(calledDecision, {
|
|
80
|
+
resultVariable: {
|
|
81
|
+
allowed: isValidVariableName
|
|
82
|
+
}
|
|
83
|
+
}, node));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// zeebe:AdHoc#outputCollection
|
|
88
|
+
if (is(node, 'bpmn:AdHocSubProcess')) {
|
|
89
|
+
const adHoc = findExtensionElement(node, 'zeebe:AdHoc');
|
|
90
|
+
|
|
91
|
+
if (adHoc) {
|
|
92
|
+
errors.push(...hasProperties(adHoc, {
|
|
93
|
+
outputCollection: {
|
|
94
|
+
allowed: isValidVariableName
|
|
95
|
+
}
|
|
96
|
+
}, node));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (errors.length) {
|
|
101
|
+
reportErrors(node, reporter, errors);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
check
|
|
107
|
+
};
|
|
108
|
+
});
|