tony
3 years ago
committed by
Gitee
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
12 changed files with
227 additions and
2 deletions
-
ruoyi-ui/bpmnlint-plugin-local/.gitignore
-
ruoyi-ui/bpmnlint-plugin-local/README.md
-
ruoyi-ui/bpmnlint-plugin-local/docs/rules/examples/no-manual-task-correct.bpmn
-
ruoyi-ui/bpmnlint-plugin-local/docs/rules/examples/no-manual-task-incorrect.bpmn
-
ruoyi-ui/bpmnlint-plugin-local/docs/rules/no-manual-task.md
-
ruoyi-ui/bpmnlint-plugin-local/index.js
-
ruoyi-ui/bpmnlint-plugin-local/package.json
-
ruoyi-ui/bpmnlint-plugin-local/rules/no-manual-task.js
-
ruoyi-ui/bpmnlint-plugin-local/rules/target-namespace.js
-
ruoyi-ui/bpmnlint-plugin-local/test.js
-
ruoyi-ui/package.json
-
ruoyi-ui/src/components/Process/.bpmnlintrc
|
|
|
@ -0,0 +1 @@ |
|
|
|
node_modules |
|
|
|
@ -0,0 +1,39 @@ |
|
|
|
# bpmnlint-plugin-local |
|
|
|
|
|
|
|
A bpmlint plug-in based on the [bpmnlint plug-in example](https://github.com/bpmn-io/bpmnlint-plugin-example). |
|
|
|
|
|
|
|
|
|
|
|
## About |
|
|
|
|
|
|
|
This plugin contributes [rules](#add-rules) and [configuration](#add-configuration) under the `local` prefix to bpmnlint. |
|
|
|
|
|
|
|
|
|
|
|
## Add Rules |
|
|
|
|
|
|
|
The [`./rules`](./rules) folder contains rules that are made available via |
|
|
|
this plug-in. Configure them with the `local` prefix in your `.bpmnlintrc`: |
|
|
|
|
|
|
|
```json |
|
|
|
{ |
|
|
|
"rules": { |
|
|
|
"local/no-manual-task": "warn" |
|
|
|
} |
|
|
|
} |
|
|
|
``` |
|
|
|
|
|
|
|
Checkout [`./test.js`](./test.js) to learn how to test your rules. |
|
|
|
|
|
|
|
|
|
|
|
## Add Configuration |
|
|
|
|
|
|
|
As part of the [`./index.js`](./index.js) the plug-in exposes configurations |
|
|
|
to extend from using `extends` in the bpmnlint configuration: |
|
|
|
|
|
|
|
```json |
|
|
|
{ |
|
|
|
"extends": [ |
|
|
|
"bpmnlint:recommended", |
|
|
|
"plugin:local/recommended" |
|
|
|
] |
|
|
|
} |
|
|
|
``` |
|
|
|
@ -0,0 +1,13 @@ |
|
|
|
<?xml version="1.0" encoding="UTF-8"?> |
|
|
|
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="sid-38422fae-e03e-43a3-bef4-bd33b32041b2" targetNamespace="http://bpmn.io/bpmn" exporter="bpmn-js (https://demo.bpmn.io)" exporterVersion="5.0.4"> |
|
|
|
<process id="Process_1" isExecutable="false"> |
|
|
|
<userTask id="Task_14wqr7n" /> |
|
|
|
</process> |
|
|
|
<bpmndi:BPMNDiagram id="BpmnDiagram_1"> |
|
|
|
<bpmndi:BPMNPlane id="BpmnPlane_1" bpmnElement="Process_1"> |
|
|
|
<bpmndi:BPMNShape id="UserTask_0xvet6g_di" bpmnElement="Task_14wqr7n"> |
|
|
|
<omgdc:Bounds x="160" y="80" width="100" height="80" /> |
|
|
|
</bpmndi:BPMNShape> |
|
|
|
</bpmndi:BPMNPlane> |
|
|
|
</bpmndi:BPMNDiagram> |
|
|
|
</definitions> |
|
|
|
@ -0,0 +1,13 @@ |
|
|
|
<?xml version="1.0" encoding="UTF-8"?> |
|
|
|
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="sid-38422fae-e03e-43a3-bef4-bd33b32041b2" targetNamespace="http://bpmn.io/bpmn" exporter="bpmn-js (https://demo.bpmn.io)" exporterVersion="5.0.4"> |
|
|
|
<process id="Process_1" isExecutable="false"> |
|
|
|
<manualTask id="Task_14wqr7n" /> |
|
|
|
</process> |
|
|
|
<bpmndi:BPMNDiagram id="BpmnDiagram_1"> |
|
|
|
<bpmndi:BPMNPlane id="BpmnPlane_1" bpmnElement="Process_1"> |
|
|
|
<bpmndi:BPMNShape id="ManualTask_0jr4uio_di" bpmnElement="Task_14wqr7n"> |
|
|
|
<omgdc:Bounds x="160" y="80" width="100" height="80" /> |
|
|
|
</bpmndi:BPMNShape> |
|
|
|
</bpmndi:BPMNPlane> |
|
|
|
</bpmndi:BPMNDiagram> |
|
|
|
</definitions> |
|
|
|
@ -0,0 +1,16 @@ |
|
|
|
# No Manual Task (no-manual-task) |
|
|
|
|
|
|
|
Checks that the diagram does not contain manual tasks that have no execution semantics. |
|
|
|
|
|
|
|
Example of __incorrect__ usage of this rule: |
|
|
|
|
|
|
|
 |
|
|
|
|
|
|
|
Cf. [`no-manual-task-incorrect.bpmn`](./examples/no-manual-task-incorrect.bpmn). |
|
|
|
|
|
|
|
|
|
|
|
Example of __correct__ usage of this rule: |
|
|
|
|
|
|
|
 |
|
|
|
|
|
|
|
Cf. [`no-manual-task-correct.bpmn`](./examples/no-manual-task-correct.bpmn). |
|
|
|
@ -0,0 +1,15 @@ |
|
|
|
module.exports = { |
|
|
|
configs: { |
|
|
|
recommended: { |
|
|
|
rules: { |
|
|
|
'target-namespace': 'error' |
|
|
|
} |
|
|
|
}, |
|
|
|
all: { |
|
|
|
rules: { |
|
|
|
'target-namespace': 'warn', |
|
|
|
'no-manual-task': 'warn' |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -0,0 +1,26 @@ |
|
|
|
{ |
|
|
|
"name": "bpmnlint-plugin-local", |
|
|
|
"version": "0.0.0", |
|
|
|
"description": "The bpmnlint local plug-in", |
|
|
|
"main": "index.js", |
|
|
|
"scripts": { |
|
|
|
"all": "npm test", |
|
|
|
"test": "mocha test.js" |
|
|
|
}, |
|
|
|
"keywords": [ |
|
|
|
"bpmnlint", |
|
|
|
"plugin" |
|
|
|
], |
|
|
|
"devDependencies": { |
|
|
|
"bpmnlint": "^7.2.1", |
|
|
|
"chai": "^4.2.0", |
|
|
|
"mocha": "^9.1.3" |
|
|
|
}, |
|
|
|
"dependencies": { |
|
|
|
"bpmnlint-utils": "^1.0.2" |
|
|
|
}, |
|
|
|
"files": [ |
|
|
|
"rules", |
|
|
|
"index.js" |
|
|
|
] |
|
|
|
} |
|
|
|
@ -0,0 +1,20 @@ |
|
|
|
const { |
|
|
|
is |
|
|
|
} = require('bpmnlint-utils'); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Rule that reports manual tasks being used. |
|
|
|
*/ |
|
|
|
module.exports = function() { |
|
|
|
|
|
|
|
function check(node, reporter) { |
|
|
|
if (is(node, 'bpmn:ManualTask')) { |
|
|
|
reporter.report(node.id, 'Element has disallowed type bpmn:ManualTask'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return { |
|
|
|
check: check |
|
|
|
}; |
|
|
|
}; |
|
|
|
@ -0,0 +1,20 @@ |
|
|
|
const { |
|
|
|
is |
|
|
|
} = require('bpmnlint-utils'); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Rule that reports missing targetNamespace on bpmn:Definitions. |
|
|
|
*/ |
|
|
|
module.exports = function() { |
|
|
|
|
|
|
|
function check(node, reporter) { |
|
|
|
if (is(node, 'bpmn:Definitions') && !node.targetNamespace) { |
|
|
|
reporter.report(node.id, 'Element is missing targetNamespace'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return { |
|
|
|
check: check |
|
|
|
}; |
|
|
|
}; |
|
|
|
@ -0,0 +1,55 @@ |
|
|
|
const { expect } = require('chai'); |
|
|
|
|
|
|
|
const { createModdle } = require('bpmnlint/lib/testers/helper'); |
|
|
|
|
|
|
|
const RuleTester = require('bpmnlint/lib/testers/rule-tester'); |
|
|
|
|
|
|
|
const manualTaskRule = require('./rules/no-manual-task'); |
|
|
|
const targetNamespaceRule = require('./rules/target-namespace'); |
|
|
|
|
|
|
|
|
|
|
|
RuleTester.verify('no-manual-task', manualTaskRule, { |
|
|
|
valid: [ |
|
|
|
{ |
|
|
|
moddleElement: createModdle( |
|
|
|
'<startEvent xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" id="startEvent" />', |
|
|
|
'bpmn:StartEvent' |
|
|
|
) |
|
|
|
} |
|
|
|
], |
|
|
|
invalid: [ |
|
|
|
{ |
|
|
|
moddleElement: createModdle( |
|
|
|
'<manualTask xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" id="manualTask" />', |
|
|
|
'bpmn:ManualTask' |
|
|
|
), |
|
|
|
report: { |
|
|
|
id: 'manualTask', |
|
|
|
message: 'Element has disallowed type bpmn:ManualTask' |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
RuleTester.verify('target-namespace', targetNamespaceRule, { |
|
|
|
valid: [ |
|
|
|
{ |
|
|
|
moddleElement: createModdle( |
|
|
|
'<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" id="definitions" targetNamespace="http://foo" />', |
|
|
|
) |
|
|
|
} |
|
|
|
], |
|
|
|
invalid: [ |
|
|
|
{ |
|
|
|
moddleElement: createModdle( |
|
|
|
'<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" id="definitions" />', |
|
|
|
), |
|
|
|
report: { |
|
|
|
id: 'definitions', |
|
|
|
message: 'Element is missing targetNamespace' |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
}); |
|
|
|
|
|
|
|
@ -66,7 +66,8 @@ |
|
|
|
"vue-router": "3.4.9", |
|
|
|
"vuedraggable": "2.24.3", |
|
|
|
"vuex": "3.6.0", |
|
|
|
"xcrud": "^0.4.19" |
|
|
|
"xcrud": "^0.4.19", |
|
|
|
"bpmnlint-plugin-local": "file:bpmnlint-plugin-local" |
|
|
|
}, |
|
|
|
"devDependencies": { |
|
|
|
"@babel/parser": "^7.20.5", |
|
|
|
|
|
|
|
@ -1,3 +1,9 @@ |
|
|
|
{ |
|
|
|
"extends": "bpmnlint:recommended" |
|
|
|
"extends": [ |
|
|
|
"bpmnlint:recommended", |
|
|
|
"plugin:local/recommended" |
|
|
|
], |
|
|
|
"rules": { |
|
|
|
"local/no-manual-task": "warn" |
|
|
|
} |
|
|
|
} |
|
|
|
|