@codacy/tools-flawfinder-2 0.14.0 → 0.15.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/dist/index.js CHANGED
@@ -2062,7 +2062,7 @@ var descriptor = {
2062
2062
  preferredVersion: "2.0.19",
2063
2063
  languages: ["C", "CPP"],
2064
2064
  filePatterns: ["**/*.c", "**/*.h", "**/*.cpp", "**/*.cc", "**/*.cxx", "**/*.hpp"],
2065
- supportedOS: ["linux", "darwin"],
2065
+ supportedOS: ["linux", "darwin", "win32"],
2066
2066
  supportedArch: ["x64", "arm64"],
2067
2067
  supportedRunners: ["local", "container"]
2068
2068
  };
@@ -2103,7 +2103,7 @@ async function getVersionFromBinary(binaryPath) {
2103
2103
  }
2104
2104
  async function resolveBinaryPath(ctx) {
2105
2105
  const venvDir = (0, import_tooling.getVenvDir)(ctx.globalDir, adapter.id);
2106
- const venvBin = import_path.default.join(venvDir, "bin", BINARY);
2106
+ const venvBin = (0, import_tooling.resolveVenvBinary)((0, import_tooling.getVenvPaths)(venvDir), BINARY);
2107
2107
  const venvVersion = await getVersionFromBinary(venvBin);
2108
2108
  if (venvVersion) return venvBin;
2109
2109
  return BINARY;
@@ -2143,7 +2143,7 @@ var adapter = {
2143
2143
  }
2144
2144
  ] : [{ name: "Python", available: false, reason: "Python 3 not found" }];
2145
2145
  const venvDir = (0, import_tooling.getVenvDir)(ctx.globalDir, adapter.id);
2146
- const venvBinPath = import_path.default.join(venvDir, "bin", BINARY);
2146
+ const venvBinPath = (0, import_tooling.resolveVenvBinary)((0, import_tooling.getVenvPaths)(venvDir), BINARY);
2147
2147
  const venvVersion = await getVersionFromBinary(venvBinPath);
