Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not error for job worker user task #182

Merged
merged 3 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ const camundaCloud86Rules = withConfig({

const camundaCloud87Rules = withConfig({
...omit(camundaCloud86Rules, [ 'no-task-listeners' ]),
'zeebe-user-task': 'error',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to remove the rule and all related tests for now. We don't keep rules in the codebase that aren't used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a complete rule removal is a breaking change. I don't think it's necessary for the bugfix.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I consider the rule being there a bug. We remove it, we fix the bug. 😆

'task-listener': 'error'
}, { version: '8.7' });

Expand Down Expand Up @@ -174,8 +173,7 @@ const rules = {
'user-task-definition': './rules/camunda-cloud/user-task-definition',
'user-task-form': './rules/camunda-cloud/user-task-form',
'version-tag': './rules/camunda-cloud/version-tag',
'wait-for-completion': './rules/camunda-cloud/wait-for-completion',
'zeebe-user-task': './rules/camunda-cloud/zeebe-user-task'
'wait-for-completion': './rules/camunda-cloud/wait-for-completion'
};

const configs = {
Expand Down
11 changes: 2 additions & 9 deletions rules/camunda-cloud/task-listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ const { is } = require('bpmnlint-utils');

const {
findExtensionElement,
hasProperties,
hasExtensionElement
hasProperties
} = require('../utils/element');

const { reportErrors } = require('../utils/reporter');
Expand All @@ -17,20 +16,14 @@ module.exports = skipInNonExecutableProcess(function() {
return;
}

let errors = hasExtensionElement(node, 'zeebe:UserTask', node);

if (errors && errors.length) {
reportErrors(node, reporter, errors);
}

const taskListeners = findExtensionElement(node, 'zeebe:TaskListeners');

if (!taskListeners) {
return;
}

const listeners = taskListeners.get('listeners');
errors = listeners.flatMap(listener => hasProperties(listener, {
const errors = listeners.flatMap(listener => hasProperties(listener, {
type: {
required: true
}
Expand Down
25 changes: 0 additions & 25 deletions rules/camunda-cloud/zeebe-user-task.js

This file was deleted.

15 changes: 0 additions & 15 deletions test/camunda-cloud/integration/zeebe-user-task-errors.bpmn

This file was deleted.

17 changes: 0 additions & 17 deletions test/camunda-cloud/integration/zeebe-user-task.bpmn

This file was deleted.

68 changes: 0 additions & 68 deletions test/camunda-cloud/integration/zeebe-user-task.spec.js

This file was deleted.

31 changes: 7 additions & 24 deletions test/camunda-cloud/task-listener.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,17 @@ const valid = [
</bpmn:extensionElements>
</bpmn:userTask>
`))
},
{
name: 'job worker user task without tasklisteners',
config: { version: '8.7' },
moddleElement: createModdle(createProcess(`
<bpmn:userTask id="UserTask_1"/>
`))
}
];

const invalid = [
{
name: 'task listener not in zeebe:UserTask',
config: { version: '8.7' },
moddleElement: createModdle(createProcess(`
<bpmn:userTask id="UserTask_1">
<bpmn:extensionElements>
<zeebe:taskListeners>
<zeebe:taskListener eventType="complete" type="complete_listener" />
</zeebe:taskListeners>
</bpmn:extensionElements>
</bpmn:userTask>
`)),
report: {
id: 'UserTask_1',
message: 'Element of type <bpmn:UserTask> must have one extension element of type <zeebe:UserTask>',
path: [],
data: {
type: ERROR_TYPES.EXTENSION_ELEMENT_REQUIRED,
node: 'UserTask_1',
parentNode: null,
requiredExtensionElement: 'zeebe:UserTask'
}
}
},
{
name: 'task listener with empty type',
config: { version: '8.7' },
Expand Down
50 changes: 0 additions & 50 deletions test/camunda-cloud/zeebe-user-task.spec.js

This file was deleted.

6 changes: 2 additions & 4 deletions test/config/configs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,7 @@ describe('configs', function() {
'user-task-definition': [ 'warn', { version: '8.7' } ],
'user-task-form': [ 'error', { version: '8.7' } ],
'version-tag': [ 'error', { version: '8.7' } ],
'wait-for-completion': [ 'error', { version: '8.7' } ],
'zeebe-user-task': [ 'error', { version: '8.7' } ]
'wait-for-completion': [ 'error', { version: '8.7' } ]
}));


Expand Down Expand Up @@ -507,8 +506,7 @@ describe('configs', function() {
'user-task-definition': 'warn',
'user-task-form': 'error',
'version-tag': 'error',
'wait-for-completion': 'error',
'zeebe-user-task': 'error'
'wait-for-completion': 'error'
}));

});
Expand Down