@sfdxy/mule-lint 1.7.1 → 1.8.2

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.
Files changed (159) hide show
  1. package/README.md +43 -7
  2. package/dist/bin/mule-lint-mcp.d.ts +3 -0
  3. package/dist/bin/mule-lint-mcp.d.ts.map +1 -0
  4. package/dist/bin/mule-lint-mcp.js +13 -0
  5. package/dist/bin/mule-lint-mcp.js.map +1 -0
  6. package/dist/package.json +6 -3
  7. package/dist/src/core/ComplexityCalculator.d.ts.map +1 -1
  8. package/dist/src/core/ComplexityCalculator.js +8 -8
  9. package/dist/src/core/ComplexityCalculator.js.map +1 -1
  10. package/dist/src/core/FileScanner.d.ts.map +1 -1
  11. package/dist/src/core/FileScanner.js +11 -12
  12. package/dist/src/core/FileScanner.js.map +1 -1
  13. package/dist/src/core/XPathHelper.d.ts.map +1 -1
  14. package/dist/src/core/XPathHelper.js +23 -23
  15. package/dist/src/core/XPathHelper.js.map +1 -1
  16. package/dist/src/core/XmlParser.js +1 -1
  17. package/dist/src/core/XmlParser.js.map +1 -1
  18. package/dist/src/core/YamlParser.d.ts.map +1 -1
  19. package/dist/src/core/YamlParser.js +1 -1
  20. package/dist/src/core/YamlParser.js.map +1 -1
  21. package/dist/src/engine/LintEngine.d.ts.map +1 -1
  22. package/dist/src/engine/LintEngine.js +6 -4
  23. package/dist/src/engine/LintEngine.js.map +1 -1
  24. package/dist/src/formatters/CsvFormatter.d.ts.map +1 -1
  25. package/dist/src/formatters/CsvFormatter.js +6 -4
  26. package/dist/src/formatters/CsvFormatter.js.map +1 -1
  27. package/dist/src/formatters/HtmlFormatter.d.ts.map +1 -1
  28. package/dist/src/formatters/HtmlFormatter.js +12 -7
  29. package/dist/src/formatters/HtmlFormatter.js.map +1 -1
  30. package/dist/src/formatters/SarifFormatter.d.ts.map +1 -1
  31. package/dist/src/formatters/SarifFormatter.js +20 -10
  32. package/dist/src/formatters/SarifFormatter.js.map +1 -1
  33. package/dist/src/formatters/TableFormatter.d.ts.map +1 -1
  34. package/dist/src/formatters/TableFormatter.js +1 -1
  35. package/dist/src/formatters/TableFormatter.js.map +1 -1
  36. package/dist/src/mcp/index.d.ts +13 -0
  37. package/dist/src/mcp/index.d.ts.map +1 -0
  38. package/dist/src/mcp/index.js +375 -0
  39. package/dist/src/mcp/index.js.map +1 -0
  40. package/dist/src/rules/api-led/ApiLedRules.d.ts.map +1 -1
  41. package/dist/src/rules/api-led/ApiLedRules.js +3 -1
  42. package/dist/src/rules/api-led/ApiLedRules.js.map +1 -1
  43. package/dist/src/rules/base/BaseRule.d.ts.map +1 -1
  44. package/dist/src/rules/base/BaseRule.js +1 -1
  45. package/dist/src/rules/base/BaseRule.js.map +1 -1
  46. package/dist/src/rules/complexity/FlowComplexityRule.d.ts.map +1 -1
  47. package/dist/src/rules/complexity/FlowComplexityRule.js +3 -5
  48. package/dist/src/rules/complexity/FlowComplexityRule.js.map +1 -1
  49. package/dist/src/rules/dataweave/DataWeaveRules.d.ts.map +1 -1
  50. package/dist/src/rules/dataweave/DataWeaveRules.js +5 -5
  51. package/dist/src/rules/dataweave/DataWeaveRules.js.map +1 -1
  52. package/dist/src/rules/dataweave/Java17DWErrorHandlingRule.d.ts +21 -0
  53. package/dist/src/rules/dataweave/Java17DWErrorHandlingRule.d.ts.map +1 -0
  54. package/dist/src/rules/dataweave/Java17DWErrorHandlingRule.js +162 -0
  55. package/dist/src/rules/dataweave/Java17DWErrorHandlingRule.js.map +1 -0
  56. package/dist/src/rules/documentation/FlowDescriptionRule.d.ts.map +1 -1
  57. package/dist/src/rules/documentation/FlowDescriptionRule.js +1 -1
  58. package/dist/src/rules/documentation/FlowDescriptionRule.js.map +1 -1
  59. package/dist/src/rules/documentation/MissingDocNameRule.d.ts.map +1 -1
  60. package/dist/src/rules/documentation/MissingDocNameRule.js +1 -1
  61. package/dist/src/rules/documentation/MissingDocNameRule.js.map +1 -1
  62. package/dist/src/rules/error-handling/CorrelationIdRule.d.ts.map +1 -1
  63. package/dist/src/rules/error-handling/CorrelationIdRule.js +1 -1
  64. package/dist/src/rules/error-handling/CorrelationIdRule.js.map +1 -1
  65. package/dist/src/rules/error-handling/GenericErrorRule.d.ts.map +1 -1
  66. package/dist/src/rules/error-handling/GenericErrorRule.js +2 -5
  67. package/dist/src/rules/error-handling/GenericErrorRule.js.map +1 -1
  68. package/dist/src/rules/error-handling/GlobalErrorHandlerRule.d.ts +1 -1
  69. package/dist/src/rules/error-handling/GlobalErrorHandlerRule.d.ts.map +1 -1
  70. package/dist/src/rules/error-handling/GlobalErrorHandlerRule.js +2 -2
  71. package/dist/src/rules/error-handling/GlobalErrorHandlerRule.js.map +1 -1
  72. package/dist/src/rules/error-handling/HttpStatusRule.d.ts.map +1 -1
  73. package/dist/src/rules/error-handling/HttpStatusRule.js +1 -1
  74. package/dist/src/rules/error-handling/HttpStatusRule.js.map +1 -1
  75. package/dist/src/rules/error-handling/MissingErrorHandlerRule.d.ts.map +1 -1
  76. package/dist/src/rules/error-handling/MissingErrorHandlerRule.js +9 -1
  77. package/dist/src/rules/error-handling/MissingErrorHandlerRule.js.map +1 -1
  78. package/dist/src/rules/experimental/ExperimentalRules.d.ts.map +1 -1
  79. package/dist/src/rules/experimental/ExperimentalRules.js +1 -1
  80. package/dist/src/rules/experimental/ExperimentalRules.js.map +1 -1
  81. package/dist/src/rules/http/HttpContentTypeRule.d.ts.map +1 -1
  82. package/dist/src/rules/http/HttpContentTypeRule.js +1 -1
  83. package/dist/src/rules/http/HttpContentTypeRule.js.map +1 -1
  84. package/dist/src/rules/http/HttpTimeoutRule.d.ts.map +1 -1
  85. package/dist/src/rules/http/HttpTimeoutRule.js +1 -1
  86. package/dist/src/rules/http/HttpTimeoutRule.js.map +1 -1
  87. package/dist/src/rules/http/HttpUserAgentRule.d.ts.map +1 -1
  88. package/dist/src/rules/http/HttpUserAgentRule.js +1 -1
  89. package/dist/src/rules/http/HttpUserAgentRule.js.map +1 -1
  90. package/dist/src/rules/index.d.ts +1 -1
  91. package/dist/src/rules/index.d.ts.map +1 -1
  92. package/dist/src/rules/index.js +7 -5
  93. package/dist/src/rules/index.js.map +1 -1
  94. package/dist/src/rules/logging/LoggerCategoryRule.js +2 -2
  95. package/dist/src/rules/logging/LoggerCategoryRule.js.map +1 -1
  96. package/dist/src/rules/logging/LoggerInUntilSuccessfulRule.js +1 -1
  97. package/dist/src/rules/logging/LoggerInUntilSuccessfulRule.js.map +1 -1
  98. package/dist/src/rules/logging/LoggerPayloadRule.d.ts.map +1 -1
  99. package/dist/src/rules/logging/LoggerPayloadRule.js +3 -3
  100. package/dist/src/rules/logging/LoggerPayloadRule.js.map +1 -1
  101. package/dist/src/rules/naming/FlowCasingRule.d.ts +1 -0
  102. package/dist/src/rules/naming/FlowCasingRule.d.ts.map +1 -1
  103. package/dist/src/rules/naming/FlowCasingRule.js +7 -1
  104. package/dist/src/rules/naming/FlowCasingRule.js.map +1 -1
  105. package/dist/src/rules/naming/FlowNamingRule.d.ts.map +1 -1
  106. package/dist/src/rules/naming/FlowNamingRule.js +12 -1
  107. package/dist/src/rules/naming/FlowNamingRule.js.map +1 -1
  108. package/dist/src/rules/naming/VariableNamingRule.d.ts.map +1 -1
  109. package/dist/src/rules/naming/VariableNamingRule.js +3 -3
  110. package/dist/src/rules/naming/VariableNamingRule.js.map +1 -1
  111. package/dist/src/rules/performance/AsyncErrorHandlerRule.d.ts.map +1 -1
  112. package/dist/src/rules/performance/AsyncErrorHandlerRule.js +1 -1
  113. package/dist/src/rules/performance/AsyncErrorHandlerRule.js.map +1 -1
  114. package/dist/src/rules/performance/LargeChoiceBlockRule.d.ts.map +1 -1
  115. package/dist/src/rules/performance/LargeChoiceBlockRule.js +1 -1
  116. package/dist/src/rules/performance/LargeChoiceBlockRule.js.map +1 -1
  117. package/dist/src/rules/performance/ScatterGatherRoutesRule.d.ts.map +1 -1
  118. package/dist/src/rules/performance/ScatterGatherRoutesRule.js +1 -1
  119. package/dist/src/rules/performance/ScatterGatherRoutesRule.js.map +1 -1
  120. package/dist/src/rules/security/HardcodedCredentialsRule.d.ts.map +1 -1
  121. package/dist/src/rules/security/HardcodedCredentialsRule.js +6 -6
  122. package/dist/src/rules/security/HardcodedCredentialsRule.js.map +1 -1
  123. package/dist/src/rules/security/HardcodedHttpRule.d.ts.map +1 -1
  124. package/dist/src/rules/security/HardcodedHttpRule.js +2 -6
  125. package/dist/src/rules/security/HardcodedHttpRule.js.map +1 -1
  126. package/dist/src/rules/security/InsecureTlsRule.d.ts.map +1 -1
  127. package/dist/src/rules/security/InsecureTlsRule.js +2 -2
  128. package/dist/src/rules/security/InsecureTlsRule.js.map +1 -1
  129. package/dist/src/rules/standards/ChoiceAntiPatternRule.d.ts.map +1 -1
  130. package/dist/src/rules/standards/ChoiceAntiPatternRule.js +8 -2
  131. package/dist/src/rules/standards/ChoiceAntiPatternRule.js.map +1 -1
  132. package/dist/src/rules/standards/DeprecatedComponentRule.d.ts.map +1 -1
  133. package/dist/src/rules/standards/DeprecatedComponentRule.js +1 -1
  134. package/dist/src/rules/standards/DeprecatedComponentRule.js.map +1 -1
  135. package/dist/src/rules/standards/DwlStandardsRule.d.ts.map +1 -1
  136. package/dist/src/rules/standards/DwlStandardsRule.js +1 -1
  137. package/dist/src/rules/standards/DwlStandardsRule.js.map +1 -1
  138. package/dist/src/rules/structure/StructureRules.d.ts.map +1 -1
  139. package/dist/src/rules/structure/StructureRules.js +6 -9
  140. package/dist/src/rules/structure/StructureRules.js.map +1 -1
  141. package/dist/src/rules/yaml/YamlRules.d.ts.map +1 -1
  142. package/dist/src/rules/yaml/YamlRules.js +19 -12
  143. package/dist/src/rules/yaml/YamlRules.js.map +1 -1
  144. package/dist/src/types/Config.d.ts.map +1 -1
  145. package/dist/src/types/Config.js +1 -5
  146. package/dist/src/types/Config.js.map +1 -1
  147. package/docs/README.md +95 -0
  148. package/docs/best-practices/documentation-standards.md +82 -0
  149. package/docs/best-practices/folder-structure.md +61 -0
  150. package/docs/best-practices/mulesoft-best-practices.md +902 -0
  151. package/docs/best-practices/rules-catalog.md +736 -0
  152. package/docs/linter/architecture.md +294 -0
  153. package/docs/linter/extending.md +426 -0
  154. package/docs/linter/folder-structure.md +251 -0
  155. package/docs/linter/images/html-report-dashboard.png +0 -0
  156. package/docs/linter/naming-conventions.md +300 -0
  157. package/docs/linter/rule-engine.md +532 -0
  158. package/docs/mcp-design.md +80 -0
  159. package/package.json +6 -3
