@sfdxy/mule-lint 1.18.1 → 1.20.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 +164 -151
- package/dist/bin/mule-lint-mcp.js.map +1 -1
- package/dist/bin/mule-lint.js +2 -2
- package/dist/bin/mule-lint.js.map +1 -1
- package/dist/package.json +26 -15
- package/dist/src/core/ComplexityCalculator.d.ts.map +1 -1
- package/dist/src/core/ComplexityCalculator.js.map +1 -1
- package/dist/src/core/FileScanner.d.ts.map +1 -1
- package/dist/src/core/FileScanner.js.map +1 -1
- package/dist/src/core/MetricsAggregator.d.ts.map +1 -1
- package/dist/src/core/MetricsAggregator.js +1 -1
- package/dist/src/core/MetricsAggregator.js.map +1 -1
- package/dist/src/core/MetricsCollector.d.ts.map +1 -1
- package/dist/src/core/MetricsCollector.js +1 -2
- package/dist/src/core/MetricsCollector.js.map +1 -1
- package/dist/src/core/QualityGateEvaluator.d.ts.map +1 -1
- package/dist/src/core/QualityGateEvaluator.js.map +1 -1
- package/dist/src/core/XPathHelper.d.ts.map +1 -1
- package/dist/src/core/XPathHelper.js +0 -1
- package/dist/src/core/XPathHelper.js.map +1 -1
- package/dist/src/core/XmlParser.d.ts.map +1 -1
- package/dist/src/core/XmlParser.js.map +1 -1
- package/dist/src/core/YamlParser.d.ts.map +1 -1
- package/dist/src/core/YamlParser.js.map +1 -1
- package/dist/src/core/errors.js.map +1 -1
- package/dist/src/engine/LintEngine.d.ts +10 -0
- package/dist/src/engine/LintEngine.d.ts.map +1 -1
- package/dist/src/engine/LintEngine.js +68 -4
- package/dist/src/engine/LintEngine.js.map +1 -1
- package/dist/src/formatter/MuleXmlFormatter.d.ts.map +1 -1
- package/dist/src/formatter/MuleXmlFormatter.js +7 -1
- package/dist/src/formatter/MuleXmlFormatter.js.map +1 -1
- package/dist/src/formatter/index.d.ts +2 -2
- package/dist/src/formatter/index.d.ts.map +1 -1
- package/dist/src/formatter/index.js.map +1 -1
- package/dist/src/formatters/CsvFormatter.js.map +1 -1
- package/dist/src/formatters/HtmlFormatter.js +0 -1
- package/dist/src/formatters/HtmlFormatter.js.map +1 -1
- package/dist/src/formatters/JsonFormatter.d.ts.map +1 -1
- package/dist/src/formatters/JsonFormatter.js.map +1 -1
- package/dist/src/formatters/SarifFormatter.js.map +1 -1
- package/dist/src/formatters/TableFormatter.js.map +1 -1
- package/dist/src/formatters/html/components/Icons.js +1 -1
- package/dist/src/formatters/html/components/Icons.js.map +1 -1
- package/dist/src/formatters/html/components/MetricCard.d.ts.map +1 -1
- package/dist/src/formatters/html/components/MetricCard.js.map +1 -1
- package/dist/src/formatters/html/components/Modal.d.ts.map +1 -1
- package/dist/src/formatters/html/components/Modal.js.map +1 -1
- package/dist/src/formatters/html/components/RatingBadge.d.ts.map +1 -1
- package/dist/src/formatters/html/components/RatingBadge.js +6 -6
- package/dist/src/formatters/html/components/RatingBadge.js.map +1 -1
- package/dist/src/formatters/html/index.d.ts +2 -2
- package/dist/src/formatters/html/index.d.ts.map +1 -1
- package/dist/src/formatters/html/index.js.map +1 -1
- package/dist/src/formatters/html/scripts/charts.d.ts.map +1 -1
- package/dist/src/formatters/html/scripts/charts.js +45 -12
- package/dist/src/formatters/html/scripts/charts.js.map +1 -1
- package/dist/src/formatters/html/scripts/index.d.ts.map +1 -1
- package/dist/src/formatters/html/scripts/index.js.map +1 -1
- package/dist/src/formatters/html/scripts/renderer.d.ts.map +1 -1
- package/dist/src/formatters/html/scripts/renderer.js +175 -35
- package/dist/src/formatters/html/scripts/renderer.js.map +1 -1
- package/dist/src/formatters/html/sections/Header.d.ts.map +1 -1
- package/dist/src/formatters/html/sections/Header.js.map +1 -1
- package/dist/src/formatters/html/sections/LintSummary.d.ts.map +1 -1
- package/dist/src/formatters/html/sections/LintSummary.js.map +1 -1
- package/dist/src/formatters/html/sections/QualityRatings.js.map +1 -1
- package/dist/src/formatters/html/sections/Sidebar.d.ts.map +1 -1
- package/dist/src/formatters/html/sections/Sidebar.js.map +1 -1
- package/dist/src/formatters/html/styles/badges.d.ts.map +1 -1
- package/dist/src/formatters/html/styles/badges.js.map +1 -1
- package/dist/src/formatters/html/styles/index.d.ts.map +1 -1
- package/dist/src/formatters/html/styles/index.js.map +1 -1
- package/dist/src/formatters/html/theme.js.map +1 -1
- package/dist/src/formatters/html/views/Dashboard.js +5 -5
- package/dist/src/formatters/html/views/Dashboard.js.map +1 -1
- package/dist/src/formatters/html/views/IssuesView.d.ts.map +1 -1
- package/dist/src/formatters/html/views/IssuesView.js.map +1 -1
- package/dist/src/formatters/index.js.map +1 -1
- package/dist/src/mcp/index.d.ts.map +1 -1
- package/dist/src/mcp/index.js +0 -1
- package/dist/src/mcp/index.js.map +1 -1
- package/dist/src/mcp/prompts/index.js.map +1 -1
- package/dist/src/mcp/resources/index.js +30 -7
- package/dist/src/mcp/resources/index.js.map +1 -1
- package/dist/src/mcp/tools/formatMuleXml.d.ts.map +1 -1
- package/dist/src/mcp/tools/formatMuleXml.js +4 -13
- package/dist/src/mcp/tools/formatMuleXml.js.map +1 -1
- package/dist/src/mcp/tools/getRuleDetails.d.ts.map +1 -1
- package/dist/src/mcp/tools/getRuleDetails.js +1 -3
- package/dist/src/mcp/tools/getRuleDetails.js.map +1 -1
- package/dist/src/mcp/tools/runLintAnalysis.js +9 -9
- package/dist/src/mcp/tools/runLintAnalysis.js.map +1 -1
- package/dist/src/mcp/tools/validateSnippet.d.ts.map +1 -1
- package/dist/src/mcp/tools/validateSnippet.js.map +1 -1
- package/dist/src/quality/calculator.d.ts.map +1 -1
- package/dist/src/quality/calculator.js +1 -1
- package/dist/src/quality/calculator.js.map +1 -1
- package/dist/src/quality/index.d.ts.map +1 -1
- package/dist/src/quality/index.js.map +1 -1
- package/dist/src/quality/thresholds.js.map +1 -1
- package/dist/src/quality/types.d.ts.map +1 -1
- package/dist/src/rules/api-led/ApiLedRules.d.ts.map +1 -1
- package/dist/src/rules/api-led/ApiLedRules.js +6 -2
- package/dist/src/rules/api-led/ApiLedRules.js.map +1 -1
- package/dist/src/rules/api-led/SingleSystemSapiRule.d.ts.map +1 -1
- package/dist/src/rules/api-led/SingleSystemSapiRule.js.map +1 -1
- package/dist/src/rules/base/BaseRule.d.ts.map +1 -1
- package/dist/src/rules/base/BaseRule.js.map +1 -1
- package/dist/src/rules/base/ProjectRule.d.ts.map +1 -1
- package/dist/src/rules/base/ProjectRule.js.map +1 -1
- package/dist/src/rules/complexity/FlowComplexityRule.d.ts.map +1 -1
- package/dist/src/rules/complexity/FlowComplexityRule.js.map +1 -1
- package/dist/src/rules/dataweave/DataWeaveRules.d.ts +6 -0
- package/dist/src/rules/dataweave/DataWeaveRules.d.ts.map +1 -1
- package/dist/src/rules/dataweave/DataWeaveRules.js +17 -3
- package/dist/src/rules/dataweave/DataWeaveRules.js.map +1 -1
- package/dist/src/rules/dataweave/Java17DWErrorHandlingRule.d.ts.map +1 -1
- package/dist/src/rules/dataweave/Java17DWErrorHandlingRule.js.map +1 -1
- package/dist/src/rules/documentation/DisplayNameRule.d.ts.map +1 -1
- package/dist/src/rules/documentation/DisplayNameRule.js.map +1 -1
- package/dist/src/rules/documentation/FlowDescriptionRule.d.ts.map +1 -1
- package/dist/src/rules/documentation/FlowDescriptionRule.js.map +1 -1
- package/dist/src/rules/documentation/MissingDocNameRule.d.ts.map +1 -1
- package/dist/src/rules/documentation/MissingDocNameRule.js.map +1 -1
- package/dist/src/rules/error-handling/CorrelationIdRule.d.ts +22 -1
- package/dist/src/rules/error-handling/CorrelationIdRule.d.ts.map +1 -1
- package/dist/src/rules/error-handling/CorrelationIdRule.js +107 -6
- package/dist/src/rules/error-handling/CorrelationIdRule.js.map +1 -1
- package/dist/src/rules/error-handling/GenericErrorRule.d.ts.map +1 -1
- package/dist/src/rules/error-handling/GenericErrorRule.js.map +1 -1
- package/dist/src/rules/error-handling/GlobalErrorHandlerRule.d.ts +14 -2
- package/dist/src/rules/error-handling/GlobalErrorHandlerRule.d.ts.map +1 -1
- package/dist/src/rules/error-handling/GlobalErrorHandlerRule.js +40 -18
- package/dist/src/rules/error-handling/GlobalErrorHandlerRule.js.map +1 -1
- package/dist/src/rules/error-handling/HttpStatusRule.d.ts +5 -0
- package/dist/src/rules/error-handling/HttpStatusRule.d.ts.map +1 -1
- package/dist/src/rules/error-handling/HttpStatusRule.js +15 -0
- package/dist/src/rules/error-handling/HttpStatusRule.js.map +1 -1
- package/dist/src/rules/error-handling/MissingErrorHandlerRule.d.ts.map +1 -1
- package/dist/src/rules/error-handling/MissingErrorHandlerRule.js.map +1 -1
- package/dist/src/rules/error-handling/TryScopeRule.d.ts.map +1 -1
- package/dist/src/rules/error-handling/TryScopeRule.js.map +1 -1
- package/dist/src/rules/experimental/ExperimentalRules.d.ts.map +1 -1
- package/dist/src/rules/experimental/ExperimentalRules.js +6 -2
- package/dist/src/rules/experimental/ExperimentalRules.js.map +1 -1
- package/dist/src/rules/governance/GovernanceRules.d.ts.map +1 -1
- package/dist/src/rules/governance/GovernanceRules.js.map +1 -1
- package/dist/src/rules/http/HttpContentTypeRule.d.ts +28 -1
- package/dist/src/rules/http/HttpContentTypeRule.d.ts.map +1 -1
- package/dist/src/rules/http/HttpContentTypeRule.js +68 -7
- package/dist/src/rules/http/HttpContentTypeRule.js.map +1 -1
- package/dist/src/rules/http/HttpTimeoutRule.d.ts.map +1 -1
- package/dist/src/rules/http/HttpTimeoutRule.js.map +1 -1
- package/dist/src/rules/http/HttpUserAgentRule.d.ts.map +1 -1
- package/dist/src/rules/http/HttpUserAgentRule.js.map +1 -1
- package/dist/src/rules/index.js.map +1 -1
- package/dist/src/rules/logging/ExcessiveLoggersRule.d.ts.map +1 -1
- package/dist/src/rules/logging/ExcessiveLoggersRule.js.map +1 -1
- package/dist/src/rules/logging/LoggerCategoryRule.d.ts.map +1 -1
- package/dist/src/rules/logging/LoggerCategoryRule.js.map +1 -1
- package/dist/src/rules/logging/LoggerInUntilSuccessfulRule.d.ts.map +1 -1
- package/dist/src/rules/logging/LoggerInUntilSuccessfulRule.js.map +1 -1
- package/dist/src/rules/logging/LoggerPayloadRule.d.ts.map +1 -1
- package/dist/src/rules/logging/LoggerPayloadRule.js.map +1 -1
- package/dist/src/rules/logging/NewLoggingRules.d.ts.map +1 -1
- package/dist/src/rules/logging/NewLoggingRules.js.map +1 -1
- package/dist/src/rules/naming/FlowCasingRule.d.ts.map +1 -1
- package/dist/src/rules/naming/FlowCasingRule.js.map +1 -1
- package/dist/src/rules/naming/FlowNamingRule.d.ts.map +1 -1
- package/dist/src/rules/naming/FlowNamingRule.js +3 -1
- package/dist/src/rules/naming/FlowNamingRule.js.map +1 -1
- package/dist/src/rules/naming/VariableNamingRule.d.ts.map +1 -1
- package/dist/src/rules/naming/VariableNamingRule.js.map +1 -1
- package/dist/src/rules/operations/CommentedCodeRule.d.ts.map +1 -1
- package/dist/src/rules/operations/CommentedCodeRule.js.map +1 -1
- package/dist/src/rules/operations/UnusedFlowRule.d.ts +6 -1
- package/dist/src/rules/operations/UnusedFlowRule.d.ts.map +1 -1
- package/dist/src/rules/operations/UnusedFlowRule.js +23 -9
- package/dist/src/rules/operations/UnusedFlowRule.js.map +1 -1
- package/dist/src/rules/performance/AsyncErrorHandlerRule.d.ts.map +1 -1
- package/dist/src/rules/performance/AsyncErrorHandlerRule.js.map +1 -1
- package/dist/src/rules/performance/ConnectionPoolingRule.d.ts +5 -0
- package/dist/src/rules/performance/ConnectionPoolingRule.d.ts.map +1 -1
- package/dist/src/rules/performance/ConnectionPoolingRule.js +18 -5
- package/dist/src/rules/performance/ConnectionPoolingRule.js.map +1 -1
- package/dist/src/rules/performance/LargeChoiceBlockRule.d.ts.map +1 -1
- package/dist/src/rules/performance/LargeChoiceBlockRule.js.map +1 -1
- package/dist/src/rules/performance/ReconnectionStrategyRule.d.ts +7 -0
- package/dist/src/rules/performance/ReconnectionStrategyRule.d.ts.map +1 -1
- package/dist/src/rules/performance/ReconnectionStrategyRule.js +15 -2
- package/dist/src/rules/performance/ReconnectionStrategyRule.js.map +1 -1
- package/dist/src/rules/performance/ScatterGatherRoutesRule.d.ts.map +1 -1
- package/dist/src/rules/performance/ScatterGatherRoutesRule.js.map +1 -1
- package/dist/src/rules/security/EncryptionKeyInLogsRule.d.ts.map +1 -1
- package/dist/src/rules/security/EncryptionKeyInLogsRule.js.map +1 -1
- package/dist/src/rules/security/HardcodedCredentialsRule.d.ts.map +1 -1
- package/dist/src/rules/security/HardcodedCredentialsRule.js.map +1 -1
- package/dist/src/rules/security/HardcodedHttpRule.d.ts.map +1 -1
- package/dist/src/rules/security/HardcodedHttpRule.js +1 -9
- package/dist/src/rules/security/HardcodedHttpRule.js.map +1 -1
- package/dist/src/rules/security/InputValidationRule.d.ts.map +1 -1
- package/dist/src/rules/security/InputValidationRule.js +1 -3
- package/dist/src/rules/security/InputValidationRule.js.map +1 -1
- package/dist/src/rules/security/InsecureTlsRule.d.ts.map +1 -1
- package/dist/src/rules/security/InsecureTlsRule.js.map +1 -1
- package/dist/src/rules/security/RateLimitingRule.d.ts.map +1 -1
- package/dist/src/rules/security/RateLimitingRule.js.map +1 -1
- package/dist/src/rules/security/TlsVersionRule.d.ts.map +1 -1
- package/dist/src/rules/security/TlsVersionRule.js.map +1 -1
- package/dist/src/rules/standards/ApiKitValidationRule.d.ts.map +1 -1
- package/dist/src/rules/standards/ApiKitValidationRule.js.map +1 -1
- package/dist/src/rules/standards/AutoDiscoveryRule.d.ts.map +1 -1
- package/dist/src/rules/standards/AutoDiscoveryRule.js.map +1 -1
- package/dist/src/rules/standards/ChoiceAntiPatternRule.d.ts.map +1 -1
- package/dist/src/rules/standards/ChoiceAntiPatternRule.js.map +1 -1
- package/dist/src/rules/standards/CronExternalizedRule.d.ts.map +1 -1
- package/dist/src/rules/standards/CronExternalizedRule.js.map +1 -1
- package/dist/src/rules/standards/DeprecatedComponentRule.d.ts.map +1 -1
- package/dist/src/rules/standards/DeprecatedComponentRule.js.map +1 -1
- package/dist/src/rules/standards/DwlStandardsRule.d.ts.map +1 -1
- package/dist/src/rules/standards/DwlStandardsRule.js.map +1 -1
- package/dist/src/rules/standards/HttpPortPlaceholderRule.d.ts.map +1 -1
- package/dist/src/rules/standards/HttpPortPlaceholderRule.js.map +1 -1
- package/dist/src/rules/structure/StructureRules.d.ts +8 -1
- package/dist/src/rules/structure/StructureRules.d.ts.map +1 -1
- package/dist/src/rules/structure/StructureRules.js +11 -7
- package/dist/src/rules/structure/StructureRules.js.map +1 -1
- package/dist/src/rules/yaml/YamlRules.d.ts.map +1 -1
- package/dist/src/rules/yaml/YamlRules.js +2 -7
- package/dist/src/rules/yaml/YamlRules.js.map +1 -1
- package/dist/src/types/Config.d.ts.map +1 -1
- package/dist/src/types/Config.js.map +1 -1
- package/dist/src/types/QualityGate.d.ts.map +1 -1
- package/dist/src/types/QualityGate.js.map +1 -1
- package/dist/src/types/Report.d.ts.map +1 -1
- package/dist/src/types/Rule.d.ts +22 -0
- package/dist/src/types/Rule.d.ts.map +1 -1
- package/docs/README.md +27 -27
- package/docs/best-practices/documentation-standards.md +20 -11
- package/docs/best-practices/folder-structure.md +16 -10
- package/docs/best-practices/mulesoft-best-practices.md +96 -94
- package/docs/best-practices/rules-catalog.md +422 -299
- package/docs/linter/architecture.md +70 -64
- package/docs/linter/extending.md +137 -128
- package/docs/linter/folder-structure.md +39 -38
- package/docs/linter/naming-conventions.md +80 -78
- package/docs/linter/rule-engine.md +306 -306
- package/docs/mcp-design.md +35 -21
- package/package.json +84 -73
|
@@ -1,6 +1,41 @@
|
|
|
1
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
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.CorrelationIdRule = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
4
39
|
const BaseRule_1 = require("../base/BaseRule");
|
|
5
40
|
const XPathHelper_1 = require("../../core/XPathHelper");
|
|
6
41
|
/**
|
|
@@ -8,6 +43,13 @@ const XPathHelper_1 = require("../../core/XPathHelper");
|
|
|
8
43
|
*
|
|
9
44
|
* Error handlers should include correlation ID for traceability.
|
|
10
45
|
* This helps track errors across distributed systems.
|
|
46
|
+
*
|
|
47
|
+
* The rule checks three patterns:
|
|
48
|
+
* 1. Inline correlationId reference in the error handler XML text/attributes
|
|
49
|
+
* 2. External DWL file referenced via resource="..." attribute on ee:set-payload
|
|
50
|
+
* (the DWL file content is read from disk and inspected)
|
|
51
|
+
* 3. If a resource reference exists but the file cannot be read, the issue is
|
|
52
|
+
* downgraded to 'info' to avoid false positives on valid code
|
|
11
53
|
*/
|
|
12
54
|
class CorrelationIdRule extends BaseRule_1.BaseRule {
|
|
13
55
|
id = 'MULE-007';
|
|
@@ -27,7 +69,7 @@ class CorrelationIdRule extends BaseRule_1.BaseRule {
|
|
|
27
69
|
'requestId',
|
|
28
70
|
'request-id',
|
|
29
71
|
];
|
|
30
|
-
validate(doc,
|
|
72
|
+
validate(doc, context) {
|
|
31
73
|
const issues = [];
|
|
32
74
|
// Find error handlers
|
|
33
75
|
const errorHandlers = this.select('//mule:error-handler', doc);
|
|
@@ -35,16 +77,68 @@ class CorrelationIdRule extends BaseRule_1.BaseRule {
|
|
|
35
77
|
const handlerName = this.getNameAttribute(handler);
|
|
36
78
|
const parentFlow = this.findParentFlow(handler);
|
|
37
79
|
const contextName = handlerName ?? parentFlow ?? 'unnamed';
|
|
38
|
-
// Check
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
80
|
+
// Check inline text/attribute content first
|
|
81
|
+
if (this.containsCorrelationId(handler)) {
|
|
82
|
+
continue; // Found inline — pass
|
|
83
|
+
}
|
|
84
|
+
// Check resource= references to external DWL files
|
|
85
|
+
const resourceResult = this.checkResourceReferences(handler, context.projectRoot);
|
|
86
|
+
if (resourceResult === 'found') {
|
|
87
|
+
continue; // Found in referenced DWL file — pass
|
|
88
|
+
}
|
|
89
|
+
if (resourceResult === 'unresolvable') {
|
|
90
|
+
// Resource reference exists but file cannot be read; cannot determine
|
|
91
|
+
// whether correlationId is present. Downgrade to info to avoid false positive.
|
|
92
|
+
issues.push(this.createIssue(handler, `Error handler in "${contextName}" delegates to an external DWL file — verify correlationId is included`, {
|
|
93
|
+
severity: 'info',
|
|
94
|
+
suggestion: 'Ensure the referenced DWL resource file includes correlationId in its output',
|
|
43
95
|
}));
|
|
96
|
+
continue;
|
|
44
97
|
}
|
|
98
|
+
// No correlationId found anywhere
|
|
99
|
+
issues.push(this.createIssue(handler, `Error handler in "${contextName}" should include correlationId for traceability`, {
|
|
100
|
+
suggestion: 'Include correlationId in error response or logging for distributed tracing',
|
|
101
|
+
}));
|
|
45
102
|
}
|
|
46
103
|
return issues;
|
|
47
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Inspect resource="..." attributes on ee:set-payload (and similar) elements
|
|
107
|
+
* within the error handler.
|
|
108
|
+
*
|
|
109
|
+
* @returns
|
|
110
|
+
* 'found' — correlationId pattern detected in a referenced DWL file
|
|
111
|
+
* 'unresolvable' — resource reference exists but could not be read
|
|
112
|
+
* 'not-found' — no resource references present or none contain correlationId
|
|
113
|
+
*/
|
|
114
|
+
checkResourceReferences(handler, projectRoot) {
|
|
115
|
+
// Look for any element with a resource= attribute (covers ee:set-payload, ee:set-variable, etc.)
|
|
116
|
+
const elementsWithResource = this.select('.//*[@resource]', handler);
|
|
117
|
+
if (elementsWithResource.length === 0) {
|
|
118
|
+
return 'not-found';
|
|
119
|
+
}
|
|
120
|
+
let hasUnresolvable = false;
|
|
121
|
+
for (const el of elementsWithResource) {
|
|
122
|
+
const resourceAttr = this.getAttribute(el, 'resource') ?? '';
|
|
123
|
+
if (!resourceAttr) {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
// Resolve relative to src/main/resources/ (standard Mule resource path)
|
|
127
|
+
const fullPath = path.join(projectRoot, 'src', 'main', 'resources', resourceAttr);
|
|
128
|
+
try {
|
|
129
|
+
const content = fs.readFileSync(fullPath, 'utf-8');
|
|
130
|
+
if (this.contentContainsCorrelationId(content)) {
|
|
131
|
+
return 'found';
|
|
132
|
+
}
|
|
133
|
+
// File read successfully but no correlationId found — continue checking others
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
// File not readable — mark as unresolvable but keep checking other resources
|
|
137
|
+
hasUnresolvable = true;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return hasUnresolvable ? 'unresolvable' : 'not-found';
|
|
141
|
+
}
|
|
48
142
|
/**
|
|
49
143
|
* Check if a node or its descendants contain correlation ID reference
|
|
50
144
|
*/
|
|
@@ -69,6 +163,13 @@ class CorrelationIdRule extends BaseRule_1.BaseRule {
|
|
|
69
163
|
}
|
|
70
164
|
return false;
|
|
71
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Check whether a raw file content string contains a correlationId pattern
|
|
168
|
+
*/
|
|
169
|
+
contentContainsCorrelationId(content) {
|
|
170
|
+
const lower = content.toLowerCase();
|
|
171
|
+
return this.CORRELATION_PATTERNS.some((p) => lower.includes(p.toLowerCase()));
|
|
172
|
+
}
|
|
72
173
|
/**
|
|
73
174
|
* Find the parent flow element for context
|
|
74
175
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CorrelationIdRule.js","sourceRoot":"","sources":["../../../../src/rules/error-handling/CorrelationIdRule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CorrelationIdRule.js","sourceRoot":"","sources":["../../../../src/rules/error-handling/CorrelationIdRule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,+CAA4C;AAC5C,wDAAwD;AAExD;;;;;;;;;;;;GAYG;AACH,MAAa,iBAAkB,SAAQ,mBAAQ;IAC7C,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,iCAAiC,CAAC;IACzC,WAAW,GAAG,uEAAuE,CAAC;IACtF,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,gBAAyB,CAAC;IACrC,SAAS,GAAc,KAAK,CAAC;IAE7B,sDAAsD;IACrC,oBAAoB,GAAG;QACtC,eAAe;QACf,gBAAgB;QAChB,gBAAgB;QAChB,kBAAkB;QAClB,SAAS;QACT,UAAU;QACV,WAAW;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I,CAAC;IACd,CAAC;CACF;AA3KD,8CA2KC"}
|
|
@@ -1 +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,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;
|
|
1
|
+
{"version":3,"file":"GenericErrorRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/error-handling/GenericErrorRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;IAC5C,EAAE,SAAc;IAChB,IAAI,SAAwB;IAC5B,WAAW,SAA+D;IAC1E,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,gBAAgB,CAAU;IACrC,SAAS,EAAE,SAAS,CAAS;IAG7B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAuB;IAErD,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;IAoB7D;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAmBzB"}
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"GenericErrorRule.js","sourceRoot":"","sources":["../../../../src/rules/error-handling/GenericErr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C,OAAO,CAAC,CAAC;YACzC,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAElD,MAAM,CAAC,IAAI,CACT,IAAI,CAAC,WAAW,CACd,OAAO,EACP,GAAG,WAAW,IAAI,WAAW,uBAAuB,SAAS,GAAG,EAChE;gBACE,UAAU,EACR,0HAA0H;aAC7H,CACF,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AArDD,4CAqDC"}
|
|
@@ -3,8 +3,20 @@ import { BaseRule } from '../base/BaseRule';
|
|
|
3
3
|
/**
|
|
4
4
|
* MULE-001: Global Error Handler Exists
|
|
5
5
|
*
|
|
6
|
-
* Every Mule project should have a global error handler
|
|
7
|
-
*
|
|
6
|
+
* Every Mule project should have a global error handler: either a dedicated
|
|
7
|
+
* file (default: global-error-handler.xml) OR any scanned XML file that
|
|
8
|
+
* contains a named <error-handler> element.
|
|
9
|
+
*
|
|
10
|
+
* The rule fires on every scanned XML file that:
|
|
11
|
+
* 1. Contains at least one <flow> or <sub-flow> (is a flow file), AND
|
|
12
|
+
* 2. Does not itself define an <error-handler> element
|
|
13
|
+
*
|
|
14
|
+
* If neither the expected file exists NOR any named <error-handler> has been
|
|
15
|
+
* found in the current document, an issue is raised.
|
|
16
|
+
*
|
|
17
|
+
* Note: the old guard `context.relativePath.includes('global')` has been
|
|
18
|
+
* removed. Restricting reports to only "global" files hid the rule for
|
|
19
|
+
* projects that did not follow that naming convention.
|
|
8
20
|
*/
|
|
9
21
|
export declare class GlobalErrorHandlerRule extends BaseRule {
|
|
10
22
|
id: string;
|
|
@@ -1 +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,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI5C
|
|
1
|
+
{"version":3,"file":"GlobalErrorHandlerRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/error-handling/GlobalErrorHandlerRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI5C;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,sBAAuB,SAAQ,QAAQ;IAClD,EAAE,SAAc;IAChB,IAAI,SAAiC;IACrC,WAAW,SACgF;IAC3F,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,gBAAgB,CAAU;IACrC,SAAS,EAAE,SAAS,CAAS;IAE7B,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAoD7D"}
|
|
@@ -40,8 +40,20 @@ const path = __importStar(require("path"));
|
|
|
40
40
|
/**
|
|
41
41
|
* MULE-001: Global Error Handler Exists
|
|
42
42
|
*
|
|
43
|
-
* Every Mule project should have a global error handler
|
|
44
|
-
*
|
|
43
|
+
* Every Mule project should have a global error handler: either a dedicated
|
|
44
|
+
* file (default: global-error-handler.xml) OR any scanned XML file that
|
|
45
|
+
* contains a named <error-handler> element.
|
|
46
|
+
*
|
|
47
|
+
* The rule fires on every scanned XML file that:
|
|
48
|
+
* 1. Contains at least one <flow> or <sub-flow> (is a flow file), AND
|
|
49
|
+
* 2. Does not itself define an <error-handler> element
|
|
50
|
+
*
|
|
51
|
+
* If neither the expected file exists NOR any named <error-handler> has been
|
|
52
|
+
* found in the current document, an issue is raised.
|
|
53
|
+
*
|
|
54
|
+
* Note: the old guard `context.relativePath.includes('global')` has been
|
|
55
|
+
* removed. Restricting reports to only "global" files hid the rule for
|
|
56
|
+
* projects that did not follow that naming convention.
|
|
45
57
|
*/
|
|
46
58
|
class GlobalErrorHandlerRule extends BaseRule_1.BaseRule {
|
|
47
59
|
id = 'MULE-001';
|
|
@@ -52,25 +64,35 @@ class GlobalErrorHandlerRule extends BaseRule_1.BaseRule {
|
|
|
52
64
|
issueType = 'bug';
|
|
53
65
|
validate(doc, context) {
|
|
54
66
|
const issues = [];
|
|
55
|
-
// Get configurable file path
|
|
67
|
+
// Get configurable expected file path
|
|
56
68
|
const expectedFile = this.getOption(context, 'filePath', 'src/main/mule/global-error-handler.xml');
|
|
57
69
|
const fullPath = path.join(context.projectRoot, expectedFile);
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
// If the dedicated global error handler file exists, the project satisfies
|
|
71
|
+
// the rule regardless of what is in the current file.
|
|
72
|
+
if ((0, FileScanner_1.fileExists)(fullPath)) {
|
|
73
|
+
return issues;
|
|
74
|
+
}
|
|
75
|
+
// The expected file does not exist. Check whether the current document
|
|
76
|
+
// itself provides a global error handler via:
|
|
77
|
+
// (a) a named <error-handler> element, OR
|
|
78
|
+
// (b) a flow that references an error handler by ref attribute
|
|
79
|
+
const hasNamedErrorHandler = this.exists('//*[local-name()="error-handler"][@name]', doc);
|
|
80
|
+
if (hasNamedErrorHandler) {
|
|
81
|
+
return issues;
|
|
82
|
+
}
|
|
83
|
+
const hasErrorHandlerRef = this.exists('//*[local-name()="error-handler"][@ref]', doc);
|
|
84
|
+
if (hasErrorHandlerRef) {
|
|
85
|
+
return issues;
|
|
86
|
+
}
|
|
87
|
+
// Only report for files that actually contain flows / sub-flows so that
|
|
88
|
+
// pure configuration files (e.g. global.xml without flows) are excluded.
|
|
89
|
+
const hasFlows = this.exists('//*[local-name()="flow" or local-name()="sub-flow"]', doc);
|
|
90
|
+
if (!hasFlows) {
|
|
91
|
+
return issues;
|
|
73
92
|
}
|
|
93
|
+
issues.push(this.createFileIssue(`Global error handler configuration not found. Expected "${expectedFile}" or a named <error-handler> element in any flow file.`, {
|
|
94
|
+
suggestion: 'Create a global-error-handler.xml file with a named <error-handler> element, or add an <error-handler name="..."> to an existing configuration file',
|
|
95
|
+
}));
|
|
74
96
|
return issues;
|
|
75
97
|
}
|
|
76
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalErrorHandlerRule.js","sourceRoot":"","sources":["../../../../src/rules/error-handling/GlobalErrorHandlerRule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAA4C;AAC5C,wDAAoD;AACpD,2CAA6B;AAE7B
|
|
1
|
+
{"version":3,"file":"GlobalErrorHandlerRule.js","sourceRoot":"","sources":["../../../../src/rules/error-handling/GlobalErrorHandlerRule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAA4C;AAC5C,wDAAoD;AACpD,2CAA6B;AAE7B;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAa,sBAAuB,SAAQ,mBAAQ;IAClD,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,6BAA6B,CAAC;IACrC,WAAW,GACT,wFAAwF,CAAC;IAC3F,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,gBAAyB,CAAC;IACrC,SAAS,GAAc,KAAK,CAAC;IAE7B,QAAQ,CAAC,GAAa,EAAE,OAA0B;QAChD,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,sCAAsC;QACtC,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CACjC,OAAO,EACP,UAAU,EACV,wCAAwC,CACzC,CAAC;QAEF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QAE9D,2EAA2E;QAC3E,sDAAsD;QACtD,IAAI,IAAA,wBAAU,EAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,wEAAwE;QACxE,8CAA8C;QAC9C,4CAA4C;QAC5C,iEAAiE;QACjE,MAAM,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAAC,0CAA0C,EAAE,GAAG,CAAC,CAAC;QAC1F,IAAI,oBAAoB,EAAE,CAAC;YACzB,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC,yCAAyC,EAAE,GAAG,CAAC,CAAC;QACvF,IAAI,kBAAkB,EAAE,CAAC;YACvB,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,wEAAwE;QACxE,yEAAyE;QACzE,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,qDAAqD,EAAE,GAAG,CAAC,CAAC;QAEzF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,CAAC,IAAI,CACT,IAAI,CAAC,eAAe,CAClB,2DAA2D,YAAY,wDAAwD,EAC/H;YACE,UAAU,EACR,qJAAqJ;SACxJ,CACF,CACF,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA7DD,wDA6DC"}
|
|
@@ -5,6 +5,11 @@ import { BaseRule } from '../base/BaseRule';
|
|
|
5
5
|
*
|
|
6
6
|
* Error handlers should set an httpStatus variable for proper API responses.
|
|
7
7
|
* This ensures clients receive appropriate HTTP status codes.
|
|
8
|
+
*
|
|
9
|
+
* This rule only applies to projects that are HTTP-exposed (i.e., have at
|
|
10
|
+
* least one http:listener or apikit:router). When the LintEngine provides
|
|
11
|
+
* context.projectContext, projects without HTTP entry points skip this check
|
|
12
|
+
* to avoid false positives on event-driven or batch Mule applications.
|
|
8
13
|
*/
|
|
9
14
|
export declare class HttpStatusRule extends BaseRule {
|
|
10
15
|
id: string;
|
|
@@ -1 +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,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"HttpStatusRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/error-handling/HttpStatusRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,EAAE,SAAc;IAChB,IAAI,SAAkC;IACtC,WAAW,SAAiF;IAC5F,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,gBAAgB,CAAU;IACrC,SAAS,EAAE,SAAS,CAAS;IAE7B,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,KAAK,EAAE;IAwD5D;;OAEG;IACH,OAAO,CAAC,cAAc;CAUvB"}
|
|
@@ -7,6 +7,11 @@ const BaseRule_1 = require("../base/BaseRule");
|
|
|
7
7
|
*
|
|
8
8
|
* Error handlers should set an httpStatus variable for proper API responses.
|
|
9
9
|
* This ensures clients receive appropriate HTTP status codes.
|
|
10
|
+
*
|
|
11
|
+
* This rule only applies to projects that are HTTP-exposed (i.e., have at
|
|
12
|
+
* least one http:listener or apikit:router). When the LintEngine provides
|
|
13
|
+
* context.projectContext, projects without HTTP entry points skip this check
|
|
14
|
+
* to avoid false positives on event-driven or batch Mule applications.
|
|
10
15
|
*/
|
|
11
16
|
class HttpStatusRule extends BaseRule_1.BaseRule {
|
|
12
17
|
id = 'MULE-005';
|
|
@@ -17,6 +22,16 @@ class HttpStatusRule extends BaseRule_1.BaseRule {
|
|
|
17
22
|
issueType = 'bug';
|
|
18
23
|
validate(doc, context) {
|
|
19
24
|
const issues = [];
|
|
25
|
+
// Skip this rule for non-HTTP projects.
|
|
26
|
+
// When projectContext is available (project-wide scan), check whether
|
|
27
|
+
// the project has any HTTP listeners or APIkit routers. If not, the
|
|
28
|
+
// httpStatus variable is irrelevant (e.g. batch or event-driven apps).
|
|
29
|
+
if (context.projectContext) {
|
|
30
|
+
const { hasHttpListener, hasApikitRouter } = context.projectContext;
|
|
31
|
+
if (!hasHttpListener && !hasApikitRouter) {
|
|
32
|
+
return issues;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
20
35
|
// Variable name to look for
|
|
21
36
|
const variableName = this.getOption(context, 'variableName', 'httpStatus');
|
|
22
37
|
// Find error handlers
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpStatusRule.js","sourceRoot":"","sources":["../../../../src/rules/error-handling/HttpStatusRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C
|
|
1
|
+
{"version":3,"file":"HttpStatusRule.js","sourceRoot":"","sources":["../../../../src/rules/error-handling/HttpStatusRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;;;;;;;GAUG;AACH,MAAa,cAAe,SAAQ,mBAAQ;IAC1C,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,8BAA8B,CAAC;IACtC,WAAW,GAAG,6EAA6E,CAAC;IAC5F,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,gBAAyB,CAAC;IACrC,SAAS,GAAc,KAAK,CAAC;IAE7B,QAAQ,CAAC,GAAa,EAAE,OAA0B;QAChD,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,wCAAwC;QACxC,sEAAsE;QACtE,qEAAqE;QACrE,uEAAuE;QACvE,IAAI,OAAO,CAAC,cAAc,EAAE,CA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AAI,CAAC,UAAU,CAAC;QAC3C,OAAO,OAAO,EAAE,CAAC;YACf,IAAI,OAAO,CAAC,QAAQ,KAAK,MAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;gBACpE,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC5C,CAAC;YACD,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;QAC/B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA7ED,wCA6EC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MissingErrorHandlerRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/error-handling/MissingErrorHandlerRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,uBAAwB,SAAQ,QAAQ;
|
|
1
|
+
{"version":3,"file":"MissingErrorHandlerRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/error-handling/MissingErrorHandlerRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,uBAAwB,SAAQ,QAAQ;IACnD,EAAE,SAAc;IAChB,IAAI,SAA2B;IAC/B,WAAW,SAAoE;IAC/E,QAAQ,EAAG,OAAO,CAAU;IAC5B,QAAQ,EAAG,gBAAgB,CAAU;IACrC,SAAS,EAAE,SAAS,CAAS;IAE7B,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAmD7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MissingErrorHandlerRule.js","sourceRoot":"","sources":["../../../../src/rules/error-handling/MissingErrorHandlerRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;;GAKG;AACH,MAAa,uBAAwB,SAAQ,mBAAQ;
|
|
1
|
+
{"version":3,"file":"MissingErrorHandlerRule.js","sourceRoot":"","sources":["../../../../src/rules/error-handling/MissingErrorHandlerRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;;GAKG;AACH,MAAa,uBAAwB,SAAQ,mBAAQ;IACnD,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,uBAAuB,CAAC;IAC/B,WAAW,GAAG,gEAAgE,CAAC;IAC/E,QAAQ,GAAG,OAAgB,CAAC;IAC5B,QAAQ,GAAG,gBAAyB,CAAC;IACrC,SAAS,GAAc,KAAK,CAAC;IAE7B,QAAQ,CAAC,GAAa,EAAE,OAA0B;QAChD,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,6EAA6E;QAC7E,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,iBAAiB,EAAE;YACjE,YAAY;YACZ,YAAY;YACZ,WAAW;YACX,yEAAyE;YACzE,OAAO;YACP,QAAQ;YACR,OAAO;YACP,SAAS;YACT,UAAU;YACV,WAAW;YACX,QAAQ;SACT,CAAC,CAAC;QAEH,oCAAoC;QACpC,oFAAoF;QACpF,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;QAE9C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;YACzC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,SAAS;YACX,CAAC;YAED,yBAAyB;YACzB,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,eAAe,CAAC,EAAE,CAAC;gBAC3C,SAAS;YACX,CAAC;YAED,iCAAiC;YACjC,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC;YAEjE,iEAAiE;YACjE,MAAM,aAAa,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;YAEnE,IAAI,CAAC,gBAAgB,IAAI,CAAC,aAAa,EAAE,CAAC;gBACxC,MAAM,CAAC,IAAI,CACT,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,SAAS,IAAI,+BAA+B,EAAE;oBACnE,UAAU,EACR,uFAAuF;iBAC1F,CAAC,CACH,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA3DD,0DA2DC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TryScopeRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/error-handling/TryScopeRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,YAAa,SAAQ,QAAQ;
|
|
1
|
+
{"version":3,"file":"TryScopeRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/error-handling/TryScopeRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,YAAa,SAAQ,QAAQ;IACxC,EAAE,SAAa;IACf,IAAI,SAA6B;IACjC,WAAW,SAAiE;IAC5E,QAAQ,EAAG,MAAM,CAAU;IAC3B,QAAQ,EAAG,gBAAgB,CAAU;IACrC,SAAS,EAAE,SAAS,CAAS;IAE7B,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAyC9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TryScopeRule.js","sourceRoot":"","sources":["../../../../src/rules/error-handling/TryScopeRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;;GAKG;AACH,MAAa,YAAa,SAAQ,mBAAQ;
|
|
1
|
+
{"version":3,"file":"TryScopeRule.js","sourceRoot":"","sources":["../../../../src/rules/error-handling/TryScopeRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;;GAKG;AACH,MAAa,YAAa,SAAQ,mBAAQ;IACxC,EAAE,GAAG,SAAS,CAAC;IACf,IAAI,GAAG,yBAAyB,CAAC;IACjC,WAAW,GAAG,6DAA6D,CAAC;IAC5E,QAAQ,GAAG,MAAe,CAAC;IAC3B,QAAQ,GAAG,gBAAyB,CAAC;IACrC,SAAS,GAAc,KAAK,CAAC;IAE7B,QAAQ,CAAC,GAAa,EAAE,QAA2B;QACjD,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,4CAA4C;QAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,0BAA0B,EAAE,GAAG,CAAC,CAAC;QAE3D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,WAAW,GAAG,IAAe,CAAC;YACpC,MAAM,QAAQ,GAAG,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC;YAE/D,oDAAoD;YACpD,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAC9B,gEAAgE,EAChE,IAAI,CACL,CAAC;YACF,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAC9B,6FAA6F,EAC7F,IAAI,CACL,CAAC;YACF,MAAM,aAAa,GAAG,CAAC,GAAG,YAAY,EAAE,GAAG,YAAY,CAAC,CAAC;YAEzD,4BAA4B;YAC5B,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAAC;YAEhE,8CAA8C;YAC9C,IAAI,aAAa,CAAC,MAAM,IAAI,CAAC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACxD,MAAM,CAAC,IAAI,CACT,IAAI,CAAC,WAAW,CACd,IAAI,EACJ,SAAS,QAAQ,SAAS,aAAa,CAAC,MAAM,6CAA6C,EAC3F;oBACE,UAAU,EACR,8EAA8E;iBACjF,CACF,CACF,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAjDD,oCAiDC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExperimentalRules.d.ts","sourceRoot":"","sources":["../../../../src/rules/experimental/ExperimentalRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;
|
|
1
|
+
{"version":3,"file":"ExperimentalRules.d.ts","sourceRoot":"","sources":["../../../../src/rules/experimental/ExperimentalRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;IAC5C,EAAE,SAAa;IACf,IAAI,SAA0B;IAC9B,WAAW,SAAoD;IAC/D,QAAQ,EAAG,MAAM,CAAU;IAC3B,QAAQ,EAAG,cAAc,CAAU;IAEnC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAuB7D;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,QAAQ;IACrD,EAAE,SAAa;IACf,IAAI,SAA6B;IACjC,WAAW,SAA+D;IAC1E,QAAQ,EAAG,MAAM,CAAU;IAC3B,QAAQ,EAAG,cAAc,CAAU;IAEnC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;IAwB7D,OAAO,CAAC,iBAAiB;CAI1B;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IAC7C,EAAE,SAAa;IACf,IAAI,SAAoB;IACxB,WAAW,SAAiD;IAC5D,QAAQ,EAAG,MAAM,CAAU;IAC3B,QAAQ,EAAG,cAAc,CAAU;IAEnC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAkB7D"}
|
|
@@ -80,7 +80,9 @@ class ConnectorConfigNamingRule extends BaseRule_1.BaseRule {
|
|
|
80
80
|
for (const config of configs) {
|
|
81
81
|
const name = this.getNameAttribute(config);
|
|
82
82
|
if (name && !this.isValidConfigName(name)) {
|
|
83
|
-
issues.push(this.createIssue(config, `Config "${name}" should follow Convention_Type pattern`, {
|
|
83
|
+
issues.push(this.createIssue(config, `Config "${name}" should follow Convention_Type pattern`, {
|
|
84
|
+
suggestion: 'Use pattern: HTTP_Request_Config, Database_Config',
|
|
85
|
+
}));
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
return issues;
|
|
@@ -108,7 +110,9 @@ class MUnitCoverageRule extends BaseRule_1.BaseRule {
|
|
|
108
110
|
const munitDir = `${context.projectRoot}/src/test/munit`;
|
|
109
111
|
if (!fs.existsSync(munitDir)) {
|
|
110
112
|
if (flows.length > 0) {
|
|
111
|
-
issues.push(this.createFileIssue(`Project has ${flows.length} flows but no MUnit tests`, {
|
|
113
|
+
issues.push(this.createFileIssue(`Project has ${flows.length} flows but no MUnit tests`, {
|
|
114
|
+
suggestion: 'Create src/test/munit/ directory with test files',
|
|
115
|
+
}));
|
|
112
116
|
}
|
|
113
117
|
}
|
|
114
118
|
return issues;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExperimentalRules.js","sourceRoot":"","sources":["../../../../src/rules/experimental/ExperimentalRules.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAA4C;AAC5C,uCAAyB;AAEzB;;;;GAIG;AACH,MAAa,gBAAiB,SAAQ,mBAAQ;
|
|
1
|
+
{"version":3,"file":"ExperimentalRules.js","sourceRoot":"","sources":["../../../../src/rules/experimental/ExperimentalRules.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAA4C;AAC5C,uCAAyB;AAEzB;;;;GAIG;AACH,MAAa,gBAAiB,SAAQ,mBAAQ;IAC5C,EAAE,GAAG,SAAS,CAAC;IACf,IAAI,GAAG,sBAAsB,CAAC;IAC9B,WAAW,GAAG,gDAAgD,CAAC;IAC/D,QAAQ,GAAG,MAAe,CAAC;IAC3B,QAAQ,GAAG,cAAuB,CAAC;IAEnC,QAAQ,CAAC,GAAa,EAAE,OAA0B;QAChD,MAAM,MAAM,GAAY,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QAExD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,+BAA+B,EAAE,GAAG,CAAC,CAAC;QAEhE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,IAAgB,CAAC,CAAC;YAEnE,IAAI,QAAQ,CAAC,MAAM,GAAG,QAAQ,EAAE,CAAC;gBAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC;gBACtD,MAAM,CAAC,IAAI,CACT,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IAAI,GAAG,gBAAgB,CAAC;IACxB,WAAW,GAAG,6CAA6C,CAAC;IAC5D,QAAQ,GAAG,MAAe,CAAC;IAC3B,QAAQ,GAAG,cAAuB,CAAC;IAEnC,QAAQ,CAAC,GAAa,EAAE,OAA0B;QAChD,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;QAC9C,MAAM,QAAQ,GAAG,GAAG,OAAO,CAAC,WAAW,iBAAiB,CAAC;QAEzD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrB,MAAM,CAAC,IAAI,CACT,IAAI,CAAC,eAAe,CAAC,eAAe,KAAK,CAAC,MAAM,2BAA2B,EAAE;oBAC3E,UAAU,EAAE,kDAAkD;iBAC/D,CAAC,CACH,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAzBD,8CAyBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GovernanceRules.d.ts","sourceRoot":"","sources":["../../../../src/rules/governance/GovernanceRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAKlD;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;
|
|
1
|
+
{"version":3,"file":"GovernanceRules.d.ts","sourceRoot":"","sources":["../../../../src/rules/governance/GovernanceRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAKlD;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,EAAE,SAAc;IAChB,IAAI,SAAoB;IACxB,WAAW,SAA6C;IACxD,QAAQ,EAAG,OAAO,CAAU;IAC5B,QAAQ,EAAG,YAAY,CAAU;IAEjC,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG,KAAK,EAAE;IAkDpD,OAAO,CAAC,YAAY;CAIrB;AAED;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAC7C,EAAE,SAAc;IAChB,IAAI,SAAiB;IACrB,WAAW,SAAgD;IAC3D,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,YAAY,CAAU;IAEjC,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG,KAAK,EAAE;CA8CrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GovernanceRules.js","sourceRoot":"","sources":["../../../../src/rules/governance/GovernanceRules.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qDAAkD;AAClD,8CAAoD;AACpD,uCAAyB;AACzB,2CAA6B;AAE7B;;;;GAIG;AACH,MAAa,iBAAkB,SAAQ,yBAAW;
|
|
1
|
+
{"version":3,"file":"GovernanceRules.js","sourceRoot":"","sources":["../../../../src/rules/governance/GovernanceRules.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qDAAkD;AAClD,8CAAoD;AACpD,uCAAyB;AACzB,2CAA6B;AAE7B;;;;GAIG;AACH,MAAa,iBAAkB,SAAQ,yBAAW;IAChD,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,gBAAgB,CAAC;IACxB,WAAW,GAAG,yCAAyC,CAAC;IACxD,QAAQ,GAAG,OAAgB,CAAC;IAC5B,QAAQ,GAAG,YAAqB,CAAC;IAEjC,eAAe,CAAC,OAA0B;QACxC,MAAM,MAAM,GAAY,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,IAA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CAAC,IAAI,EAAE,CAAC,CAAC;YAEvD,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,kBAAkB,CAAC,CAAC;YAClF,MAAM,cAAc,GAAG,eAAe,CAAC,MAAM,CAC3C,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,KAAK,CAAC,CAC3E,CAAC;YAEF,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC9B,MAAM,CAAC,IAAI,CACT,IAAI,CAAC,kBAAkB,CACrB,wCAAwC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EACnE;oBACE,QAAQ,EAAE,MAAM;oBAChB,UAAU,EAAE,wCAAwC;iBACrD,CACF,CACF,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,IAAI,CACT,IAAI,CAAC,kBAAkB,CAAC,6BAA6B,IAAA,wBAAe,EAAC,KAAK,CAAC,EAAE,EAAE;gBAC7E,QAAQ,EAAE,SAAS;aACpB,CAAC,CACH,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AArDD,wCAqDC"}
|
|
@@ -4,6 +4,25 @@ import { BaseRule } from '../base/BaseRule';
|
|
|
4
4
|
* MULE-402: HTTP Request Content-Type
|
|
5
5
|
*
|
|
6
6
|
* POST/PUT HTTP requests should include Content-Type header.
|
|
7
|
+
*
|
|
8
|
+
* The rule detects Content-Type in three patterns:
|
|
9
|
+
*
|
|
10
|
+
* Pattern A — Static <http:header> element:
|
|
11
|
+
* <http:headers>
|
|
12
|
+
* <http:header headerName="Content-Type" value="application/json"/>
|
|
13
|
+
* </http:headers>
|
|
14
|
+
*
|
|
15
|
+
* Pattern B — CDATA DataWeave expression block:
|
|
16
|
+
* <http:headers><![CDATA[#[output application/java --- {"Content-Type": "application/json"}]]]></http:headers>
|
|
17
|
+
*
|
|
18
|
+
* Pattern C — Inline DataWeave expression on value attribute:
|
|
19
|
+
* <http:headers value='#[{"Content-Type": "application/json"}]'/>
|
|
20
|
+
*
|
|
21
|
+
* When headers are set via DataWeave (patterns B/C), the rule performs a
|
|
22
|
+
* case-insensitive text search for "content-type" within the expression body.
|
|
23
|
+
* If a DataWeave expression is present but does not contain "content-type",
|
|
24
|
+
* the issue is downgraded to 'info' severity to acknowledge the static analysis
|
|
25
|
+
* limitation of evaluating dynamic expressions.
|
|
7
26
|
*/
|
|
8
27
|
export declare class HttpContentTypeRule extends BaseRule {
|
|
9
28
|
id: string;
|
|
@@ -12,6 +31,14 @@ export declare class HttpContentTypeRule extends BaseRule {
|
|
|
12
31
|
severity: "warning";
|
|
13
32
|
category: "http";
|
|
14
33
|
validate(doc: Document, _context: ValidationContext): Issue[];
|
|
15
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Check whether a Content-Type header is present on the given http:request element.
|
|
36
|
+
*
|
|
37
|
+
* @returns
|
|
38
|
+
* 'present' — Content-Type definitively found
|
|
39
|
+
* 'dynamic-unverified' — headers set via DW expression but Content-Type not visible
|
|
40
|
+
* 'missing' — no headers element or no Content-Type anywhere
|
|
41
|
+
*/
|
|
42
|
+
private checkContentTypeHeader;
|
|
16
43
|
}
|
|
17
44
|
//# sourceMappingURL=HttpContentTypeRule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpContentTypeRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/http/HttpContentTypeRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"HttpContentTypeRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/http/HttpContentTypeRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,mBAAoB,SAAQ,QAAQ;IAC/C,EAAE,SAAc;IAChB,IAAI,SAA+B;IACnC,WAAW,SAA+D;IAC1E,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,MAAM,CAAU;IAE3B,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;IAqD7D;;;;;;;OAOG;IACH,OAAO,CAAC,sBAAsB;CAuC/B"}
|