bpmnlint
Version:
Validate your BPMN diagrams based on configurable lint rules
37 lines (28 loc) • 736 B
JavaScript
const {
is
} = require('bpmnlint-utils');
const {
annotateRule
} = require('./helper');
/**
* A rule that checks, whether a gateway has only one source and target.
*
* Those gateways are superfluous since they don't do anything.
*
* @type { import('../lib/types.js').RuleFactory }
*/
module.exports = function() {
function check(node, reporter) {
if (!is(node, 'bpmn:Gateway')) {
return;
}
const incoming = node.incoming || [];
const outgoing = node.outgoing || [];
if (incoming.length === 1 && outgoing.length === 1) {
reporter.report(node.id, 'Gateway is superfluous. It only has one source and target.');
}
}
return annotateRule('superfluous-gateway', {
check
});
};