bpmnlint
Version:
Validate your BPMN diagrams based on configurable lint rules
44 lines (32 loc) • 909 B
JavaScript
const {
is
} = require('bpmnlint-utils');
const {
annotateRule
} = require('./helper');
/**
* A rule that checks that start events inside a normal sub-processes
* are blank (do not have an event definition).
*
* @type { import('../lib/types.js').RuleFactory }
*/
module.exports = function() {
function check(node, reporter) {
if (!is(node, 'bpmn:SubProcess') || node.triggeredByEvent) {
return;
}
const flowElements = node.flowElements || [];
flowElements.forEach(function(flowElement) {
if (!is(flowElement, 'bpmn:StartEvent')) {
return false;
}
const eventDefinitions = flowElement.eventDefinitions || [];
if (eventDefinitions.length > 0) {
reporter.report(flowElement.id, 'Start event must be blank', [ 'eventDefinitions' ]);
}
});
}
return annotateRule('sub-process-blank-start-event', {
check
});
};