From dde2f20b1d71f073c0a6975793b3d0f203f404fd Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Fri, 22 Nov 2024 15:05:33 +0100 Subject: [PATCH] fix: remove `zeebe-user-task` rule The rule was added too early as the feature is still supported in all versions of Camunda. Related to https://github.com/camunda/camunda-modeler/issues/4718 --- index.js | 4 +- rules/camunda-cloud/zeebe-user-task.js | 25 ------- .../integration/zeebe-user-task-errors.bpmn | 15 ---- .../integration/zeebe-user-task.bpmn | 17 ----- .../integration/zeebe-user-task.spec.js | 68 ------------------- test/camunda-cloud/zeebe-user-task.spec.js | 50 -------------- test/config/configs.spec.js | 6 +- 7 files changed, 3 insertions(+), 182 deletions(-) delete mode 100644 rules/camunda-cloud/zeebe-user-task.js delete mode 100644 test/camunda-cloud/integration/zeebe-user-task-errors.bpmn delete mode 100644 test/camunda-cloud/integration/zeebe-user-task.bpmn delete mode 100644 test/camunda-cloud/integration/zeebe-user-task.spec.js delete mode 100644 test/camunda-cloud/zeebe-user-task.spec.js diff --git a/index.js b/index.js index d23aeee..6fdc492 100644 --- a/index.js +++ b/index.js @@ -96,7 +96,6 @@ const camundaCloud86Rules = withConfig({ const camundaCloud87Rules = withConfig({ ...omit(camundaCloud86Rules, [ 'no-task-listeners' ]), - 'zeebe-user-task': 'error', 'task-listener': 'error' }, { version: '8.7' }); @@ -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 = { diff --git a/rules/camunda-cloud/zeebe-user-task.js b/rules/camunda-cloud/zeebe-user-task.js deleted file mode 100644 index 97e1f7f..0000000 --- a/rules/camunda-cloud/zeebe-user-task.js +++ /dev/null @@ -1,25 +0,0 @@ -const { is } = require('bpmnlint-utils'); - -const { reportErrors } = require('../utils/reporter'); - -const { skipInNonExecutableProcess } = require('../utils/rule'); - -const { hasExtensionElement } = require('../utils/element'); - -module.exports = skipInNonExecutableProcess(function() { - function check(node, reporter) { - if (!is(node, 'bpmn:UserTask')) { - return; - } - - const errors = hasExtensionElement(node, 'zeebe:UserTask', node); - - if (errors && errors.length) { - reportErrors(node, reporter, errors); - } - } - - return { - check - }; -}); diff --git a/test/camunda-cloud/integration/zeebe-user-task-errors.bpmn b/test/camunda-cloud/integration/zeebe-user-task-errors.bpmn deleted file mode 100644 index 36293b7..0000000 --- a/test/camunda-cloud/integration/zeebe-user-task-errors.bpmn +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/test/camunda-cloud/integration/zeebe-user-task.bpmn b/test/camunda-cloud/integration/zeebe-user-task.bpmn deleted file mode 100644 index c5dcc1d..0000000 --- a/test/camunda-cloud/integration/zeebe-user-task.bpmn +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/test/camunda-cloud/integration/zeebe-user-task.spec.js b/test/camunda-cloud/integration/zeebe-user-task.spec.js deleted file mode 100644 index db37395..0000000 --- a/test/camunda-cloud/integration/zeebe-user-task.spec.js +++ /dev/null @@ -1,68 +0,0 @@ -const { expect } = require('chai'); - -const Linter = require('bpmnlint/lib/linter'); - -const NodeResolver = require('bpmnlint/lib/resolver/node-resolver'); - -const { readModdle } = require('../../helper'); - -const versions = [ - '8.7' -]; - -describe('integration - zeebe-user-task', function() { - - versions.forEach(function(version) { - - let linter; - - beforeEach(function() { - linter = new Linter({ - config: { - extends: `plugin:camunda-compat/camunda-cloud-${ version.replace('.', '-') }` - }, - resolver: new NodeResolver() - }); - }); - - - describe(`Camunda Cloud ${ version }`, function() { - - describe('no errors', function() { - - it('should not have errors', async function() { - - // given - const { root } = await readModdle('test/camunda-cloud/integration/zeebe-user-task.bpmn'); - - // when - const reports = await linter.lint(root); - - // then - expect(reports[ 'camunda-compat/zeebe-user-task' ]).not.to.exist; - }); - - }); - - - describe('errors', function() { - - it('should have errors', async function() { - - // given - const { root } = await readModdle('test/camunda-cloud/integration/zeebe-user-task-errors.bpmn'); - - // when - const reports = await linter.lint(root); - - // then - expect(reports[ 'camunda-compat/zeebe-user-task' ]).to.exist; - }); - - }); - - }); - - }); - -}); \ No newline at end of file diff --git a/test/camunda-cloud/zeebe-user-task.spec.js b/test/camunda-cloud/zeebe-user-task.spec.js deleted file mode 100644 index 3f1cdbe..0000000 --- a/test/camunda-cloud/zeebe-user-task.spec.js +++ /dev/null @@ -1,50 +0,0 @@ -const RuleTester = require('bpmnlint/lib/testers/rule-tester'); - -const rule = require('../../rules/camunda-cloud/zeebe-user-task'); - -const { - createModdle, - createProcess -} = require('../helper'); - -const { ERROR_TYPES } = require('../../rules/utils/element'); - -const valid = [ - { - name: 'zeebe user task (Camunda 8.7)', - config: { version: '8.7' }, - moddleElement: createModdle(createProcess(` - - - - - - `)) - } -]; - -const invalid = [ - { - name: 'job worker user task (Camunda 8.7)', - config: { version: '8.7' }, - moddleElement: createModdle(createProcess(` - - `)), - report: { - id: 'UserTask_1', - message: 'Element of type must have one extension element of type ', - path: [], - data: { - type: ERROR_TYPES.EXTENSION_ELEMENT_REQUIRED, - node: 'UserTask_1', - parentNode: null, - requiredExtensionElement: 'zeebe:UserTask' - } - } - } -]; - -RuleTester.verify('zeebe-user-task', rule, { - valid, - invalid -}); \ No newline at end of file diff --git a/test/config/configs.spec.js b/test/config/configs.spec.js index c6b446c..290536b 100644 --- a/test/config/configs.spec.js +++ b/test/config/configs.spec.js @@ -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' } ] })); @@ -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' })); });