@sfdxy/mule-lint 1.4.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 +413 -0
- package/dist/bin/mule-lint.d.ts +3 -0
- package/dist/bin/mule-lint.d.ts.map +1 -0
- package/dist/bin/mule-lint.js +123 -0
- package/dist/bin/mule-lint.js.map +1 -0
- package/dist/src/core/ComplexityCalculator.d.ts +42 -0
- package/dist/src/core/ComplexityCalculator.d.ts.map +1 -0
- package/dist/src/core/ComplexityCalculator.js +123 -0
- package/dist/src/core/ComplexityCalculator.js.map +1 -0
- package/dist/src/core/FileScanner.d.ts +58 -0
- package/dist/src/core/FileScanner.d.ts.map +1 -0
- package/dist/src/core/FileScanner.js +161 -0
- package/dist/src/core/FileScanner.js.map +1 -0
- package/dist/src/core/XPathHelper.d.ts +81 -0
- package/dist/src/core/XPathHelper.d.ts.map +1 -0
- package/dist/src/core/XPathHelper.js +229 -0
- package/dist/src/core/XPathHelper.js.map +1 -0
- package/dist/src/core/XmlParser.d.ts +38 -0
- package/dist/src/core/XmlParser.d.ts.map +1 -0
- package/dist/src/core/XmlParser.js +131 -0
- package/dist/src/core/XmlParser.js.map +1 -0
- package/dist/src/core/YamlParser.d.ts +30 -0
- package/dist/src/core/YamlParser.d.ts.map +1 -0
- package/dist/src/core/YamlParser.js +120 -0
- package/dist/src/core/YamlParser.js.map +1 -0
- package/dist/src/core/index.d.ts +4 -0
- package/dist/src/core/index.d.ts.map +1 -0
- package/dist/src/core/index.js +21 -0
- package/dist/src/core/index.js.map +1 -0
- package/dist/src/engine/LintEngine.d.ts +60 -0
- package/dist/src/engine/LintEngine.d.ts.map +1 -0
- package/dist/src/engine/LintEngine.js +271 -0
- package/dist/src/engine/LintEngine.js.map +1 -0
- package/dist/src/engine/index.d.ts +2 -0
- package/dist/src/engine/index.d.ts.map +1 -0
- package/dist/src/engine/index.js +18 -0
- package/dist/src/engine/index.js.map +1 -0
- package/dist/src/formatters/JsonFormatter.d.ts +18 -0
- package/dist/src/formatters/JsonFormatter.d.ts.map +1 -0
- package/dist/src/formatters/JsonFormatter.js +45 -0
- package/dist/src/formatters/JsonFormatter.js.map +1 -0
- package/dist/src/formatters/SarifFormatter.d.ts +8 -0
- package/dist/src/formatters/SarifFormatter.d.ts.map +1 -0
- package/dist/src/formatters/SarifFormatter.js +115 -0
- package/dist/src/formatters/SarifFormatter.js.map +1 -0
- package/dist/src/formatters/TableFormatter.d.ts +10 -0
- package/dist/src/formatters/TableFormatter.d.ts.map +1 -0
- package/dist/src/formatters/TableFormatter.js +100 -0
- package/dist/src/formatters/TableFormatter.js.map +1 -0
- package/dist/src/formatters/index.d.ts +10 -0
- package/dist/src/formatters/index.d.ts.map +1 -0
- package/dist/src/formatters/index.js +42 -0
- package/dist/src/formatters/index.js.map +1 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +28 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/rules/api-led/ApiLedRules.d.ts +42 -0
- package/dist/src/rules/api-led/ApiLedRules.d.ts.map +1 -0
- package/dist/src/rules/api-led/ApiLedRules.js +95 -0
- package/dist/src/rules/api-led/ApiLedRules.js.map +1 -0
- package/dist/src/rules/base/BaseRule.d.ts +89 -0
- package/dist/src/rules/base/BaseRule.d.ts.map +1 -0
- package/dist/src/rules/base/BaseRule.js +137 -0
- package/dist/src/rules/base/BaseRule.js.map +1 -0
- package/dist/src/rules/complexity/FlowComplexityRule.d.ts +18 -0
- package/dist/src/rules/complexity/FlowComplexityRule.d.ts.map +1 -0
- package/dist/src/rules/complexity/FlowComplexityRule.js +58 -0
- package/dist/src/rules/complexity/FlowComplexityRule.js.map +1 -0
- package/dist/src/rules/dataweave/DataWeaveRules.d.ts +45 -0
- package/dist/src/rules/dataweave/DataWeaveRules.d.ts.map +1 -0
- package/dist/src/rules/dataweave/DataWeaveRules.js +168 -0
- package/dist/src/rules/dataweave/DataWeaveRules.js.map +1 -0
- package/dist/src/rules/documentation/FlowDescriptionRule.d.ts +16 -0
- package/dist/src/rules/documentation/FlowDescriptionRule.d.ts.map +1 -0
- package/dist/src/rules/documentation/FlowDescriptionRule.js +33 -0
- package/dist/src/rules/documentation/FlowDescriptionRule.js.map +1 -0
- package/dist/src/rules/documentation/MissingDocNameRule.d.ts +17 -0
- package/dist/src/rules/documentation/MissingDocNameRule.d.ts.map +1 -0
- package/dist/src/rules/documentation/MissingDocNameRule.js +44 -0
- package/dist/src/rules/documentation/MissingDocNameRule.js.map +1 -0
- package/dist/src/rules/error-handling/CorrelationIdRule.d.ts +26 -0
- package/dist/src/rules/error-handling/CorrelationIdRule.d.ts.map +1 -0
- package/dist/src/rules/error-handling/CorrelationIdRule.js +86 -0
- package/dist/src/rules/error-handling/CorrelationIdRule.js.map +1 -0
- package/dist/src/rules/error-handling/GenericErrorRule.d.ts +22 -0
- package/dist/src/rules/error-handling/GenericErrorRule.d.ts.map +1 -0
- package/dist/src/rules/error-handling/GenericErrorRule.js +51 -0
- package/dist/src/rules/error-handling/GenericErrorRule.js.map +1 -0
- package/dist/src/rules/error-handling/GlobalErrorHandlerRule.d.ts +17 -0
- package/dist/src/rules/error-handling/GlobalErrorHandlerRule.d.ts.map +1 -0
- package/dist/src/rules/error-handling/GlobalErrorHandlerRule.js +77 -0
- package/dist/src/rules/error-handling/GlobalErrorHandlerRule.js.map +1 -0
- package/dist/src/rules/error-handling/HttpStatusRule.d.ts +21 -0
- package/dist/src/rules/error-handling/HttpStatusRule.d.ts.map +1 -0
- package/dist/src/rules/error-handling/HttpStatusRule.js +57 -0
- package/dist/src/rules/error-handling/HttpStatusRule.js.map +1 -0
- package/dist/src/rules/error-handling/MissingErrorHandlerRule.d.ts +17 -0
- package/dist/src/rules/error-handling/MissingErrorHandlerRule.d.ts.map +1 -0
- package/dist/src/rules/error-handling/MissingErrorHandlerRule.js +51 -0
- package/dist/src/rules/error-handling/MissingErrorHandlerRule.js.map +1 -0
- package/dist/src/rules/experimental/ExperimentalRules.d.ts +43 -0
- package/dist/src/rules/experimental/ExperimentalRules.d.ts.map +1 -0
- package/dist/src/rules/experimental/ExperimentalRules.js +92 -0
- package/dist/src/rules/experimental/ExperimentalRules.js.map +1 -0
- package/dist/src/rules/http/HttpContentTypeRule.d.ts +17 -0
- package/dist/src/rules/http/HttpContentTypeRule.d.ts.map +1 -0
- package/dist/src/rules/http/HttpContentTypeRule.js +50 -0
- package/dist/src/rules/http/HttpContentTypeRule.js.map +1 -0
- package/dist/src/rules/http/HttpTimeoutRule.d.ts +16 -0
- package/dist/src/rules/http/HttpTimeoutRule.d.ts.map +1 -0
- package/dist/src/rules/http/HttpTimeoutRule.js +33 -0
- package/dist/src/rules/http/HttpTimeoutRule.js.map +1 -0
- package/dist/src/rules/http/HttpUserAgentRule.d.ts +17 -0
- package/dist/src/rules/http/HttpUserAgentRule.d.ts.map +1 -0
- package/dist/src/rules/http/HttpUserAgentRule.js +48 -0
- package/dist/src/rules/http/HttpUserAgentRule.js.map +1 -0
- package/dist/src/rules/index.d.ts +45 -0
- package/dist/src/rules/index.d.ts.map +1 -0
- package/dist/src/rules/index.js +205 -0
- package/dist/src/rules/index.js.map +1 -0
- package/dist/src/rules/logging/LoggerCategoryRule.d.ts +21 -0
- package/dist/src/rules/logging/LoggerCategoryRule.d.ts.map +1 -0
- package/dist/src/rules/logging/LoggerCategoryRule.js +61 -0
- package/dist/src/rules/logging/LoggerCategoryRule.js.map +1 -0
- package/dist/src/rules/logging/LoggerInUntilSuccessfulRule.d.ts +16 -0
- package/dist/src/rules/logging/LoggerInUntilSuccessfulRule.d.ts.map +1 -0
- package/dist/src/rules/logging/LoggerInUntilSuccessfulRule.js +29 -0
- package/dist/src/rules/logging/LoggerInUntilSuccessfulRule.js.map +1 -0
- package/dist/src/rules/logging/LoggerPayloadRule.d.ts +17 -0
- package/dist/src/rules/logging/LoggerPayloadRule.d.ts.map +1 -0
- package/dist/src/rules/logging/LoggerPayloadRule.js +39 -0
- package/dist/src/rules/logging/LoggerPayloadRule.js.map +1 -0
- package/dist/src/rules/naming/FlowCasingRule.d.ts +18 -0
- package/dist/src/rules/naming/FlowCasingRule.d.ts.map +1 -0
- package/dist/src/rules/naming/FlowCasingRule.js +40 -0
- package/dist/src/rules/naming/FlowCasingRule.js.map +1 -0
- package/dist/src/rules/naming/FlowNamingRule.d.ts +17 -0
- package/dist/src/rules/naming/FlowNamingRule.d.ts.map +1 -0
- package/dist/src/rules/naming/FlowNamingRule.js +60 -0
- package/dist/src/rules/naming/FlowNamingRule.js.map +1 -0
- package/dist/src/rules/naming/VariableNamingRule.d.ts +18 -0
- package/dist/src/rules/naming/VariableNamingRule.d.ts.map +1 -0
- package/dist/src/rules/naming/VariableNamingRule.js +39 -0
- package/dist/src/rules/naming/VariableNamingRule.js.map +1 -0
- package/dist/src/rules/performance/AsyncErrorHandlerRule.d.ts +16 -0
- package/dist/src/rules/performance/AsyncErrorHandlerRule.d.ts.map +1 -0
- package/dist/src/rules/performance/AsyncErrorHandlerRule.js +34 -0
- package/dist/src/rules/performance/AsyncErrorHandlerRule.js.map +1 -0
- package/dist/src/rules/performance/LargeChoiceBlockRule.d.ts +16 -0
- package/dist/src/rules/performance/LargeChoiceBlockRule.d.ts.map +1 -0
- package/dist/src/rules/performance/LargeChoiceBlockRule.js +32 -0
- package/dist/src/rules/performance/LargeChoiceBlockRule.js.map +1 -0
- package/dist/src/rules/performance/ScatterGatherRoutesRule.d.ts +16 -0
- package/dist/src/rules/performance/ScatterGatherRoutesRule.d.ts.map +1 -0
- package/dist/src/rules/performance/ScatterGatherRoutesRule.js +32 -0
- package/dist/src/rules/performance/ScatterGatherRoutesRule.js.map +1 -0
- package/dist/src/rules/security/HardcodedCredentialsRule.d.ts +19 -0
- package/dist/src/rules/security/HardcodedCredentialsRule.d.ts.map +1 -0
- package/dist/src/rules/security/HardcodedCredentialsRule.js +66 -0
- package/dist/src/rules/security/HardcodedCredentialsRule.js.map +1 -0
- package/dist/src/rules/security/HardcodedHttpRule.d.ts +33 -0
- package/dist/src/rules/security/HardcodedHttpRule.d.ts.map +1 -0
- package/dist/src/rules/security/HardcodedHttpRule.js +108 -0
- package/dist/src/rules/security/HardcodedHttpRule.js.map +1 -0
- package/dist/src/rules/security/InsecureTlsRule.d.ts +16 -0
- package/dist/src/rules/security/InsecureTlsRule.d.ts.map +1 -0
- package/dist/src/rules/security/InsecureTlsRule.js +36 -0
- package/dist/src/rules/security/InsecureTlsRule.js.map +1 -0
- package/dist/src/rules/standards/ChoiceAntiPatternRule.d.ts +17 -0
- package/dist/src/rules/standards/ChoiceAntiPatternRule.d.ts.map +1 -0
- package/dist/src/rules/standards/ChoiceAntiPatternRule.js +43 -0
- package/dist/src/rules/standards/ChoiceAntiPatternRule.js.map +1 -0
- package/dist/src/rules/standards/DeprecatedComponentRule.d.ts +17 -0
- package/dist/src/rules/standards/DeprecatedComponentRule.d.ts.map +1 -0
- package/dist/src/rules/standards/DeprecatedComponentRule.js +37 -0
- package/dist/src/rules/standards/DeprecatedComponentRule.js.map +1 -0
- package/dist/src/rules/standards/DwlStandardsRule.d.ts +22 -0
- package/dist/src/rules/standards/DwlStandardsRule.d.ts.map +1 -0
- package/dist/src/rules/standards/DwlStandardsRule.js +90 -0
- package/dist/src/rules/standards/DwlStandardsRule.js.map +1 -0
- package/dist/src/rules/structure/StructureRules.d.ts +45 -0
- package/dist/src/rules/structure/StructureRules.d.ts.map +1 -0
- package/dist/src/rules/structure/StructureRules.js +163 -0
- package/dist/src/rules/structure/StructureRules.js.map +1 -0
- package/dist/src/rules/yaml/YamlRules.d.ts +46 -0
- package/dist/src/rules/yaml/YamlRules.d.ts.map +1 -0
- package/dist/src/rules/yaml/YamlRules.js +226 -0
- package/dist/src/rules/yaml/YamlRules.js.map +1 -0
- package/dist/src/types/Config.d.ts +50 -0
- package/dist/src/types/Config.d.ts.map +1 -0
- package/dist/src/types/Config.js +18 -0
- package/dist/src/types/Config.js.map +1 -0
- package/dist/src/types/Report.d.ts +47 -0
- package/dist/src/types/Report.d.ts.map +1 -0
- package/dist/src/types/Report.js +3 -0
- package/dist/src/types/Report.js.map +1 -0
- package/dist/src/types/Rule.d.ts +76 -0
- package/dist/src/types/Rule.d.ts.map +1 -0
- package/dist/src/types/Rule.js +3 -0
- package/dist/src/types/Rule.js.map +1 -0
- package/dist/src/types/index.d.ts +4 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +21 -0
- package/dist/src/types/index.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.DwlModulesRule = exports.DwlNamingRule = exports.ExternalDwlRule = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const BaseRule_1 = require("../base/BaseRule");
|
|
40
|
+
/**
|
|
41
|
+
* DW-001: External DWL for Complex Transforms
|
|
42
|
+
*
|
|
43
|
+
* Complex DataWeave transforms should be in external .dwl files.
|
|
44
|
+
*/
|
|
45
|
+
class ExternalDwlRule extends BaseRule_1.BaseRule {
|
|
46
|
+
id = 'DW-001';
|
|
47
|
+
name = 'External DWL for Complex Transforms';
|
|
48
|
+
description = 'Complex DataWeave should be externalized to .dwl files';
|
|
49
|
+
severity = 'warning';
|
|
50
|
+
category = 'dataweave';
|
|
51
|
+
validate(doc, context) {
|
|
52
|
+
const issues = [];
|
|
53
|
+
const maxInlineLines = this.getOption(context, 'maxInlineLines', 10);
|
|
54
|
+
// Find all transform components
|
|
55
|
+
const transforms = this.select('//*[local-name()="transform"]', doc);
|
|
56
|
+
for (const transform of transforms) {
|
|
57
|
+
const setPayload = this.select('.//*[local-name()="set-payload"]', transform);
|
|
58
|
+
for (const payload of setPayload) {
|
|
59
|
+
const content = payload.textContent ?? '';
|
|
60
|
+
const lines = content.split('\n').filter(l => l.trim().length > 0);
|
|
61
|
+
if (lines.length > maxInlineLines) {
|
|
62
|
+
const docName = this.getDocName(transform) ?? 'Transform';
|
|
63
|
+
issues.push(this.createIssue(transform, `Transform "${docName}" has ${lines.length} lines - externalize to .dwl file`, {
|
|
64
|
+
suggestion: `Move to src/main/resources/dwl/ and use: resource("dwl/transform-name.dwl")`
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return issues;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.ExternalDwlRule = ExternalDwlRule;
|
|
73
|
+
/**
|
|
74
|
+
* DW-002: DWL File Naming Convention
|
|
75
|
+
*
|
|
76
|
+
* DataWeave files should follow naming convention.
|
|
77
|
+
*/
|
|
78
|
+
class DwlNamingRule extends BaseRule_1.BaseRule {
|
|
79
|
+
id = 'DW-002';
|
|
80
|
+
name = 'DWL File Naming';
|
|
81
|
+
description = 'DataWeave files should follow naming conventions';
|
|
82
|
+
severity = 'info';
|
|
83
|
+
category = 'dataweave';
|
|
84
|
+
validate(_doc, context) {
|
|
85
|
+
const issues = [];
|
|
86
|
+
const dwlDir = path.join(context.projectRoot, 'src/main/resources/dwl');
|
|
87
|
+
if (!fs.existsSync(dwlDir))
|
|
88
|
+
return issues;
|
|
89
|
+
const dwlFiles = this.findDwlFiles(dwlDir);
|
|
90
|
+
for (const file of dwlFiles) {
|
|
91
|
+
const basename = path.basename(file, '.dwl');
|
|
92
|
+
if (!this.isValidDwlName(basename)) {
|
|
93
|
+
issues.push({
|
|
94
|
+
line: 1,
|
|
95
|
+
message: `DWL file "${basename}.dwl" should use kebab-case naming`,
|
|
96
|
+
ruleId: this.id,
|
|
97
|
+
severity: this.severity,
|
|
98
|
+
suggestion: 'Rename to kebab-case: my-transform.dwl'
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return issues;
|
|
103
|
+
}
|
|
104
|
+
isValidDwlName(name) {
|
|
105
|
+
return /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(name);
|
|
106
|
+
}
|
|
107
|
+
findDwlFiles(dir) {
|
|
108
|
+
const files = [];
|
|
109
|
+
try {
|
|
110
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
111
|
+
for (const entry of entries) {
|
|
112
|
+
const fullPath = path.join(dir, entry.name);
|
|
113
|
+
if (entry.isDirectory()) {
|
|
114
|
+
files.push(...this.findDwlFiles(fullPath));
|
|
115
|
+
}
|
|
116
|
+
else if (entry.name.endsWith('.dwl')) {
|
|
117
|
+
files.push(fullPath);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
// Directory not readable
|
|
123
|
+
}
|
|
124
|
+
return files;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.DwlNamingRule = DwlNamingRule;
|
|
128
|
+
/**
|
|
129
|
+
* DW-003: DWL Modules Usage
|
|
130
|
+
*
|
|
131
|
+
* Common DataWeave functions should be in reusable modules.
|
|
132
|
+
*/
|
|
133
|
+
class DwlModulesRule extends BaseRule_1.BaseRule {
|
|
134
|
+
id = 'DW-003';
|
|
135
|
+
name = 'DWL Modules';
|
|
136
|
+
description = 'Project should have common DataWeave modules';
|
|
137
|
+
severity = 'info';
|
|
138
|
+
category = 'dataweave';
|
|
139
|
+
validate(_doc, context) {
|
|
140
|
+
const issues = [];
|
|
141
|
+
const dwlDir = path.join(context.projectRoot, 'src/main/resources/dwl');
|
|
142
|
+
if (!fs.existsSync(dwlDir))
|
|
143
|
+
return issues;
|
|
144
|
+
const hasCommonModule = this.hasFile(dwlDir, 'common');
|
|
145
|
+
const hasUtilsModule = this.hasFile(dwlDir, 'utils');
|
|
146
|
+
if (!hasCommonModule && !hasUtilsModule) {
|
|
147
|
+
issues.push({
|
|
148
|
+
line: 1,
|
|
149
|
+
message: 'No common/utils DWL module found',
|
|
150
|
+
ruleId: this.id,
|
|
151
|
+
severity: this.severity,
|
|
152
|
+
suggestion: 'Create common.dwl or utils.dwl for reusable functions'
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return issues;
|
|
156
|
+
}
|
|
157
|
+
hasFile(dir, pattern) {
|
|
158
|
+
try {
|
|
159
|
+
const files = fs.readdirSync(dir);
|
|
160
|
+
return files.some(f => f.toLowerCase().includes(pattern));
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
exports.DwlModulesRule = DwlModulesRule;
|
|
168
|
+
//# sourceMappingURL=DataWeaveRules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataWeaveRules.js","sourceRoot":"","sources":["../../../../src/rules/dataweave/DataWeaveRules.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,eAAgB,SAAQ,mBAAQ;IACzC,EAAE,GAAG,QAAQ,CAAC;IACd,IAAI,GAAG,qCAAqC,CAAC;IAC7C,WAAW,GAAG,wDAAwD,CAAC;IACvE,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,WAAoB,CAAC;IAEhC,QAAQ,CAAC,GAAa,EAAE,OAA0B;QAC9C,MAAM,MAAM,GAAY,EAAE,CAAC;QAC3B,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;QAErE,gCAAgC;QAChC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,+BAA+B,EAAE,GAAG,CAAC,CAAC;QAErE,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACjC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,kCAAkC,EAAE,SAAqB,CAAC,CAAC;YAE1F,KAAK,MAAM,OAAO,IAAI,UAAU,EAAE,CAAC;gBAC/B,MAAM,OAAO,GAAG,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC;gBAC1C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC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5
|
+
*
|
|
6
|
+
* Flows should have doc:description for documentation.
|
|
7
|
+
*/
|
|
8
|
+
export declare class FlowDescriptionRule extends BaseRule {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
severity: "info";
|
|
13
|
+
category: "documentation";
|
|
14
|
+
validate(doc: Document, _context: ValidationContext): Issue[];
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=FlowDescriptionRule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowDescriptionRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/documentation/FlowDescriptionRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,QAAQ;IAC7C,EAAE,SAAc;IAChB,IAAI,SAA8B;IAClC,WAAW,SAAyD;IACpE,QAAQ,EAAG,MAAM,CAAU;IAC3B,QAAQ,EAAG,eAAe,CAAU;IAEpC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAuBhE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlowDescriptionRule = void 0;
|
|
4
|
+
const BaseRule_1 = require("../base/BaseRule");
|
|
5
|
+
/**
|
|
6
|
+
* MULE-601: Flow Missing Description
|
|
7
|
+
*
|
|
8
|
+
* Flows should have doc:description for documentation.
|
|
9
|
+
*/
|
|
10
|
+
class FlowDescriptionRule extends BaseRule_1.BaseRule {
|
|
11
|
+
id = 'MULE-601';
|
|
12
|
+
name = 'Flow Missing Description';
|
|
13
|
+
description = 'Flows should have doc:description for documentation';
|
|
14
|
+
severity = 'info';
|
|
15
|
+
category = 'documentation';
|
|
16
|
+
validate(doc, _context) {
|
|
17
|
+
const issues = [];
|
|
18
|
+
// Find flows without description
|
|
19
|
+
const flows = this.select('//mule:flow', doc);
|
|
20
|
+
for (const flow of flows) {
|
|
21
|
+
const description = this.getAttribute(flow, 'doc:description');
|
|
22
|
+
const name = this.getNameAttribute(flow) ?? 'unnamed';
|
|
23
|
+
if (!description || description.trim() === '') {
|
|
24
|
+
issues.push(this.createIssue(flow, `Flow "${name}" is missing doc:description`, {
|
|
25
|
+
suggestion: 'Add doc:description="Description of what this flow does"'
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return issues;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.FlowDescriptionRule = FlowDescriptionRule;
|
|
33
|
+
//# sourceMappingURL=FlowDescriptionRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowDescriptionRule.js","sourceRoot":"","sources":["../../../../src/rules/documentation/FlowDescriptionRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,mBAAoB,SAAQ,mBAAQ;IAC7C,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,0BAA0B,CAAC;IAClC,WAAW,GAAG,qDAAqD,CAAC;IACpE,QAAQ,GAAG,MAAe,CAAC;IAC3B,QAAQ,GAAG,eAAwB,CAAC;IAEpC,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,iCAAiC;QACjC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;QAE9C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;YAC/D,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC;YAEtD,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;gBAC5C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CACxB,IAAI,EACJ,SAAS,IAAI,8BAA8B,EAC3C;oBACI,UAAU,EAAE,0DAA0D;iBACzE,CACJ,CAAC,CAAC;YACP,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA9BD,kDA8BC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ValidationContext, Issue } from '../../types';
|
|
2
|
+
import { BaseRule } from '../base/BaseRule';
|
|
3
|
+
/**
|
|
4
|
+
* MULE-604: Missing doc:name
|
|
5
|
+
*
|
|
6
|
+
* Key components should have doc:name for Anypoint Studio.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MissingDocNameRule extends BaseRule {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
severity: "warning";
|
|
13
|
+
category: "documentation";
|
|
14
|
+
private readonly COMPONENTS_REQUIRING_DOC_NAME;
|
|
15
|
+
validate(doc: Document, _context: ValidationContext): Issue[];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=MissingDocNameRule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MissingDocNameRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/documentation/MissingDocNameRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,QAAQ;IAC5C,EAAE,SAAc;IAChB,IAAI,SAAsB;IAC1B,WAAW,SAA6D;IACxE,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,eAAe,CAAU;IAEpC,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAU5C;IAEF,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAuBhE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MissingDocNameRule = void 0;
|
|
4
|
+
const BaseRule_1 = require("../base/BaseRule");
|
|
5
|
+
/**
|
|
6
|
+
* MULE-604: Missing doc:name
|
|
7
|
+
*
|
|
8
|
+
* Key components should have doc:name for Anypoint Studio.
|
|
9
|
+
*/
|
|
10
|
+
class MissingDocNameRule extends BaseRule_1.BaseRule {
|
|
11
|
+
id = 'MULE-604';
|
|
12
|
+
name = 'Missing doc:name';
|
|
13
|
+
description = 'Key components should have doc:name for Anypoint Studio';
|
|
14
|
+
severity = 'warning';
|
|
15
|
+
category = 'documentation';
|
|
16
|
+
COMPONENTS_REQUIRING_DOC_NAME = [
|
|
17
|
+
'logger',
|
|
18
|
+
'set-variable',
|
|
19
|
+
'set-payload',
|
|
20
|
+
'transform',
|
|
21
|
+
'flow-ref',
|
|
22
|
+
'try',
|
|
23
|
+
'async',
|
|
24
|
+
'choice',
|
|
25
|
+
'scatter-gather',
|
|
26
|
+
];
|
|
27
|
+
validate(doc, _context) {
|
|
28
|
+
const issues = [];
|
|
29
|
+
for (const componentName of this.COMPONENTS_REQUIRING_DOC_NAME) {
|
|
30
|
+
const components = this.select(`//mule:${componentName}`, doc);
|
|
31
|
+
for (const component of components) {
|
|
32
|
+
const docName = this.getDocName(component);
|
|
33
|
+
if (!docName || docName.trim() === '') {
|
|
34
|
+
issues.push(this.createIssue(component, `${componentName} is missing doc:name attribute`, {
|
|
35
|
+
suggestion: 'Add doc:name="Descriptive Name" for Anypoint Studio'
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return issues;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.MissingDocNameRule = MissingDocNameRule;
|
|
44
|
+
//# sourceMappingURL=MissingDocNameRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MissingDocNameRule.js","sourceRoot":"","sources":["../../../../src/rules/documentation/MissingDocNameRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,kBAAmB,SAAQ,mBAAQ;IAC5C,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,kBAAkB,CAAC;IAC1B,WAAW,GAAG,yDAAyD,CAAC;IACxE,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,eAAwB,CAAC;IAEnB,6BAA6B,GAAG;QAC7C,QAAQ;QACR,cAAc;QACd,aAAa;QACb,WAAW;QACX,UAAU;QACV,KAAK;QACL,OAAO;QACP,QAAQ;QACR,gBAAgB;KACnB,CAAC;IAEF,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,KAAK,MAAM,aAAa,IAAI,IAAI,CAAC,6BAA6B,EAAE,CAAC;YAC7D,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,aAAa,EAAE,EAAE,GAAG,CAAC,CAAC;YAE/D,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;gBACjC,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;gBAE3C,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;oBACpC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CACxB,SAAS,EACT,GAAG,aAAa,gCAAgC,EAChD;wBACI,UAAU,EAAE,qDAAqD;qBACpE,CACJ,CAAC,CAAC;gBACP,CAAC;YACL,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA1CD,gDA0CC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ValidationContext, Issue } from '../../types';
|
|
2
|
+
import { BaseRule } from '../base/BaseRule';
|
|
3
|
+
/**
|
|
4
|
+
* MULE-007: Correlation ID in Error Handler
|
|
5
|
+
*
|
|
6
|
+
* Error handlers should include correlation ID for traceability.
|
|
7
|
+
* This helps track errors across distributed systems.
|
|
8
|
+
*/
|
|
9
|
+
export declare class CorrelationIdRule extends BaseRule {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
severity: "warning";
|
|
14
|
+
category: "error-handling";
|
|
15
|
+
private readonly CORRELATION_PATTERNS;
|
|
16
|
+
validate(doc: Document, _context: ValidationContext): Issue[];
|
|
17
|
+
/**
|
|
18
|
+
* Check if a node or its descendants contain correlation ID reference
|
|
19
|
+
*/
|
|
20
|
+
private containsCorrelationId;
|
|
21
|
+
/**
|
|
22
|
+
* Find the parent flow element for context
|
|
23
|
+
*/
|
|
24
|
+
private findParentFlow;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=CorrelationIdRule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CorrelationIdRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/error-handling/CorrelationIdRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IAC3C,EAAE,SAAc;IAChB,IAAI,SAAqC;IACzC,WAAW,SAA2E;IACtF,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,gBAAgB,CAAU;IAGrC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CASnC;IAEF,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;IA4B7D;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAyB7B;;OAEG;IACH,OAAO,CAAC,cAAc;CAUzB"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CorrelationIdRule = void 0;
|
|
4
|
+
const BaseRule_1 = require("../base/BaseRule");
|
|
5
|
+
const XPathHelper_1 = require("../../core/XPathHelper");
|
|
6
|
+
/**
|
|
7
|
+
* MULE-007: Correlation ID in Error Handler
|
|
8
|
+
*
|
|
9
|
+
* Error handlers should include correlation ID for traceability.
|
|
10
|
+
* This helps track errors across distributed systems.
|
|
11
|
+
*/
|
|
12
|
+
class CorrelationIdRule extends BaseRule_1.BaseRule {
|
|
13
|
+
id = 'MULE-007';
|
|
14
|
+
name = 'Correlation ID in Error Handler';
|
|
15
|
+
description = 'Error handlers should reference correlationId for distributed tracing';
|
|
16
|
+
severity = 'warning';
|
|
17
|
+
category = 'error-handling';
|
|
18
|
+
// Patterns that indicate correlation ID is being used
|
|
19
|
+
CORRELATION_PATTERNS = [
|
|
20
|
+
'correlationId',
|
|
21
|
+
'correlation-id',
|
|
22
|
+
'correlation_id',
|
|
23
|
+
'x-correlation-id',
|
|
24
|
+
'traceId',
|
|
25
|
+
'trace-id',
|
|
26
|
+
'requestId',
|
|
27
|
+
'request-id',
|
|
28
|
+
];
|
|
29
|
+
validate(doc, _context) {
|
|
30
|
+
const issues = [];
|
|
31
|
+
// Find error handlers
|
|
32
|
+
const errorHandlers = this.select('//mule:error-handler', doc);
|
|
33
|
+
for (const handler of errorHandlers) {
|
|
34
|
+
const handlerName = this.getNameAttribute(handler);
|
|
35
|
+
const parentFlow = this.findParentFlow(handler);
|
|
36
|
+
const contextName = handlerName ?? parentFlow ?? 'unnamed';
|
|
37
|
+
// Check if any on-error block references correlation ID
|
|
38
|
+
const hasCorrelationId = this.containsCorrelationId(handler);
|
|
39
|
+
if (!hasCorrelationId) {
|
|
40
|
+
issues.push(this.createIssue(handler, `Error handler in "${contextName}" should include correlationId for traceability`, {
|
|
41
|
+
suggestion: 'Include correlationId in error response or logging for distributed tracing'
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return issues;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Check if a node or its descendants contain correlation ID reference
|
|
49
|
+
*/
|
|
50
|
+
containsCorrelationId(node) {
|
|
51
|
+
const content = (0, XPathHelper_1.getTextContent)(node).toLowerCase();
|
|
52
|
+
for (const pattern of this.CORRELATION_PATTERNS) {
|
|
53
|
+
if (content.includes(pattern.toLowerCase())) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// Also check attributes
|
|
58
|
+
const element = node;
|
|
59
|
+
if (element.attributes) {
|
|
60
|
+
for (let i = 0; i < element.attributes.length; i++) {
|
|
61
|
+
const attrValue = element.attributes[i].value.toLowerCase();
|
|
62
|
+
for (const pattern of this.CORRELATION_PATTERNS) {
|
|
63
|
+
if (attrValue.includes(pattern.toLowerCase())) {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Find the parent flow element for context
|
|
73
|
+
*/
|
|
74
|
+
findParentFlow(node) {
|
|
75
|
+
let current = node.parentNode;
|
|
76
|
+
while (current) {
|
|
77
|
+
if (current.nodeName === 'flow' || current.nodeName === 'mule:flow') {
|
|
78
|
+
return this.getAttribute(current, 'name');
|
|
79
|
+
}
|
|
80
|
+
current = current.parentNode;
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.CorrelationIdRule = CorrelationIdRule;
|
|
86
|
+
//# sourceMappingURL=CorrelationIdRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CorrelationIdRule.js","sourceRoot":"","sources":["../../../../src/rules/error-handling/CorrelationIdRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAC5C,wDAAwD;AAExD;;;;;GAKG;AACH,MAAa,iBAAkB,SAAQ,mBAAQ;IAC3C,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,iCAAiC,CAAC;IACzC,WAAW,GAAG,uEAAuE,CAAC;IACtF,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,gBAAyB,CAAC;IAErC,sDAAsD;IACrC,oBAAoB,GAAG;QACpC,eAAe;QACf,gBAAgB;QAChB,gBAAgB;QAChB,kBAAkB;QAClB,SAAS;QACT,UAAU;QACV,WAAW;QACX,YAAY;KACf,CAAC;IAEF,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,sBAAsB;QACtB,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;QAE/D,KAAK,MAAM,OAAO,IAAI,aAAa,EAAE,CAAC;YAClC,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;YACnD,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YAChD,MAAM,WAAW,GAAG,WAAW,IAAI,UAAU,IAAI,SAAS,CAAC;YAE3D,wDAAwD;YACxD,MAAM,gBAAgB,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;YAE7D,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACpB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CACxB,OAAO,EACP,qBAAqB,WAAW,iDAAiD,EACjF;oBACI,UAAU,EAAE,4EAA4E;iBAC3F,CACJ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,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;QACjC,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAxFD,8CAwFC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ValidationContext, Issue } from '../../types';
|
|
2
|
+
import { BaseRule } from '../base/BaseRule';
|
|
3
|
+
/**
|
|
4
|
+
* MULE-009: Generic Error Type
|
|
5
|
+
*
|
|
6
|
+
* Avoid catching type="ANY" in error handlers.
|
|
7
|
+
* Be specific about error types to handle them appropriately.
|
|
8
|
+
*/
|
|
9
|
+
export declare class GenericErrorRule extends BaseRule {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
severity: "warning";
|
|
14
|
+
category: "error-handling";
|
|
15
|
+
private readonly GENERIC_TYPES;
|
|
16
|
+
validate(doc: Document, _context: ValidationContext): Issue[];
|
|
17
|
+
/**
|
|
18
|
+
* Check if handler uses generic error type
|
|
19
|
+
*/
|
|
20
|
+
private checkGenericType;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=GenericErrorRule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericErrorRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/error-handling/GenericErrorRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;IAC1C,EAAE,SAAc;IAChB,IAAI,SAAwB;IAC5B,WAAW,SAA+D;IAC1E,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,gBAAgB,CAAU;IAGrC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAG5B;IAEF,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;IA0B7D;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAoB3B"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GenericErrorRule = void 0;
|
|
4
|
+
const BaseRule_1 = require("../base/BaseRule");
|
|
5
|
+
/**
|
|
6
|
+
* MULE-009: Generic Error Type
|
|
7
|
+
*
|
|
8
|
+
* Avoid catching type="ANY" in error handlers.
|
|
9
|
+
* Be specific about error types to handle them appropriately.
|
|
10
|
+
*/
|
|
11
|
+
class GenericErrorRule extends BaseRule_1.BaseRule {
|
|
12
|
+
id = 'MULE-009';
|
|
13
|
+
name = 'Generic Error Type';
|
|
14
|
+
description = 'Avoid catching type="ANY" - be specific about error types';
|
|
15
|
+
severity = 'warning';
|
|
16
|
+
category = 'error-handling';
|
|
17
|
+
// Generic types to flag
|
|
18
|
+
GENERIC_TYPES = [
|
|
19
|
+
'ANY',
|
|
20
|
+
'MULE:ANY',
|
|
21
|
+
];
|
|
22
|
+
validate(doc, _context) {
|
|
23
|
+
const issues = [];
|
|
24
|
+
// Find on-error-continue with type="ANY"
|
|
25
|
+
const onErrorContinue = this.select('//mule:on-error-continue[@type]', doc);
|
|
26
|
+
for (const handler of onErrorContinue) {
|
|
27
|
+
this.checkGenericType(handler, 'on-error-continue', issues);
|
|
28
|
+
}
|
|
29
|
+
// Find on-error-propagate with type="ANY"
|
|
30
|
+
const onErrorPropagate = this.select('//mule:on-error-propagate[@type]', doc);
|
|
31
|
+
for (const handler of onErrorPropagate) {
|
|
32
|
+
this.checkGenericType(handler, 'on-error-propagate', issues);
|
|
33
|
+
}
|
|
34
|
+
return issues;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Check if handler uses generic error type
|
|
38
|
+
*/
|
|
39
|
+
checkGenericType(handler, handlerType, issues) {
|
|
40
|
+
const errorType = this.getAttribute(handler, 'type');
|
|
41
|
+
if (errorType && this.GENERIC_TYPES.includes(errorType.toUpperCase())) {
|
|
42
|
+
const docName = this.getDocName(handler);
|
|
43
|
+
const displayName = docName ? `"${docName}"` : '';
|
|
44
|
+
issues.push(this.createIssue(handler, `${handlerType} ${displayName} uses generic type="${errorType}"`, {
|
|
45
|
+
suggestion: 'Catch specific error types (e.g., HTTP:CONNECTIVITY, DB:CONNECTIVITY, VALIDATION:INVALID_JSON) for better error handling'
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.GenericErrorRule = GenericErrorRule;
|
|
51
|
+
//# sourceMappingURL=GenericErrorRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericErrorRule.js","sourceRoot":"","sources":["../../../../src/rules/error-handling/GenericErrorRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;;GAKG;AACH,MAAa,gBAAiB,SAAQ,mBAAQ;IAC1C,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,oBAAoB,CAAC;IAC5B,WAAW,GAAG,2DAA2D,CAAC;IAC1E,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,gBAAyB,CAAC;IAErC,wBAAwB;IACP,aAAa,GAAG;QAC7B,KAAK;QACL,UAAU;KACb,CAAC;IAEF,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,yCAAyC;QACzC,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAC/B,iCAAiC,EACjC,GAAG,CACN,CAAC;QAEF,KAAK,MAAM,OAAO,IAAI,eAAe,EAAE,CAAC;YACpC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;QAChE,CAAC;QAED,0CAA0C;QAC1C,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAChC,kCAAkC,EAClC,GAAG,CACN,CAAC;QAEF,KAAK,MAAM,OAAO,IAAI,gBAAgB,EAAE,CAAC;YACrC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,MAAM,CAAC,CAAC;QACjE,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;OAEG;IACK,gBAAgB,CACpB,OAAa,EACb,WAAmB,EACnB,MAAe;QAEf,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAErD,IAAI,SAAS,IAAI,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;YACpE,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACzC,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAElD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CACxB,OAAO,EACP,GAAG,WAAW,IAAI,WAAW,uBAAuB,SAAS,GAAG,EAChE;gBACI,UAAU,EAAE,0HAA0H;aACzI,CACJ,CAAC,CAAC;QACP,CAAC;IACL,CAAC;CACJ;AA9DD,4CA8DC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ValidationContext, Issue } from '../../types';
|
|
2
|
+
import { BaseRule } from '../base/BaseRule';
|
|
3
|
+
/**
|
|
4
|
+
* MULE-001: Global Error Handler Exists
|
|
5
|
+
*
|
|
6
|
+
* Every Mule project should have a global error handler file with a
|
|
7
|
+
* reusable error-handler configuration.
|
|
8
|
+
*/
|
|
9
|
+
export declare class GlobalErrorHandlerRule extends BaseRule {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
severity: "error";
|
|
14
|
+
category: "error-handling";
|
|
15
|
+
validate(doc: Document, context: ValidationContext): Issue[];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=GlobalErrorHandlerRule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlobalErrorHandlerRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/error-handling/GlobalErrorHandlerRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI5C;;;;;GAKG;AACH,qBAAa,sBAAuB,SAAQ,QAAQ;IAChD,EAAE,SAAc;IAChB,IAAI,SAAiC;IACrC,WAAW,SAA4F;IACvG,QAAQ,EAAG,OAAO,CAAU;IAC5B,QAAQ,EAAG,gBAAgB,CAAU;IAErC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,KAAK,EAAE;CA0C/D"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.GlobalErrorHandlerRule = void 0;
|
|
37
|
+
const BaseRule_1 = require("../base/BaseRule");
|
|
38
|
+
const FileScanner_1 = require("../../core/FileScanner");
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
/**
|
|
41
|
+
* MULE-001: Global Error Handler Exists
|
|
42
|
+
*
|
|
43
|
+
* Every Mule project should have a global error handler file with a
|
|
44
|
+
* reusable error-handler configuration.
|
|
45
|
+
*/
|
|
46
|
+
class GlobalErrorHandlerRule extends BaseRule_1.BaseRule {
|
|
47
|
+
id = 'MULE-001';
|
|
48
|
+
name = 'Global Error Handler Exists';
|
|
49
|
+
description = 'Project should have a global error handler configuration for consistent error handling';
|
|
50
|
+
severity = 'error';
|
|
51
|
+
category = 'error-handling';
|
|
52
|
+
validate(doc, context) {
|
|
53
|
+
const issues = [];
|
|
54
|
+
// Get configurable file path
|
|
55
|
+
const expectedFile = this.getOption(context, 'filePath', 'src/main/mule/global-error-handler.xml');
|
|
56
|
+
const fullPath = path.join(context.projectRoot, expectedFile);
|
|
57
|
+
// Only check once per project (check if this is the main config file or first file)
|
|
58
|
+
// We'll trigger this check on any XML file but only report if the file doesn't exist
|
|
59
|
+
if (!(0, FileScanner_1.fileExists)(fullPath)) {
|
|
60
|
+
// Check if current file could serve as global error handler
|
|
61
|
+
const hasGlobalErrorHandler = this.exists('//mule:error-handler[@name="global-error-handler"]', doc);
|
|
62
|
+
// If current file has a global-error-handler, that's acceptable
|
|
63
|
+
if (!hasGlobalErrorHandler) {
|
|
64
|
+
// Check if any error-handler with ref to global exists
|
|
65
|
+
const hasGlobalRef = this.exists('//mule:flow/mule:error-handler[@ref="global-error-handler"]', doc);
|
|
66
|
+
if (!hasGlobalRef && context.relativePath.includes('global')) {
|
|
67
|
+
issues.push(this.createFileIssue(`Global error handler configuration not found at "${expectedFile}"`, {
|
|
68
|
+
suggestion: 'Create a global-error-handler.xml file with a named error-handler element'
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return issues;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.GlobalErrorHandlerRule = GlobalErrorHandlerRule;
|
|
77
|
+
//# sourceMappingURL=GlobalErrorHandlerRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlobalErrorHandlerRule.js","sourceRoot":"","sources":["../../../../src/rules/error-handling/GlobalErrorHandlerRule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAA4C;AAC5C,wDAAoD;AACpD,2CAA6B;AAE7B;;;;;GAKG;AACH,MAAa,sBAAuB,SAAQ,mBAAQ;IAChD,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,6BAA6B,CAAC;IACrC,WAAW,GAAG,wFAAwF,CAAC;IACvG,QAAQ,GAAG,OAAgB,CAAC;IAC5B,QAAQ,GAAG,gBAAyB,CAAC;IAErC,QAAQ,CAAC,GAAa,EAAE,OAA0B;QAC9C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,6BAA6B;QAC7B,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAC/B,OAAO,EACP,UAAU,EACV,wCAAwC,CAC3C,CAAC;QAEF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QAE9D,oFAAoF;QACpF,qFAAqF;QACrF,IAAI,CAAC,IAAA,wBAAU,EAAC,QAAQ,CAAC,EAAE,CAAC;YACxB,4DAA4D;YAC5D,MAAM,qBAAqB,GAAG,IAAI,CAAC,MAAM,CACrC,oDAAoD,EACpD,GAAG,CACN,CAAC;YAEF,gEAAgE;YAChE,IAAI,CAAC,qBAAqB,EAAE,CAAC;gBACzB,uDAAuD;gBACvD,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAC5B,6DAA6D,EAC7D,GAAG,CACN,CAAC;gBAEF,IAAI,CAAC,YAAY,IAAI,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;oBAC3D,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAC5B,oDAAoD,YAAY,GAAG,EACnE;wBACI,UAAU,EAAE,2EAA2E;qBAC1F,CACJ,CAAC,CAAC;gBACP,CAAC;YACL,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAjDD,wDAiDC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ValidationContext, Issue } from '../../types';
|
|
2
|
+
import { BaseRule } from '../base/BaseRule';
|
|
3
|
+
/**
|
|
4
|
+
* MULE-005: HTTP Status in Error Handler
|
|
5
|
+
*
|
|
6
|
+
* Error handlers should set an httpStatus variable for proper API responses.
|
|
7
|
+
* This ensures clients receive appropriate HTTP status codes.
|
|
8
|
+
*/
|
|
9
|
+
export declare class HttpStatusRule extends BaseRule {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
severity: "warning";
|
|
14
|
+
category: "error-handling";
|
|
15
|
+
validate(doc: Document, context: ValidationContext): Issue[];
|
|
16
|
+
/**
|
|
17
|
+
* Find the parent flow element for context
|
|
18
|
+
*/
|
|
19
|
+
private findParentFlow;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=HttpStatusRule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpStatusRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/error-handling/HttpStatusRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IACxC,EAAE,SAAc;IAChB,IAAI,SAAkC;IACtC,WAAW,SAAiF;IAC5F,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,gBAAgB,CAAU;IAErC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,KAAK,EAAE;IA2C5D;;OAEG;IACH,OAAO,CAAC,cAAc;CAUzB"}
|