2148
2148
  if (venvVersion) {
2149
2149
  ctx.logger.debug("Found flawfinder in codacy venv", {
@@ -2279,44 +2279,71 @@ var adapter = {
2279
2279
  }
2280
2280
  const binary = await resolveBinaryPath(ctx);
2281
2281
  const absoluteFiles = ctx.targetFiles.map((f) => import_path.default.resolve(ctx.repositoryRoot, f));
2282
- const args = ["--sarif", "--falsepositive", ...absoluteFiles];
2282
+ const args = ["--sarif", "--falsepositive"];
2283
+ const fileChunks = (0, import_tooling.chunkFilesForArgv)(absoluteFiles);
2283
2284
  try {
2284
- const { stdout, stderr, exitCode } = await (0, import_tooling.spawnTool)(binary, args, {
2285
- cwd: ctx.repositoryRoot,
2286
- logger: ctx.logger
2287
- });
2288
- if (exitCode !== 0) {
2289
- errors.push({
2290
- toolId: TOOL_ID,
2291
- phase: "toolInvoke",
2292
- kind: "NonZeroExit",
2293
- message: `flawfinder exited with code ${exitCode}${stderr ? `: ${stderr.trim()}` : ""}`,
2294
- level: "error"
2295
- });
2296
- return (0, import_tooling.buildResult)(TOOL_ID, startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
2297
- }
2298
- if (!stdout.trim()) {
2299
- return (0, import_tooling.buildResult)(TOOL_ID, startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
2300
- }
2301
- let sarif;
2302
- try {
2303
- sarif = JSON.parse(stdout);
2304
- } catch (err) {
2305
- errors.push({
2306
- toolId: TOOL_ID,
2307
- phase: "outputParse",
2308
- kind: "MalformedOutput",
2309
- message: `Failed to parse flawfinder SARIF output: ${err instanceof Error ? err.message : String(err)}`,
2310
- level: "error"
2311
- });
2312
- return (0, import_tooling.buildResult)(TOOL_ID, startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
2313
- }
2314
- const run = sarif.runs?.[0];
2315
- const results = run?.results ?? [];
2285
+ const results = [];
2316
2286
  const ruleIdToFunctionName = /* @__PURE__ */ new Map();
2317
- for (const rule of run?.tool?.driver?.rules ?? []) {
2318
- if (rule.id && rule.name) {
2319
- ruleIdToFunctionName.set(rule.id, extractFunctionName(rule.name));
2287
+ for (const chunk of fileChunks) {
2288
+ const { stdout, stderr, exitCode } = await (0, import_tooling.spawnTool)(binary, [...args, ...chunk], {
2289
+ cwd: ctx.repositoryRoot,
2290
+ logger: ctx.logger
2291
+ });
2292
+ if (exitCode !== 0) {
2293
+ errors.push({
2294
+ toolId: TOOL_ID,
2295
+ phase: "toolInvoke",
2296
+ kind: "NonZeroExit",
2297
+ message: `flawfinder exited with code ${exitCode}${stderr ? `: ${stderr.trim()}` : ""}`,
2298
+ level: "error"
2299
+ });
2300
+ return (0, import_tooling.buildResult)(
2301
+ TOOL_ID,
2302
+ startedAt,
2303
+ /* @__PURE__ */ new Date(),
2304
+ issues,
2305
+ errors,
2306
+ ctx.targetFiles.length
2307
+ );
2308
+ }
2309
+ if (stderr.trim()) {
2310
+ errors.push({
2311
+ toolId: TOOL_ID,
2312
+ phase: "outputParse",
2313
+ kind: "ParseWarning",
2314
+ message: `flawfinder stderr: ${stderr.trim()}`,
2315
+ level: "warning"
2316
+ });
2317
+ }
2318
+ if (!stdout.trim()) continue;
2319
+ let sarif;
2320
+ try {
2321
+ sarif = JSON.parse(stdout);
2322
+ } catch (err) {
2323
+ errors.push({
2324
+ toolId: TOOL_ID,
2325
+ phase: "outputParse",
2326
+ kind: "MalformedOutput",
2327
+ message: `Failed to parse flawfinder SARIF output: ${err instanceof Error ? err.message : String(err)}`,
2328
+ level: "error"
2329
+ });
2330
+ return (0, import_tooling.buildResult)(
2331
+ TOOL_ID,
2332
+ startedAt,
2333
+ /* @__PURE__ */ new Date(),
2334
+ issues,
2335
+ errors,
2336
+ ctx.targetFiles.length
2337
+ );
2338
+ }
2339
+ const run = sarif.runs?.[0];
2340
+ for (const result2 of run?.results ?? []) {
2341
+ results.push(result2);
2342
+ }
2343
+ for (const rule of run?.tool?.driver?.rules ?? []) {
2344
+ if (rule.id && rule.name) {
2345
+ ruleIdToFunctionName.set(rule.id, extractFunctionName(rule.name));
2346
+ }
2320
2347
  }
2321
2348
  }
2322
2349
  const enabledPatterns = new Set(codacyConfig.patterns.map((p) => p.patternId));
@@ -2356,15 +2383,6 @@ var adapter = {
2356
2383
  });
2357
2384
  }
2358
2385
  }
2359
- if (stderr.trim()) {
2360
- errors.push({
2361
- toolId: TOOL_ID,
2362
- phase: "outputParse",
2363
- kind: "ParseWarning",
2364
- message: `flawfinder stderr: ${stderr.trim()}`,
2365
- level: "warning"
2366
- });
2367
- }
2368
2386
  } catch (err) {
2369
2387
  errors.push({
2370
2388
  toolId: TOOL_ID,
package/dist/metadata.js CHANGED
@@ -29,7 +29,7 @@ var descriptor = {
29
29
  preferredVersion: "2.0.19",
30
30
  languages: ["C", "CPP"],
31
31
  filePatterns: ["**/*.c", "**/*.h", "**/*.cpp", "**/*.cc", "**/*.cxx", "**/*.hpp"],
32
- supportedOS: ["linux", "darwin"],
32
+ supportedOS: ["linux", "darwin", "win32"],
33
33
  supportedArch: ["x64", "arm64"],
34
34
  supportedRunners: ["local", "container"]
35
35
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/tools-flawfinder-2",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "Flawfinder adapter — CLI-mode C/C++ security analyzer",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "dist"
9
9
  ],
10
10
  "dependencies": {
11
- "@codacy/tooling": "0.14.0"
11
+ "@codacy/tooling": "0.15.0"
12
12
  },
13
13
  "license": "MIT",
14
14
  "author": "Codacy <support@codacy.com> (https://www.codacy.com)",