flowlint 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/cli.js +53 -8
- package/dist/cli.js.map +1 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# FlowLint CLI
|
|
2
2
|
|
|
3
|
+

|
|
4
|
+
|
|
3
5
|
Command-line tool for static analysis of n8n workflows.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
@@ -43,6 +45,14 @@ flowlint init
|
|
|
43
45
|
|
|
44
46
|
Creates a `.flowlint.yml` file in the current directory.
|
|
45
47
|
|
|
48
|
+
## Testing
|
|
49
|
+
|
|
50
|
+
Run tests with coverage reporting:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm run test:coverage
|
|
54
|
+
```
|
|
55
|
+
|
|
46
56
|
## Configuration
|
|
47
57
|
|
|
48
58
|
Create a `.flowlint.yml` file:
|
package/dist/cli.js
CHANGED
|
@@ -9,6 +9,10 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
9
9
|
var __commonJS = (cb, mod) => function __require2() {
|
|
10
10
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
11
|
};
|
|
12
|
+
var __export = (target, all) => {
|
|
13
|
+
for (var name in all)
|
|
14
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
+
};
|
|
12
16
|
var __copyProps = (to, from, except, desc) => {
|
|
13
17
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
18
|
for (let key of __getOwnPropNames(from))
|
|
@@ -25,6 +29,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
29
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
30
|
mod
|
|
27
31
|
));
|
|
32
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
33
|
|
|
29
34
|
// node_modules/commander/lib/error.js
|
|
30
35
|
var require_error = __commonJS({
|
|
@@ -17581,6 +17586,13 @@ var require_dist2 = __commonJS({
|
|
|
17581
17586
|
}
|
|
17582
17587
|
});
|
|
17583
17588
|
|
|
17589
|
+
// src/cli.ts
|
|
17590
|
+
var cli_exports = {};
|
|
17591
|
+
__export(cli_exports, {
|
|
17592
|
+
program: () => program2
|
|
17593
|
+
});
|
|
17594
|
+
module.exports = __toCommonJS(cli_exports);
|
|
17595
|
+
|
|
17584
17596
|
// node_modules/commander/esm.mjs
|
|
17585
17597
|
var import_index = __toESM(require_commander(), 1);
|
|
17586
17598
|
var {
|
|
@@ -23942,7 +23954,7 @@ function countFindingsBySeverity(findings) {
|
|
|
23942
23954
|
var path = __toESM(require("path"));
|
|
23943
23955
|
function formatJunit(findings) {
|
|
23944
23956
|
const byFile = findings.reduce((acc, finding) => {
|
|
23945
|
-
const file = finding.
|
|
23957
|
+
const file = finding.path || "unknown";
|
|
23946
23958
|
if (!acc[file]) acc[file] = [];
|
|
23947
23959
|
acc[file].push(finding);
|
|
23948
23960
|
return acc;
|
|
@@ -23954,8 +23966,8 @@ function formatJunit(findings) {
|
|
|
23954
23966
|
xml += ` <testsuite name="${filename}" tests="${failures}" failures="${failures}" errors="0" skipped="0" timestamp="${(/* @__PURE__ */ new Date()).toISOString()}" time="0" hostname="flowlint">
|
|
23955
23967
|
`;
|
|
23956
23968
|
for (const finding of fileFindings) {
|
|
23957
|
-
const line = finding.
|
|
23958
|
-
const rule = finding.
|
|
23969
|
+
const line = finding.line || 0;
|
|
23970
|
+
const rule = finding.rule || "unknown-rule";
|
|
23959
23971
|
const msg = finding.message || "";
|
|
23960
23972
|
xml += ` <testcase classname="${file}" name="${rule}" time="0">
|
|
23961
23973
|
`;
|
|
@@ -24051,8 +24063,31 @@ function formatJson(findings, stats) {
|
|
|
24051
24063
|
}, null, 2);
|
|
24052
24064
|
}
|
|
24053
24065
|
|
|
24066
|
+
// src/reporters/github-actions.ts
|
|
24067
|
+
function formatGithubActions(findings) {
|
|
24068
|
+
return findings.map((f) => {
|
|
24069
|
+
const level = mapSeverityToGithub(f.severity);
|
|
24070
|
+
const file = f.path ? `file=${f.path},` : "";
|
|
24071
|
+
const line = f.line ? `line=${f.line},` : "";
|
|
24072
|
+
const message = f.message.replaceAll("%", "%25").replaceAll("\r", "%0D").replaceAll("\n", "%0A");
|
|
24073
|
+
return `::${level} ${file}${line}::${message}`;
|
|
24074
|
+
}).join("\n");
|
|
24075
|
+
}
|
|
24076
|
+
function mapSeverityToGithub(severity) {
|
|
24077
|
+
switch (severity) {
|
|
24078
|
+
case "must":
|
|
24079
|
+
return "error";
|
|
24080
|
+
case "should":
|
|
24081
|
+
return "warning";
|
|
24082
|
+
case "nit":
|
|
24083
|
+
return "notice";
|
|
24084
|
+
default:
|
|
24085
|
+
return "warning";
|
|
24086
|
+
}
|
|
24087
|
+
}
|
|
24088
|
+
|
|
24054
24089
|
// src/commands/scan.ts
|
|
24055
|
-
var scanCommand = new Command("scan").description("Scan workflow files (directory or single file) for issues").argument("[path]", "Directory or workflow file to scan", ".").option("--config <path>", "Path to .flowlint.yml config file").option("--format <format>", "Output format: stylish|json|junit|sarif", "stylish").option("--fail-on-error", "Exit with code 1 if errors found", false).action(async (scanPath, options) => {
|
|
24090
|
+
var scanCommand = new Command("scan").description("Scan workflow files (directory or single file) for issues").argument("[path]", "Directory or workflow file to scan", ".").option("--config <path>", "Path to .flowlint.yml config file").option("--format <format>", "Output format: stylish|json|junit|sarif|github-actions", "stylish").option("--fail-on-error", "Exit with code 1 if errors found", false).action(async (scanPath, options) => {
|
|
24056
24091
|
try {
|
|
24057
24092
|
const absolutePath = path2.resolve(process.cwd(), scanPath);
|
|
24058
24093
|
const isStylish = options.format === "stylish";
|
|
@@ -24160,6 +24195,9 @@ var scanCommand = new Command("scan").description("Scan workflow files (director
|
|
|
24160
24195
|
case "sarif":
|
|
24161
24196
|
console.log(formatSarif(allFindings));
|
|
24162
24197
|
break;
|
|
24198
|
+
case "github-actions":
|
|
24199
|
+
console.log(formatGithubActions(allFindings));
|
|
24200
|
+
break;
|
|
24163
24201
|
case "stylish":
|
|
24164
24202
|
default:
|
|
24165
24203
|
const summary = countFindingsBySeverity(allFindings);
|
|
@@ -24209,12 +24247,19 @@ var initCommand = new Command("init").description("Initialize FlowLint configura
|
|
|
24209
24247
|
});
|
|
24210
24248
|
|
|
24211
24249
|
// src/cli.ts
|
|
24250
|
+
var import_meta = {};
|
|
24212
24251
|
var program2 = new Command();
|
|
24213
|
-
program2.name("flowlint").description("Static analysis tool for n8n workflows").version("0.8.
|
|
24252
|
+
program2.name("flowlint").description("Static analysis tool for n8n workflows").version("0.8.2");
|
|
24214
24253
|
program2.addCommand(scanCommand);
|
|
24215
24254
|
program2.addCommand(initCommand);
|
|
24216
|
-
|
|
24217
|
-
|
|
24218
|
-
|
|
24255
|
+
if (import_meta.url === `file://${process.argv[1]}`) {
|
|
24256
|
+
program2.parse(process.argv);
|
|
24257
|
+
if (!process.argv.slice(2).length) {
|
|
24258
|
+
program2.outputHelp();
|
|
24259
|
+
}
|
|
24219
24260
|
}
|
|
24261
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
24262
|
+
0 && (module.exports = {
|
|
24263
|
+
program
|
|
24264
|
+
});
|
|
24220
24265
|
//# sourceMappingURL=cli.js.map
|