Skip to content

Commit

Permalink
Fixed script task required script rule when script type is external r…
Browse files Browse the repository at this point in the history
…esource
  • Loading branch information
membro committed Oct 12, 2021
1 parent b3d3e2a commit 80e8ac0
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 3 deletions.
6 changes: 5 additions & 1 deletion bpmnlint-plugin-custom/rules/script-task-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ module.exports = function () {
return reporter.report(node.id, 'Only `js/javascript` are supported script formats');
}

if (!node.script) {
if ('script' in node && !node.script) {
reporter.report(node.id, 'Script must be defined');
}

if ('resource' in node && !node.resource) {
reporter.report(node.id, 'Resource must be defined');
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion dist/client.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/client.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions test/rules/script-task-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ RuleTester.verify('script-task-error', rule, {
valid: [
{
moddleElement: readModdle(__dirname + '/script-task-error/valid.bpmn')
},
{
moddleElement: readModdle(__dirname + '/script-task-error/valid-resource.bpmn')
}
],
invalid: [
Expand Down
38 changes: 38 additions & 0 deletions test/rules/script-task-error/valid-resource.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_13cv35p" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.10.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
<bpmn:process id="js" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_1hn5qoa</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_1hn5qoa" sourceRef="StartEvent_1" targetRef="script_task" />
<bpmn:endEvent id="Event_1f8qgj7">
<bpmn:incoming>Flow_1bem8gr</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_1bem8gr" sourceRef="script_task" targetRef="Event_1f8qgj7" />
<bpmn:scriptTask id="script_task" scriptFormat="js" camunda:resource="url">
<bpmn:incoming>Flow_1hn5qoa</bpmn:incoming>
<bpmn:outgoing>Flow_1bem8gr</bpmn:outgoing>
</bpmn:scriptTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="js">
<bpmndi:BPMNEdge id="Flow_1bem8gr_di" bpmnElement="Flow_1bem8gr">
<di:waypoint x="370" y="117" />
<di:waypoint x="432" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1hn5qoa_di" bpmnElement="Flow_1hn5qoa">
<di:waypoint x="215" y="117" />
<di:waypoint x="270" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1f8qgj7_di" bpmnElement="Event_1f8qgj7">
<dc:Bounds x="432" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0frc6re_di" bpmnElement="script_task">
<dc:Bounds x="270" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

0 comments on commit 80e8ac0

Please sign in to comment.