@codacy/tools-reek-6 0.2.6 → 0.2.7

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.
Files changed (2) hide show
  1. package/dist/index.js +20 -0
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -567,6 +567,7 @@ var ADAPTER_ID = "reek-6";
567
567
  var REEK_VERSION = "6.5.0";
568
568
  var RUBY_VERSION_RANGE = ">=2.7.0";
569
569
  var CONFIG_FILE_CANDIDATES = [".reek.yml", "config.reek"];
570
+ var REEK_DEFAULT_OFF_DETECTORS = /* @__PURE__ */ new Set(["UnusedPrivateMethod"]);
570
571
  var PATTERN_META = new Map(
571
572
  patterns_default.map((p) => [
572
573
  p.id,
@@ -601,6 +602,20 @@ async function resolveToolInvocation(ctx) {
601
602
  }
602
603
  return { binary: "reek", prefixArgs: [], rubyPath: rubyInfo?.path };
603
604
  }
605
+ async function maybeMaterializeReekConfig(ctx, codacyConfig) {
606
+ const enabled = codacyConfig.patterns.map((p) => p.patternId).filter((id) => REEK_DEFAULT_OFF_DETECTORS.has(id));
607
+ if (enabled.length === 0) return void 0;
608
+ await import_promises.default.mkdir(ctx.generatedConfigDir, { recursive: true });
609
+ const configPath = import_path.default.join(ctx.generatedConfigDir, "reek.codacy.yml");
610
+ const lines = ["detectors:", ...enabled.flatMap((id) => [` ${id}:`, " enabled: true"])];
611
+ await import_promises.default.writeFile(configPath, lines.join("\n") + "\n", "utf8");
612
+ ctx.logger.debug("Wrote generated reek config to re-enable default-off detectors", {
613
+ toolId: TOOL_ID,
614
+ path: configPath,
615
+ detectors: enabled
616
+ });
617
+ return configPath;
618
+ }
604
619
  var adapter = {
605
620
  ...descriptor,
606
621
  compatibleVersions: ">=6.0.0",
@@ -782,6 +797,11 @@ var adapter = {
782
797
  toolId: TOOL_ID
783
798
  });
784
799
  return (0, import_tooling.buildResult)(TOOL_ID, startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
800
+ } else {
801
+ const generatedConfigPath = await maybeMaterializeReekConfig(ctx, codacyConfig);
802
+ if (generatedConfigPath) {
803
+ args.push("--config", generatedConfigPath);
804
+ }
785
805
  }
786
806
  args.push(...absoluteFiles);
787
807
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/tools-reek-6",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
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.6.0"
11
+ "@codacy/tooling": "0.6.1"
12
12
  },
13
13
  "license": "MIT",
14
14
  "author": "Codacy <support@codacy.com> (https://www.codacy.com)",