@codacy/tools-reek-6 0.3.8 → 0.3.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 +80 -53
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -656,7 +656,7 @@ var adapter = {
|
|
|
656
656
|
return {
|
|
657
657
|
available: false,
|
|
658
658
|
reason: "Ruby runtime not found (required for Reek)",
|
|
659
|
-
installHint:
|
|
659
|
+
installHint: (0, import_tooling.rubyInstallHint)(),
|
|
660
660
|
dependencies
|
|
661
661
|
};
|
|
662
662
|
}
|
|
@@ -718,7 +718,7 @@ var adapter = {
|
|
|
718
718
|
toolId: TOOL_ID,
|
|
719
719
|
phase: "requirementCheck",
|
|
720
720
|
kind: "MissingPrerequisite",
|
|
721
|
-
message:
|
|
721
|
+
message: (0, import_tooling.rubyUnavailableMessage)("Reek", RUBY_VERSION_RANGE),
|
|
722
722
|
level: "error"
|
|
723
723
|
}
|
|
724
724
|
};
|
|
@@ -804,50 +804,87 @@ var adapter = {
|
|
|
804
804
|
args.push("--config", generatedConfigPath);
|
|
805
805
|
}
|
|
806
806
|
}
|
|
807
|
-
|
|
807
|
+
const fileChunks = (0, import_tooling.chunkFilesForArgv)(absoluteFiles);
|
|
808
808
|
try {
|
|
809
809
|
const gemPaths = (0, import_tooling.getGemPaths)(ctx.globalDir, ADAPTER_ID);
|
|
810
810
|
const env = (0, import_tooling.buildGemEnv)(gemPaths, invocation.rubyPath);
|
|
811
|
-
const
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
811
|
+
const smells = [];
|
|
812
|
+
for (const chunk of fileChunks) {
|
|
813
|
+
const { stdout, stderr, exitCode } = await (0, import_tooling.spawnTool)(
|
|
814
|
+
invocation.binary,
|
|
815
|
+
[...args, ...chunk],
|
|
816
|
+
{
|
|
817
|
+
cwd: ctx.repositoryRoot,
|
|
818
|
+
env,
|
|
819
|
+
logger: ctx.logger
|
|
820
|
+
}
|
|
821
|
+
);
|
|
822
|
+
if (exitCode !== 0 && exitCode !== 2) {
|
|
823
|
+
errors.push({
|
|
824
|
+
toolId: TOOL_ID,
|
|
825
|
+
phase: "toolInvoke",
|
|
826
|
+
kind: "NonZeroExit",
|
|
827
|
+
message: `Reek exited with code ${exitCode}${stderr ? `: ${stderr.trim()}` : ""}`,
|
|
828
|
+
level: "error"
|
|
829
|
+
});
|
|
830
|
+
return (0, import_tooling.buildResult)(
|
|
831
|
+
TOOL_ID,
|
|
832
|
+
startedAt,
|
|
833
|
+
/* @__PURE__ */ new Date(),
|
|
834
|
+
issues,
|
|
835
|
+
errors,
|
|
836
|
+
ctx.targetFiles.length
|
|
837
|
+
);
|
|
838
|
+
}
|
|
839
|
+
const stderrFiltered = stderr.split("\n").filter((l) => l.trim()).join("\n").trim();
|
|
840
|
+
if (stderrFiltered) {
|
|
841
|
+
errors.push({
|
|
842
|
+
toolId: TOOL_ID,
|
|
843
|
+
phase: "outputParse",
|
|
844
|
+
kind: "ParseWarning",
|
|
845
|
+
message: `Reek stderr: ${stderrFiltered}`,
|
|
846
|
+
level: "warning"
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
if (!stdout.trim()) continue;
|
|
850
|
+
let chunkSmells;
|
|
851
|
+
try {
|
|
852
|
+
chunkSmells = JSON.parse(stdout);
|
|
853
|
+
} catch (err) {
|
|
854
|
+
errors.push({
|
|
855
|
+
toolId: TOOL_ID,
|
|
856
|
+
phase: "outputParse",
|
|
857
|
+
kind: "MalformedOutput",
|
|
858
|
+
message: `Failed to parse Reek JSON output: ${err instanceof Error ? err.message : String(err)}`,
|
|
859
|
+
level: "error"
|
|
860
|
+
});
|
|
861
|
+
return (0, import_tooling.buildResult)(
|
|
862
|
+
TOOL_ID,
|
|
863
|
+
startedAt,
|
|
864
|
+
/* @__PURE__ */ new Date(),
|
|
865
|
+
issues,
|
|
866
|
+
errors,
|
|
867
|
+
ctx.targetFiles.length
|
|
868
|
+
);
|
|
869
|
+
}
|
|
870
|
+
if (!Array.isArray(chunkSmells)) {
|
|
871
|
+
errors.push({
|
|
872
|
+
toolId: TOOL_ID,
|
|
873
|
+
phase: "outputParse",
|
|
874
|
+
kind: "MalformedOutput",
|
|
875
|
+
message: "Reek output is not a JSON array",
|
|
876
|
+
level: "error"
|
|
877
|
+
});
|
|
878
|
+
return (0, import_tooling.buildResult)(
|
|
879
|
+
TOOL_ID,
|
|
880
|
+
startedAt,
|
|
881
|
+
/* @__PURE__ */ new Date(),
|
|
882
|
+
issues,
|
|
883
|
+
errors,
|
|
884
|
+
ctx.targetFiles.length
|
|
885
|
+
);
|
|
886
|
+
}
|
|
887
|
+
smells.push(...chunkSmells);
|
|
851
888
|
}
|
|
852
889
|
const enabledPatterns = new Set(codacyConfig.patterns.map((p) => p.patternId));
|
|
853
890
|
const fileLineCache = /* @__PURE__ */ new Map();
|
|
@@ -880,16 +917,6 @@ var adapter = {
|
|
|
880
917
|
severity: meta.severity
|
|
881
918
|
});
|
|
882
919
|
}
|
|
883
|
-
const stderrFiltered = stderr.split("\n").filter((l) => l.trim()).join("\n").trim();
|
|
884
|
-
if (stderrFiltered) {
|
|
885
|
-
errors.push({
|
|
886
|
-
toolId: TOOL_ID,
|
|
887
|
-
phase: "outputParse",
|
|
888
|
-
kind: "ParseWarning",
|
|
889
|
-
message: `Reek stderr: ${stderrFiltered}`,
|
|
890
|
-
level: "warning"
|
|
891
|
-
});
|
|
892
|
-
}
|
|
893
920
|
} catch (invokeErr) {
|
|
894
921
|
errors.push({
|
|
895
922
|
toolId: TOOL_ID,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codacy/tools-reek-6",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"description": "Reek adapter — CLI-mode Ruby code smell detector",
|
|
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.
|
|
11
|
+
"@codacy/tooling": "0.15.0"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"author": "Codacy <support@codacy.com> (https://www.codacy.com)",
|