@codacy/tools-revive-1 0.4.8 → 0.4.10

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
@@ -993,7 +993,7 @@ var descriptor = {
993
993
  preferredVersion: "1.12.0",
994
994
  languages: ["Go"],
995
995
  filePatterns: ["**/*.go"],
996
- supportedOS: ["linux", "darwin"],
996
+ supportedOS: ["linux", "darwin", "win32"],
997
997
  supportedArch: ["x64", "arm64"],
998
998
  supportedRunners: ["local", "container"]
999
999
  };
@@ -1018,7 +1018,10 @@ var PLATFORM_MAP = {
1018
1018
  "darwin-arm64": "darwin_arm64",
1019
1019
  "darwin-x64": "darwin_amd64",
1020
1020
  "linux-x64": "linux_amd64",
1021
- "linux-arm64": "linux_arm64"
1021
+ "linux-arm64": "linux_arm64",
1022
+ // Windows ships `revive_windows_amd64.tar.gz` with `revive.exe` at the top
1023
+ // level. Requires the Go runtime (also Windows-aware) for type-checked rules.
1024
+ "win32-x64": "windows_amd64"
1022
1025
  };
1023
1026
  async function getVersionFromBinary(binaryPath) {
1024
1027
  try {
@@ -1033,7 +1036,7 @@ async function getVersionFromBinary(binaryPath) {
1033
1036
  }
1034
1037
  }
1035
1038
  async function resolveBinaryPath(ctx) {
1036
- const codacyBin = import_path.default.join(ctx.toolInstallDir, BINARY);
1039
+ const codacyBin = import_path.default.join(ctx.toolInstallDir, (0, import_tooling.exeName)(BINARY));
1037
1040
  const version = await getVersionFromBinary(codacyBin);
1038
1041
  if (version) return codacyBin;
1039
1042
  return BINARY;
@@ -1081,7 +1084,7 @@ var adapter = {
1081
1084
  ctx.logger.debug("Checking availability", { toolId: TOOL_ID });
1082
1085
  const goInfo = await (0, import_tooling.findGo)(">=1.21", ctx.logger);
1083
1086
  const goDep = goInfo ? { name: "go", version: goInfo.version, path: goInfo.path, available: true } : { name: "go", available: false, reason: "Go not found; type-checked rules may not work" };
1084
- const codacyBin = import_path.default.join(ctx.toolInstallDir, BINARY);
1087
+ const codacyBin = import_path.default.join(ctx.toolInstallDir, (0, import_tooling.exeName)(BINARY));
1085
1088
  const codacyVersion = await getVersionFromBinary(codacyBin);
1086
1089
  if (codacyVersion) {
1087
1090
  ctx.logger.debug("Found codacy-managed binary", {
@@ -1147,8 +1150,8 @@ var adapter = {
1147
1150
  ctx.logger.info(`Downloading revive v${version} for ${platformKey}...`);
1148
1151
  await import_promises.default.mkdir(destDir, { recursive: true });
1149
1152
  await (0, import_tooling.downloadAndExtract)(url, destDir, void 0, ctx.logger);
1150
- const destPath = import_path.default.join(destDir, BINARY);
1151
- await import_promises.default.chmod(destPath, 493);
1153
+ const destPath = import_path.default.join(destDir, (0, import_tooling.exeName)(BINARY));
1154
+ if (!import_tooling.IS_WINDOWS) await import_promises.default.chmod(destPath, 493);
1152
1155
  ctx.logger.info(`Installed revive v${version} to ${destPath}`);
1153
1156
  } catch (err) {
1154
1157
  return {
@@ -1176,7 +1179,7 @@ var adapter = {
1176
1179
  }
1177
1180
  return {
1178
1181
  success: true,
1179
- installedPath: import_path.default.join(destDir, BINARY),
1182
+ installedPath: import_path.default.join(destDir, (0, import_tooling.exeName)(BINARY)),
1180
1183
  installedVersion: version
1181
1184
  };
1182
1185
  },
@@ -1254,7 +1257,7 @@ var adapter = {
1254
1257
  if (configPath) {
1255
1258
  args.push("-config", configPath);
1256
1259
  }
1257
- args.push(...absoluteFiles);
1260
+ const fileChunks = (0, import_tooling.chunkFilesForArgv)(absoluteFiles);
1258
1261
  try {
1259
1262
  const spawnOpts = {
1260
1263
  cwd: ctx.repositoryRoot,
@@ -1263,32 +1266,61 @@ var adapter = {
1263
1266
  if (goEnv) {
1264
1267
  spawnOpts.env = goEnv;
1265
1268
  }
1266
- const { stdout, stderr, exitCode } = await (0, import_tooling.spawnTool)(binary, args, spawnOpts);
1267
- if (exitCode >= 2) {
1268
- errors.push({
1269
- toolId: TOOL_ID,
1270
- phase: "toolInvoke",
1271
- kind: "NonZeroExit",
1272
- message: `revive exited with code ${exitCode}${stderr ? `: ${stderr.trim()}` : ""}`,
1273
- level: "error"
1274
- });
1275
- return (0, import_tooling.buildResult)(TOOL_ID, startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
1276
- }
1277
- if (!stdout.trim()) {
1278
- return (0, import_tooling.buildResult)(TOOL_ID, startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
1279
- }
1280
- let findings;
1281
- try {
1282
- findings = JSON.parse(stdout);
1283
- } catch (err) {
1284
- errors.push({
1285
- toolId: TOOL_ID,
1286
- phase: "outputParse",
1287
- kind: "MalformedOutput",
1288
- message: `Failed to parse revive JSON output: ${err instanceof Error ? err.message : String(err)}`,
1289
- level: "error"
1290
- });
1291
- return (0, import_tooling.buildResult)(TOOL_ID, startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
1269
+ const findings = [];
1270
+ for (const chunk of fileChunks) {
1271
+ const { stdout, stderr, exitCode } = await (0, import_tooling.spawnTool)(
1272
+ binary,
1273
+ [...args, ...chunk],
1274
+ spawnOpts
1275
+ );
1276
+ if (exitCode >= 2) {
1277
+ errors.push({
1278
+ toolId: TOOL_ID,
1279
+ phase: "toolInvoke",
1280
+ kind: "NonZeroExit",
1281
+ message: `revive exited with code ${exitCode}${stderr ? `: ${stderr.trim()}` : ""}`,
1282
+ level: "error"
1283
+ });
1284
+ return (0, import_tooling.buildResult)(
1285
+ TOOL_ID,
1286
+ startedAt,
1287
+ /* @__PURE__ */ new Date(),
1288
+ issues,
1289
+ errors,
1290
+ ctx.targetFiles.length
1291
+ );
1292
+ }
1293
+ if (stderr.trim()) {
1294
+ errors.push({
1295
+ toolId: TOOL_ID,
1296
+ phase: "outputParse",
1297
+ kind: "ParseWarning",
1298
+ message: `revive stderr: ${stderr.trim()}`,
1299
+ level: "warning"
1300
+ });
1301
+ }
1302
+ if (!stdout.trim()) continue;
1303
+ let chunkFindings;
1304
+ try {
1305
+ chunkFindings = JSON.parse(stdout);
1306
+ } catch (err) {
1307
+ errors.push({
1308
+ toolId: TOOL_ID,
1309
+ phase: "outputParse",
1310
+ kind: "MalformedOutput",
1311
+ message: `Failed to parse revive JSON output: ${err instanceof Error ? err.message : String(err)}`,
1312
+ level: "error"
1313
+ });
1314
+ return (0, import_tooling.buildResult)(
1315
+ TOOL_ID,
1316
+ startedAt,
1317
+ /* @__PURE__ */ new Date(),
1318
+ issues,
1319
+ errors,
1320
+ ctx.targetFiles.length
1321
+ );
1322
+ }
1323
+ findings.push(...chunkFindings);
1292
1324
  }
1293
1325
  const enabledPatterns = new Set(codacyConfig.patterns.map((p) => p.patternId));
1294
1326
  const findingsByFile = /* @__PURE__ */ new Map();
@@ -1328,15 +1360,6 @@ var adapter = {
1328
1360
  });
1329
1361
  }
1330
1362
  }
1331
- if (stderr.trim()) {
1332
- errors.push({
1333
- toolId: TOOL_ID,
1334
- phase: "outputParse",
1335
- kind: "ParseWarning",
1336
- message: `revive stderr: ${stderr.trim()}`,
1337
- level: "warning"
1338
- });
1339
- }
1340
1363
  } catch (err) {
1341
1364
  errors.push({
1342
1365
  toolId: TOOL_ID,
package/dist/metadata.js CHANGED
@@ -29,7 +29,7 @@ var descriptor = {
29
29
  preferredVersion: "1.12.0",
30
30
  languages: ["Go"],
31
31
  filePatterns: ["**/*.go"],
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-revive-1",
3
- "version": "0.4.8",
3
+ "version": "0.4.10",
4
4
  "description": "Revive adapter — CLI-mode Go linter",
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.13.0"
11
+ "@codacy/tooling": "0.15.0"
12
12
  },
13
13
  "license": "MIT",
14
14
  "author": "Codacy <support@codacy.com> (https://www.codacy.com)",