bpmnlint-plugin-camunda-compat 2.35.0 → 2.36.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/LICENSE +20 -20
- package/README.md +39 -39
- package/index.js +286 -286
- package/package.json +53 -53
- package/rules/camunda-cloud/ad-hoc-sub-process.js +60 -60
- package/rules/camunda-cloud/called-element.js +44 -44
- package/rules/camunda-cloud/collapsed-subprocess.js +40 -40
- package/rules/camunda-cloud/connector-properties/config.js +90 -90
- package/rules/camunda-cloud/connector-properties/index.js +47 -47
- package/rules/camunda-cloud/duplicate-execution-listeners.js +33 -33
- package/rules/camunda-cloud/duplicate-task-headers.js +58 -58
- package/rules/camunda-cloud/element-type/config.js +67 -67
- package/rules/camunda-cloud/element-type/index.js +135 -135
- package/rules/camunda-cloud/error-reference.js +72 -72
- package/rules/camunda-cloud/escalation-boundary-event-attached-to-ref.js +47 -47
- package/rules/camunda-cloud/escalation-reference.js +67 -67
- package/rules/camunda-cloud/event-based-gateway-target.js +38 -38
- package/rules/camunda-cloud/executable-process.js +61 -61
- package/rules/camunda-cloud/execution-listener.js +33 -33
- package/rules/camunda-cloud/feel.js +86 -86
- package/rules/camunda-cloud/implementation/config.js +19 -19
- package/rules/camunda-cloud/implementation/index.js +218 -218
- package/rules/camunda-cloud/inclusive-gateway.js +35 -35
- package/rules/camunda-cloud/link-event.js +142 -142
- package/rules/camunda-cloud/loop-characteristics.js +66 -66
- package/rules/camunda-cloud/message-reference.js +61 -61
- package/rules/camunda-cloud/no-binding-type.js +43 -43
- package/rules/camunda-cloud/no-candidate-users.js +38 -38
- package/rules/camunda-cloud/no-execution-listeners.js +21 -21
- package/rules/camunda-cloud/no-expression.js +173 -173
- package/rules/camunda-cloud/no-loop.js +316 -316
- package/rules/camunda-cloud/no-multiple-none-start-events.js +41 -41
- package/rules/camunda-cloud/no-priority-definition.js +18 -18
- package/rules/camunda-cloud/no-propagate-all-parent-variables.js +44 -44
- package/rules/camunda-cloud/no-signal-event-sub-process.js +45 -45
- package/rules/camunda-cloud/no-task-listeners.js +21 -21
- package/rules/camunda-cloud/no-task-schedule.js +18 -18
- package/rules/camunda-cloud/no-template.js +23 -23
- package/rules/camunda-cloud/no-version-tag.js +24 -24
- package/rules/camunda-cloud/no-zeebe-properties.js +18 -18
- package/rules/camunda-cloud/no-zeebe-user-task.js +27 -27
- package/rules/camunda-cloud/priority-definition.js +61 -61
- package/rules/camunda-cloud/secrets.js +119 -119
- package/rules/camunda-cloud/sequence-flow-condition.js +56 -56
- package/rules/camunda-cloud/signal-reference.js +64 -64
- package/rules/camunda-cloud/start-event-form.js +97 -97
- package/rules/camunda-cloud/subscription.js +65 -65
- package/rules/camunda-cloud/task-listener.js +39 -39
- package/rules/camunda-cloud/task-schedule.js +67 -67
- package/rules/camunda-cloud/timer/config.js +46 -46
- package/rules/camunda-cloud/timer/index.js +183 -183
- package/rules/camunda-cloud/user-task-definition.js +24 -24
- package/rules/camunda-cloud/user-task-form.js +142 -142
- package/rules/camunda-cloud/wait-for-completion.js +46 -46
- package/rules/camunda-cloud/zeebe-user-task.js +30 -30
- package/rules/camunda-platform/history-time-to-live.js +24 -21
- package/rules/helper.js +38 -38
- package/rules/utils/cron.js +95 -95
- package/rules/utils/element.js +533 -533
- package/rules/utils/error-types.js +26 -26
- package/rules/utils/iso8601.js +52 -52
- package/rules/utils/reporter.js +37 -37
- package/rules/utils/rule.js +46 -46
- package/rules/utils/version.js +4 -4
@@ -1,142 +1,142 @@
|
|
1
|
-
const { is } = require('bpmnlint-utils');
|
2
|
-
|
3
|
-
const {
|
4
|
-
findExtensionElement,
|
5
|
-
findExtensionElements,
|
6
|
-
findParent,
|
7
|
-
hasProperties,
|
8
|
-
hasProperty
|
9
|
-
} = require('../utils/element');
|
10
|
-
|
11
|
-
const { reportErrors } = require('../utils/reporter');
|
12
|
-
|
13
|
-
const { skipInNonExecutableProcess } = require('../utils/rule');
|
14
|
-
|
15
|
-
const { greaterOrEqual } = require('../utils/version');
|
16
|
-
|
17
|
-
const FORM_ID_ALLOWED_VERSIONS = {
|
18
|
-
desktop: '8.4',
|
19
|
-
web: '8.0'
|
20
|
-
};
|
21
|
-
|
22
|
-
const ZEEBE_USER_TASK_VERSION = '8.5';
|
23
|
-
|
24
|
-
module.exports = skipInNonExecutableProcess(function({ modeler = 'desktop', version }) {
|
25
|
-
function check(node, reporter) {
|
26
|
-
if (!is(node, 'bpmn:UserTask')) {
|
27
|
-
return;
|
28
|
-
}
|
29
|
-
|
30
|
-
const formDefinition = findExtensionElement(node, 'zeebe:FormDefinition');
|
31
|
-
|
32
|
-
if (!formDefinition) {
|
33
|
-
return;
|
34
|
-
}
|
35
|
-
|
36
|
-
// handle Zebee User Task
|
37
|
-
if (isZeebeUserTask(node)) {
|
38
|
-
|
39
|
-
// handled by no-zeebe-user-task rule
|
40
|
-
if (!greaterOrEqual(version, ZEEBE_USER_TASK_VERSION)) {
|
41
|
-
return;
|
42
|
-
}
|
43
|
-
|
44
|
-
const errors = hasProperty(formDefinition, [
|
45
|
-
'externalReference',
|
46
|
-
'formId'
|
47
|
-
], node) || [];
|
48
|
-
|
49
|
-
if (errors.length) {
|
50
|
-
reportErrors(node, reporter, errors);
|
51
|
-
}
|
52
|
-
|
53
|
-
return;
|
54
|
-
}
|
55
|
-
|
56
|
-
let errors;
|
57
|
-
|
58
|
-
const formIdAllowedVersion = FORM_ID_ALLOWED_VERSIONS[ modeler ];
|
59
|
-
|
60
|
-
if (isFormIdAllowed(version, formIdAllowedVersion)) {
|
61
|
-
errors = hasProperty(formDefinition, [
|
62
|
-
'formKey',
|
63
|
-
'formId'
|
64
|
-
], node);
|
65
|
-
} else {
|
66
|
-
errors = hasProperties(formDefinition, {
|
67
|
-
formId: {
|
68
|
-
allowed: false,
|
69
|
-
allowedVersion: formIdAllowedVersion
|
70
|
-
}
|
71
|
-
}, node);
|
72
|
-
|
73
|
-
if (errors.length) {
|
74
|
-
reportErrors(node, reporter, errors);
|
75
|
-
|
76
|
-
return;
|
77
|
-
}
|
78
|
-
|
79
|
-
errors = hasProperties(formDefinition, {
|
80
|
-
formKey: {
|
81
|
-
required: true
|
82
|
-
}
|
83
|
-
}, node);
|
84
|
-
}
|
85
|
-
|
86
|
-
if (errors.length) {
|
87
|
-
reportErrors(node, reporter, errors);
|
88
|
-
|
89
|
-
return;
|
90
|
-
}
|
91
|
-
|
92
|
-
const formKey = formDefinition.get('formKey');
|
93
|
-
|
94
|
-
const userTaskForm = findUserTaskForm(node, formKey);
|
95
|
-
|
96
|
-
if (!userTaskForm) {
|
97
|
-
return;
|
98
|
-
}
|
99
|
-
|
100
|
-
errors = hasProperties(userTaskForm, {
|
101
|
-
body: {
|
102
|
-
required: true
|
103
|
-
}
|
104
|
-
}, node);
|
105
|
-
|
106
|
-
if (errors.length) {
|
107
|
-
reportErrors(node, reporter, errors);
|
108
|
-
}
|
109
|
-
}
|
110
|
-
|
111
|
-
return {
|
112
|
-
check
|
113
|
-
};
|
114
|
-
});
|
115
|
-
|
116
|
-
// helpers //////////
|
117
|
-
|
118
|
-
function findUserTaskForm(node, formKey) {
|
119
|
-
const process = findParent(node, 'bpmn:Process');
|
120
|
-
|
121
|
-
if (!process) {
|
122
|
-
return;
|
123
|
-
}
|
124
|
-
|
125
|
-
const userTaskForms = findExtensionElements(process, 'zeebe:UserTaskForm');
|
126
|
-
|
127
|
-
if (userTaskForms && userTaskForms.length) {
|
128
|
-
return userTaskForms.find(userTaskForm => {
|
129
|
-
const id = userTaskForm.get('id');
|
130
|
-
|
131
|
-
return `camunda-forms:bpmn:${ id }` === formKey;
|
132
|
-
});
|
133
|
-
}
|
134
|
-
}
|
135
|
-
|
136
|
-
function isFormIdAllowed(version, formIdAllowedVersion) {
|
137
|
-
return greaterOrEqual(version, formIdAllowedVersion);
|
138
|
-
}
|
139
|
-
|
140
|
-
function isZeebeUserTask(node) {
|
141
|
-
return !!findExtensionElement(node, 'zeebe:UserTask');
|
142
|
-
}
|
1
|
+
const { is } = require('bpmnlint-utils');
|
2
|
+
|
3
|
+
const {
|
4
|
+
findExtensionElement,
|
5
|
+
findExtensionElements,
|
6
|
+
findParent,
|
7
|
+
hasProperties,
|
8
|
+
hasProperty
|
9
|
+
} = require('../utils/element');
|
10
|
+
|
11
|
+
const { reportErrors } = require('../utils/reporter');
|
12
|
+
|
13
|
+
const { skipInNonExecutableProcess } = require('../utils/rule');
|
14
|
+
|
15
|
+
const { greaterOrEqual } = require('../utils/version');
|
16
|
+
|
17
|
+
const FORM_ID_ALLOWED_VERSIONS = {
|
18
|
+
desktop: '8.4',
|
19
|
+
web: '8.0'
|
20
|
+
};
|
21
|
+
|
22
|
+
const ZEEBE_USER_TASK_VERSION = '8.5';
|
23
|
+
|
24
|
+
module.exports = skipInNonExecutableProcess(function({ modeler = 'desktop', version }) {
|
25
|
+
function check(node, reporter) {
|
26
|
+
if (!is(node, 'bpmn:UserTask')) {
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
|
30
|
+
const formDefinition = findExtensionElement(node, 'zeebe:FormDefinition');
|
31
|
+
|
32
|
+
if (!formDefinition) {
|
33
|
+
return;
|
34
|
+
}
|
35
|
+
|
36
|
+
// handle Zebee User Task
|
37
|
+
if (isZeebeUserTask(node)) {
|
38
|
+
|
39
|
+
// handled by no-zeebe-user-task rule
|
40
|
+
if (!greaterOrEqual(version, ZEEBE_USER_TASK_VERSION)) {
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
|
44
|
+
const errors = hasProperty(formDefinition, [
|
45
|
+
'externalReference',
|
46
|
+
'formId'
|
47
|
+
], node) || [];
|
48
|
+
|
49
|
+
if (errors.length) {
|
50
|
+
reportErrors(node, reporter, errors);
|
51
|
+
}
|
52
|
+
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
|
56
|
+
let errors;
|
57
|
+
|
58
|
+
const formIdAllowedVersion = FORM_ID_ALLOWED_VERSIONS[ modeler ];
|
59
|
+
|
60
|
+
if (isFormIdAllowed(version, formIdAllowedVersion)) {
|
61
|
+
errors = hasProperty(formDefinition, [
|
62
|
+
'formKey',
|
63
|
+
'formId'
|
64
|
+
], node);
|
65
|
+
} else {
|
66
|
+
errors = hasProperties(formDefinition, {
|
67
|
+
formId: {
|
68
|
+
allowed: false,
|
69
|
+
allowedVersion: formIdAllowedVersion
|
70
|
+
}
|
71
|
+
}, node);
|
72
|
+
|
73
|
+
if (errors.length) {
|
74
|
+
reportErrors(node, reporter, errors);
|
75
|
+
|
76
|
+
return;
|
77
|
+
}
|
78
|
+
|
79
|
+
errors = hasProperties(formDefinition, {
|
80
|
+
formKey: {
|
81
|
+
required: true
|
82
|
+
}
|
83
|
+
}, node);
|
84
|
+
}
|
85
|
+
|
86
|
+
if (errors.length) {
|
87
|
+
reportErrors(node, reporter, errors);
|
88
|
+
|
89
|
+
return;
|
90
|
+
}
|
91
|
+
|
92
|
+
const formKey = formDefinition.get('formKey');
|
93
|
+
|
94
|
+
const userTaskForm = findUserTaskForm(node, formKey);
|
95
|
+
|
96
|
+
if (!userTaskForm) {
|
97
|
+
return;
|
98
|
+
}
|
99
|
+
|
100
|
+
errors = hasProperties(userTaskForm, {
|
101
|
+
body: {
|
102
|
+
required: true
|
103
|
+
}
|
104
|
+
}, node);
|
105
|
+
|
106
|
+
if (errors.length) {
|
107
|
+
reportErrors(node, reporter, errors);
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
return {
|
112
|
+
check
|
113
|
+
};
|
114
|
+
});
|
115
|
+
|
116
|
+
// helpers //////////
|
117
|
+
|
118
|
+
function findUserTaskForm(node, formKey) {
|
119
|
+
const process = findParent(node, 'bpmn:Process');
|
120
|
+
|
121
|
+
if (!process) {
|
122
|
+
return;
|
123
|
+
}
|
124
|
+
|
125
|
+
const userTaskForms = findExtensionElements(process, 'zeebe:UserTaskForm');
|
126
|
+
|
127
|
+
if (userTaskForms && userTaskForms.length) {
|
128
|
+
return userTaskForms.find(userTaskForm => {
|
129
|
+
const id = userTaskForm.get('id');
|
130
|
+
|
131
|
+
return `camunda-forms:bpmn:${ id }` === formKey;
|
132
|
+
});
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
function isFormIdAllowed(version, formIdAllowedVersion) {
|
137
|
+
return greaterOrEqual(version, formIdAllowedVersion);
|
138
|
+
}
|
139
|
+
|
140
|
+
function isZeebeUserTask(node) {
|
141
|
+
return !!findExtensionElement(node, 'zeebe:UserTask');
|
142
|
+
}
|
@@ -1,46 +1,46 @@
|
|
1
|
-
const {
|
2
|
-
is
|
3
|
-
} = require('bpmnlint-utils');
|
4
|
-
|
5
|
-
const {
|
6
|
-
getEventDefinition,
|
7
|
-
hasProperties
|
8
|
-
} = require('../utils/element');
|
9
|
-
|
10
|
-
const { reportErrors } = require('../utils/reporter');
|
11
|
-
|
12
|
-
const { skipInNonExecutableProcess } = require('../utils/rule');
|
13
|
-
|
14
|
-
module.exports = skipInNonExecutableProcess(waitForCompletion);
|
15
|
-
|
16
|
-
/**
|
17
|
-
* Make sure that wait for completion is NOT set to false.
|
18
|
-
*/
|
19
|
-
function waitForCompletion() {
|
20
|
-
function check(node, reporter) {
|
21
|
-
if (!is(node, 'bpmn:ThrowEvent')) {
|
22
|
-
return;
|
23
|
-
}
|
24
|
-
|
25
|
-
const eventDefinition = getEventDefinition(node);
|
26
|
-
|
27
|
-
if (!eventDefinition || !is(eventDefinition, 'bpmn:CompensateEventDefinition')) {
|
28
|
-
return;
|
29
|
-
}
|
30
|
-
|
31
|
-
const errors = hasProperties(eventDefinition, {
|
32
|
-
waitForCompletion: {
|
33
|
-
value: true
|
34
|
-
}
|
35
|
-
}, node);
|
36
|
-
|
37
|
-
if (errors && errors.length) {
|
38
|
-
reportErrors(node, reporter, errors);
|
39
|
-
}
|
40
|
-
}
|
41
|
-
|
42
|
-
|
43
|
-
return {
|
44
|
-
check
|
45
|
-
};
|
46
|
-
}
|
1
|
+
const {
|
2
|
+
is
|
3
|
+
} = require('bpmnlint-utils');
|
4
|
+
|
5
|
+
const {
|
6
|
+
getEventDefinition,
|
7
|
+
hasProperties
|
8
|
+
} = require('../utils/element');
|
9
|
+
|
10
|
+
const { reportErrors } = require('../utils/reporter');
|
11
|
+
|
12
|
+
const { skipInNonExecutableProcess } = require('../utils/rule');
|
13
|
+
|
14
|
+
module.exports = skipInNonExecutableProcess(waitForCompletion);
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Make sure that wait for completion is NOT set to false.
|
18
|
+
*/
|
19
|
+
function waitForCompletion() {
|
20
|
+
function check(node, reporter) {
|
21
|
+
if (!is(node, 'bpmn:ThrowEvent')) {
|
22
|
+
return;
|
23
|
+
}
|
24
|
+
|
25
|
+
const eventDefinition = getEventDefinition(node);
|
26
|
+
|
27
|
+
if (!eventDefinition || !is(eventDefinition, 'bpmn:CompensateEventDefinition')) {
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
|
31
|
+
const errors = hasProperties(eventDefinition, {
|
32
|
+
waitForCompletion: {
|
33
|
+
value: true
|
34
|
+
}
|
35
|
+
}, node);
|
36
|
+
|
37
|
+
if (errors && errors.length) {
|
38
|
+
reportErrors(node, reporter, errors);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
|
43
|
+
return {
|
44
|
+
check
|
45
|
+
};
|
46
|
+
}
|
@@ -1,30 +1,30 @@
|
|
1
|
-
const { is } = require('bpmnlint-utils');
|
2
|
-
|
3
|
-
const { reportErrors } = require('../utils/reporter');
|
4
|
-
|
5
|
-
const { skipInNonExecutableProcess } = require('../utils/rule');
|
6
|
-
|
7
|
-
const { hasExtensionElement } = require('../utils/element');
|
8
|
-
|
9
|
-
module.exports = skipInNonExecutableProcess(function() {
|
10
|
-
function check(node, reporter) {
|
11
|
-
if (!is(node, 'bpmn:UserTask')) {
|
12
|
-
return;
|
13
|
-
}
|
14
|
-
|
15
|
-
const errors = hasExtensionElement(node, 'zeebe:UserTask', node);
|
16
|
-
|
17
|
-
if (errors && errors.length) {
|
18
|
-
reportErrors(node, reporter, errors);
|
19
|
-
}
|
20
|
-
}
|
21
|
-
|
22
|
-
return {
|
23
|
-
meta: {
|
24
|
-
documentation: {
|
25
|
-
url: 'https://docs.camunda.io/docs/next/apis-tools/migration-manuals/migrate-to-camunda-user-tasks'
|
26
|
-
}
|
27
|
-
},
|
28
|
-
check
|
29
|
-
};
|
30
|
-
});
|
1
|
+
const { is } = require('bpmnlint-utils');
|
2
|
+
|
3
|
+
const { reportErrors } = require('../utils/reporter');
|
4
|
+
|
5
|
+
const { skipInNonExecutableProcess } = require('../utils/rule');
|
6
|
+
|
7
|
+
const { hasExtensionElement } = require('../utils/element');
|
8
|
+
|
9
|
+
module.exports = skipInNonExecutableProcess(function() {
|
10
|
+
function check(node, reporter) {
|
11
|
+
if (!is(node, 'bpmn:UserTask')) {
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
|
15
|
+
const errors = hasExtensionElement(node, 'zeebe:UserTask', node);
|
16
|
+
|
17
|
+
if (errors && errors.length) {
|
18
|
+
reportErrors(node, reporter, errors);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
return {
|
23
|
+
meta: {
|
24
|
+
documentation: {
|
25
|
+
url: 'https://docs.camunda.io/docs/next/apis-tools/migration-manuals/migrate-to-camunda-user-tasks'
|
26
|
+
}
|
27
|
+
},
|
28
|
+
check
|
29
|
+
};
|
30
|
+
});
|
@@ -1,22 +1,25 @@
|
|
1
|
-
const { is } = require('bpmnlint-utils');
|
2
|
-
|
3
|
-
const {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
1
|
+
const { is } = require('bpmnlint-utils');
|
2
|
+
|
3
|
+
const { skipInNonExecutableProcess } = require('../utils/rule');
|
4
|
+
|
5
|
+
module.exports = skipInNonExecutableProcess(function() {
|
6
|
+
function check(node, reporter) {
|
7
|
+
|
8
|
+
if (!is(node, 'bpmn:Process')) {
|
9
|
+
return;
|
10
|
+
}
|
11
|
+
|
12
|
+
if (!node.get('camunda:historyTimeToLive')) {
|
13
|
+
reporter.report(node.id, 'Property <historyTimeToLive> should be configured on <bpmn:Process> or engine level.', [ 'historyTimeToLive' ]);
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
return {
|
18
|
+
meta: {
|
19
|
+
documentation: {
|
20
|
+
url: 'https://docs.camunda.org/manual/latest/modeler/history-time-to-live/'
|
21
|
+
}
|
22
|
+
},
|
23
|
+
check
|
24
|
+
};
|
22
25
|
});
|
package/rules/helper.js
CHANGED
@@ -1,39 +1,39 @@
|
|
1
|
-
const modelingGuidanceBaseUrl = 'https://docs.camunda.io/docs/next/components/modeler/reference/modeling-guidance/rules';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* @typedef { any } RuleDefinition
|
5
|
-
*/
|
6
|
-
|
7
|
-
/**
|
8
|
-
* Annotate a rule with core information, such as the documentation url.
|
9
|
-
*
|
10
|
-
* @param { string } ruleName
|
11
|
-
* @param { RuleDefinition } options
|
12
|
-
*
|
13
|
-
* @return { RuleDefinition }
|
14
|
-
*/
|
15
|
-
function annotateRule(ruleName, options) {
|
16
|
-
|
17
|
-
const {
|
18
|
-
meta: {
|
19
|
-
documentation = {},
|
20
|
-
...restMeta
|
21
|
-
} = {},
|
22
|
-
...restOptions
|
23
|
-
} = options;
|
24
|
-
|
25
|
-
const documentationUrl = `${modelingGuidanceBaseUrl}/${ruleName}/`;
|
26
|
-
|
27
|
-
return {
|
28
|
-
meta: {
|
29
|
-
documentation: {
|
30
|
-
url: documentationUrl,
|
31
|
-
...documentation
|
32
|
-
},
|
33
|
-
...restMeta
|
34
|
-
},
|
35
|
-
...restOptions
|
36
|
-
};
|
37
|
-
}
|
38
|
-
|
1
|
+
const modelingGuidanceBaseUrl = 'https://docs.camunda.io/docs/next/components/modeler/reference/modeling-guidance/rules';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @typedef { any } RuleDefinition
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Annotate a rule with core information, such as the documentation url.
|
9
|
+
*
|
10
|
+
* @param { string } ruleName
|
11
|
+
* @param { RuleDefinition } options
|
12
|
+
*
|
13
|
+
* @return { RuleDefinition }
|
14
|
+
*/
|
15
|
+
function annotateRule(ruleName, options) {
|
16
|
+
|
17
|
+
const {
|
18
|
+
meta: {
|
19
|
+
documentation = {},
|
20
|
+
...restMeta
|
21
|
+
} = {},
|
22
|
+
...restOptions
|
23
|
+
} = options;
|
24
|
+
|
25
|
+
const documentationUrl = `${modelingGuidanceBaseUrl}/${ruleName}/`;
|
26
|
+
|
27
|
+
return {
|
28
|
+
meta: {
|
29
|
+
documentation: {
|
30
|
+
url: documentationUrl,
|
31
|
+
...documentation
|
32
|
+
},
|
33
|
+
...restMeta
|
34
|
+
},
|
35
|
+
...restOptions
|
36
|
+
};
|
37
|
+
}
|
38
|
+
|
39
39
|
module.exports.annotateRule = annotateRule;
|