Détail du package

bpmnlint

bpmn-io83.1kMIT11.6.0

Validate your BPMN diagrams based on configurable lint rules

bpmnlint, bpmn, linter, cli

readme

bpmnlint

CI

Validate your BPMN diagrams based on configurable lint rules.

Installation

Install the utility via npm:

npm install -g bpmnlint

Usage

Validate your diagrams via the commandline:

> bpmnlint invoice.bpmn

/Projects/process-application/resources/invoice.bpmn
  Flow_1    error    Sequence flow is missing condition  conditional-flows
  Process   error    Process is missing end event        end-event-required
  Task_13   warning  Element is missing label/name       label-required
  Event_12  warning  Element is missing label/name       label-required
  Event_27  warning  Element is missing label/name       label-required
  Process   error    Process is missing start event      start-event-required

✖ 6 problems (6 errors, 0 warnings)

Rules

Our documentation lists all currenty implemented rules, the ./rules folder contains each rules implementation.

Do you miss a rule that should be included? Propose a new rule.

Configuration

Create a .bpmnlintrc file in your working directory and inherit from a common configuration using the extends block:

{
  "extends": "bpmnlint:recommended"
}

Add or customize rules using the rules block:

{
  "extends": "bpmnlint:recommended",
  "rules": {
    "label-required": "off"
  }
}

You may also extend from multiple configurations, including those provided by custom plug-ins:

{
  "extends": [
    "bpmnlint:recommended",
    "plugin:foo/recommended",
    "plugin:@bar/bpmnlint-plugin-bar/recommended"
  ]
}

This will amend core recommended rules with recommended rulesets provided by bpmnlint-plugin-foo and @bar/bpmnlint-plugin-bar, respectively.

Available Configurations

API

Invoke the tool directly from NodeJS:

import Linter from 'bpmnlint';
import NodeResolver from 'bpmnlint/lib/resolver/node-resolver';

import BpmnModdle from 'bpmn-moddle';

const moddle = new BpmnModdle();

const linter = new Linter({ 
  config: {
    extends: 'bpmnlint:recommended'
  },
  resolver: new NodeResolver()
});

const xmlStr = `
  <?xml version="1.0" encoding="UTF-8"?>
  <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" 
                     id="definitions" 
                     targetNamespace="http://bpmn.io/schema/bpmn">
    <bpmn:process id="process" />
  </bpmn:definitions>
`;

const {
  rootElement: definitions
} = await moddle.fromXML(xmlStr);

const reports = linter.lint(definitions);

// {
//    "end-event-required": [
//      {
//        "id": "process",
//        "message": "Process is missing end event"
//      }
//    ],
//    ...
// }

Writing a Plug-in

Create your first plug-in using the plugin creator:

npm init bpmnlint-plugin {PLUGIN_NAME}

Checkout the bpmnlint-plugin-example for details on how to define, test, and consume custom lint rules. Use the bpmnlint playground to implement new rules with quick visual feedback.

[!NOTE] Plug-ins must always follow the naming scheme bpmnlint-plugin-{NAME_OF_YOUR_PLUGIN} and may contain a namespace prefix.

When using your custom plug-in, reference its configuration or rules via the shorthand plug-in name, or the full identifier:

{
  "extends": [
    "bpmnlint:recommended",
    "plugin:foo/recommended",
    "plugin:@bar/bpmnlint-plugin-bar/recommended"
  ],
  "rules": {
    "foo/special-rule": "off",
    "@bar/bar/other-rule": "warn"
  }
}

Bundling

For browser usage include your linting configuration using your favorite bundler plug-in (Rollup, Webpack).

Visual Feedback

Integrate the linter via bpmn-js-bpmnlint into bpmn-js and get direct feedback during modeling.

To try out visual validation, checkout the bpmnlint playground.

Related

License

MIT

changelog

Changelog

All notable changes to bpmnlint are documented here. We use semantic versioning for releases.

Unreleased

_Note: Yet to be released changes appear here._