@@ -0,0 +1,736 @@
1
+ # Rules Catalog
2
+
3
+ > **Version:** 2.0.0
4
+ > **Total Rules:** 40 implemented across 5 rule families
5
+ > **Last Updated:** December 2025
6
+
7
+ ---
8
+
9
+ ## Quick Navigation
10
+
11
+ - [Rule Categories](#rule-categories)
12
+ - [Error Handling Rules](#error-handling-rules-mule-001-009)
13
+ - [Naming Rules](#naming-rules-mule-002-101-102)
14
+ - [Security Rules](#security-rules-mule-004-201-202)
15
+ - [Logging Rules](#logging-rules-mule-006-301-303)
16
+ - [HTTP Rules](#http-rules-mule-401-403)
17
+ - [Performance Rules](#performance-rules-mule-501-503)
18
+ - [Documentation Rules](#documentation-rules-mule-601-604)
19
+ - [Standards Rules](#standards-rules-mule-008-010-701)
20
+ - [Complexity Rules](#complexity-rules-mule-801)
21
+ - [Structure Rules](#structure-rules-mule-802-804)
22
+ - [YAML Rules](#yaml-rules-yaml-001-004)
23
+ - [DataWeave Rules](#dataweave-rules-dw-001-003)
24
+ - [API-Led Rules](#api-led-rules-api-001-003)
25
+ - [Experimental Rules](#experimental-rules-exp-001-003)
26
+
27
+ ---
28
+
29
+ ## Rule Categories
30
+
31
+ | Family | Prefix | Count | Description |
32
+ |--------|--------|-------|-------------|
33
+ | Core MuleSoft | MULE-XXX | 29 | Core Mule 4 XML validation |
34
+ | YAML Properties | YAML-XXX | 3 | YAML configuration validation |
35
+ | DataWeave | DW-XXX | 3 | DataWeave file validation |
36
+ | API-Led | API-XXX | 3 | API-Led connectivity patterns |
37
+ | Experimental | EXP-XXX | 3 | Beta rules for evaluation |
38
+
39
+ ### MULE Category ID Ranges
40
+
41
+ | Range | Category | Description |
42
+ |-------|----------|-------------|
43
+ | 001-099 | Error Handling | Error handler configuration and best practices |
44
+ | 100-199 | Naming | Naming conventions for flows, variables, files |
45
+ | 200-299 | Security | Security vulnerabilities and hardcoded values |
46
+ | 300-399 | Logging | Logging standards and structured logging |
47
+ | 400-499 | HTTP | HTTP configuration and headers |
48
+ | 500-599 | Performance | Performance anti-patterns |
49
+ | 600-699 | Documentation | Documentation requirements |
50
+ | 700-799 | Standards | General coding standards |
51
+ | 800-899 | Complexity/Structure | Code complexity and project structure |
52
+
53
+ ---
54
+
55
+ > 📘 **For detailed best practices, see [MuleSoft Best Practices Guide](mulesoft-best-practices.md)**
56
+
57
+ ## Error Handling Rules (MULE-001-009)
58
+
59
+ > **Best Practice**: Every flow should have explicit error handling. Use a global error handler for consistency, but override specific handlers where needed.
60
+
61
+ ### MULE-001: Global Error Handler Exists
62
+
63
+ | Property | Value |
64
+ |----------|-------|
65
+ | **Severity** | Error |
66
+ | **Category** | Error Handling |
67
+ | **Fixable** | No |
68
+
69
+ **Description:** Every Mule project should have a global error handler file with a reusable error-handler configuration.
70
+
71
+ **Check Logic:**
72
+ 1. Verify file exists: `src/main/mule/global-error-handler.xml`
73
+ 2. Verify contains: `<error-handler name="global-error-handler">`
74
+
75
+ **Why This Matters:** A global error handler ensures consistent error responses across all flows and reduces code duplication.
76
+
77
+ ---
78
+
79
+ ### MULE-003: Missing Error Handler
80
+
81
+ | Property | Value |
82
+ |----------|-------|
83
+ | **Severity** | Error |
84
+ | **Category** | Error Handling |
85
+ | **Fixable** | No |
86
+
87
+ **Description:** Every flow should have an error handler or reference the global one.
88
+
89
+ **XPath:**
90
+ ```xpath
91
+ //mule:flow[not(mule:error-handler) and not(contains(@name, 'api-main'))]
92
+ ```
93
+
94
+ ---
95
+
96
+ ### MULE-005: HTTP Status in Error Handler
97
+
98
+ | Property | Value |
99
+ |----------|-------|
100
+ | **Severity** | Warning |
101
+ | **Category** | Error Handling |
102
+ | **Fixable** | No |
103
+
104
+ **Description:** Error handlers should set an `httpStatus` variable for proper API responses.
105
+
106
+ **Best Practice:** Always set httpStatus in error handlers to return appropriate HTTP codes (400, 404, 500, etc.).
107
+
108
+ ---
109
+
110
+ ### MULE-007: Correlation ID in Error Handler
111
+
112
+ | Property | Value |
113
+ |----------|-------|
114
+ | **Severity** | Warning |
115
+ | **Category** | Error Handling |
116
+ | **Fixable** | No |
117
+
118
+ **Description:** Error handlers should reference `correlationId` for traceability across distributed systems.
119
+
120
+ ---
121
+
122
+ ### MULE-009: Generic Error Type
123
+
124
+ | Property | Value |
125
+ |----------|-------|
126
+ | **Severity** | Warning |
127
+ | **Category** | Error Handling |
128
+ | **Fixable** | No |
129
+
130
+ **Description:** Avoid catching `type="ANY"` in error handlers. Be specific about error types.
131
+
132
+ **Why This Matters:** Catching `ANY` can mask important errors and make debugging difficult.
133
+
134
+ ---
135
+
136
+ ## Naming Rules (MULE-002, 101, 102)
137
+
138
+ > **Best Practice**: Consistent naming conventions improve readability and maintainability. Use kebab-case for flows and camelCase for variables.
139
+
140
+ ### MULE-002: Flow Naming Convention
141
+
142
+ | Property | Value |
143
+ |----------|-------|
144
+ | **Severity** | Warning |
145
+ | **Category** | Naming |
146
+ | **Fixable** | Yes |
147
+
148
+ **Description:** Flows must end with `-flow` suffix, sub-flows with `-subflow`.
149
+
150
+ **Examples:**
151
+ ```xml
152
+ <!-- ✅ Good -->
153
+ <flow name="process-order-flow">
154
+ <sub-flow name="validate-input-subflow">
155
+
156
+ <!-- ❌ Bad -->
157
+ <flow name="processOrder">
158
+ <sub-flow name="validateInput">
159
+ ```
160
+
161
+ ---
162
+
163
+ ### MULE-101: Flow Name Casing
164
+
165
+ | Property | Value |
166
+ |----------|-------|
167
+ | **Severity** | Warning |
168
+ | **Category** | Naming |
169
+ | **Fixable** | No |
170
+
171
+ **Description:** Flow names should follow consistent casing (kebab-case recommended).
172
+
173
+ **Options:**
174
+ - `kebab-case`: `my-flow-name` (recommended)
175
+ - `camelCase`: `myFlowName`
176
+ - `snake_case`: `my_flow_name`
177
+
178
+ ---
179
+
180
+ ### MULE-102: Variable Naming Convention
181
+
182
+ | Property | Value |
183
+ |----------|-------|
184
+ | **Severity** | Warning |
185
+ | **Category** | Naming |
186
+ | **Fixable** | No |
187
+
188
+ **Description:** Variables set via `set-variable` should follow camelCase naming.
189
+
190
+ ---
191
+
192
+ ## Security Rules (MULE-004, 201, 202)
193
+
194
+ > **Best Practice**: Never commit secrets to source control. Use secure properties files with encryption or external secrets management.
195
+
196
+ ### MULE-004: Hardcoded HTTP URLs
197
+
198
+ | Property | Value |
199
+ |----------|-------|
200
+ | **Severity** | Error |
201
+ | **Category** | Security |
202
+ | **Fixable** | No |
203
+
204
+ **Description:** HTTP/HTTPS URLs should use property placeholders, not hardcoded values.
205
+
206
+ **Examples:**
207
+ ```xml
208
+ <!-- ❌ Bad -->
209
+ <http:request url="https://api.example.com/orders" />
210
+
211
+ <!-- ✅ Good -->
212
+ <http:request url="${api.orders.url}" />
213
+ ```
214
+
215
+ ---
216
+
217
+ ### MULE-201: Hardcoded Credentials
218
+
219
+ | Property | Value |
220
+ |----------|-------|
221
+ | **Severity** | Error |
222
+ | **Category** | Security |
223
+ | **Fixable** | No |
224
+
225
+ **Description:** Passwords and secrets should never be hardcoded. Use secure properties.
226
+
227
+ **Best Practice:** Use MuleSoft Secure Properties module with encrypted values `![encrypted.value]`.
228
+
229
+ ---
230
+
231
+ ### MULE-202: Insecure TLS Configuration
232
+
233
+ | Property | Value |
234
+ |----------|-------|
235
+ | **Severity** | Error |
236
+ | **Category** | Security |
237
+ | **Fixable** | No |
238
+
239
+ **Description:** TLS configurations should not use insecure protocols or disable certificate verification.
240
+
241
+ ---
242
+
243
+ ## Logging Rules (MULE-006, 301, 303)
244
+
245
+ > **Best Practice**: Use structured logging with categories. Never log full payloads in production - they may contain PII or be excessively large.
246
+
247
+ ### MULE-006: Logger Category Required
248
+
249
+ | Property | Value |
250
+ |----------|-------|
251
+ | **Severity** | Warning |
252
+ | **Category** | Logging |
253
+ | **Fixable** | Yes |
254
+
255
+ **Description:** All loggers must have a `category` attribute for proper log filtering.
256
+
257
+ **Example:**
258
+ ```xml
259
+ <!-- ✅ Good -->
260
+ <logger category="com.myorg.orders" message="Processing order" level="INFO"/>
261
+ ```
262
+
263
+ ---
264
+
265
+ ### MULE-301: Logger Payload Reference
266
+
267
+ | Property | Value |
268
+ |----------|-------|
269
+ | **Severity** | Warning |
270
+ | **Category** | Logging |
271
+ | **Fixable** | No |
272
+
273
+ **Description:** Loggers should not directly reference `#[payload]` as it may log sensitive data and cause performance issues.
274
+
275
+ **Examples:**
276
+ ```xml
277
+ <!-- ❌ Bad - logs entire payload -->
278
+ <logger message="#[payload]" />
279
+
280
+ <!-- ✅ Good - logs specific fields -->
281
+ <logger message="#['Order ID: ' ++ payload.orderId]" />
282
+ ```
283
+
284
+ ---
285
+
286
+ ### MULE-303: Logger in Until-Successful
287
+
288
+ | Property | Value |
289
+ |----------|-------|
290
+ | **Severity** | Warning |
291
+ | **Category** | Logging |
292
+ | **Fixable** | No |
293
+
294
+ **Description:** Having a logger inside `until-successful` may flood logs on retries.
295
+
296
+ ---
297
+
298
+ ## HTTP Rules (MULE-401-403)
299
+
300
+ > **Best Practice**: Configure explicit timeouts, include identifying headers, and handle all HTTP response codes appropriately.
301
+
302
+ ### MULE-401: HTTP Request Missing User-Agent
303
+
304
+ | Property | Value |
305
+ |----------|-------|
306
+ | **Severity** | Warning |
307
+ | **Category** | HTTP |
308
+ | **Fixable** | No |
309
+
310
+ **Description:** All HTTP requests should include a `User-Agent` header for API identification.
311
+
312
+ ---
313
+
314
+ ### MULE-402: HTTP Request Missing Content-Type
315
+
316
+ | Property | Value |
317
+ |----------|-------|
318
+ | **Severity** | Warning |
319
+ | **Category** | HTTP |
320
+ | **Fixable** | No |
321
+
322
+ **Description:** POST/PUT HTTP requests should include a `Content-Type` header.
323
+
324
+ ---
325
+
326
+ ### MULE-403: HTTP Request Timeout
327
+
328
+ | Property | Value |
329
+ |----------|-------|
330
+ | **Severity** | Warning |
331
+ | **Category** | HTTP |
332
+ | **Fixable** | No |
333
+
334
+ **Description:** HTTP requests should have explicit timeout configuration.
335
+
336
+ **Best Practice:** Always set `responseTimeout` to avoid hanging connections.
337
+
338
+ ---
339
+
340
+ ## Performance Rules (MULE-501-503)
341
+
342
+ > **Best Practice**: Keep flows simple and focused. Use async processing carefully with proper error handling.
343
+
344
+ ### MULE-501: Scatter-Gather Routes
345
+
346
+ | Property | Value |
347
+ |----------|-------|
348
+ | **Severity** | Info |
349
+ | **Category** | Performance |
350
+ | **Fixable** | No |
351
+
352
+ **Description:** Scatter-gather with many routes may cause memory issues. Consider limiting routes.
353
+
354
+ ---
355
+
356
+ ### MULE-502: Async Without Error Handler
357
+
358
+ | Property | Value |
359
+ |----------|-------|
360
+ | **Severity** | Warning |
361
+ | **Category** | Performance |
362
+ | **Fixable** | No |
363
+
364
+ **Description:** Async scopes should have their own error handling since they don't propagate errors to the parent flow.
365
+
366
+ **Why This Matters:** Errors in async scopes are silently swallowed without explicit handling.
367
+
368
+ ---
369
+
370
+ ### MULE-503: Large Choice Blocks
371
+
372
+ | Property | Value |
373
+ |----------|-------|
374
+ | **Severity** | Warning |
375
+ | **Category** | Performance |
376
+ | **Fixable** | No |
377
+
378
+ **Description:** Choice blocks with many when clauses should be refactored to DataWeave lookups or routing slip pattern.
379
+
380
+ ---
381
+
382
+ ## Documentation Rules (MULE-601, 604)
383
+
384
+ > **Best Practice**: Well-documented flows are easier to maintain. Use meaningful names that describe business purpose.
385
+
386
+ ### MULE-601: Flow Missing Description
387
+
388
+ | Property | Value |
389
+ |----------|-------|
390
+ | **Severity** | Info |
391
+ | **Category** | Documentation |
392
+ | **Fixable** | No |
393
+
394
+ **Description:** Flows should have a `doc:description` attribute for documentation.
395
+
396
+ ---
397
+
398
+ ### MULE-604: Missing doc:name
399
+
400
+ | Property | Value |
401
+ |----------|-------|
402
+ | **Severity** | Warning |
403
+ | **Category** | Documentation |
404
+ | **Fixable** | No |
405
+
406
+ **Description:** Key components (logger, set-variable, transform, etc.) should have `doc:name` for Anypoint Studio visibility.
407
+
408
+ ---
409
+
410
+ ## Standards Rules (MULE-008, 010, 701)
411
+
412
+ ### MULE-008: Choice Anti-Pattern
413
+
414
+ | Property | Value |
415
+ |----------|-------|
416
+ | **Severity** | Warning |
417
+ | **Category** | Standards |
418
+ | **Fixable** | No |
419
+
420
+ **Description:** Avoid using `raise-error` directly inside `choice/otherwise`. Use a more descriptive error type.
421
+
422
+ ---
423
+
424
+ ### MULE-010: DWL Standards File
425
+
426
+ | Property | Value |
427
+ |----------|-------|
428
+ | **Severity** | Info |
429
+ | **Category** | Standards |
430
+ | **Fixable** | No |
431
+
432
+ **Description:** Project should have a standard error DataWeave file at `src/main/resources/dwl/standard-error.dwl`.
433
+
434
+ ---
435
+
436
+ ### MULE-701: Deprecated Component Usage
437
+
438
+ | Property | Value |
439
+ |----------|-------|
440
+ | **Severity** | Warning |
441
+ | **Category** | Standards |
442
+ | **Fixable** | No |
443
+
444
+ **Description:** Detect usage of deprecated Mule components.
445
+
446
+ ---
447
+
448
+ ## Complexity Rules (MULE-801)
449
+
450
+ > **Best Practice**: Keep cyclomatic complexity below 10. Extract complex logic into sub-flows.
451
+
452
+ ### MULE-801: Flow Complexity
453
+
454
+ | Property | Value |
455
+ |----------|-------|
456
+ | **Severity** | Warning |
457
+ | **Category** | Complexity |
458
+ | **Fixable** | No |
459
+
460
+ **Description:** Flow cyclomatic complexity should not exceed threshold.
461
+
462
+ **Configuration:**
463
+ ```json
464
+ {
465
+ "MULE-801": {
466
+ "options": {
467
+ "warnThreshold": 10,
468
+ "errorThreshold": 20
469
+ }
470
+ }
471
+ }
472
+ ```
473
+
474
+ ---
475
+
476
+ ## Structure Rules (MULE-802-804)
477
+
478
+ > **Best Practice**: Follow standard MuleSoft project structure. Keep XML files focused - one flow per file for complex flows.
479
+
480
+ ### MULE-802: Project Structure
481
+
482
+ | Property | Value |
483
+ |----------|-------|
484
+ | **Severity** | Warning |
485
+ | **Category** | Structure |
486
+ | **Fixable** | No |
487
+
488
+ **Description:** Validate standard MuleSoft project folder structure.
489
+
490
+ **Required Directories:**
491
+ - `src/main/mule`
492
+ - `src/main/resources`
493
+
494
+ **Recommended Directories:**
495
+ - `src/main/resources/dwl`
496
+ - `src/main/resources/api`
497
+ - `src/test/munit`
498
+
499
+ ---
500
+
501
+ ### MULE-803: Global Config File
502
+
503
+ | Property | Value |
504
+ |----------|-------|
505
+ | **Severity** | Warning |
506
+ | **Category** | Structure |
507
+ | **Fixable** | No |
508
+
509
+ **Description:** Project should have `global.xml` with shared configurations (HTTP listeners, error handlers, etc.).
510
+
511
+ ---
512
+
513
+ ### MULE-804: Monolithic XML File
514
+
515
+ | Property | Value |
516
+ |----------|-------|
517
+ | **Severity** | Warning |
518
+ | **Category** | Structure |
519
+ | **Fixable** | No |
520
+
521
+ **Description:** XML files should not exceed 10 flows/sub-flows. Split large files by domain.
522
+
523
+ ---
524
+
525
+ ## YAML Rules (YAML-001-004)
526
+
527
+ > **Best Practice**: Use environment-specific YAML files (dev.yaml, qa.yaml, prod.yaml). Encrypt sensitive properties.
528
+
529
+ ### YAML-001: Environment Properties Files
530
+
531
+ | Property | Value |
532
+ |----------|-------|
533
+ | **Severity** | Warning |
534
+ | **Category** | Standards |
535
+ | **Fixable** | No |
536
+
537
+ **Description:** Environment-specific YAML property files should exist for each environment.
538
+
539
+ **Expected Files:**
540
+ - `dev.yaml` or `config-dev.yaml`
541
+ - `qa.yaml` or `config-qa.yaml`
542
+ - `prod.yaml` or `config-prod.yaml`
543
+
544
+ ---
545
+
546
+ ### YAML-003: Property Naming Convention
547
+
548
+ | Property | Value |
549
+ |----------|-------|
550
+ | **Severity** | Info |
551
+ | **Category** | Standards |
552
+ | **Fixable** | No |
553
+
554
+ **Description:** Property keys should follow `category.property` format.
555
+
556
+ **Examples:**
557
+ ```yaml
558
+ # ✅ Good
559
+ db.host: localhost
560
+ api.timeout: 30000
561
+
562
+ # ❌ Bad
563
+ DBHOST: localhost
564
+ ApiTimeout: 30000
565
+ ```
566
+
567
+ ---
568
+
569
+ ### YAML-004: No Plaintext Secrets
570
+
571
+ | Property | Value |
572
+ |----------|-------|
573
+ | **Severity** | Error |
574
+ | **Category** | Security |
575
+ | **Fixable** | No |
576
+
577
+ **Description:** Sensitive properties (passwords, keys, secrets) should be encrypted with `![...]` syntax.
578
+
579
+ **Example:**
580
+ ```yaml
581
+ # ❌ Bad - plaintext secret
582
+ db.password: mySecretPassword
583
+
584
+ # ✅ Good - encrypted
585
+ db.password: "![encryptedValue]"
586
+ ```
587
+
588
+ ---
589
+
590
+ ## DataWeave Rules (DW-001-003)
591
+
592
+ > **Best Practice**: Externalize complex transformations to .dwl files. Create reusable modules for common functions.
593
+
594
+ ### DW-001: External DWL for Complex Transforms
595
+
596
+ | Property | Value |
597
+ |----------|-------|
598
+ | **Severity** | Warning |
599
+ | **Category** | DataWeave |
600
+ | **Fixable** | No |
601
+
602
+ **Description:** Complex DataWeave (10+ lines) should be externalized to `.dwl` files.
603
+
604
+ ---
605
+
606
+ ### DW-002: DWL File Naming
607
+
608
+ | Property | Value |
609
+ |----------|-------|
610
+ | **Severity** | Info |
611
+ | **Category** | DataWeave |
612
+ | **Fixable** | No |
613
+
614
+ **Description:** DataWeave files should use kebab-case naming (`my-transform.dwl`).
615
+
616
+ ---
617
+
618
+ ### DW-003: DWL Modules
619
+
620
+ | Property | Value |
621
+ |----------|-------|
622
+ | **Severity** | Info |
623
+ | **Category** | DataWeave |
624
+ | **Fixable** | No |
625
+
626
+ **Description:** Project should have common reusable DataWeave modules (`common.dwl`, `utils.dwl`).
627
+
628
+ ---
629
+
630
+ ## API-Led Rules (API-001-003)
631
+
632
+ > **Best Practice**: Follow API-Led Connectivity architecture with clear layer separation:
633
+ > - **Experience Layer**: Channel-specific APIs (web, mobile)
634
+ > - **Process Layer**: Orchestration and business logic
635
+ > - **System Layer**: Backend system connectivity
636
+
637
+ ### API-001: Experience Layer Pattern
638
+
639
+ | Property | Value |
640
+ |----------|-------|
641
+ | **Severity** | Info |
642
+ | **Category** | API-Led |
643
+ | **Fixable** | No |
644
+
645
+ **Description:** Experience layer APIs (with `-exp-` in name) should have HTTP listeners as entry points.
646
+
647
+ ---
648
+
649
+ ### API-002: Process Layer Pattern
650
+
651
+ | Property | Value |
652
+ |----------|-------|
653
+ | **Severity** | Info |
654
+ | **Category** | API-Led |
655
+ | **Fixable** | No |
656
+
657
+ **Description:** Process layer APIs (with `-proc-` in name) should orchestrate other APIs via flow-refs or HTTP requests.
658
+
659
+ ---
660
+
661
+ ### API-003: System Layer Pattern
662
+
663
+ | Property | Value |
664
+ |----------|-------|
665
+ | **Severity** | Info |
666
+ | **Category** | API-Led |
667
+ | **Fixable** | No |
668
+
669
+ **Description:** System layer APIs (with `-sys-` in name) should connect to external systems (databases, HTTP services).
670
+
671
+ ---
672
+
673
+ ## Experimental Rules (EXP-001-003)
674
+
675
+ > ⚠️ These rules are in beta and may have false positives. Use for guidance only.
676
+
677
+ ### EXP-001: Flow Reference Depth
678
+
679
+ | Property | Value |
680
+ |----------|-------|
681
+ | **Severity** | Info |
682
+ | **Category** | Experimental |
683
+ | **Fixable** | No |
684
+
685
+ **Description:** Limit the number of flow-refs in a single flow to avoid deep call chains.
686
+
687
+ ---
688
+
689
+ ### EXP-002: Connector Config Naming
690
+
691
+ | Property | Value |
692
+ |----------|-------|
693
+ | **Severity** | Info |
694
+ | **Category** | Experimental |
695
+ | **Fixable** | No |
696
+
697
+ **Description:** Connector configurations should follow `Convention_Type` pattern (e.g., `HTTP_Request_Config`).
698
+
699
+ ---
700
+
701
+ ### EXP-003: MUnit Coverage
702
+
703
+ | Property | Value |
704
+ |----------|-------|
705
+ | **Severity** | Info |
706
+ | **Category** | Experimental |
707
+ | **Fixable** | No |
708
+
709
+ **Description:** Flows should have corresponding MUnit tests in `src/test/munit`.
710
+
711
+ ---
712
+
713
+ ## Rule Priority Matrix
714
+
715
+ | Severity | Count | Rules |
716
+ |----------|-------|-------|
717
+ | Error | 7 | MULE-001, 003, 004, 201, 202, YAML-004 |
718
+ | Warning | 21 | MULE-002, 005, 006, 007, 008, 009, 101, 102, 301, 303, 401, 402, 403, 502, 503, 604, 701, 801, 802, 803, 804 |
719
+ | Info | 12 | MULE-010, 501, 601, YAML-001, 003, DW-001, 002, 003, API-001, 002, 003, EXP-001, 002, 003 |
720
+
721
+ ---
722
+
723
+ ## Configuration
724
+
725
+ See [Extending mule-lint](../linter/extending.md) for instructions on adding organization-specific rules and customizing rule behavior.
726
+
727
+ ### Disabling Rules
728
+
729
+ ```json
730
+ {
731
+ "rules": {
732
+ "MULE-002": { "enabled": false },
733
+ "MULE-801": { "options": { "warnThreshold": 15 } }
734
+ }
735
+ }
736
+ ```