Skip to content

Commit

Permalink
chore: code style
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Sep 6, 2024
1 parent 3d6ab8b commit e4de70b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
5 changes: 3 additions & 2 deletions rules/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ function disallowNodeType(type) {

}

module.exports.disallowNodeType = disallowNodeType;

/**
* Find a parent for the given element
*
Expand Down Expand Up @@ -56,5 +58,4 @@ function findParent(node, type) {
return findParent(parent, type);
}

module.exports.findParent = findParent;
module.exports.disallowNodeType = disallowNodeType;
module.exports.findParent = findParent;
22 changes: 12 additions & 10 deletions rules/no-implicit-end.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,19 @@ module.exports = function() {
);
}

function isConnectedToActivity(node) {
function hasCompensationActivity(node) {
const parent = findParent(node, 'bpmn:Process');

const artifacts = parent.artifacts || [];

return artifacts.some((element) => {
return (
is(element, 'bpmn:Association') &&
is(element.sourceRef, 'bpmn:BoundaryEvent') &&
element.sourceRef.id === node.id
);
if (!is(element, 'bpmn:Association')) {
return false;
}

const source = element.sourceRef;

return source.id === node.id;
});
}

Expand All @@ -59,10 +63,8 @@ module.exports = function() {
return false;
}

if (is(node, 'bpmn:BoundaryEvent')) {
if (isCompensationEvent(node) && isConnectedToActivity(node)) {
return false;
}
if (is(node, 'bpmn:BoundaryEvent') && isCompensationEvent(node) && hasCompensationActivity(node)) {
return false;
}

if (is(node, 'bpmn:Task') && isForCompensation(node)) {
Expand Down

0 comments on commit e4de70b

Please sign in to comment.