11.6.0

  • FEAT: add single-blank-start-event to correctness ruleset (#187)

11.5.0

  • FEAT: allow to pass moddle extensions when validating via CLI (#62, #8, #188)

11.4.4

  • FIX: allow outgoing sequence flows on intermediate throw events in ad-hoc-subprocess (#186)

11.4.3

  • FIX: allow disconnected elements and missing start/end events within ad-hoc subprocess (#181)

11.4.2

  • FIX: do not require start and end events in ad-hoc subprocess (#176)

11.4.1

  • FIX: make link-event rule check only BPMN compliance

11.4.0

  • FEAT: rework message on elements that should not be used (#173)

11.3.0

  • FEAT: add correctness ruleset (#170)

11.2.0

  • FEAT: allow to pass custom meta data with rules (#18, #165)
  • FEAT: allow to transform rules (#165)
  • FEAT: add documentation URL to built-in rules (#167)

11.1.0

  • FEAT: add ad-hoc-sub-process rule (#160)
  • CHORE: improve error message on missing rule hook (#162)
  • CHORE: simplify local require (#161)

11.0.0

  • DEPS: update to bpmn-moddle@9
  • DEPS: update to min-dash@4.2.2
  • FIX: gracefully handle missing bounds in no-overlapping-elements rule (#156)
  • FIX: gracefully handle missing bpmnElement in no-bpmndi rule (#156)
  • FIX: gracefully handle missing diagram in no-bpmndi rule (#154)
  • CHORE: require Node@20

Breaking Changes

  • Node@20 is required to use this library.

10.3.1

  • FIX: correct false positive in global rule (#139)
  • FIX: correct false positive in no-implicit-end rule (#140)
  • FIX: correct label-required not triggering for boundary events (#141)

10.3.0

  • FEAT: add global rule (#137)
  • FEAT: add types for RuleTester#verify API (#138)
  • DEPS: update to bpmn-moddle@8.1.0
  • DEPS: update to min-dash@4.2.1

10.2.3

  • CHORE: eagerly filter non-DI elements in no-overlapping-elements rule (c40cd8a)

10.2.2

  • FIX: gracefully handle missing DI in no-overlapping-elements rule (#135)

10.2.1

  • FIX: correct compensation activities triggering no-implicit-start (#132)

10.2.0

  • FEAT: add link-event rule (#128)

10.1.0

  • FEAT: add superfluous-termination rule (#19)

10.0.0

  • DEPS: update to @bpmn-io/moddle-utils@0.2.1
  • FIX: apply fake-join and no-implicit-split on all activities (#126)
  • CHORE: require Node >= 16

9.2.0

  • FEAT: compile custom rule imports to package local references (#115)
  • FIX: correct custom rule path compilation on Windows (#112, #114)

9.1.0

  • FEAT: add no-overlapping-elements rule (#107, #72)
  • FEAT: detect intermediate events overlapping tasks (#71, #107)

9.0.0

  • FEAT: introduce rule-error category for rule errors (#109)

Breaking Changes

  • rule errors are now reported as rule-error category instead of error

8.3.2

  • FIX: correct no-implicit-start and no-implicit-end in different scenarios (#106)

8.3.1

  • DEPS: update to @bpmn-io/moddle-utils@0.2.0

8.3.0

  • FEAT: add no-implicit-start and no-implicit-end rules (#88)
  • FEAT: allow to resolve rules from custom paths (#99)
  • DEPS: bump to bpmn-moddle@8.0.1
  • DEPS: bump to min-dash@4.1.1
  • DEPS: bump to bpmnlint-utils@1.1.1

8.2.0

  • FEAT: support info type (#102)

8.1.1

  • FIX: correct category in recommended config (#94)

8.1.0

  • FEAT: add --max-warnings cli switch (#92)

8.0.0

  • FEAT: detect message flows without DI (#85)
  • FEAT: serialize disabled rules (#90)
  • DEPS: depend on @bpmn-io/moddle-utils (31de95a3)
  • CHORE: drop Node@10 support

7.8.0

  • FEAT: be able to configure rules (#82)
  • FEAT: be able to configure rules when testing (#83)

7.7.0

  • FEAT: fuzzy test for equality of nodes when using RuleTester#verify (#79)

7.6.0

  • FEAT: allow passing object as third parameter to Reporter#report (#75)

7.5.0

  • FEAT: add optional path parameter to Reporter#report (#73)
  • FEAT: add optional name parameter to RuleTester#verify (#68)
  • CHORE: update to bpmn-moddle@7.1.2

7.4.0

  • FEAT: resolve local package by name (#64)

7.3.0

  • FEAT: support --version command line flag (#65)
  • FEAT: allow rule testers to provide custom it
  • FIX: make no-bpmndi handle missing LaneSet#lanes gracefully (#63, #66)

7.2.1

  • FIX: exclude compensation boundary and activity in no-disconnected check (#60)

7.2.0

  • FEAT: add no-bpmndi rule (#55)

7.1.0

  • FEAT: allow rules to skip sub-tree traversal (#53)
  • FEAT: allow rules to hook into node enter and leave (#52)

7.0.1

  • CHORE: drop debug log statement

7.0.0

  • CHORE: update to bpmn-moddle@7
  • CHORE: reduce library footprint
  • CHORE: require NodeJS>=10

6.5.0

  • FEAT: add globbing support (#46)
  • DOCS: add explaination to no-inclusive-gateway rule

6.4.0

  • FEAT: add superfluous-gateway check (#42)

6.3.0

  • FEAT: support rules and configuration provided by scoped packages (#35)
  • CHORE: improve Node >= 12.20 compatibility (#37)

6.2.0

  • DOCS: document existing rules (#14)

6.1.2

  • FIX: exclude event-based sub-processes from no-disconnected check (#31)

6.1.1

  • FEAT: allow tool to be used with Node >= 8

6.1.0

  • FEAT: resolve local rules in plug-ins without prefix (640e411a)

6.0.0

  • FEAT: resolve plug-in provided rules/configuration local to working directory (f1bf331f)
  • CHORE: improve errors on rule/plugin resolution failures
  • CHORE: require >= node@10.12

5.3.0

  • FEAT: add --init option to create .bpmnlintrc in current working directory

5.2.0

  • FEAT: provide help on missing .bpmnlintrc

5.1.2

  • DOCS: add package description

5.1.1

  • CHORE: exclude additional development assets from distribution

5.1.0

  • FEAT: add no-duplicate-sequence-flows rule (#22)
  • FEAT: catch more BPMN parse errors
  • FEAT: be able to define multiple expected test results in RuleTester
  • FIX: make nyc a development dependency
  • CHORE: update to bpmn-moddle@6

5.0.0

  • FEAT: don't expose utils to rules; use bpmnlint-utils instead

4.1.0

  • FEAT: handle and report diagram import errors and warnings via CLI
  • FEAT: properly handle generic moddle elements during rule checking
  • FEAT: report rule execution errors

4.0.0

  • FEAT: add ability to batch lint multiple files via CLI
  • FEAT: don't resolve disabled rules (6c45f3f9)
  • CHORE: unify messages of built-in rules
  • CHORE: adopt cli output to eslint styling

3.3.1

  • FIX: handle empty flow element containers in rules

3.3.0

  • FEAT: do not expose disabled rules when bundling .bpmnlintrc

3.2.1

  • DOCS: fix readme code snippet

3.2.0

  • FEAT: add ability to pass linter configuration via constructor

3.1.0

  • FEAT: add support script to compile .bpmnlintrc files to JavaScript (cf53a389)

3.0.0

Breaking Changes

  • FEAT: treat unprefixed rules as built-in ones

2.0.0

Breaking Changes

  • CHORE: make NodeResolver a constructor
  • CHORE: unify file names to dashed-case
  • CHORE: rework Resolver APIs

Other Enhancements

  • FEAT: add StaticResolver to load cached resources
  • FEAT: add { Linter } as a library export
  • CHORE: move rule and config name resolution to linter
  • CHORE: catch all cli errors and exit accordingly

1.0.0

  • FEAT: add numerous new rules (#5)
  • FEAT: add bpmnlint:all configuration
  • FEAT: improve label-required rule (#11)
  • FEAT: group lint results by rule names
  • FEAT: exit cli with code=1 on lint errors
  • FEAT: add isAny(node, [ ... types ]) method to utils
  • CHORE: improve / test cover existing rules
  • CHORE: include new rules in bpmnlint:recommended configuration

1.0.0-alpha6

  • DOCS: documentation simplification / improvements

1.0.0-alpha5

Initial stable release.

  • FEAT: configure, resolve and execute local and external rules
  • FEAT: extend external configuration via extends
  • FEAT: make rule and configuration resolution async
  • FEAT: provide bpmnlint:recommended configuration
  • CHORE: linter is now a constructor, offering a #lint(moddleElement, config) method
  • CHORE: moved library to bpmn-io/bpmnlint
  • CHORE: full rewrite of internals
  • CHORE: utils API change

...

Check git log for earlier history.