@camunda/linting 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Linter.js CHANGED
@@ -13,6 +13,8 @@ import zeebeModdle from 'zeebe-bpmn-moddle/resources/zeebe.json';
13
13
  import { getErrorMessage } from './utils/error-messages';
14
14
  import { getEntryIds } from './utils/properties-panel';
15
15
 
16
+ import { toSemverMinor } from './utils/version';
17
+
16
18
  const moddle = new BpmnModdle({
17
19
  modeler: modelerModdle,
18
20
  zeebe: zeebeModdle
@@ -133,10 +135,6 @@ function toLowerCase(string) {
133
135
  return string.toLowerCase();
134
136
  }
135
137
 
136
- function toSemverMinor(executionPlatformVersion) {
137
- return executionPlatformVersion.split('.').slice(0, 2).join('.');
138
- }
139
-
140
138
  async function createCache(configName) {
141
139
  let config = require('bpmnlint-plugin-camunda-compat').configs[ configName ];
142
140
 
@@ -9,6 +9,8 @@ import {
9
9
 
10
10
  import { getTypeString } from './types';
11
11
 
12
+ import { toSemverMinor } from './version';
13
+
12
14
  const TIMER_PROPERTIES = [
13
15
  'timeCycle',
14
16
  'timeDate',
@@ -27,7 +29,7 @@ const executionPlatformLabels = {
27
29
 
28
30
  export function getExecutionPlatformLabel(executionPlatform, executionPlatformVersion) {
29
31
  const executionPlatformLabel = executionPlatformLabels[ executionPlatform ]
30
- && executionPlatformLabels[ executionPlatform ][ executionPlatformVersion ];
32
+ && executionPlatformLabels[ executionPlatform ][ toSemverMinor(executionPlatformVersion) ];
31
33
 
32
34
  if (executionPlatformLabel) {
33
35
  return executionPlatformLabel;
@@ -38,7 +40,7 @@ export function getExecutionPlatformLabel(executionPlatform, executionPlatformVe
38
40
  executionPlatform = executionPlatformLabels[ executionPlatform ][ 'default' ];
39
41
  }
40
42
 
41
- return `${ executionPlatform } ${ executionPlatformVersion }`;
43
+ return `${ executionPlatform } ${ toSemverMinor(executionPlatformVersion) }`;
42
44
  }
43
45
 
44
46
  function getIndefiniteArticle(type) {
@@ -101,6 +103,10 @@ export function getErrorMessage(report, executionPlatform, executionPlatformVers
101
103
  return getPropertyValueDuplicatedErrorMessage(report);
102
104
  }
103
105
 
106
+ if (type === ERROR_TYPES.PROPERTY_VALUE_REQUIRED) {
107
+ return getPropertyValueRequiredErrorMessage(report);
108
+ }
109
+
104
110
  if (type === ERROR_TYPES.EXPRESSION_REQUIRED) {
105
111
  return getExpressionRequiredErrorMessage(report);
106
112
  }
@@ -164,6 +170,29 @@ function getPropertyValueDuplicatedErrorMessage(report) {
164
170
  return message;
165
171
  }
166
172
 
173
+ function getPropertyValueRequiredErrorMessage(report) {
174
+ const {
175
+ data,
176
+ message
177
+ } = report;
178
+
179
+ const {
180
+ node,
181
+ property,
182
+ parentNode
183
+ } = data;
184
+
185
+ if (is(node, 'bpmn:Process') && property === 'isExecutable') {
186
+ if (parentNode && is(parentNode, 'bpmn:Participant')) {
187
+ return 'One <Process> must be <Executable>';
188
+ } else {
189
+ return 'A <Process> must be <Executable>';
190
+ }
191
+ }
192
+
193
+ return message;
194
+ }
195
+
167
196
  function getExtensionElementNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion) {
168
197
  const {
169
198
  data,
@@ -51,6 +51,10 @@ export function getEntryIds(report) {
51
51
  path
52
52
  } = report;
53
53
 
54
+ if (isPropertyError(data, 'isExecutable')) {
55
+ return [ 'isExecutable' ];
56
+ }
57
+
54
58
  if (isExtensionElementRequiredError(data, 'zeebe:CalledDecision', 'bpmn:BusinessRuleTask')) {
55
59
  return [ 'businessRuleImplementation' ];
56
60
  }
@@ -203,6 +207,16 @@ export function getErrorMessage(id, report) {
203
207
  return;
204
208
  }
205
209
 
210
+ if (id === 'isExecutable') {
211
+ const { parentNode } = data;
212
+
213
+ if (parentNode && is(parentNode, 'bpmn:Participant')) {
214
+ return 'One process must be executable.';
215
+ } else {
216
+ return 'Process must be executable.';
217
+ }
218
+ }
219
+
206
220
  if (id === 'businessRuleImplementation') {
207
221
  return 'Implementation must be defined.';
208
222
  }
@@ -0,0 +1,3 @@
1
+ export function toSemverMinor(executionPlatformVersion) {
2
+ return executionPlatformVersion.split('.').slice(0, 2).join('.');
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/linting",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Linting for Camunda Platform",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -27,7 +27,7 @@
27
27
  "dependencies": {
28
28
  "bpmn-moddle": "^7.1.3",
29
29
  "bpmnlint": "^8.0.0",
30
- "bpmnlint-plugin-camunda-compat": "^0.14.1",
30
+ "bpmnlint-plugin-camunda-compat": "^0.15.1",
31
31
  "bpmnlint-utils": "^1.0.2",
32
32
  "min-dash": "^4.0.0",
33
33
  "min-dom": "^4.0.1",