@sfdxy/mule-lint 1.16.3 → 1.18.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/README.md +12 -6
- package/dist/bin/mule-lint.js +82 -1
- package/dist/bin/mule-lint.js.map +1 -1
- package/dist/package.json +8 -6
- package/dist/src/formatter/MuleXmlFormatter.d.ts +68 -0
- package/dist/src/formatter/MuleXmlFormatter.d.ts.map +1 -0
- package/dist/src/formatter/MuleXmlFormatter.js +146 -0
- package/dist/src/formatter/MuleXmlFormatter.js.map +1 -0
- package/dist/src/formatter/index.d.ts +3 -0
- package/dist/src/formatter/index.d.ts.map +1 -0
- package/dist/src/formatter/index.js +9 -0
- package/dist/src/formatter/index.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/index.d.ts.map +1 -1
- package/dist/src/mcp/index.js +105 -0
- package/dist/src/mcp/index.js.map +1 -1
- package/docs/best-practices/rules-catalog.md +513 -44
- package/package.json +8 -6
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
# Rules Catalog
|
|
2
2
|
|
|
3
|
-
> **Version:**
|
|
4
|
-
> **Total Rules:** 56 implemented across
|
|
5
|
-
> **Last Updated:**
|
|
3
|
+
> **Version:** 3.0.0
|
|
4
|
+
> **Total Rules:** 56 implemented across 14 categories
|
|
5
|
+
> **Last Updated:** February 2026
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## Quick Navigation
|
|
10
10
|
|
|
11
11
|
- [Rule Categories](#rule-categories)
|
|
12
|
-
- [Error Handling Rules](#error-handling-rules
|
|
13
|
-
- [Naming Rules](#naming-rules
|
|
14
|
-
- [Security Rules](#security-rules
|
|
15
|
-
- [Logging Rules](#logging-rules
|
|
16
|
-
- [HTTP Rules](#http-rules
|
|
17
|
-
- [Performance Rules](#performance-rules
|
|
18
|
-
- [Documentation Rules](#documentation-rules
|
|
19
|
-
- [Standards Rules](#standards-rules
|
|
20
|
-
- [Complexity Rules](#complexity-rules
|
|
21
|
-
- [Structure Rules](#structure-rules
|
|
22
|
-
- [YAML Rules](#yaml-rules
|
|
23
|
-
- [DataWeave Rules](#dataweave-rules
|
|
24
|
-
- [API-Led Rules](#api-led-rules
|
|
25
|
-
- [
|
|
12
|
+
- [Error Handling Rules](#error-handling-rules)
|
|
13
|
+
- [Naming Rules](#naming-rules)
|
|
14
|
+
- [Security Rules](#security-rules)
|
|
15
|
+
- [Logging Rules](#logging-rules)
|
|
16
|
+
- [HTTP Rules](#http-rules)
|
|
17
|
+
- [Performance Rules](#performance-rules)
|
|
18
|
+
- [Documentation Rules](#documentation-rules)
|
|
19
|
+
- [Standards Rules](#standards-rules)
|
|
20
|
+
- [Complexity Rules](#complexity-rules)
|
|
21
|
+
- [Structure Rules](#structure-rules)
|
|
22
|
+
- [YAML Rules](#yaml-rules)
|
|
23
|
+
- [DataWeave Rules](#dataweave-rules)
|
|
24
|
+
- [API-Led Rules](#api-led-rules)
|
|
25
|
+
- [Operations & Hygiene Rules](#operations--hygiene-rules)
|
|
26
|
+
- [Governance Rules](#governance-rules)
|
|
27
|
+
- [Experimental Rules](#experimental-rules)
|
|
26
28
|
|
|
27
29
|
---
|
|
28
30
|
|
|
@@ -30,15 +32,22 @@
|
|
|
30
32
|
|
|
31
33
|
| Family | Prefix | Count | Description |
|
|
32
34
|
|--------|--------|-------|-------------|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
35
|
+
| Error Handling | MULE-001/003/005/007/009, ERR-001 | 6 | Error handler configuration and best practices |
|
|
36
|
+
| Naming | MULE-002/101/102 | 3 | Naming conventions for flows and variables |
|
|
37
|
+
| Security | MULE-004/201/202, SEC-002/003/004/006 | 7 | Security vulnerabilities, TLS, rate limiting |
|
|
38
|
+
| Logging | MULE-006/301/303, LOG-001/004, HYG-001 | 6 | Logging standards, structured logging, hygiene |
|
|
39
|
+
| HTTP | MULE-401/402/403 | 3 | HTTP configuration and headers |
|
|
40
|
+
| Performance | MULE-501/502/503, PERF-002, RES-001 | 5 | Performance anti-patterns and resilience |
|
|
41
|
+
| Documentation | MULE-601/604, DOC-001 | 3 | Documentation requirements |
|
|
42
|
+
| Standards | MULE-008/010/701, OPS-001/002/003, API-005 | 7 | Coding standards and operations |
|
|
43
|
+
| Complexity | MULE-801 | 1 | Code complexity |
|
|
44
|
+
| Structure | MULE-802/803/804 | 3 | Project structure |
|
|
45
|
+
| YAML | YAML-001/003/004 | 3 | YAML configuration validation |
|
|
46
|
+
| DataWeave | DW-001/002/003/004 | 4 | DataWeave file validation |
|
|
47
|
+
| API-Led | API-001/002/003/004 | 4 | API-Led connectivity patterns |
|
|
48
|
+
| Governance | PROJ-001/002 | 2 | POM and Git hygiene |
|
|
49
|
+
| Code Hygiene | HYG-002/003 | 2 | Commented code and unused flows |
|
|
50
|
+
| Experimental | EXP-001/002/003 | 3 | Beta rules for evaluation |
|
|
42
51
|
|
|
43
52
|
### MULE Category ID Ranges
|
|
44
53
|
|
|
@@ -58,7 +67,7 @@
|
|
|
58
67
|
|
|
59
68
|
> 📘 **For detailed best practices, see [MuleSoft Best Practices Guide](mulesoft-best-practices.md)**
|
|
60
69
|
|
|
61
|
-
## Error Handling Rules
|
|
70
|
+
## Error Handling Rules
|
|
62
71
|
|
|
63
72
|
> **Best Practice**: Every flow should have explicit error handling. Use a global error handler for consistency, but override specific handlers where needed.
|
|
64
73
|
|
|
@@ -137,7 +146,43 @@
|
|
|
137
146
|
|
|
138
147
|
---
|
|
139
148
|
|
|
140
|
-
|
|
149
|
+
### ERR-001: Try Scope Best Practice
|
|
150
|
+
|
|
151
|
+
| Property | Value |
|
|
152
|
+
|----------|-------|
|
|
153
|
+
| **Severity** | Info |
|
|
154
|
+
| **Category** | Error Handling |
|
|
155
|
+
| **Issue Type** | Bug |
|
|
156
|
+
| **Fixable** | No |
|
|
157
|
+
|
|
158
|
+
**Description:** Complex operations (DB calls, HTTP requests) should use Try scope for granular error isolation and handling.
|
|
159
|
+
|
|
160
|
+
**Check Logic:** Flags flows that have 2+ external calls (HTTP requests, DB operations) without any Try scope wrapping them.
|
|
161
|
+
|
|
162
|
+
**Example:**
|
|
163
|
+
```xml
|
|
164
|
+
<!-- ❌ Bad - multiple calls without Try -->
|
|
165
|
+
<flow name="process-order-flow">
|
|
166
|
+
<http:request config-ref="API"/>
|
|
167
|
+
<db:insert config-ref="Database"/>
|
|
168
|
+
</flow>
|
|
169
|
+
|
|
170
|
+
<!-- ✅ Good - risky operations isolated -->
|
|
171
|
+
<flow name="process-order-flow">
|
|
172
|
+
<try>
|
|
173
|
+
<http:request config-ref="API"/>
|
|
174
|
+
<error-handler>...</error-handler>
|
|
175
|
+
</try>
|
|
176
|
+
<try>
|
|
177
|
+
<db:insert config-ref="Database"/>
|
|
178
|
+
<error-handler>...</error-handler>
|
|
179
|
+
</try>
|
|
180
|
+
</flow>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Naming Rules
|
|
141
186
|
|
|
142
187
|
> **Best Practice**: Consistent naming conventions improve readability and maintainability. Use kebab-case for flows and camelCase for variables.
|
|
143
188
|
|
|
@@ -193,7 +238,7 @@
|
|
|
193
238
|
|
|
194
239
|
---
|
|
195
240
|
|
|
196
|
-
## Security Rules
|
|
241
|
+
## Security Rules
|
|
197
242
|
|
|
198
243
|
> **Best Practice**: Never commit secrets to source control. Use secure properties files with encryption or external secrets management.
|
|
199
244
|
|
|
@@ -244,7 +289,95 @@
|
|
|
244
289
|
|
|
245
290
|
---
|
|
246
291
|
|
|
247
|
-
|
|
292
|
+
### SEC-002: TLS Version Check
|
|
293
|
+
|
|
294
|
+
| Property | Value |
|
|
295
|
+
|----------|-------|
|
|
296
|
+
| **Severity** | Error |
|
|
297
|
+
| **Category** | Security |
|
|
298
|
+
| **Issue Type** | Vulnerability |
|
|
299
|
+
| **Fixable** | No |
|
|
300
|
+
|
|
301
|
+
**Description:** Detect use of deprecated TLS versions (< 1.2). TLS 1.0 and 1.1 are deprecated and should not be used per current security standards.
|
|
302
|
+
|
|
303
|
+
**Deprecated Protocols:** `TLSv1`, `TLSv1.0`, `TLSv1.1`, `SSLv3`, `SSLv2`
|
|
304
|
+
|
|
305
|
+
**Example:**
|
|
306
|
+
```xml
|
|
307
|
+
<!-- ❌ Bad - deprecated protocol -->
|
|
308
|
+
<tls:context enabledProtocols="TLSv1.1,TLSv1.2">
|
|
309
|
+
|
|
310
|
+
<!-- ✅ Good -->
|
|
311
|
+
<tls:context enabledProtocols="TLSv1.2,TLSv1.3">
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
### SEC-003: Rate Limiting Policy
|
|
317
|
+
|
|
318
|
+
| Property | Value |
|
|
319
|
+
|----------|-------|
|
|
320
|
+
| **Severity** | Warning |
|
|
321
|
+
| **Category** | Security |
|
|
322
|
+
| **Issue Type** | Vulnerability |
|
|
323
|
+
| **Fixable** | No |
|
|
324
|
+
|
|
325
|
+
**Description:** APIs should have rate limiting or throttling configured to prevent DoS attacks and manage API consumption.
|
|
326
|
+
|
|
327
|
+
**Check Logic:** Scans API interface files for HTTP listeners without associated rate limiting, throttling, or spike control policies.
|
|
328
|
+
|
|
329
|
+
**Best Practice:** Configure rate limiting via API Manager policies or add `throttling:config` to protect against abuse.
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
### SEC-004: Input Validation
|
|
334
|
+
|
|
335
|
+
| Property | Value |
|
|
336
|
+
|----------|-------|
|
|
337
|
+
| **Severity** | Warning |
|
|
338
|
+
| **Category** | Security |
|
|
339
|
+
| **Issue Type** | Vulnerability |
|
|
340
|
+
| **Fixable** | No |
|
|
341
|
+
|
|
342
|
+
**Description:** Incoming payloads should be validated using JSON or XML schema validation to prevent injection attacks and malformed data processing.
|
|
343
|
+
|
|
344
|
+
**Check Logic:** Flags flows accepting POST/PUT/PATCH requests that have no schema validation or DataWeave validation patterns.
|
|
345
|
+
|
|
346
|
+
**Example:**
|
|
347
|
+
```xml
|
|
348
|
+
<!-- ✅ Good - schema validation -->
|
|
349
|
+
<flow name="post:\orders:api-config">
|
|
350
|
+
<json:validate-schema schema="schemas/order.json"/>
|
|
351
|
+
...
|
|
352
|
+
</flow>
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
### SEC-006: Encryption Key in Logs
|
|
358
|
+
|
|
359
|
+
| Property | Value |
|
|
360
|
+
|----------|-------|
|
|
361
|
+
| **Severity** | Error |
|
|
362
|
+
| **Category** | Security |
|
|
363
|
+
| **Fixable** | No |
|
|
364
|
+
|
|
365
|
+
**Description:** Encryption keys, passwords, and sensitive credentials should not appear in log statements.
|
|
366
|
+
|
|
367
|
+
**Detected Patterns:** `encrypt.*key`, `password`, `credentials`, `api_key`, `secret.*key`, `mule.key`, `secure::.*key`
|
|
368
|
+
|
|
369
|
+
**Example:**
|
|
370
|
+
```xml
|
|
371
|
+
<!-- ❌ Bad -->
|
|
372
|
+
<logger message="Key: #[vars.encryptionKey]"/>
|
|
373
|
+
|
|
374
|
+
<!-- ✅ Good -->
|
|
375
|
+
<logger message="Processing completed for order #[vars.orderId]"/>
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
## Logging Rules
|
|
248
381
|
|
|
249
382
|
> **Best Practice**: Use structured logging with categories. Never log full payloads in production - they may contain PII or be excessively large.
|
|
250
383
|
|
|
@@ -299,7 +432,71 @@
|
|
|
299
432
|
|
|
300
433
|
---
|
|
301
434
|
|
|
302
|
-
|
|
435
|
+
### LOG-001: Structured Logging
|
|
436
|
+
|
|
437
|
+
| Property | Value |
|
|
438
|
+
|----------|-------|
|
|
439
|
+
| **Severity** | Info |
|
|
440
|
+
| **Category** | Logging |
|
|
441
|
+
| **Fixable** | No |
|
|
442
|
+
|
|
443
|
+
**Description:** Recommend JSON logger format over plain text for production applications to enable better log parsing and analysis.
|
|
444
|
+
|
|
445
|
+
**Check Logic:** Flags global/config files that use standard loggers without JSON Logger Module configuration.
|
|
446
|
+
|
|
447
|
+
**Best Practice:** Use JSON Logger Module for structured log output in production environments. This enables better log aggregation and analysis with tools like Splunk, ELK, or Anypoint Monitoring.
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
### LOG-004: Sensitive Data in Logs
|
|
452
|
+
|
|
453
|
+
| Property | Value |
|
|
454
|
+
|----------|-------|
|
|
455
|
+
| **Severity** | Error |
|
|
456
|
+
| **Category** | Logging |
|
|
457
|
+
| **Fixable** | No |
|
|
458
|
+
|
|
459
|
+
**Description:** Log statements should not contain sensitive data values (passwords, tokens, SSNs, PII).
|
|
460
|
+
|
|
461
|
+
**Detected Patterns:** Variable references like `vars.password`, `payload.token`, `${secure::*}`, concatenated sensitive values.
|
|
462
|
+
|
|
463
|
+
**Example:**
|
|
464
|
+
```xml
|
|
465
|
+
<!-- ❌ Bad - logs sensitive variable value -->
|
|
466
|
+
<logger message="#['Token: ' ++ vars.accessToken]"/>
|
|
467
|
+
|
|
468
|
+
<!-- ✅ Good -->
|
|
469
|
+
<logger message="Authentication successful for user #[vars.userId]"/>
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
---
|
|
473
|
+
|
|
474
|
+
### HYG-001: Excessive Loggers
|
|
475
|
+
|
|
476
|
+
| Property | Value |
|
|
477
|
+
|----------|-------|
|
|
478
|
+
| **Severity** | Warning |
|
|
479
|
+
| **Category** | Logging |
|
|
480
|
+
| **Fixable** | No |
|
|
481
|
+
|
|
482
|
+
**Description:** Flows should not have too many loggers, which can impact performance.
|
|
483
|
+
|
|
484
|
+
**Configuration:**
|
|
485
|
+
```json
|
|
486
|
+
{
|
|
487
|
+
"HYG-001": {
|
|
488
|
+
"options": {
|
|
489
|
+
"maxLoggers": 5
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
**Best Practice:** Keep logger count per flow ≤ 5. Move detailed logging to DEBUG level.
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
## HTTP Rules
|
|
303
500
|
|
|
304
501
|
> **Best Practice**: Configure explicit timeouts, include identifying headers, and handle all HTTP response codes appropriately.
|
|
305
502
|
|
|
@@ -341,9 +538,9 @@
|
|
|
341
538
|
|
|
342
539
|
---
|
|
343
540
|
|
|
344
|
-
## Performance Rules
|
|
541
|
+
## Performance Rules
|
|
345
542
|
|
|
346
|
-
> **Best Practice**: Keep flows simple and focused. Use async processing carefully with proper error handling.
|
|
543
|
+
> **Best Practice**: Keep flows simple and focused. Use async processing carefully with proper error handling. Configure connection pooling and reconnection for production resilience.
|
|
347
544
|
|
|
348
545
|
### MULE-501: Scatter-Gather Routes
|
|
349
546
|
|
|
@@ -383,7 +580,58 @@
|
|
|
383
580
|
|
|
384
581
|
---
|
|
385
582
|
|
|
386
|
-
|
|
583
|
+
### PERF-002: Connection Pooling
|
|
584
|
+
|
|
585
|
+
| Property | Value |
|
|
586
|
+
|----------|-------|
|
|
587
|
+
| **Severity** | Warning |
|
|
588
|
+
| **Category** | Performance |
|
|
589
|
+
| **Fixable** | No |
|
|
590
|
+
|
|
591
|
+
**Description:** DB and HTTP connectors should configure connection pools for optimal performance and resource management.
|
|
592
|
+
|
|
593
|
+
**Check Logic:** Flags HTTP request configs missing `maxConnections`/`connectionIdleTimeout` and DB configs missing `pooling-profile`.
|
|
594
|
+
|
|
595
|
+
**Example:**
|
|
596
|
+
```xml
|
|
597
|
+
<!-- ✅ Good - HTTP with pooling -->
|
|
598
|
+
<http:request-config name="API_Config" maxConnections="20" connectionIdleTimeout="30000"/>
|
|
599
|
+
|
|
600
|
+
<!-- ✅ Good - DB with pooling -->
|
|
601
|
+
<db:config name="Database_Config">
|
|
602
|
+
<db:pooling-profile maxPoolSize="10" minPoolSize="2"/>
|
|
603
|
+
</db:config>
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
---
|
|
607
|
+
|
|
608
|
+
### RES-001: Reconnection Strategy
|
|
609
|
+
|
|
610
|
+
| Property | Value |
|
|
611
|
+
|----------|-------|
|
|
612
|
+
| **Severity** | Warning |
|
|
613
|
+
| **Category** | Performance |
|
|
614
|
+
| **Fixable** | No |
|
|
615
|
+
|
|
616
|
+
**Description:** Connectors should have reconnection strategies configured for resilience.
|
|
617
|
+
|
|
618
|
+
**Checked Connectors:** HTTP Request, HTTP Listener, JMS, AMQP, SFTP, FTP, VM, Database
|
|
619
|
+
|
|
620
|
+
**Example:**
|
|
621
|
+
```xml
|
|
622
|
+
<!-- ✅ Good -->
|
|
623
|
+
<http:request-config name="API_Config">
|
|
624
|
+
<http:request-connection>
|
|
625
|
+
<reconnection>
|
|
626
|
+
<reconnect count="3" frequency="2000"/>
|
|
627
|
+
</reconnection>
|
|
628
|
+
</http:request-connection>
|
|
629
|
+
</http:request-config>
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
---
|
|
633
|
+
|
|
634
|
+
## Documentation Rules
|
|
387
635
|
|
|
388
636
|
> **Best Practice**: Well-documented flows are easier to maintain. Use meaningful names that describe business purpose.
|
|
389
637
|
|
|
@@ -411,7 +659,30 @@
|
|
|
411
659
|
|
|
412
660
|
---
|
|
413
661
|
|
|
414
|
-
|
|
662
|
+
### DOC-001: Display Name Enforcement
|
|
663
|
+
|
|
664
|
+
| Property | Value |
|
|
665
|
+
|----------|-------|
|
|
666
|
+
| **Severity** | Info |
|
|
667
|
+
| **Category** | Documentation |
|
|
668
|
+
| **Fixable** | No |
|
|
669
|
+
|
|
670
|
+
**Description:** Key components should have meaningful `doc:name` attributes, not default/generic names.
|
|
671
|
+
|
|
672
|
+
**Flagged Defaults:** `Set Payload`, `Set Variable`, `Transform Message`, `Flow Reference`, `Logger`, `Choice`
|
|
673
|
+
|
|
674
|
+
**Example:**
|
|
675
|
+
```xml
|
|
676
|
+
<!-- ❌ Bad - generic default name -->
|
|
677
|
+
<set-payload doc:name="Set Payload" value="#[output application/json --- {}]"/>
|
|
678
|
+
|
|
679
|
+
<!-- ✅ Good - descriptive name -->
|
|
680
|
+
<set-payload doc:name="Build Order Response" value="#[output application/json --- {}]"/>
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
---
|
|
684
|
+
|
|
685
|
+
## Standards Rules
|
|
415
686
|
|
|
416
687
|
### MULE-008: Choice Anti-Pattern
|
|
417
688
|
|
|
@@ -449,7 +720,89 @@
|
|
|
449
720
|
|
|
450
721
|
---
|
|
451
722
|
|
|
452
|
-
|
|
723
|
+
### OPS-001: Auto-Discovery Configuration
|
|
724
|
+
|
|
725
|
+
| Property | Value |
|
|
726
|
+
|----------|-------|
|
|
727
|
+
| **Severity** | Info |
|
|
728
|
+
| **Category** | Standards |
|
|
729
|
+
| **Fixable** | No |
|
|
730
|
+
|
|
731
|
+
**Description:** APIs should have auto-discovery configured for API Manager integration.
|
|
732
|
+
|
|
733
|
+
**Check Logic:** Flags API projects (those with APIKit router) that are missing `<api-gateway:autodiscovery>`. Also verifies that `apiId` uses a property placeholder.
|
|
734
|
+
|
|
735
|
+
**Example:**
|
|
736
|
+
```xml
|
|
737
|
+
<!-- ✅ Good -->
|
|
738
|
+
<api-gateway:autodiscovery apiId="${api.id}" flowRef="api-main"/>
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
---
|
|
742
|
+
|
|
743
|
+
### OPS-002: HTTP Port Placeholder
|
|
744
|
+
|
|
745
|
+
| Property | Value |
|
|
746
|
+
|----------|-------|
|
|
747
|
+
| **Severity** | Warning |
|
|
748
|
+
| **Category** | Standards |
|
|
749
|
+
| **Fixable** | No |
|
|
750
|
+
|
|
751
|
+
**Description:** HTTP listener ports should use property placeholders, not hardcoded values.
|
|
752
|
+
|
|
753
|
+
**Example:**
|
|
754
|
+
```xml
|
|
755
|
+
<!-- ❌ Bad -->
|
|
756
|
+
<http:listener-config port="8081"/>
|
|
757
|
+
|
|
758
|
+
<!-- ✅ Good -->
|
|
759
|
+
<http:listener-config port="${http.port}"/>
|
|
760
|
+
```
|
|
761
|
+
|
|
762
|
+
---
|
|
763
|
+
|
|
764
|
+
### OPS-003: Externalized Cron Expression
|
|
765
|
+
|
|
766
|
+
| Property | Value |
|
|
767
|
+
|----------|-------|
|
|
768
|
+
| **Severity** | Warning |
|
|
769
|
+
| **Category** | Standards |
|
|
770
|
+
| **Fixable** | No |
|
|
771
|
+
|
|
772
|
+
**Description:** Cron expressions in schedulers should use property placeholders to allow environment-specific scheduling.
|
|
773
|
+
|
|
774
|
+
**Example:**
|
|
775
|
+
```xml
|
|
776
|
+
<!-- ❌ Bad -->
|
|
777
|
+
<scheduling-strategy>
|
|
778
|
+
<cron expression="0 0 3 * * ?"/>
|
|
779
|
+
</scheduling-strategy>
|
|
780
|
+
|
|
781
|
+
<!-- ✅ Good -->
|
|
782
|
+
<scheduling-strategy>
|
|
783
|
+
<cron expression="${scheduler.cron}"/>
|
|
784
|
+
</scheduling-strategy>
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
---
|
|
788
|
+
|
|
789
|
+
### API-005: APIKit Validation
|
|
790
|
+
|
|
791
|
+
| Property | Value |
|
|
792
|
+
|----------|-------|
|
|
793
|
+
| **Severity** | Info |
|
|
794
|
+
| **Category** | Standards |
|
|
795
|
+
| **Fixable** | No |
|
|
796
|
+
|
|
797
|
+
**Description:** APIs should use APIKit for auto-generated implementation interfaces.
|
|
798
|
+
|
|
799
|
+
**Check Logic:** Flags API projects (those with HTTP listeners and main flows) that don't use an APIKit router.
|
|
800
|
+
|
|
801
|
+
**Best Practice:** APIKit provides consistent API implementation patterns and automatic input validation based on the RAML/OAS spec.
|
|
802
|
+
|
|
803
|
+
---
|
|
804
|
+
|
|
805
|
+
## Complexity Rules
|
|
453
806
|
|
|
454
807
|
> **Best Practice**: Keep cyclomatic complexity below 10. Extract complex logic into sub-flows.
|
|
455
808
|
|
|
@@ -491,7 +844,7 @@
|
|
|
491
844
|
|
|
492
845
|
---
|
|
493
846
|
|
|
494
|
-
## Structure Rules
|
|
847
|
+
## Structure Rules
|
|
495
848
|
|
|
496
849
|
> **Best Practice**: Follow standard MuleSoft project structure. Keep XML files focused - one flow per file for complex flows.
|
|
497
850
|
|
|
@@ -540,7 +893,7 @@
|
|
|
540
893
|
|
|
541
894
|
---
|
|
542
895
|
|
|
543
|
-
## YAML Rules
|
|
896
|
+
## YAML Rules
|
|
544
897
|
|
|
545
898
|
> **Best Practice**: Use environment-specific YAML files (dev.yaml, qa.yaml, prod.yaml). Encrypt sensitive properties.
|
|
546
899
|
|
|
@@ -605,7 +958,7 @@ db.password: "![encryptedValue]"
|
|
|
605
958
|
|
|
606
959
|
---
|
|
607
960
|
|
|
608
|
-
## DataWeave Rules
|
|
961
|
+
## DataWeave Rules
|
|
609
962
|
|
|
610
963
|
> **Best Practice**: Externalize complex transformations to .dwl files. Create reusable modules for common functions.
|
|
611
964
|
|
|
@@ -645,7 +998,39 @@ db.password: "![encryptedValue]"
|
|
|
645
998
|
|
|
646
999
|
---
|
|
647
1000
|
|
|
648
|
-
|
|
1001
|
+
### DW-004: Java 17 DataWeave Error Handling
|
|
1002
|
+
|
|
1003
|
+
| Property | Value |
|
|
1004
|
+
|----------|-------|
|
|
1005
|
+
| **Severity** | Error |
|
|
1006
|
+
| **Category** | DataWeave |
|
|
1007
|
+
| **Fixable** | No |
|
|
1008
|
+
|
|
1009
|
+
**Description:** Enforces DataWeave error handling patterns compatible with Java 17 encapsulation. Detects restricted property access patterns that fail at runtime on Java 17.
|
|
1010
|
+
|
|
1011
|
+
**Forbidden Patterns & Replacements:**
|
|
1012
|
+
|
|
1013
|
+
| Forbidden | Replacement |
|
|
1014
|
+
|-----------|-------------|
|
|
1015
|
+
| `error.description` | `error.detailedDescription` |
|
|
1016
|
+
| `error.errorType.asString` | `error.errorType.namespace ++ ":" ++ error.errorType.identifier` |
|
|
1017
|
+
| `error.muleMessage` | `error.errorMessage` |
|
|
1018
|
+
| `error.errors` | `error.childErrors` |
|
|
1019
|
+
|
|
1020
|
+
**Example:**
|
|
1021
|
+
```dataweave
|
|
1022
|
+
// ❌ Bad - restricted in Java 17
|
|
1023
|
+
error.description
|
|
1024
|
+
error.errorType.asString()
|
|
1025
|
+
|
|
1026
|
+
// ✅ Good - Java 17 compatible
|
|
1027
|
+
error.detailedDescription
|
|
1028
|
+
error.errorType.namespace ++ ":" ++ error.errorType.identifier
|
|
1029
|
+
```
|
|
1030
|
+
|
|
1031
|
+
---
|
|
1032
|
+
|
|
1033
|
+
## API-Led Rules
|
|
649
1034
|
|
|
650
1035
|
> **Best Practice**: Follow API-Led Connectivity architecture with clear layer separation:
|
|
651
1036
|
> - **Experience Layer**: Channel-specific APIs (web, mobile)
|
|
@@ -688,7 +1073,91 @@ db.password: "![encryptedValue]"
|
|
|
688
1073
|
|
|
689
1074
|
---
|
|
690
1075
|
|
|
691
|
-
|
|
1076
|
+
### API-004: Single System Per SAPI
|
|
1077
|
+
|
|
1078
|
+
| Property | Value |
|
|
1079
|
+
|----------|-------|
|
|
1080
|
+
| **Severity** | Warning |
|
|
1081
|
+
| **Category** | API-Led |
|
|
1082
|
+
| **Fixable** | No |
|
|
1083
|
+
|
|
1084
|
+
**Description:** System API should integrate with only one backend system. This promotes clear separation of concerns, easier maintenance, better reusability, and simplified error handling.
|
|
1085
|
+
|
|
1086
|
+
**Check Logic:** Scans all Mule XML files in a SAPI project (identified by `-sapi`, `-sys-`, or `-system-` in the project name) for connector namespace declarations. If multiple distinct external system connectors are found (e.g., Salesforce + Database), the rule flags it.
|
|
1087
|
+
|
|
1088
|
+
**Recognized Connectors:** Salesforce, NetSuite, Database, SAP, Workday, ServiceNow, JMS, AMQP, Kafka, SFTP, FTP, MongoDB, Redis, and more.
|
|
1089
|
+
|
|
1090
|
+
---
|
|
1091
|
+
|
|
1092
|
+
## Operations & Hygiene Rules
|
|
1093
|
+
|
|
1094
|
+
### HYG-002: Commented Code Detection
|
|
1095
|
+
|
|
1096
|
+
| Property | Value |
|
|
1097
|
+
|----------|-------|
|
|
1098
|
+
| **Severity** | Info |
|
|
1099
|
+
| **Category** | Standards |
|
|
1100
|
+
| **Fixable** | No |
|
|
1101
|
+
|
|
1102
|
+
**Description:** Detects potentially commented-out code blocks in Mule configurations.
|
|
1103
|
+
|
|
1104
|
+
**Detected Patterns:** XML comments containing `<flow `, `<sub-flow `, `<logger `, `<set-variable `, `<set-payload `, `<choice>`, `<transform `, `<flow-ref `, `<try>`, `<db:`.
|
|
1105
|
+
|
|
1106
|
+
**Best Practice:** Remove commented code or convert to proper documentation comments. Use version control instead.
|
|
1107
|
+
|
|
1108
|
+
---
|
|
1109
|
+
|
|
1110
|
+
### HYG-003: Unused Flow Detection
|
|
1111
|
+
|
|
1112
|
+
| Property | Value |
|
|
1113
|
+
|----------|-------|
|
|
1114
|
+
| **Severity** | Warning |
|
|
1115
|
+
| **Category** | Standards |
|
|
1116
|
+
| **Fixable** | No |
|
|
1117
|
+
|
|
1118
|
+
**Description:** Detects flows and sub-flows that are never referenced by `flow-ref` within the same file.
|
|
1119
|
+
|
|
1120
|
+
**Check Logic:**
|
|
1121
|
+
- **Sub-flows**: Always expected to be referenced; flagged if no `flow-ref` points to them.
|
|
1122
|
+
- **Flows without triggers**: Flows that have no HTTP listener, scheduler, or VM listener and aren't referenced are flagged.
|
|
1123
|
+
- **Exclusions**: Flows matching common external patterns (`-main`, `-api`, `api-`, `-console`, `-error-handler`, `global`) are excluded.
|
|
1124
|
+
|
|
1125
|
+
---
|
|
1126
|
+
|
|
1127
|
+
## Governance Rules
|
|
1128
|
+
|
|
1129
|
+
### PROJ-001: POM Validation
|
|
1130
|
+
|
|
1131
|
+
| Property | Value |
|
|
1132
|
+
|----------|-------|
|
|
1133
|
+
| **Severity** | Error |
|
|
1134
|
+
| **Category** | Structure |
|
|
1135
|
+
| **Fixable** | No |
|
|
1136
|
+
|
|
1137
|
+
**Description:** Validates `pom.xml` existence and critical plugins.
|
|
1138
|
+
|
|
1139
|
+
**Checks:**
|
|
1140
|
+
1. `pom.xml` exists in project root
|
|
1141
|
+
2. Contains `mule-maven-plugin` in build configuration
|
|
1142
|
+
3. Contains `munit-maven-plugin` if test files exist
|
|
1143
|
+
|
|
1144
|
+
---
|
|
1145
|
+
|
|
1146
|
+
### PROJ-002: Git Hygiene
|
|
1147
|
+
|
|
1148
|
+
| Property | Value |
|
|
1149
|
+
|----------|-------|
|
|
1150
|
+
| **Severity** | Warning |
|
|
1151
|
+
| **Category** | Structure |
|
|
1152
|
+
| **Fixable** | No |
|
|
1153
|
+
|
|
1154
|
+
**Description:** Validates `.gitignore` existence and standard entries in git repositories.
|
|
1155
|
+
|
|
1156
|
+
**Required Entries:** `target/`, `.project`, `.classpath`, `.tooling-project`
|
|
1157
|
+
|
|
1158
|
+
---
|
|
1159
|
+
|
|
1160
|
+
## Experimental Rules
|
|
692
1161
|
|
|
693
1162
|
> ⚠️ These rules are in beta and may have false positives. Use for guidance only.
|
|
694
1163
|
|
|
@@ -732,9 +1201,9 @@ db.password: "![encryptedValue]"
|
|
|
732
1201
|
|
|
733
1202
|
| Severity | Count | Rules |
|
|
734
1203
|
|----------|-------|-------|
|
|
735
|
-
| Error |
|
|
736
|
-
| Warning |
|
|
737
|
-
| Info |
|
|
1204
|
+
| Error | 10 | MULE-001, 003, 004, 201, 202, SEC-002, SEC-006, LOG-004, DW-004, YAML-004, PROJ-001 |
|
|
1205
|
+
| Warning | 25 | MULE-002, 005, 006, 007, 008, 009, 101, 102, 301, 303, 401, 402, 403, 502, 503, 604, 701, 801, 802, 803, 804, SEC-003, SEC-004, PERF-002, RES-001, OPS-002, OPS-003, HYG-001, HYG-003, API-004, PROJ-002 |
|
|
1206
|
+
| Info | 21 | MULE-010, 501, 601, YAML-001, 003, DW-001, 002, 003, API-001, 002, 003, 005, EXP-001, 002, 003, ERR-001, LOG-001, OPS-001, DOC-001, HYG-002 |
|
|
738
1207
|
|
|
739
1208
|
---
|
|
740
1209
|
|