Skip to content

Commit

Permalink
feat: adjust the zeebe:userTask required message
Browse files Browse the repository at this point in the history
  • Loading branch information
Skaiir authored and barmac committed Dec 12, 2024
1 parent 024b138 commit 47b222a
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 35 deletions.
53 changes: 29 additions & 24 deletions lib/compiled-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const rules = {
"camunda-compat/no-zeebe-properties": "error",
"camunda-compat/no-zeebe-user-task": "error",
"camunda-compat/priority-definition": "error",
"camunda-compat/zeebe-user-task": "warn",
"camunda-compat/secrets": "warn",
"camunda-compat/sequence-flow-condition": "error",
"camunda-compat/signal-reference": "error",
Expand Down Expand Up @@ -231,50 +232,54 @@ import rule_34 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/priority

cache['bpmnlint-plugin-camunda-compat/priority-definition'] = rule_34;

import rule_35 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/secrets';
import rule_35 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/zeebe-user-task';

cache['bpmnlint-plugin-camunda-compat/secrets'] = rule_35;
cache['bpmnlint-plugin-camunda-compat/zeebe-user-task'] = rule_35;

import rule_36 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/sequence-flow-condition';
import rule_36 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/secrets';

cache['bpmnlint-plugin-camunda-compat/sequence-flow-condition'] = rule_36;
cache['bpmnlint-plugin-camunda-compat/secrets'] = rule_36;

import rule_37 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/signal-reference';
import rule_37 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/sequence-flow-condition';

cache['bpmnlint-plugin-camunda-compat/signal-reference'] = rule_37;
cache['bpmnlint-plugin-camunda-compat/sequence-flow-condition'] = rule_37;

import rule_38 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/start-event-form';
import rule_38 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/signal-reference';

cache['bpmnlint-plugin-camunda-compat/start-event-form'] = rule_38;
cache['bpmnlint-plugin-camunda-compat/signal-reference'] = rule_38;

import rule_39 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/subscription';
import rule_39 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/start-event-form';

cache['bpmnlint-plugin-camunda-compat/subscription'] = rule_39;
cache['bpmnlint-plugin-camunda-compat/start-event-form'] = rule_39;

import rule_40 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-listener';
import rule_40 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/subscription';

cache['bpmnlint-plugin-camunda-compat/task-listener'] = rule_40;
cache['bpmnlint-plugin-camunda-compat/subscription'] = rule_40;

import rule_41 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-schedule';
import rule_41 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-listener';

cache['bpmnlint-plugin-camunda-compat/task-schedule'] = rule_41;
cache['bpmnlint-plugin-camunda-compat/task-listener'] = rule_41;

import rule_42 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/timer';
import rule_42 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-schedule';

cache['bpmnlint-plugin-camunda-compat/timer'] = rule_42;
cache['bpmnlint-plugin-camunda-compat/task-schedule'] = rule_42;

import rule_43 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-definition';
import rule_43 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/timer';

cache['bpmnlint-plugin-camunda-compat/user-task-definition'] = rule_43;
cache['bpmnlint-plugin-camunda-compat/timer'] = rule_43;

import rule_44 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-form';
import rule_44 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-definition';

cache['bpmnlint-plugin-camunda-compat/user-task-form'] = rule_44;
cache['bpmnlint-plugin-camunda-compat/user-task-definition'] = rule_44;

import rule_45 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/version-tag';
import rule_45 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-form';

cache['bpmnlint-plugin-camunda-compat/version-tag'] = rule_45;
cache['bpmnlint-plugin-camunda-compat/user-task-form'] = rule_45;

import rule_46 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/wait-for-completion';
import rule_46 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/version-tag';

cache['bpmnlint-plugin-camunda-compat/wait-for-completion'] = rule_46;
cache['bpmnlint-plugin-camunda-compat/version-tag'] = rule_46;

import rule_47 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/wait-for-completion';

cache['bpmnlint-plugin-camunda-compat/wait-for-completion'] = rule_47;
5 changes: 5 additions & 0 deletions lib/utils/documentation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const baseUrl = 'https://docs.camunda.io/docs/next/components/modeler/reference/modeling-guidance/rules';
const userTaskMigrationUrl = 'https://docs.camunda.io/docs/next/apis-tools/migration-manuals/migrate-to-zeebe-user-tasks';

export function getDocumentationUrl(rule) {
if (rule === 'camunda-compat/called-element') {
Expand Down Expand Up @@ -29,6 +30,10 @@ export function getDocumentationUrl(rule) {
return getUrl('history-time-to-live');
}

if (rule === 'camunda-compat/zeebe-user-task') {
return userTaskMigrationUrl;
}

return null;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/utils/error-messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function getErrorMessage(report, executionPlatform, executionPlatformVers
}

if (type === ERROR_TYPES.EXTENSION_ELEMENT_REQUIRED) {
return getExtensionElementRequiredErrorMessage(report);
return getExtensionElementRequiredErrorMessage(report, executionPlatform, executionPlatformVersion);
}

if (type === ERROR_TYPES.PROPERTY_DEPENDENT_REQUIRED) {
Expand Down Expand Up @@ -347,7 +347,7 @@ function getExtensionElementNotAllowedErrorMessage(report, executionPlatform, ex
return message;
}

function getExtensionElementRequiredErrorMessage(report) {
function getExtensionElementRequiredErrorMessage(report, executionPlatform, executionPlatformVersion) {
const {
data,
message
Expand Down Expand Up @@ -390,7 +390,7 @@ function getExtensionElementRequiredErrorMessage(report) {
}

if (requiredExtensionElement === 'zeebe:UserTask') {
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have <Implementation: Zeebe user task>`;
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Implementation: Job worker> is deprecated on ${ getExecutionPlatformLabel(executionPlatform, executionPlatformVersion) }. Consider migrating to <Implementation: Zeebe user task>.`;
}

return message;
Expand Down
14 changes: 7 additions & 7 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 @@ -32,7 +32,7 @@
"@bpmn-io/diagram-js-ui": "^0.2.3",
"bpmn-moddle": "^9.0.1",
"bpmnlint": "^10.3.1",
"bpmnlint-plugin-camunda-compat": "^2.28.1",
"bpmnlint-plugin-camunda-compat": "^2.29.0",
"bpmnlint-utils": "^1.0.2",
"camunda-bpmn-moddle": "^7.0.1",
"clsx": "^2.0.0",
Expand Down
20 changes: 20 additions & 0 deletions test/spec/utils/error-messages.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,26 @@ describe('utils/error-messages', function() {
// then
expect(errorMessage).to.equal('A <User Task> should have a defined <Form>');
});


it('should adjust (zeebe:UserTask)', async function() {

// given
const executionPlatformVersion = '8.6';

const node = createElement('bpmn:UserTask');

const { default: rule } = await import('bpmnlint-plugin-camunda-compat/rules/camunda-cloud/zeebe-user-task');

const report = await getLintError(node, rule);

// when
const errorMessage = getErrorMessage(report, 'Camunda Cloud', executionPlatformVersion);

// then
expect(errorMessage).to.equal('A <User Task> with <Implementation: Job worker> is deprecated on Camunda 8.6. Consider migrating to <Implementation: Zeebe user task>.');
});

});


Expand Down

0 comments on commit 47b222a

Please sign in to comment.