-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from ProcessMaker/validate-empty-signal-ref
- Loading branch information
Showing
15 changed files
with
351 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const { is, isAny } = require('bpmnlint-utils'); | ||
|
||
/** | ||
* A rule that checks that signal events have a signal ref | ||
*/ | ||
module.exports = function() { | ||
|
||
function hasEventDefinitions(node) { | ||
return Array.isArray(node.eventDefinitions) | ||
&& node.eventDefinitions.length > 0; | ||
} | ||
|
||
function filterEventDefinitionsWithoutSignalRef(node) { | ||
return node.eventDefinitions.filter( | ||
eventDefinition => is(eventDefinition, 'bpmn:SignalEventDefinition') | ||
&& !eventDefinition.signalRef | ||
); | ||
} | ||
|
||
function check(node, reporter) { | ||
if (!isAny(node, [ | ||
'bpmn:StartEvent', | ||
'bpmn:EndEvent', | ||
'bpmn:IntermediateCatchEvent', | ||
'bpmn:IntermediateThrowEvent', | ||
'bpmn:BoundaryEvent', | ||
])) { | ||
return; | ||
} | ||
|
||
if (!hasEventDefinitions(node)) { | ||
return; | ||
} | ||
|
||
const missing = filterEventDefinitionsWithoutSignalRef(node); | ||
|
||
if (missing.length > 0) { | ||
reporter.report(node.id, 'Missing signal reference'); | ||
} | ||
} | ||
|
||
return { check }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:pm="http://processmaker.com/BPMN/2.0/Schema.xsd" id="Definitions_03dabax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="ProcessMaker Modeler" exporterVersion="1.0"> | ||
<bpmn:process id="Process_1" isExecutable="true"> | ||
<bpmn:task id="node_1" name="Form Task" pm:assignment="requester" /> | ||
<bpmn:boundaryEvent id="node_2" name="out" attachedToRef="node_1"> | ||
<bpmn:signalEventDefinition signalRef="" /> | ||
</bpmn:boundaryEvent> | ||
</bpmn:process> | ||
<bpmn:signal id="global_1" name="global signal 1" /> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> | ||
<bpmndi:BPMNShape id="node_1_di" bpmnElement="node_1"> | ||
<dc:Bounds x="150" y="130" width="116" height="76" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="node_2_di" bpmnElement="node_2"> | ||
<dc:Bounds x="190" y="112" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn:definitions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:pm="http://processmaker.com/BPMN/2.0/Schema.xsd" id="Definitions_03dabax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="ProcessMaker Modeler" exporterVersion="1.0"> | ||
<bpmn:process id="Process_1" isExecutable="true"> | ||
<bpmn:task id="node_1" name="Form Task" pm:assignment="requester" /> | ||
<bpmn:boundaryEvent id="node_2" name="out" attachedToRef="node_1"> | ||
<bpmn:signalEventDefinition signalRef="global_1" /> | ||
</bpmn:boundaryEvent> | ||
</bpmn:process> | ||
<bpmn:signal id="global_1" name="global signal 1" /> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> | ||
<bpmndi:BPMNShape id="node_1_di" bpmnElement="node_1"> | ||
<dc:Bounds x="150" y="130" width="116" height="76" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="node_2_di" bpmnElement="node_2"> | ||
<dc:Bounds x="190" y="112" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn:definitions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_03dabax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="ProcessMaker Modeler" exporterVersion="1.0"> | ||
<bpmn:process id="Process_1" isExecutable="true"> | ||
<bpmn:endEvent id="node_2" name="Signal End Event"> | ||
<bpmn:signalEventDefinition signalRef="" /> | ||
</bpmn:endEvent> | ||
</bpmn:process> | ||
<bpmn:signal id="global_1" name="global signal 1" /> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> | ||
<bpmndi:BPMNShape id="node_2_di" bpmnElement="node_2"> | ||
<dc:Bounds x="210" y="140" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn:definitions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_03dabax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="ProcessMaker Modeler" exporterVersion="1.0"> | ||
<bpmn:process id="Process_1" isExecutable="true"> | ||
<bpmn:endEvent id="node_2" name="Signal End Event"> | ||
<bpmn:signalEventDefinition signalRef="global_1" /> | ||
</bpmn:endEvent> | ||
</bpmn:process> | ||
<bpmn:signal id="global_1" name="global signal 1" /> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> | ||
<bpmndi:BPMNShape id="node_2_di" bpmnElement="node_2"> | ||
<dc:Bounds x="210" y="140" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn:definitions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_03dabax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="ProcessMaker Modeler" exporterVersion="1.0"> | ||
<bpmn:process id="Process_1" isExecutable="true"> | ||
<bpmn:startEvent id="node_2" name="Signal Start Event"> | ||
<bpmn:signalEventDefinition /> | ||
</bpmn:startEvent> | ||
<bpmn:startEvent id="node_4" name="Start Timer Event"> | ||
<bpmn:timerEventDefinition> | ||
<bpmn:timeCycle>2020-04-17T20:19:00.000Z|R/2020-04-17T20:19:00.000Z/P1W</bpmn:timeCycle> | ||
</bpmn:timerEventDefinition> | ||
</bpmn:startEvent> | ||
<bpmn:startEvent id="node_6" name="Message Start Event"> | ||
<bpmn:messageEventDefinition /> | ||
</bpmn:startEvent> | ||
<bpmn:intermediateCatchEvent id="node_7" name="Intermediate Timer Event"> | ||
<bpmn:timerEventDefinition> | ||
<bpmn:timeDate>2020-04-17T20:34:00.000Z</bpmn:timeDate> | ||
</bpmn:timerEventDefinition> | ||
</bpmn:intermediateCatchEvent> | ||
<bpmn:endEvent id="node_9" name="Error End Event"> | ||
<bpmn:errorEventDefinition errorRef="node_9_error" /> | ||
</bpmn:endEvent> | ||
<bpmn:endEvent id="node_11" name="Terminate End Event"> | ||
<bpmn:terminateEventDefinition /> | ||
</bpmn:endEvent> | ||
<bpmn:intermediateCatchEvent id="node_12" name="Intermediate Timer Event"> | ||
<bpmn:timerEventDefinition> | ||
<bpmn:timeDuration>PT1H</bpmn:timeDuration> | ||
</bpmn:timerEventDefinition> | ||
</bpmn:intermediateCatchEvent> | ||
</bpmn:process> | ||
<bpmn:error id="node_9_error" name="node_9_error" /> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> | ||
<bpmndi:BPMNShape id="node_2_di" bpmnElement="node_2"> | ||
<dc:Bounds x="210" y="90" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="node_4_di" bpmnElement="node_4"> | ||
<dc:Bounds x="210" y="190" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="node_6_di" bpmnElement="node_6"> | ||
<dc:Bounds x="360" y="90" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="node_7_di" bpmnElement="node_7"> | ||
<dc:Bounds x="360" y="190" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="node_9_di" bpmnElement="node_9"> | ||
<dc:Bounds x="510" y="90" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="node_11_di" bpmnElement="node_11"> | ||
<dc:Bounds x="510" y="190" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="node_12_di" bpmnElement="node_12"> | ||
<dc:Bounds x="360" y="310" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn:definitions> |
16 changes: 16 additions & 0 deletions
16
test-diagrams/intermediate-catch-event-signal-ref.invalid.bpmn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_03dabax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="ProcessMaker Modeler" exporterVersion="1.0"> | ||
<bpmn:process id="Process_1" isExecutable="true"> | ||
<bpmn:intermediateCatchEvent id="node_2" name="Intermediate Signal Throw Event"> | ||
<bpmn:signalEventDefinition signalRef="" /> | ||
</bpmn:intermediateCatchEvent> | ||
</bpmn:process> | ||
<bpmn:signal id="global_1" name="global signal 1" /> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> | ||
<bpmndi:BPMNShape id="node_2_di" bpmnElement="node_2"> | ||
<dc:Bounds x="230" y="120" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn:definitions> |
16 changes: 16 additions & 0 deletions
16
test-diagrams/intermediate-catch-event-signal-ref.valid.bpmn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_03dabax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="ProcessMaker Modeler" exporterVersion="1.0"> | ||
<bpmn:process id="Process_1" isExecutable="true"> | ||
<bpmn:intermediateCatchEvent id="node_2" name="Intermediate Signal Throw Event"> | ||
<bpmn:signalEventDefinition signalRef="global_1" /> | ||
</bpmn:intermediateCatchEvent> | ||
</bpmn:process> | ||
<bpmn:signal id="global_1" name="global signal 1" /> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> | ||
<bpmndi:BPMNShape id="node_2_di" bpmnElement="node_2"> | ||
<dc:Bounds x="230" y="120" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn:definitions> |
16 changes: 16 additions & 0 deletions
16
test-diagrams/intermediate-throw-event-signal-ref.invalid.bpmn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_03dabax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="ProcessMaker Modeler" exporterVersion="1.0"> | ||
<bpmn:process id="Process_1" isExecutable="true"> | ||
<bpmn:intermediateThrowEvent id="node_2" name="Intermediate Signal Throw Event"> | ||
<bpmn:signalEventDefinition signalRef="" /> | ||
</bpmn:intermediateThrowEvent> | ||
</bpmn:process> | ||
<bpmn:signal id="global_1" name="global signal 1" /> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> | ||
<bpmndi:BPMNShape id="node_2_di" bpmnElement="node_2"> | ||
<dc:Bounds x="230" y="120" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn:definitions> |
16 changes: 16 additions & 0 deletions
16
test-diagrams/intermediate-throw-event-signal-ref.valid.bpmn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_03dabax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="ProcessMaker Modeler" exporterVersion="1.0"> | ||
<bpmn:process id="Process_1" isExecutable="true"> | ||
<bpmn:intermediateThrowEvent id="node_2" name="Intermediate Signal Throw Event"> | ||
<bpmn:signalEventDefinition signalRef="global_1" /> | ||
</bpmn:intermediateThrowEvent> | ||
</bpmn:process> | ||
<bpmn:signal id="global_1" name="global signal 1" /> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> | ||
<bpmndi:BPMNShape id="node_2_di" bpmnElement="node_2"> | ||
<dc:Bounds x="230" y="120" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn:definitions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_03dabax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="ProcessMaker Modeler" exporterVersion="1.0"> | ||
<bpmn:process id="Process_1" isExecutable="true"> | ||
<bpmn:startEvent id="node_2" name="Signal Start Event"> | ||
<bpmn:signalEventDefinition signalRef="" /> | ||
</bpmn:startEvent> | ||
</bpmn:process> | ||
<bpmn:signal id="global_1" name="global signal 1" /> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> | ||
<bpmndi:BPMNShape id="node_2_di" bpmnElement="node_2"> | ||
<dc:Bounds x="280" y="160" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn:definitions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_03dabax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="ProcessMaker Modeler" exporterVersion="1.0"> | ||
<bpmn:process id="Process_1" isExecutable="true"> | ||
<bpmn:startEvent id="node_2" name="Signal Start Event"> | ||
<bpmn:signalEventDefinition signalRef="global_1" /> | ||
</bpmn:startEvent> | ||
</bpmn:process> | ||
<bpmn:signal id="global_1" name="global signal 1" /> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> | ||
<bpmndi:BPMNShape id="node_2_di" bpmnElement="node_2"> | ||
<dc:Bounds x="280" y="160" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn:definitions> |
Oops, something went wrong.