Skip to content

Commit

Permalink
feat: lint zeebe:bindingType
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Aug 1, 2024
1 parent bd2ef2d commit d124e10
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 54 deletions.
89 changes: 47 additions & 42 deletions lib/compiled-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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;
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;
8 changes: 8 additions & 0 deletions lib/utils/error-messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,14 @@ function getPropertyValueNotAllowedErrorMessage(report, executionPlatform, execu
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <Propagate all variables> disabled`, executionPlatform, executionPlatformVersion, allowedVersion);
}

if (isAny(node, [
'zeebe:CalledDecision',
'zeebe:CalledElement',
'zeebe:FormDefinition'
]) && property === 'bindingType') {
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <Binding: deployment>`, executionPlatform, executionPlatformVersion, allowedVersion);
}

return message;
}

Expand Down
8 changes: 8 additions & 0 deletions lib/utils/properties-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,10 @@ export function getEntryIds(report) {
});
}

if (isPropertyError(data, 'bindingType')) {
return [ 'bindingType' ];
}

return [];
}

Expand Down Expand Up @@ -552,6 +556,10 @@ export function getErrorMessage(id, report) {
return 'Must be defined.';
}
}

if (id === 'bindingType') {
return getNotSupportedMessage('', allowedVersion);
}
}

function isExtensionElementNotAllowedError(data, extensionElement, type) {
Expand Down
19 changes: 8 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
25 changes: 25 additions & 0 deletions test/spec/utils/error-messages.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1863,6 +1863,31 @@ describe('utils/error-messages', function() {
expect(errorMessage).to.equal('A <Compensate End Event> with <Wait for completion> 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 <Call Activity> with <Binding: deployment> is only supported by Camunda 8.6 or newer');
});

});


Expand Down

0 comments on commit d124e10

Please sign in to comment.