From f2bd53ef884eb1ddd502987a82a731e3b59cfefd Mon Sep 17 00:00:00 2001 From: Philipp Fromme Date: Thu, 1 Aug 2024 14:22:45 +0200 Subject: [PATCH] feat: lint `zeebe:bindingType` Related to https://github.com/camunda/camunda-modeler/issues/4386 --- lib/compiled-config.js | 89 ++++++++++++++------------ lib/utils/error-messages.js | 8 +++ lib/utils/properties-panel.js | 8 +++ package-lock.json | 19 +++--- package.json | 2 +- test/spec/utils/error-messages.spec.js | 25 ++++++++ 6 files changed, 97 insertions(+), 54 deletions(-) diff --git a/lib/compiled-config.js b/lib/compiled-config.js index 766624b..83d209a 100644 --- a/lib/compiled-config.js +++ b/lib/compiled-config.js @@ -48,6 +48,7 @@ const rules = { "camunda-compat/link-event": "error", "camunda-compat/loop-characteristics": "error", "camunda-compat/message-reference": "error", + "camunda-compat/no-binding-type": "error", "camunda-compat/no-candidate-users": "error", "camunda-compat/no-execution-listeners": "error", "camunda-compat/no-expression": "error", @@ -160,86 +161,90 @@ import rule_18 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/message- cache['bpmnlint-plugin-camunda-compat/message-reference'] = rule_18; -import rule_19 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-candidate-users'; +import rule_19 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-binding-type'; -cache['bpmnlint-plugin-camunda-compat/no-candidate-users'] = rule_19; +cache['bpmnlint-plugin-camunda-compat/no-binding-type'] = rule_19; -import rule_20 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-execution-listeners'; +import rule_20 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-candidate-users'; -cache['bpmnlint-plugin-camunda-compat/no-execution-listeners'] = rule_20; +cache['bpmnlint-plugin-camunda-compat/no-candidate-users'] = rule_20; -import rule_21 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-expression'; +import rule_21 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-execution-listeners'; -cache['bpmnlint-plugin-camunda-compat/no-expression'] = rule_21; +cache['bpmnlint-plugin-camunda-compat/no-execution-listeners'] = rule_21; -import rule_22 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-loop'; +import rule_22 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-expression'; -cache['bpmnlint-plugin-camunda-compat/no-loop'] = rule_22; +cache['bpmnlint-plugin-camunda-compat/no-expression'] = rule_22; -import rule_23 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-multiple-none-start-events'; +import rule_23 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-loop'; -cache['bpmnlint-plugin-camunda-compat/no-multiple-none-start-events'] = rule_23; +cache['bpmnlint-plugin-camunda-compat/no-loop'] = rule_23; -import rule_24 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-propagate-all-parent-variables'; +import rule_24 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-multiple-none-start-events'; -cache['bpmnlint-plugin-camunda-compat/no-propagate-all-parent-variables'] = rule_24; +cache['bpmnlint-plugin-camunda-compat/no-multiple-none-start-events'] = rule_24; -import rule_25 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-signal-event-sub-process'; +import rule_25 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-propagate-all-parent-variables'; -cache['bpmnlint-plugin-camunda-compat/no-signal-event-sub-process'] = rule_25; +cache['bpmnlint-plugin-camunda-compat/no-propagate-all-parent-variables'] = rule_25; -import rule_26 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-task-schedule'; +import rule_26 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-signal-event-sub-process'; -cache['bpmnlint-plugin-camunda-compat/no-task-schedule'] = rule_26; +cache['bpmnlint-plugin-camunda-compat/no-signal-event-sub-process'] = rule_26; -import rule_27 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-template'; +import rule_27 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-task-schedule'; -cache['bpmnlint-plugin-camunda-compat/no-template'] = rule_27; +cache['bpmnlint-plugin-camunda-compat/no-task-schedule'] = rule_27; -import rule_28 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-properties'; +import rule_28 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-template'; -cache['bpmnlint-plugin-camunda-compat/no-zeebe-properties'] = rule_28; +cache['bpmnlint-plugin-camunda-compat/no-template'] = rule_28; -import rule_29 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-user-task'; +import rule_29 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-properties'; -cache['bpmnlint-plugin-camunda-compat/no-zeebe-user-task'] = rule_29; +cache['bpmnlint-plugin-camunda-compat/no-zeebe-properties'] = rule_29; -import rule_30 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/secrets'; +import rule_30 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-user-task'; -cache['bpmnlint-plugin-camunda-compat/secrets'] = rule_30; +cache['bpmnlint-plugin-camunda-compat/no-zeebe-user-task'] = rule_30; -import rule_31 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/sequence-flow-condition'; +import rule_31 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/secrets'; -cache['bpmnlint-plugin-camunda-compat/sequence-flow-condition'] = rule_31; +cache['bpmnlint-plugin-camunda-compat/secrets'] = rule_31; -import rule_32 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/signal-reference'; +import rule_32 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/sequence-flow-condition'; -cache['bpmnlint-plugin-camunda-compat/signal-reference'] = rule_32; +cache['bpmnlint-plugin-camunda-compat/sequence-flow-condition'] = rule_32; -import rule_33 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/start-event-form'; +import rule_33 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/signal-reference'; -cache['bpmnlint-plugin-camunda-compat/start-event-form'] = rule_33; +cache['bpmnlint-plugin-camunda-compat/signal-reference'] = rule_33; -import rule_34 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/subscription'; +import rule_34 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/start-event-form'; -cache['bpmnlint-plugin-camunda-compat/subscription'] = rule_34; +cache['bpmnlint-plugin-camunda-compat/start-event-form'] = rule_34; -import rule_35 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-schedule'; +import rule_35 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/subscription'; -cache['bpmnlint-plugin-camunda-compat/task-schedule'] = rule_35; +cache['bpmnlint-plugin-camunda-compat/subscription'] = rule_35; -import rule_36 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/timer'; +import rule_36 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-schedule'; -cache['bpmnlint-plugin-camunda-compat/timer'] = rule_36; +cache['bpmnlint-plugin-camunda-compat/task-schedule'] = rule_36; -import rule_37 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-definition'; +import rule_37 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/timer'; -cache['bpmnlint-plugin-camunda-compat/user-task-definition'] = rule_37; +cache['bpmnlint-plugin-camunda-compat/timer'] = rule_37; -import rule_38 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-form'; +import rule_38 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-definition'; -cache['bpmnlint-plugin-camunda-compat/user-task-form'] = rule_38; +cache['bpmnlint-plugin-camunda-compat/user-task-definition'] = rule_38; -import rule_39 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/wait-for-completion'; +import rule_39 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-form'; -cache['bpmnlint-plugin-camunda-compat/wait-for-completion'] = rule_39; \ No newline at end of file +cache['bpmnlint-plugin-camunda-compat/user-task-form'] = rule_39; + +import rule_40 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/wait-for-completion'; + +cache['bpmnlint-plugin-camunda-compat/wait-for-completion'] = rule_40; \ No newline at end of file diff --git a/lib/utils/error-messages.js b/lib/utils/error-messages.js index 8244092..bfd6bf3 100644 --- a/lib/utils/error-messages.js +++ b/lib/utils/error-messages.js @@ -710,6 +710,14 @@ function getPropertyValueNotAllowedErrorMessage(report, executionPlatform, execu return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with disabled`, executionPlatform, executionPlatformVersion, allowedVersion); } + if (isAny(node, [ + 'zeebe:CalledDecision', + 'zeebe:CalledElement', + 'zeebe:FormDefinition' + ]) && property === 'bindingType') { + return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with `, executionPlatform, executionPlatformVersion, allowedVersion); + } + return message; } diff --git a/lib/utils/properties-panel.js b/lib/utils/properties-panel.js index e019321..1b16712 100644 --- a/lib/utils/properties-panel.js +++ b/lib/utils/properties-panel.js @@ -332,6 +332,10 @@ export function getEntryIds(report) { }); } + if (isPropertyError(data, 'bindingType')) { + return [ 'bindingType' ]; + } + return []; } @@ -552,6 +556,10 @@ export function getErrorMessage(id, report) { return 'Must be defined.'; } } + + if (id === 'bindingType') { + return getNotSupportedMessage('', allowedVersion); + } } function isExtensionElementNotAllowedError(data, extensionElement, type) { diff --git a/package-lock.json b/package-lock.json index 4231d14..f6ae9f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "devDependencies": { "bpmn-js": "^17.9.0", "bpmn-js-element-templates": "^1.16.0", - "bpmn-js-properties-panel": "^5.20.0", + "bpmn-js-properties-panel": "^5.21.0", "camunda-bpmn-js-behaviors": "^1.5.0", "chai": "^4.4.1", "cross-env": "^7.0.3", @@ -1482,11 +1482,10 @@ } }, "node_modules/bpmn-js-properties-panel": { - "version": "5.20.0", - "resolved": "https://registry.npmjs.org/bpmn-js-properties-panel/-/bpmn-js-properties-panel-5.20.0.tgz", - "integrity": "sha512-0hj1OdOwEmO7alqG8k33aRgtWrXGqHgCe2Gc1IkvEqdzNNIy0vyIujoHwnmsCar/5g3l8k4ef+AiHfm4+pBTjQ==", + "version": "5.21.0", + "resolved": "https://registry.npmjs.org/bpmn-js-properties-panel/-/bpmn-js-properties-panel-5.21.0.tgz", + "integrity": "sha512-W9mm0EftiRJqara+nDO7q5IhI7syXWmhmbyYv/fR8o9+KqOZJuj7zwg+WKxbZVCgCLRcyVgM96zEF10dTZO5Ug==", "dev": true, - "license": "MIT", "dependencies": { "@bpmn-io/extract-process-variables": "^0.8.0", "array-move": "^4.0.0", @@ -1832,7 +1831,6 @@ "resolved": "https://registry.npmjs.org/camunda-bpmn-js-behaviors/-/camunda-bpmn-js-behaviors-1.5.0.tgz", "integrity": "sha512-LHExkeC+ZallNMirN9pcm3y43ifUS5465mFIRsTUlitU1apgGS/L52NS0tsPXXQvCgNdEMk2bjs/kwiHhBLdSw==", "dev": true, - "license": "MIT", "dependencies": { "ids": "^1.0.0", "min-dash": "^4.0.0" @@ -6625,8 +6623,7 @@ "node_modules/zeebe-bpmn-moddle": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/zeebe-bpmn-moddle/-/zeebe-bpmn-moddle-1.4.0.tgz", - "integrity": "sha512-XSm0fMHPjQ5cmEGxga02du9arxb5NKH5ve7VQ0LFSes4wGcrZ/oJjaR3NlBqH6xTTD3g+Mcbh45+yesydPUQPg==", - "license": "MIT" + "integrity": "sha512-XSm0fMHPjQ5cmEGxga02du9arxb5NKH5ve7VQ0LFSes4wGcrZ/oJjaR3NlBqH6xTTD3g+Mcbh45+yesydPUQPg==" }, "node_modules/zod": { "version": "3.23.8", @@ -7892,9 +7889,9 @@ } }, "bpmn-js-properties-panel": { - "version": "5.20.0", - "resolved": "https://registry.npmjs.org/bpmn-js-properties-panel/-/bpmn-js-properties-panel-5.20.0.tgz", - "integrity": "sha512-0hj1OdOwEmO7alqG8k33aRgtWrXGqHgCe2Gc1IkvEqdzNNIy0vyIujoHwnmsCar/5g3l8k4ef+AiHfm4+pBTjQ==", + "version": "5.21.0", + "resolved": "https://registry.npmjs.org/bpmn-js-properties-panel/-/bpmn-js-properties-panel-5.21.0.tgz", + "integrity": "sha512-W9mm0EftiRJqara+nDO7q5IhI7syXWmhmbyYv/fR8o9+KqOZJuj7zwg+WKxbZVCgCLRcyVgM96zEF10dTZO5Ug==", "dev": true, "requires": { "@bpmn-io/extract-process-variables": "^0.8.0", diff --git a/package.json b/package.json index 3f1c655..282d0d6 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "devDependencies": { "bpmn-js": "^17.9.0", "bpmn-js-element-templates": "^1.16.0", - "bpmn-js-properties-panel": "^5.20.0", + "bpmn-js-properties-panel": "^5.21.0", "camunda-bpmn-js-behaviors": "^1.5.0", "chai": "^4.4.1", "cross-env": "^7.0.3", diff --git a/test/spec/utils/error-messages.spec.js b/test/spec/utils/error-messages.spec.js index f033aeb..8f46924 100644 --- a/test/spec/utils/error-messages.spec.js +++ b/test/spec/utils/error-messages.spec.js @@ -1863,6 +1863,31 @@ describe('utils/error-messages', function() { expect(errorMessage).to.equal('A with disabled is not supported by Camunda 8 (Zeebe 1.0)'); }); + + it('should adjust (binding type set to false)', async function() { + + // given + const node = createElement('bpmn:CallActivity', { + extensionElements: createElement('bpmn:ExtensionElements', { + values: [ + createElement('zeebe:CalledElement', { + bindingType: 'deployment' + }) + ] + }) + }); + + const { default: rule } = await import('bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-binding-type'); + + const report = await getLintError(node, rule); + + // when + const errorMessage = getErrorMessage(report, 'Camunda Cloud', '1.0'); + + // then + expect(errorMessage).to.equal('A with is only supported by Camunda 8.6 or newer'); + }); + });