camunda / bpmnlint-plugin-camunda

Camunda model guidelines, packed as a bpmnlint plug-in.
MIT License
5 stars 2 forks source link

Linter Rules `camunda/implementation` fails when extension elements exists on bpmn element #24

Closed jonathanlukas closed 1 year ago

jonathanlukas commented 1 year ago

Describe the bug

When a bpmn diagram contains bpmn:extensionElements on a bpmn element, the linting rule breaks.

rule <camunda/implementation> failed with error:  TypeError: extensionElements.some is not a function
    at hasConnector (implementation.js:63:1)
    at check (implementation.js:27:1)
    at r.enter (test-rule.js:70:30)
    at e (traverse.js:13:33)
    at traverse.js:29:13
    at Array.forEach (<anonymous>)
    at traverse.js:28:25
    at Array.forEach (<anonymous>)
    at e (traverse.js:23:25)
    at traverse.js:29:13
    at Array.forEach (<anonymous>)
    at traverse.js:28:25
    at Array.forEach (<anonymous>)
    at e (traverse.js:23:25)
    at e.exports (test-rule.js:69:3)
    at i.applyRule (linter.js:54:21)
    at linter.js:240:28
    at Array.forEach (<anonymous>)
    at linter.js:234:21
    at async $d.lint (Linter.js:61:11)
    at async op.lintTab (App.js:875:11)
    at async App.js:2315:7

This error is caught and written to the linter, but without an id of the element. On processing the reports on the linting tab, this leads to an exception when generating the report name.

TypeError: Cannot read properties of undefined (reading 'toLowerCase')
    at B (LintingTab.js:110:13)
    at LintingTab.js:127:11
    at Array.sort (<anonymous>)
    at LintingTab.js:124:25
    at P (LintingTab.js:54:7)
    at Ho (react-dom.production.min.js:150:96)
    at wi (react-dom.production.min.js:166:273)
    at react-dom.production.min.js:179:453
    at Rs (react-dom.production.min.js:232:22)
    at Ns (react-dom.production.min.js:233:284)
    at xa (react-dom.production.min.js:249:348)
    at Ca (react-dom.production.min.js:248:144)
    at ga (react-dom.production.min.js:245:332)
    at qs (react-dom.production.min.js:243:86)
    at Object.enqueueSetState (react-dom.production.min.js:130:228)
    at C.setState (react.production.min.js:13:224)
    at op.setLintingState (App.js:900:10)
    at op.lintTab (App.js:877:10)
    at async App.js:2315:7

Steps to reproduce

  1. Activate this rule set on the Camunda Modeler

  2. Open this diagram: failing-element-template.bpmn.txt

  3. The rule breaks

Expected behavior

The rule should just run through and not crash

Environment

Additional context

No response

philippfromme commented 1 year ago

Can you share the diagram? The implementation rule shouldn't be used to lint Camunda 7 diagrams.

jonathanlukas commented 1 year ago

failing-element-template.bpmn.txt

When applying the above provided template to this bpmn xml, the modeler breaks.

nikku commented 1 year ago

This is a bug we want to fix.

nikku commented 1 year ago

I've tried to reproduce this issue using the context you provided @jonathanlukas and failed:

Please ensure it is not plug-ins causing this side-effect.


image



    <bpmn:serviceTask id="Activity_06jyj77" name="This task cannot have an element template applied" camunda:modelerTemplate="deepJavaNestedConnector" camunda:type="external" camunda:topic="deepNestedConnector">
      <bpmn:extensionElements>
        <camunda:inputOutput>
          <camunda:inputParameter name="inputVariableName" />
          <camunda:inputParameter name="inputDataMapper" />
          <camunda:inputParameter name="outputDataMapper" />
        </camunda:inputOutput>
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_1cbjocq</bpmn:incoming>
    </bpmn:serviceTask>
nikku commented 1 year ago

@jonathanlukas Moved this issue over to camunda/bpmnlint-plugin-camunda as we found these rules blow up on the diagram in question. Please update your steps to reproduce (share a diagram that blows the linter up) and we can take bug fixing from there.

nikku commented 1 year ago

PR fixing this issue via https://github.com/camunda/bpmnlint-plugin-camunda/pull/25.

nikku commented 1 year ago

Closed via https://github.com/camunda/bpmnlint-plugin-camunda/pull/25.