@codacy/tools-detekt-1 0.18.0 → 0.20.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/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # @codacy/tools-detekt-1
2
2
 
3
3
  ## Table of Contents
4
+
4
5
  - [Overview](#overview)
5
6
  - [Updating patterns](#updating-patterns)
6
7
  - [Updating the detekt version](#updating-the-detekt-version)
@@ -13,14 +14,14 @@
13
14
 
14
15
  Kotlin static analyzer using the [detekt](https://detekt.dev/) CLI JAR. Uses the CLI execution strategy -- spawns `java -jar detekt-cli-all.jar` via `spawnTool()` and parses its Checkstyle XML output.
15
16
 
16
- | Property | Value |
17
- |----------|-------|
18
- | Tool ID | `detekt` |
19
- | Codacy UUID | `cb36c32d-fc0d-4b4c-8f21-66e536ef4513` |
20
- | Strategy | CLI |
21
- | Languages | Kotlin |
22
- | Binary | `detekt-cli-1.23.8-all.jar` (downloaded from GitHub) |
23
- | File patterns | `**/*.kt`, `**/*.kts` |
17
+ | Property | Value |
18
+ | ------------- | ---------------------------------------------------- |
19
+ | Tool ID | `detekt` |
20
+ | Codacy UUID | `cb36c32d-fc0d-4b4c-8f21-66e536ef4513` |
21
+ | Strategy | CLI |
22
+ | Languages | Kotlin |
23
+ | Binary | `detekt-cli-1.23.8-all.jar` (downloaded from GitHub) |
24
+ | File patterns | `**/*.kt`, `**/*.kts` |
24
25
 
25
26
  ## Updating patterns
26
27
 
@@ -50,6 +51,7 @@ pnpm test # Run tests (requires java in PATH + detekt JAR)
50
51
  ```
51
52
 
52
53
  To install detekt locally for testing:
54
+
53
55
  ```bash
54
56
  # Download the all-in-one JAR
55
57
  curl -L -o /tmp/codacy-detekt-test-tools/detekt-cli-1.23.8-all.jar \
@@ -58,6 +60,13 @@ curl -L -o /tmp/codacy-detekt-test-tools/detekt-cli-1.23.8-all.jar \
58
60
 
59
61
  ## Notes for maintainers
60
62
 
63
+ - **Preset mappings (`src/pattern-mappings.json`)**: the seven coroutines rules are gated on
64
+ `kotlinx-coroutines`, detected from any `kotlinx-coroutines-*` Maven artifact. All seven are
65
+ default-off upstream, so before this they could never be enabled by `init --auto` — not even
66
+ in a coroutines project. Five carry detekt's own `coroutines` tag; `GlobalCoroutineUsage` and
67
+ `InjectDispatcher` carry no tag and are matched by their bare rule name (detekt pattern IDs
68
+ have no tool prefix).
69
+
61
70
  - detekt requires Java 8+ as a runtime. The adapter uses `ensureJre()` to download Adoptium Temurin JDK 17 if no system Java is found.
62
71
  - The detekt CLI JAR is an all-in-one fat JAR downloaded from GitHub releases to `ctx.toolInstallDir`.
63
72
  - Output format is Checkstyle 4.3 XML written to a temp file via `--report xml:<path>`.
package/dist/index.js CHANGED
@@ -2715,6 +2715,14 @@ var patterns_default = [
2715
2715
  }
2716
2716
  ];
2717
2717
 
2718
+ // src/pattern-mappings.json
2719
+ var pattern_mappings_default = {
2720
+ "kotlinx-coroutines": {
2721
+ prefixes: ["GlobalCoroutineUsage", "InjectDispatcher"],
2722
+ tags: ["coroutines"]
2723
+ }
2724
+ };
2725
+
2718
2726
  // src/metadata.ts
2719
2727
  var descriptor = {
2720
2728
  id: "detekt",
@@ -2724,7 +2732,8 @@ var descriptor = {
2724
2732
  filePatterns: ["**/*.kt", "**/*.kts"],
2725
2733
  supportedOS: ["linux", "darwin"],
2726
2734
  supportedArch: ["x64", "arm64"],
2727
- supportedRunners: ["local", "container"]
2735
+ supportedRunners: ["local", "container"],
2736
+ frameworkMappings: pattern_mappings_default
2728
2737
  };
2729
2738
 
2730
2739
  // src/adapter.ts
package/dist/metadata.js CHANGED
@@ -23,6 +23,16 @@ __export(metadata_exports, {
23
23
  descriptor: () => descriptor
24
24
  });
25
25
  module.exports = __toCommonJS(metadata_exports);
26
+
27
+ // src/pattern-mappings.json
28
+ var pattern_mappings_default = {
29
+ "kotlinx-coroutines": {
30
+ prefixes: ["GlobalCoroutineUsage", "InjectDispatcher"],
31
+ tags: ["coroutines"]
32
+ }
33
+ };
34
+
35
+ // src/metadata.ts
26
36
  var descriptor = {
27
37
  id: "detekt",
28
38
  displayName: "detekt",
@@ -31,7 +41,8 @@ var descriptor = {
31
41
  filePatterns: ["**/*.kt", "**/*.kts"],
32
42
  supportedOS: ["linux", "darwin"],
33
43
  supportedArch: ["x64", "arm64"],
34
- supportedRunners: ["local", "container"]
44
+ supportedRunners: ["local", "container"],
45
+ frameworkMappings: pattern_mappings_default
35
46
  };
36
47
  // Annotate the CommonJS export names for ESM import in node:
37
48
  0 && (module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/tools-detekt-1",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
4
4
  "description": "detekt adapter — CLI-mode Kotlin static analyzer",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "dependencies": {
11
11
  "fast-xml-parser": "^5.5.6",
12
- "@codacy/tooling": "0.18.0"
12
+ "@codacy/tooling": "0.20.0"
13
13
  },
14
14
  "license": "MIT",
15
15
  "author": "Codacy <support@codacy.com> (https://www.codacy.com)",