From 8f3db081cd1d4314c7db03a95b72f0e357075c9e Mon Sep 17 00:00:00 2001 From: Philipp Date: Mon, 25 Sep 2023 09:43:02 +0200 Subject: [PATCH 1/4] deps: update bpmnlint-plugin-camunda-compat to v2.8.0 --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7083638..afd65d5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@bpmn-io/diagram-js-ui": "^0.2.2", "bpmn-moddle": "^8.0.0", "bpmnlint": "^9.2.0", - "bpmnlint-plugin-camunda-compat": "^2.7.1", + "bpmnlint-plugin-camunda-compat": "^2.8.0", "bpmnlint-utils": "^1.0.2", "camunda-bpmn-moddle": "^7.0.1", "clsx": "^2.0.0", @@ -1372,9 +1372,9 @@ } }, "node_modules/bpmnlint-plugin-camunda-compat": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/bpmnlint-plugin-camunda-compat/-/bpmnlint-plugin-camunda-compat-2.7.1.tgz", - "integrity": "sha512-ngk+H8cn89emvfitxBMFzVVFeIcMQ4inB7iJR1mY2MW9SZUXP5H6EEpMgc7sJHjzdeBYCFJJae215NyHZf7azQ==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/bpmnlint-plugin-camunda-compat/-/bpmnlint-plugin-camunda-compat-2.8.0.tgz", + "integrity": "sha512-JE1SDyk2zZSrLpCxIFrskuf04CZW/aUVUxk/SgHFn+XiHWUPj/nq223TsVvgO/4oR7JhcNLhjUqgEsMzL2eG9Q==", "dependencies": { "@bpmn-io/feel-lint": "^1.0.0", "@bpmn-io/moddle-utils": "^0.1.0", @@ -7366,9 +7366,9 @@ } }, "bpmnlint-plugin-camunda-compat": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/bpmnlint-plugin-camunda-compat/-/bpmnlint-plugin-camunda-compat-2.7.1.tgz", - "integrity": "sha512-ngk+H8cn89emvfitxBMFzVVFeIcMQ4inB7iJR1mY2MW9SZUXP5H6EEpMgc7sJHjzdeBYCFJJae215NyHZf7azQ==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/bpmnlint-plugin-camunda-compat/-/bpmnlint-plugin-camunda-compat-2.8.0.tgz", + "integrity": "sha512-JE1SDyk2zZSrLpCxIFrskuf04CZW/aUVUxk/SgHFn+XiHWUPj/nq223TsVvgO/4oR7JhcNLhjUqgEsMzL2eG9Q==", "requires": { "@bpmn-io/feel-lint": "^1.0.0", "@bpmn-io/moddle-utils": "^0.1.0", diff --git a/package.json b/package.json index c8b8007..5d433ae 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@bpmn-io/diagram-js-ui": "^0.2.2", "bpmn-moddle": "^8.0.0", "bpmnlint": "^9.2.0", - "bpmnlint-plugin-camunda-compat": "^2.7.1", + "bpmnlint-plugin-camunda-compat": "^2.8.0", "bpmnlint-utils": "^1.0.2", "camunda-bpmn-moddle": "^7.0.1", "clsx": "^2.0.0", From c8cde8ef4551ffca215cac1a95347de991fbe14f Mon Sep 17 00:00:00 2001 From: Philipp Date: Fri, 22 Sep 2023 12:36:51 +0200 Subject: [PATCH 2/4] chore: simplify utility for readability --- lib/utils/properties-panel.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/utils/properties-panel.js b/lib/utils/properties-panel.js index a459e5a..c427317 100644 --- a/lib/utils/properties-panel.js +++ b/lib/utils/properties-panel.js @@ -226,7 +226,7 @@ export function getEntryIds(report) { ]; for (const [ type, prefix ] of LIST_PROPERTIES) { - if (hasType(data, type) + if (isType(data, type) && getPropertyName(data)) { const index = path[ path.length - 2 ]; @@ -235,7 +235,7 @@ export function getEntryIds(report) { } } - if (hasType(data, 'zeebe:LoopCharacteristics')) { + if (isType(data, 'zeebe:LoopCharacteristics')) { return [ `multiInstance-${getPropertyName(data)}` ]; } @@ -498,14 +498,16 @@ function isPropertyError(data, property, type) { && (!type || is(data.node, type)); } -function hasType(data, type) { - return data.node && is(data.node, type); -} - function getPropertyName(data) { - const propertyKey = data.type === ERROR_TYPES.PROPERTY_REQUIRED ? 'requiredProperty' : 'property'; + if (data.type === ERROR_TYPES.PROPERTY_REQUIRED) { + return data.requiredProperty; + } - return data[ propertyKey ]; + return data.property; +} + +function isType(data, type) { + return data.node && is(data.node, type); } function isOneOfPropertiesRequiredError(data, requiredProperty, type) { From df20b036cdd658ecfa7b35bc8b3a5653294e16db Mon Sep 17 00:00:00 2001 From: Philipp Date: Fri, 22 Sep 2023 12:57:47 +0200 Subject: [PATCH 3/4] fix: do not try and get errors for reports that are not errors --- lib/utils/properties-panel.js | 16 +++--- test/spec/utils/properties-panel-info.bpmn | 43 ++++++++++++++++ test/spec/utils/properties-panel.spec.js | 59 ++++++++++++++++++++-- 3 files changed, 109 insertions(+), 9 deletions(-) create mode 100644 test/spec/utils/properties-panel-info.bpmn diff --git a/lib/utils/properties-panel.js b/lib/utils/properties-panel.js index c427317..8c8b81b 100644 --- a/lib/utils/properties-panel.js +++ b/lib/utils/properties-panel.js @@ -22,7 +22,11 @@ const TIMER_PROPERTIES = [ */ export function getErrors(reports, element) { return reports.reduce((errors, report) => { - if (!element || getBusinessObject(element).get('id') !== report.id) { + const { category } = report; + + if (!element + || getBusinessObject(element).get('id') !== report.id + || category !== 'error') { return errors; } @@ -298,10 +302,6 @@ export function getErrorMessage(id, report) { return 'Cannot be an expression.'; } - if (data.type === ERROR_TYPES.SECRET_EXPRESSION_FORMAT_DEPRECATED) { - return 'Secret expression format deprecated.'; - } - if (id === 'isExecutable') { const { parentNode } = data; @@ -384,7 +384,11 @@ export function getErrorMessage(id, report) { return 'Type must be defined.'; } - if (id === 'messageSubscriptionCorrelationKey') { + if (id === 'messageSubscriptionCorrelationKey' + && [ + ERROR_TYPES.EXTENSION_ELEMENT_REQUIRED, + ERROR_TYPES.PROPERTY_REQUIRED + ].includes(data.type)) { return 'Subscription correlation key must be defined.'; } diff --git a/test/spec/utils/properties-panel-info.bpmn b/test/spec/utils/properties-panel-info.bpmn new file mode 100644 index 0000000..491a82b --- /dev/null +++ b/test/spec/utils/properties-panel-info.bpmn @@ -0,0 +1,43 @@ + + + + + SequenceFlow_1 + + + + + + + + SequenceFlow_1 + SequenceFlow_2 + + + + SequenceFlow_2 + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/spec/utils/properties-panel.spec.js b/test/spec/utils/properties-panel.spec.js index be575a5..841425f 100644 --- a/test/spec/utils/properties-panel.spec.js +++ b/test/spec/utils/properties-panel.spec.js @@ -21,6 +21,7 @@ import { } from './lint-helper'; import propertiesPanelXML from './properties-panel.bpmn'; +import propertiesPanelInfoXML from './properties-panel-info.bpmn'; import propertiesPanelPlatformXML from './properties-panel-platform.bpmn'; describe('utils/properties-panel', function() { @@ -1590,7 +1591,7 @@ describe('utils/properties-panel', function() { // then expect(entryIds).to.eql([ 'messageSubscriptionCorrelationKey' ]); - expectErrorMessage(entryIds[ 0 ], 'Secret expression format deprecated.', report); + expectNoErrorMessage(entryIds[ 0 ], report); }); @@ -1622,7 +1623,7 @@ describe('utils/properties-panel', function() { // then expect(entryIds).to.eql([ 'ServiceTask_1-input-0-source' ]); - expectErrorMessage(entryIds[ 0 ], 'Secret expression format deprecated.', report); + expectNoErrorMessage(entryIds[ 0 ], report); }); @@ -1654,7 +1655,7 @@ describe('utils/properties-panel', function() { // then expect(entryIds).to.eql([ 'ServiceTask_1-extensionProperty-0-value' ]); - expectErrorMessage(entryIds[ 0 ], 'Secret expression format deprecated.', report); + expectNoErrorMessage(entryIds[ 0 ], report); }); }); @@ -1759,6 +1760,54 @@ describe('utils/properties-panel', function() { }); }); + + it('should not return errors for category info', async function() { + + // given + const linter = new Linter(); + + const { root } = await createModdle(propertiesPanelInfoXML); + + const reports = await linter.lint(root); + + // when + let element = root.rootElements[ 0 ].flowElements.find(({ id }) => id === 'Task_1'); + + let errors = getErrors(reports, element); + + // then + expect(errors).to.be.empty; + }); + + + it('should not return errors for category info', async function() { + + // given + const linter = new Linter({ + plugins: [ + { + config: { + rules: { + 'camunda-compat/secrets': 'warn' + } + } + } + ] + }); + + const { root } = await createModdle(propertiesPanelInfoXML); + + const reports = await linter.lint(root); + + // when + let element = root.rootElements[ 0 ].flowElements.find(({ id }) => id === 'Task_1'); + + let errors = getErrors(reports, element); + + // then + expect(errors).to.be.empty; + }); + }); }); @@ -1825,4 +1874,8 @@ function expectErrorMessage(id, expectedErrorMessage, report) { // then expect(errorMessage).to.equal(expectedErrorMessage); +} + +function expectNoErrorMessage(id, report) { + expectErrorMessage(id, undefined, report); } \ No newline at end of file From b572c8e8c5eed2c9c4a732c23083ea1f476a4b80 Mon Sep 17 00:00:00 2001 From: Philipp Date: Mon, 25 Sep 2023 10:43:15 +0200 Subject: [PATCH 4/4] chore: adjust `no-signal-event-subprocess` error message to changes --- test/spec/utils/error-messages.spec.js | 2 +- test/spec/utils/properties-panel.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/spec/utils/error-messages.spec.js b/test/spec/utils/error-messages.spec.js index 0448a69..b7f2622 100644 --- a/test/spec/utils/error-messages.spec.js +++ b/test/spec/utils/error-messages.spec.js @@ -63,7 +63,7 @@ describe('utils/error-messages', function() { const errorMessage = getErrorMessage(report, 'Camunda Cloud', executionPlatformVersion); // then - expect(errorMessage).to.equal('A in a is not supported by Camunda 8.2'); + expect(errorMessage).to.equal('A in a is only supported by Camunda 8.3 or newer'); }); }); diff --git a/test/spec/utils/properties-panel.spec.js b/test/spec/utils/properties-panel.spec.js index 841425f..a601885 100644 --- a/test/spec/utils/properties-panel.spec.js +++ b/test/spec/utils/properties-panel.spec.js @@ -1780,7 +1780,7 @@ describe('utils/properties-panel', function() { }); - it('should not return errors for category info', async function() { + it('should not return errors for category warn', async function() { // given const linter = new Linter({