@codacy/analysis-runner 0.5.0 → 0.6.1
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.d.ts +1 -1
- package/dist/index.js +15 -8
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ interface AnalyzeOptions {
|
|
|
27
27
|
outputFormat?: OutputFormat;
|
|
28
28
|
/** Execution mode. Defaults to "standard". */
|
|
29
29
|
mode?: ExecutionMode;
|
|
30
|
-
/** Maximum time in ms for each tool invocation. Defaults to
|
|
30
|
+
/** Maximum time in ms for each tool invocation. Defaults to 600000 (10 minutes). */
|
|
31
31
|
toolTimeout?: number;
|
|
32
32
|
/** Maximum number of tools to run in parallel. 1 = sequential. Defaults to 1. */
|
|
33
33
|
parallelTools?: number;
|
package/dist/index.js
CHANGED
|
@@ -67,6 +67,7 @@ var import_os = __toESM(require("os"));
|
|
|
67
67
|
var import_path3 = __toESM(require("path"));
|
|
68
68
|
var import_child_process2 = require("child_process");
|
|
69
69
|
var import_util = require("util");
|
|
70
|
+
var import_tooling3 = require("@codacy/tooling");
|
|
70
71
|
|
|
71
72
|
// src/registry.ts
|
|
72
73
|
var import_tooling = require("@codacy/tooling");
|
|
@@ -360,6 +361,7 @@ function filterByTargetFiles(allFiles, targetPatterns) {
|
|
|
360
361
|
}
|
|
361
362
|
|
|
362
363
|
// src/executor.ts
|
|
364
|
+
var import_tooling2 = require("@codacy/tooling");
|
|
363
365
|
async function runTool(adapter, ctx, codacyToolConfig, timeoutMs) {
|
|
364
366
|
const startTime = Date.now();
|
|
365
367
|
ctx.logger.debug("runTool started", {
|
|
@@ -370,7 +372,7 @@ async function runTool(adapter, ctx, codacyToolConfig, timeoutMs) {
|
|
|
370
372
|
try {
|
|
371
373
|
const timeoutPromise = new Promise((_resolve, reject) => {
|
|
372
374
|
setTimeout(
|
|
373
|
-
() => reject(new Error(`TIMEOUT: Tool ${adapter.id} exceeded ${timeoutMs}
|
|
375
|
+
() => reject(new Error(`TIMEOUT: Tool ${adapter.id} exceeded ${(0, import_tooling2.formatDuration)(timeoutMs)}`)),
|
|
374
376
|
timeoutMs
|
|
375
377
|
);
|
|
376
378
|
});
|
|
@@ -406,7 +408,7 @@ async function runTool(adapter, ctx, codacyToolConfig, timeoutMs) {
|
|
|
406
408
|
toolId: adapter.id,
|
|
407
409
|
phase: "toolInvoke",
|
|
408
410
|
kind: isTimeout ? "Timeout" : "InvocationError",
|
|
409
|
-
message: isTimeout ? `Tool ${adapter.id} exceeded timeout of ${timeoutMs}
|
|
411
|
+
message: isTimeout ? `Tool ${adapter.id} exceeded timeout of ${(0, import_tooling2.formatDuration)(timeoutMs)}` : `Tool ${adapter.id} failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
410
412
|
level: "error"
|
|
411
413
|
}
|
|
412
414
|
],
|
|
@@ -473,7 +475,7 @@ var nullLogger = {
|
|
|
473
475
|
async function analyze(options) {
|
|
474
476
|
const startedAt = /* @__PURE__ */ new Date();
|
|
475
477
|
const mode = options.mode || "standard";
|
|
476
|
-
const toolTimeout = options.toolTimeout ||
|
|
478
|
+
const toolTimeout = options.toolTimeout || 6e5;
|
|
477
479
|
const parallelTools = options.parallelTools || 1;
|
|
478
480
|
const logger = options.logger ?? nullLogger;
|
|
479
481
|
const emptyCapability = {
|
|
@@ -563,7 +565,11 @@ async function analyze(options) {
|
|
|
563
565
|
adapter.checkAvailability(ctx),
|
|
564
566
|
new Promise(
|
|
565
567
|
(_, reject) => setTimeout(
|
|
566
|
-
() => reject(
|
|
568
|
+
() => reject(
|
|
569
|
+
new Error(
|
|
570
|
+
`checkAvailability timed out after ${(0, import_tooling3.formatDuration)(availabilityTimeout)}`
|
|
571
|
+
)
|
|
572
|
+
),
|
|
567
573
|
availabilityTimeout
|
|
568
574
|
)
|
|
569
575
|
)
|
|
@@ -882,6 +888,7 @@ function buildResult(startedAt, repositoryRoot, mode, capability, issues, errors
|
|
|
882
888
|
|
|
883
889
|
// src/format.ts
|
|
884
890
|
var import_path4 = __toESM(require("path"));
|
|
891
|
+
var import_tooling4 = require("@codacy/tooling");
|
|
885
892
|
var import_ansis = __toESM(require("ansis"));
|
|
886
893
|
var import_cli_table3 = __toESM(require("cli-table3"));
|
|
887
894
|
function formatOutput(result, format) {
|
|
@@ -1063,7 +1070,7 @@ function formatTextSummary(result, isInspect) {
|
|
|
1063
1070
|
} else {
|
|
1064
1071
|
const headerLine = `Analysis complete: ${totalIssues} issue${totalIssues !== 1 ? "s" : ""} found`;
|
|
1065
1072
|
lines.push(totalIssues > 0 ? import_ansis.default.bold.red(headerLine) : import_ansis.default.bold(headerLine));
|
|
1066
|
-
lines.push(`${toolCount} tool${toolCount !== 1 ? "s" : ""} ran in ${duration}
|
|
1073
|
+
lines.push(`${toolCount} tool${toolCount !== 1 ? "s" : ""} ran in ${(0, import_tooling4.formatDuration)(duration)}`);
|
|
1067
1074
|
}
|
|
1068
1075
|
if (totalErrors > 0) {
|
|
1069
1076
|
lines.push(import_ansis.default.red(`${totalErrors} error${totalErrors !== 1 ? "s" : ""} occurred`));
|
|
@@ -1124,7 +1131,7 @@ function formatTextSummary(result, isInspect) {
|
|
|
1124
1131
|
formatConfigCell(tool, result.metadata.repositoryRoot),
|
|
1125
1132
|
filesCell,
|
|
1126
1133
|
issueCount > 0 ? import_ansis.default.bold.red(String(issueCount)) : String(issueCount),
|
|
1127
|
-
|
|
1134
|
+
(0, import_tooling4.formatDuration)(durationMs)
|
|
1128
1135
|
]);
|
|
1129
1136
|
}
|
|
1130
1137
|
for (const tool of unavailableTools) {
|
|
@@ -1239,7 +1246,7 @@ function colorSeverity(severity) {
|
|
|
1239
1246
|
var import_promises3 = __toESM(require("fs/promises"));
|
|
1240
1247
|
var import_path6 = __toESM(require("path"));
|
|
1241
1248
|
var import_child_process3 = require("child_process");
|
|
1242
|
-
var
|
|
1249
|
+
var import_tooling5 = require("@codacy/tooling");
|
|
1243
1250
|
|
|
1244
1251
|
// src/codacy-yaml.ts
|
|
1245
1252
|
var import_promises2 = __toESM(require("fs/promises"));
|
|
@@ -4874,7 +4881,7 @@ async function detectLanguages(repositoryRoot) {
|
|
|
4874
4881
|
for (const file of files) {
|
|
4875
4882
|
const basename = import_path6.default.basename(file);
|
|
4876
4883
|
const ext = import_path6.default.extname(file).toLowerCase();
|
|
4877
|
-
for (const [lang, config] of Object.entries(
|
|
4884
|
+
for (const [lang, config] of Object.entries(import_tooling5.LANGUAGE_CONFIG)) {
|
|
4878
4885
|
if (config.extensions.includes(ext)) {
|
|
4879
4886
|
detected.add(lang);
|
|
4880
4887
|
} else if (config.files.includes(basename)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codacy/analysis-runner",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Core orchestration engine for Codacy analysis",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
"cli-table3": "^0.6",
|
|
13
13
|
"minimatch": "10.2.4",
|
|
14
14
|
"yaml": "^2.6.0",
|
|
15
|
-
"@codacy/tooling": "0.
|
|
15
|
+
"@codacy/tooling": "0.6.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@codacy/openapi-typescript-codegen": "0.0.9",
|
|
19
|
-
"@codacy/tools-dummy-1": "0.
|
|
19
|
+
"@codacy/tools-dummy-1": "0.6.1"
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"author": "Codacy <support@codacy.com> (https://www.codacy.com)",
|