bpmn-io / bpmnlint

Validate BPMN diagrams based on configurable lint rules.
MIT License
125 stars 37 forks source link

No duplicate names rule proposal #153

Open danielriedmueller opened 4 days ago

danielriedmueller commented 4 days ago

No Duplicate Names (no-duplicate-names)

A rule that checks, whether two elements have the same name.

Example of incorrect usage for this rule:

Incorrect usage example

    ...
    <bpmn:startEvent id="StartEvent_070f514" name="Element A">
      <bpmn:outgoing>Flow_1fnaiy8</bpmn:outgoing>
    </bpmn:startEvent>
    <bpmn:endEvent id="Event_1copj14" name="Element A">
      <bpmn:incoming>Flow_1fnaiy8</bpmn:incoming>
    </bpmn:endEvent>
    ...

Example of correct usage for this rule:

Correct usage example

    ...
    <bpmn:startEvent id="StartEvent_070f514" name="Element A">
      <bpmn:outgoing>Flow_1fnaiy8</bpmn:outgoing>
    </bpmn:startEvent>
    <bpmn:endEvent id="Event_1copj14" name="Element B">
      <bpmn:incoming>Flow_1fnaiy8</bpmn:incoming>
    </bpmn:endEvent>
    ...

How does the rule improve the BPMN diagram?

With unique named elements, each element could be recognized by a human (IDs are not human friendly readable) and for further processing, like unique description pages for each element with nice titles.

Rule Details

What alternatives did you consider?

In our project, we need to have each elements name be unique. The unique ids are not human friendly readable. Alternative would be to auto rename name, if same name already exists (this would be the workaround in our project). Our project if you are interested: https://www.mediawiki.org/wiki/Extension:Cognitive_Process_Designer

nikku commented 4 days ago

I think this is a great proposal for a rule, thanks for sharing :star_struck:

barmac commented 3 days ago

While the rule may be useful, I'd rather not include it in the recommended ruleset. There can be multiple exceptions, e.g. for outcoming flows of an exclusive gateway:

image
nikku commented 1 day ago

I think we'd be just fine if we whitelist outgoing flows.

nikku commented 1 day ago

We also want to whitelist labels on gateways and throw events:

image