@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,271 @@
|
|
|
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.LintEngine = void 0;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const Config_1 = require("../types/Config");
|
|
40
|
+
const XmlParser_1 = require("../core/XmlParser");
|
|
41
|
+
const FileScanner_1 = require("../core/FileScanner");
|
|
42
|
+
/**
|
|
43
|
+
* Main lint engine that orchestrates file scanning, parsing, and rule execution
|
|
44
|
+
*/
|
|
45
|
+
class LintEngine {
|
|
46
|
+
rules;
|
|
47
|
+
config;
|
|
48
|
+
verbose;
|
|
49
|
+
constructor(options) {
|
|
50
|
+
this.rules = options.rules;
|
|
51
|
+
this.config = { ...Config_1.DEFAULT_CONFIG, ...options.config };
|
|
52
|
+
this.verbose = options.verbose ?? false;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Scan a directory or file and return lint report
|
|
56
|
+
*/
|
|
57
|
+
async scan(targetPath) {
|
|
58
|
+
const startTime = Date.now();
|
|
59
|
+
let projectRoot = path.resolve(targetPath);
|
|
60
|
+
let isStandalone = false;
|
|
61
|
+
const stats = fs.statSync(projectRoot);
|
|
62
|
+
const isFile = stats.isFile();
|
|
63
|
+
if (isFile) {
|
|
64
|
+
// Try to find actual project root
|
|
65
|
+
const detectedRoot = this.findProjectRoot(path.dirname(projectRoot));
|
|
66
|
+
if (detectedRoot) {
|
|
67
|
+
projectRoot = detectedRoot;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
// Standalone file logic
|
|
71
|
+
projectRoot = path.dirname(projectRoot);
|
|
72
|
+
isStandalone = true;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
this.log(`Scanning: ${projectRoot} ${isStandalone ? '(Standalone)' : ''}`);
|
|
76
|
+
this.log(`Rules enabled: ${this.getEnabledRules().length}`);
|
|
77
|
+
// Discover files
|
|
78
|
+
const files = await (0, FileScanner_1.scanDirectory)(isFile ? targetPath : projectRoot, {
|
|
79
|
+
include: this.config.include,
|
|
80
|
+
exclude: this.config.exclude,
|
|
81
|
+
});
|
|
82
|
+
this.log(`Found ${files.length} files to scan`);
|
|
83
|
+
// Process each file
|
|
84
|
+
const fileResults = [];
|
|
85
|
+
for (const file of files) {
|
|
86
|
+
const result = this.processFile(file, projectRoot, isStandalone);
|
|
87
|
+
fileResults.push(result);
|
|
88
|
+
}
|
|
89
|
+
// Build report
|
|
90
|
+
const durationMs = Date.now() - startTime;
|
|
91
|
+
const summary = this.buildSummary(fileResults);
|
|
92
|
+
this.log(`Scan complete in ${durationMs}ms`);
|
|
93
|
+
this.log(`Found ${summary.bySeverity.error} errors, ${summary.bySeverity.warning} warnings`);
|
|
94
|
+
return {
|
|
95
|
+
projectRoot,
|
|
96
|
+
timestamp: new Date().toISOString(),
|
|
97
|
+
durationMs,
|
|
98
|
+
files: fileResults,
|
|
99
|
+
summary,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Find project root by looking for marker files
|
|
104
|
+
*/
|
|
105
|
+
findProjectRoot(startDir) {
|
|
106
|
+
let currentDir = startDir;
|
|
107
|
+
const root = path.parse(startDir).root;
|
|
108
|
+
while (currentDir !== root) {
|
|
109
|
+
if (fs.existsSync(path.join(currentDir, 'pom.xml')) ||
|
|
110
|
+
fs.existsSync(path.join(currentDir, 'mule-artifact.json'))) {
|
|
111
|
+
return currentDir;
|
|
112
|
+
}
|
|
113
|
+
currentDir = path.dirname(currentDir);
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Scan XML content directly (useful for VS Code extension)
|
|
119
|
+
*/
|
|
120
|
+
scanContent(content, filePath) {
|
|
121
|
+
const parseResult = (0, XmlParser_1.parseXml)(content, filePath);
|
|
122
|
+
if (!parseResult.success || !parseResult.document) {
|
|
123
|
+
return [{
|
|
124
|
+
line: parseResult.errorLine ?? 1,
|
|
125
|
+
column: parseResult.errorColumn,
|
|
126
|
+
message: parseResult.error ?? 'Failed to parse XML',
|
|
127
|
+
ruleId: 'PARSE-ERROR',
|
|
128
|
+
severity: 'error',
|
|
129
|
+
}];
|
|
130
|
+
}
|
|
131
|
+
// For direct content scan, we assume standalone unless we can infer otherwise (out of scope here)
|
|
132
|
+
return this.runRules(parseResult.document, filePath, path.dirname(filePath), true);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Get all enabled rules based on configuration
|
|
136
|
+
*/
|
|
137
|
+
getEnabledRules() {
|
|
138
|
+
return this.rules.filter(rule => {
|
|
139
|
+
const ruleConfig = this.getRuleConfig(rule.id);
|
|
140
|
+
return ruleConfig.enabled;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Process a single file
|
|
145
|
+
*/
|
|
146
|
+
processFile(file, projectRoot, isStandalone = false) {
|
|
147
|
+
this.log(` Processing: ${file.relativePath}`);
|
|
148
|
+
try {
|
|
149
|
+
const content = (0, FileScanner_1.readFileContent)(file.absolutePath);
|
|
150
|
+
const parseResult = (0, XmlParser_1.parseXml)(content, file.relativePath);
|
|
151
|
+
if (!parseResult.success || !parseResult.document) {
|
|
152
|
+
return {
|
|
153
|
+
filePath: file.absolutePath,
|
|
154
|
+
relativePath: file.relativePath,
|
|
155
|
+
issues: [],
|
|
156
|
+
parsed: false,
|
|
157
|
+
parseError: parseResult.error,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
const issues = this.runRules(parseResult.document, file.absolutePath, projectRoot, isStandalone);
|
|
161
|
+
return {
|
|
162
|
+
filePath: file.absolutePath,
|
|
163
|
+
relativePath: file.relativePath,
|
|
164
|
+
issues,
|
|
165
|
+
parsed: true,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
170
|
+
return {
|
|
171
|
+
filePath: file.absolutePath,
|
|
172
|
+
relativePath: file.relativePath,
|
|
173
|
+
issues: [],
|
|
174
|
+
parsed: false,
|
|
175
|
+
parseError: `Error reading file: ${message}`,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Run all enabled rules against a document
|
|
181
|
+
*/
|
|
182
|
+
runRules(doc, filePath, projectRoot, isStandalone = false) {
|
|
183
|
+
const issues = [];
|
|
184
|
+
const enabledRules = this.getEnabledRules();
|
|
185
|
+
for (const rule of enabledRules) {
|
|
186
|
+
// Skip structure rules for standalone files
|
|
187
|
+
if (isStandalone && rule.category === 'structure') {
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
try {
|
|
191
|
+
const context = {
|
|
192
|
+
filePath,
|
|
193
|
+
relativePath: path.relative(projectRoot, filePath),
|
|
194
|
+
projectRoot,
|
|
195
|
+
config: this.getRuleConfig(rule.id),
|
|
196
|
+
};
|
|
197
|
+
const ruleIssues = rule.validate(doc, context);
|
|
198
|
+
// Apply severity override from config
|
|
199
|
+
const configSeverity = context.config.severity;
|
|
200
|
+
if (configSeverity) {
|
|
201
|
+
ruleIssues.forEach(issue => {
|
|
202
|
+
issue.severity = configSeverity;
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
issues.push(...ruleIssues);
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
209
|
+
console.error(`Error in rule ${rule.id}: ${message}`);
|
|
210
|
+
// Don't fail the whole scan for a single rule error
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return issues;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Get configuration for a specific rule
|
|
217
|
+
*/
|
|
218
|
+
getRuleConfig(ruleId) {
|
|
219
|
+
const config = this.config.rules[ruleId];
|
|
220
|
+
if (config === undefined) {
|
|
221
|
+
// Default: enabled with rule's default severity
|
|
222
|
+
return { enabled: true };
|
|
223
|
+
}
|
|
224
|
+
if (typeof config === 'boolean') {
|
|
225
|
+
return { enabled: config };
|
|
226
|
+
}
|
|
227
|
+
return config;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Build summary statistics from file results
|
|
231
|
+
*/
|
|
232
|
+
buildSummary(files) {
|
|
233
|
+
const bySeverity = {
|
|
234
|
+
error: 0,
|
|
235
|
+
warning: 0,
|
|
236
|
+
info: 0,
|
|
237
|
+
};
|
|
238
|
+
const byRule = {};
|
|
239
|
+
let filesWithIssues = 0;
|
|
240
|
+
let parseErrors = 0;
|
|
241
|
+
for (const file of files) {
|
|
242
|
+
if (!file.parsed) {
|
|
243
|
+
parseErrors++;
|
|
244
|
+
}
|
|
245
|
+
if (file.issues.length > 0) {
|
|
246
|
+
filesWithIssues++;
|
|
247
|
+
}
|
|
248
|
+
for (const issue of file.issues) {
|
|
249
|
+
bySeverity[issue.severity]++;
|
|
250
|
+
byRule[issue.ruleId] = (byRule[issue.ruleId] ?? 0) + 1;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return {
|
|
254
|
+
totalFiles: files.length,
|
|
255
|
+
filesWithIssues,
|
|
256
|
+
parseErrors,
|
|
257
|
+
bySeverity,
|
|
258
|
+
byRule,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Log message if verbose mode is enabled
|
|
263
|
+
*/
|
|
264
|
+
log(message) {
|
|
265
|
+
if (this.verbose) {
|
|
266
|
+
console.log(message);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
exports.LintEngine = LintEngine;
|
|
271
|
+
//# sourceMappingURL=LintEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YAC3D,CAAC;QACL,CAAC;QAED,OAAO;YACH,UAAU,EAAE,KAAK,CAAC,MAAM;YACxB,eAAe;YACf,WAAW;YACX,UAAU;YACV,MAAM;SACT,CAAC;IACN,CAAC;IAED;;OAEG;IACK,GAAG,CAAC,OAAe;QACvB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACzB,CAAC;IACL,CAAC;CACJ;AAlQD,gCAkQC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/engine/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./LintEngine"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/engine/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LintReport } from '../types/Report';
|
|
2
|
+
import { Issue } from '../types/Rule';
|
|
3
|
+
/**
|
|
4
|
+
* JSON output format - flat array of issues
|
|
5
|
+
*/
|
|
6
|
+
export interface JsonIssue extends Issue {
|
|
7
|
+
filePath: string;
|
|
8
|
+
relativePath: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Format lint report as JSON
|
|
12
|
+
*/
|
|
13
|
+
export declare function formatJson(report: LintReport, pretty?: boolean): string;
|
|
14
|
+
/**
|
|
15
|
+
* Format full report as JSON (including summary)
|
|
16
|
+
*/
|
|
17
|
+
export declare function formatJsonFull(report: LintReport, pretty?: boolean): string;
|
|
18
|
+
//# sourceMappingURL=JsonFormatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JsonFormatter.d.ts","sourceRoot":"","sources":["../../../src/formatters/JsonFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,KAAK;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,UAAO,GAAG,MAAM,CA8BpE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,UAAO,GAAG,MAAM,CAKxE"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatJson = formatJson;
|
|
4
|
+
exports.formatJsonFull = formatJsonFull;
|
|
5
|
+
/**
|
|
6
|
+
* Format lint report as JSON
|
|
7
|
+
*/
|
|
8
|
+
function formatJson(report, pretty = true) {
|
|
9
|
+
const issues = [];
|
|
10
|
+
for (const file of report.files) {
|
|
11
|
+
// Add parse errors
|
|
12
|
+
if (!file.parsed) {
|
|
13
|
+
issues.push({
|
|
14
|
+
filePath: file.filePath,
|
|
15
|
+
relativePath: file.relativePath,
|
|
16
|
+
line: 1,
|
|
17
|
+
message: file.parseError ?? 'Failed to parse file',
|
|
18
|
+
ruleId: 'PARSE-ERROR',
|
|
19
|
+
severity: 'error',
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
// Add issues
|
|
23
|
+
for (const issue of file.issues) {
|
|
24
|
+
issues.push({
|
|
25
|
+
...issue,
|
|
26
|
+
filePath: file.filePath,
|
|
27
|
+
relativePath: file.relativePath,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (pretty) {
|
|
32
|
+
return JSON.stringify(issues, null, 2);
|
|
33
|
+
}
|
|
34
|
+
return JSON.stringify(issues);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Format full report as JSON (including summary)
|
|
38
|
+
*/
|
|
39
|
+
function formatJsonFull(report, pretty = true) {
|
|
40
|
+
if (pretty) {
|
|
41
|
+
return JSON.stringify(report, null, 2);
|
|
42
|
+
}
|
|
43
|
+
return JSON.stringify(report);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=JsonFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JsonFormatter.js","sourceRoot":"","sources":["../../../src/formatters/JsonFormatter.ts"],"names":[],"mappings":";;AAcA,gCA8BC;AAKD,wCAKC;AA3CD;;GAEG;AACH,SAAgB,UAAU,CAAC,MAAkB,EAAE,MAAM,GAAG,IAAI;IACxD,MAAM,MAAM,GAAgB,EAAE,CAAC;IAE/B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QAC9B,mBAAmB;QACnB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACf,MAAM,CAAC,IAAI,CAAC;gBACR,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,IAAI,EAAE,CAAC;gBACP,OAAO,EAAE,IAAI,CAAC,UAAU,IAAI,sBAAsB;gBAClD,MAAM,EAAE,aAAa;gBACrB,QAAQ,EAAE,OAAO;aACpB,CAAC,CAAC;QACP,CAAC;QAED,aAAa;QACb,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC9B,MAAM,CAAC,IAAI,CAAC;gBACR,GAAG,KAAK;gBACR,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,YAAY,EAAE,IAAI,CAAC,YAAY;aAClC,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACT,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,MAAkB,EAAE,MAAM,GAAG,IAAI;IAC5D,IAAI,MAAM,EAAE,CAAC;QACT,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LintReport } from '../types/Report';
|
|
2
|
+
import { Rule } from '../types/Rule';
|
|
3
|
+
/**
|
|
4
|
+
* Format lint report as SARIF 2.1.0
|
|
5
|
+
* This format is understood by VS Code, GitHub, and AI agents
|
|
6
|
+
*/
|
|
7
|
+
export declare function formatSarif(report: LintReport, rules?: Rule[]): string;
|
|
8
|
+
//# sourceMappingURL=SarifFormatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SarifFormatter.d.ts","sourceRoot":"","sources":["../../../src/formatters/SarifFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAmB,IAAI,EAAE,MAAM,eAAe,CAAC;AA2JtD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,GAAE,IAAI,EAAc,GAAG,MAAM,CAkDjF"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatSarif = formatSarif;
|
|
4
|
+
const rules_1 = require("../rules");
|
|
5
|
+
/**
|
|
6
|
+
* Convert mule-lint severity to SARIF level
|
|
7
|
+
*/
|
|
8
|
+
function toSarifLevel(severity) {
|
|
9
|
+
switch (severity) {
|
|
10
|
+
case 'error':
|
|
11
|
+
return 'error';
|
|
12
|
+
case 'warning':
|
|
13
|
+
return 'warning';
|
|
14
|
+
case 'info':
|
|
15
|
+
return 'note';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Convert Rule to SARIF rule definition
|
|
20
|
+
*/
|
|
21
|
+
function toSarifRule(rule) {
|
|
22
|
+
return {
|
|
23
|
+
id: rule.id,
|
|
24
|
+
name: rule.name,
|
|
25
|
+
shortDescription: { text: rule.name },
|
|
26
|
+
fullDescription: { text: rule.description },
|
|
27
|
+
helpUri: rule.docsUrl,
|
|
28
|
+
defaultConfiguration: {
|
|
29
|
+
level: toSarifLevel(rule.severity),
|
|
30
|
+
},
|
|
31
|
+
properties: {
|
|
32
|
+
category: rule.category,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Convert Issue to SARIF result
|
|
38
|
+
*/
|
|
39
|
+
function toSarifResult(issue, relativePath) {
|
|
40
|
+
const result = {
|
|
41
|
+
ruleId: issue.ruleId,
|
|
42
|
+
level: toSarifLevel(issue.severity),
|
|
43
|
+
message: { text: issue.message },
|
|
44
|
+
locations: [{
|
|
45
|
+
physicalLocation: {
|
|
46
|
+
artifactLocation: {
|
|
47
|
+
uri: relativePath,
|
|
48
|
+
uriBaseId: '%SRCROOT%',
|
|
49
|
+
},
|
|
50
|
+
region: {
|
|
51
|
+
startLine: issue.line,
|
|
52
|
+
startColumn: issue.column,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
}],
|
|
56
|
+
};
|
|
57
|
+
// Add fix suggestion if available
|
|
58
|
+
if (issue.suggestion) {
|
|
59
|
+
result.fixes = [{
|
|
60
|
+
description: { text: issue.suggestion },
|
|
61
|
+
}];
|
|
62
|
+
}
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Format lint report as SARIF 2.1.0
|
|
67
|
+
* This format is understood by VS Code, GitHub, and AI agents
|
|
68
|
+
*/
|
|
69
|
+
function formatSarif(report, rules = rules_1.ALL_RULES) {
|
|
70
|
+
const sarifLog = {
|
|
71
|
+
$schema: 'https://json.schemastore.org/sarif-2.1.0.json',
|
|
72
|
+
version: '2.1.0',
|
|
73
|
+
runs: [{
|
|
74
|
+
tool: {
|
|
75
|
+
driver: {
|
|
76
|
+
name: 'mule-lint',
|
|
77
|
+
version: '1.0.0',
|
|
78
|
+
informationUri: 'https://github.com/mule-lint/mule-lint',
|
|
79
|
+
rules: rules.map(toSarifRule),
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
results: [],
|
|
83
|
+
invocations: [{
|
|
84
|
+
executionSuccessful: report.summary.parseErrors === 0,
|
|
85
|
+
startTimeUtc: report.timestamp,
|
|
86
|
+
}],
|
|
87
|
+
}],
|
|
88
|
+
};
|
|
89
|
+
// Add results from all files
|
|
90
|
+
for (const file of report.files) {
|
|
91
|
+
// Add parse errors
|
|
92
|
+
if (!file.parsed) {
|
|
93
|
+
sarifLog.runs[0].results.push({
|
|
94
|
+
ruleId: 'PARSE-ERROR',
|
|
95
|
+
level: 'error',
|
|
96
|
+
message: { text: file.parseError ?? 'Failed to parse file' },
|
|
97
|
+
locations: [{
|
|
98
|
+
physicalLocation: {
|
|
99
|
+
artifactLocation: {
|
|
100
|
+
uri: file.relativePath,
|
|
101
|
+
uriBaseId: '%SRCROOT%',
|
|
102
|
+
},
|
|
103
|
+
region: { startLine: 1 },
|
|
104
|
+
},
|
|
105
|
+
}],
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
// Add issues
|
|
109
|
+
for (const issue of file.issues) {
|
|
110
|
+
sarifLog.runs[0].results.push(toSarifResult(issue, file.relativePath));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return JSON.stringify(sarifLog, null, 2);
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=SarifFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SarifFormatter.js","sourceRoot":"","sources":["../../../src/formatters/SarifFormatter.ts"],"names":[],"mappings":";;AAgKA,kCAkDC;AAhND,oCAAqC;AAsFrC;;GAEG;AACH,SAAS,YAAY,CAAC,QAAkB;IACpC,QAAQ,QAAQ,EAAE,CAAC;QACf,KAAK,OAAO;YACR,OAAO,OAAO,CAAC;QACnB,KAAK,SAAS;YACV,OAAO,SAAS,CAAC;QACrB,KAAK,MAAM;YACP,OAAO,MAAM,CAAC;IACtB,CAAC;AACL,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,IAAU;IAC3B,OAAO;QACH,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,gBAAgB,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;QACrC,eAAe,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
* Format lint report as a colorized table for human consumption
|
|
4
|
+
*/
|
|
5
|
+
export declare function formatTable(report: LintReport): string;
|
|
6
|
+
/**
|
|
7
|
+
* Get exit code based on report
|
|
8
|
+
*/
|
|
9
|
+
export declare function getExitCode(report: LintReport, failOnWarning?: boolean): number;
|
|
10
|
+
//# sourceMappingURL=TableFormatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableFormatter.d.ts","sourceRoot":"","sources":["../../../src/formatters/TableFormatter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAiDtD;AAuCD;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,aAAa,UAAQ,GAAG,MAAM,CAW7E"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.formatTable = formatTable;
|
|
7
|
+
exports.getExitCode = getExitCode;
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
/**
|
|
10
|
+
* Format lint report as a colorized table for human consumption
|
|
11
|
+
*/
|
|
12
|
+
function formatTable(report) {
|
|
13
|
+
const lines = [];
|
|
14
|
+
// Header
|
|
15
|
+
lines.push('');
|
|
16
|
+
lines.push(chalk_1.default.bold('Mule-Lint Report'));
|
|
17
|
+
lines.push(chalk_1.default.gray(`Scanned ${report.summary.totalFiles} files in ${report.durationMs}ms`));
|
|
18
|
+
lines.push('');
|
|
19
|
+
// Files with issues
|
|
20
|
+
const filesWithIssues = report.files.filter(f => f.issues.length > 0 || !f.parsed);
|
|
21
|
+
if (filesWithIssues.length === 0) {
|
|
22
|
+
lines.push(chalk_1.default.green('✓ No issues found!'));
|
|
23
|
+
lines.push('');
|
|
24
|
+
return lines.join('\n');
|
|
25
|
+
}
|
|
26
|
+
// Group issues by file
|
|
27
|
+
for (const file of filesWithIssues) {
|
|
28
|
+
// File header
|
|
29
|
+
lines.push(chalk_1.default.underline(file.relativePath));
|
|
30
|
+
// Parse errors
|
|
31
|
+
if (!file.parsed) {
|
|
32
|
+
lines.push(formatIssue({
|
|
33
|
+
line: 1,
|
|
34
|
+
message: file.parseError ?? 'Failed to parse file',
|
|
35
|
+
ruleId: 'PARSE-ERROR',
|
|
36
|
+
severity: 'error',
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
// Issues
|
|
40
|
+
for (const issue of file.issues) {
|
|
41
|
+
lines.push(formatIssue(issue));
|
|
42
|
+
}
|
|
43
|
+
lines.push('');
|
|
44
|
+
}
|
|
45
|
+
// Summary
|
|
46
|
+
lines.push(chalk_1.default.bold('Summary:'));
|
|
47
|
+
lines.push(formatSummaryLine('error', report.summary.bySeverity.error));
|
|
48
|
+
lines.push(formatSummaryLine('warning', report.summary.bySeverity.warning));
|
|
49
|
+
lines.push(formatSummaryLine('info', report.summary.bySeverity.info));
|
|
50
|
+
lines.push('');
|
|
51
|
+
return lines.join('\n');
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Format a single issue line
|
|
55
|
+
*/
|
|
56
|
+
function formatIssue(issue) {
|
|
57
|
+
const severity = formatSeverity(issue.severity);
|
|
58
|
+
const location = chalk_1.default.gray(`${issue.line}:${issue.column ?? 0}`);
|
|
59
|
+
const ruleId = chalk_1.default.gray(`(${issue.ruleId})`);
|
|
60
|
+
const message = issue.message;
|
|
61
|
+
return ` ${location.padEnd(12)} ${severity} ${message} ${ruleId}`;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Format severity with color
|
|
65
|
+
*/
|
|
66
|
+
function formatSeverity(severity) {
|
|
67
|
+
switch (severity) {
|
|
68
|
+
case 'error':
|
|
69
|
+
return chalk_1.default.red('error ');
|
|
70
|
+
case 'warning':
|
|
71
|
+
return chalk_1.default.yellow('warning');
|
|
72
|
+
case 'info':
|
|
73
|
+
return chalk_1.default.blue('info ');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Format summary line
|
|
78
|
+
*/
|
|
79
|
+
function formatSummaryLine(severity, count) {
|
|
80
|
+
const label = severity.charAt(0).toUpperCase() + severity.slice(1) + 's:';
|
|
81
|
+
const value = count.toString();
|
|
82
|
+
const color = severity === 'error' ? chalk_1.default.red : severity === 'warning' ? chalk_1.default.yellow : chalk_1.default.blue;
|
|
83
|
+
return ` ${label.padEnd(10)} ${color(value)}`;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get exit code based on report
|
|
87
|
+
*/
|
|
88
|
+
function getExitCode(report, failOnWarning = false) {
|
|
89
|
+
if (report.summary.bySeverity.error > 0) {
|
|
90
|
+
return 1;
|
|
91
|
+
}
|
|
92
|
+
if (failOnWarning && report.summary.bySeverity.warning > 0) {
|
|
93
|
+
return 1;
|
|
94
|
+
}
|
|
95
|
+
if (report.summary.parseErrors > 0) {
|
|
96
|
+
return 3;
|
|
97
|
+
}
|
|
98
|
+
return 0;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=TableFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableFormatter.js","sourceRoot":"","sources":["../../../src/formatters/TableFormatter.ts"],"names":[],"mappings":";;;;;AAOA,kCAiDC;AA0CD,kCAWC;AA7GD,kDAA0B;AAI1B;;GAEG;AACH,SAAgB,WAAW,CAAC,MAAkB;IAC1C,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,SAAS;IACT,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,eAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,C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from './JsonFormatter';
|
|
3
|
+
export * from './SarifFormatter';
|
|
4
|
+
import { LintReport } from '../types/Report';
|
|
5
|
+
import { FormatterType } from '../types/Config';
|
|
6
|
+
/**
|
|
7
|
+
* Format a lint report using the specified formatter
|
|
8
|
+
*/
|
|
9
|
+
export declare function format(report: LintReport, type: FormatterType): string;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/formatters/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAMhD;;GAEG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,GAAG,MAAM,CAatE"}
|