@codacy/tools-unsupported-tools 0.10.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Codacy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,111 @@
1
+ # @codacy/tools-unsupported-tools
2
+
3
+ ## Table of Contents
4
+
5
+ - [Overview](#overview)
6
+ - [What "unsupported" means](#what-unsupported-means)
7
+ - [Contents](#contents)
8
+ - [Framework mappings](#framework-mappings)
9
+ - [Regenerating the manifest](#regenerating-the-manifest)
10
+ - [How it's consumed](#how-its-consumed)
11
+ - [Development](#development)
12
+ - [Notes for maintainers](#notes-for-maintainers)
13
+
14
+ ## Overview
15
+
16
+ This package holds a **generated, committed manifest** of every Codacy Cloud tool
17
+ that does **not** have a local analyzer adapter in this CLI — the "unsupported"
18
+ (cloud-only) tools. It lets the CLI treat those tools as first-class citizens of
19
+ the configuration and of the `info` / `analyze` / `init` flows, even though they
20
+ are never executed locally.
21
+
22
+ ## What "unsupported" means
23
+
24
+ A tool is tracked here when it is in the Codacy catalog (`/api/v3/tools`), has **no
25
+ local adapter** (its UUID is not referenced by any sibling tool package's
26
+ `prefetch` script), and is **trackable** — i.e. not deprecated and not
27
+ client-side/standalone-only (those run only in the customer environment).
28
+
29
+ Descriptors carry `unsupported: true`, which is how the rest of the CLI tells them
30
+ apart from real adapters.
31
+
32
+ ## Contents
33
+
34
+ - `src/descriptors.json` — one `AdapterDescriptor` per tool (`unsupported: true`,
35
+ `uuid` set, `supportedRunners: ["container"]`).
36
+ - `src/patterns/<toolId>.json` — that tool's full pattern set (same shape as a
37
+ supported adapter's `patterns.json`). Tools with no patterns have no file.
38
+ - `src/index.ts` — exports `unsupportedDescriptors` (eager, tiny) and
39
+ `loadUnsupportedPatterns(toolId)` (lazy disk read, cached).
40
+ - `src/framework-mappings.json` — hand-curated framework matching rules (see below).
41
+
42
+ ## Framework mappings
43
+
44
+ Several cloud-only tools ship framework-specific patterns (PHPCS → CakePHP/WordPress/Drupal/Magento/
45
+ Symfony; dartanalyzer → Flutter/Angular; SonarCSharp → ASP.NET Core/Entity Framework/xUnit/…;
46
+ CodeNarc → Grails/Spock/…). `src/framework-mappings.json` maps **tool ID → `FrameworkMappings`** so
47
+ `init --auto` can include those patterns only when the framework is actually detected (and exclude
48
+ them otherwise), exactly like supported tools.
49
+
50
+ - It is **hand-curated and committed** — unlike `descriptors.json`/`patterns/`, it is **not** touched
51
+ by `generate`, so it survives regeneration. `index.ts` merges it onto each descriptor's
52
+ `frameworkMappings` at load time.
53
+ - Choose the mechanism per tool from its pattern shape: `prefixes` when pattern IDs are namespaced by
54
+ framework (e.g. `PHPCS_CakePHP_`), `tags` otherwise (e.g. `flutter`, `aspnetcore`, `grails`).
55
+ - Each **key must equal the discover catalog `displayName`** for that framework
56
+ (`packages/runner/src/discover-catalog.ts`) — that's what auto-init matches against. Add a catalog
57
+ entry + manifest parser there if discover can't yet detect the framework.
58
+ - `test/framework-mappings.test.ts` enforces that every key maps to a real tool, the merge applied,
59
+ and every prefix/tag still matches ≥1 committed pattern (guards against drift after regeneration).
60
+
61
+ ## Regenerating the manifest
62
+
63
+ From the repo root:
64
+
65
+ ```bash
66
+ pnpm generate-unsupported
67
+ ```
68
+
69
+ or from this package:
70
+
71
+ ```bash
72
+ pnpm generate
73
+ ```
74
+
75
+ The script (`scripts/generate.mjs`) fetches the catalog, subtracts locally
76
+ supported tools (by UUID, read from sibling `prefetch` scripts — no list to keep
77
+ in sync), filters out deprecated/client-side tools, and rewrites
78
+ `descriptors.json` + `patterns/`. Commit the result. On network failure it warns
79
+ and exits 0, leaving committed files untouched.
80
+
81
+ Run this whenever Codacy adds/removes tools or you implement a new local adapter
82
+ (which should then disappear from this manifest on the next regeneration).
83
+
84
+ ## How it's consumed
85
+
86
+ - `packages/cli/src/index.ts` registers every descriptor via
87
+ `registerUnsupportedTool()` so they appear in `getRegisteredDescriptors()`.
88
+ - `init --auto` calls `loadUnsupportedPatterns()` to fill cloud-only tools offline.
89
+ - `init --remote` / `--default` fetch patterns from the API at runtime, so they
90
+ do not read this package's pattern files — only its descriptors/registration.
91
+
92
+ ## Development
93
+
94
+ ```bash
95
+ pnpm build # tsup bundle + copy src/patterns → dist/patterns
96
+ pnpm test # manifest shape + drift invariants
97
+ pnpm lint
98
+ ```
99
+
100
+ `loadUnsupportedPatterns` reads `dist/patterns/<toolId>.json` at runtime
101
+ (`__dirname`-relative) and `src/patterns/` during tests.
102
+
103
+ ## Notes for maintainers
104
+
105
+ - The patterns directory is **recreated** on every `generate` run so removed tools
106
+ don't leave stale files behind.
107
+ - The package is named with the `@codacy/tools-` prefix on purpose: the CLI keeps
108
+ those external from its bundle, so `__dirname` resolves to this package's own
109
+ `dist/` and the pattern files are found.
110
+ - `filePatterns` is `["*"]` for all entries — unsupported tools never route files
111
+ locally, so the value is cosmetic.
@@ -0,0 +1,31 @@
1
+ import { PatternEntry, AdapterDescriptor } from '@codacy/tooling';
2
+
3
+ /**
4
+ * @codacy/tools-unsupported-tools — generated manifest of Codacy Cloud tools
5
+ * that have no local analyzer in this CLI ("unsupported"/cloud-only tools).
6
+ *
7
+ * The manifest is produced by `scripts/generate.mjs` (run `pnpm generate` here,
8
+ * or `pnpm generate-unsupported` from the repo root) and committed:
9
+ * - `descriptors.json` — one `AdapterDescriptor` per tool (`unsupported: true`).
10
+ * - `patterns/<toolId>.json` — that tool's full pattern set.
11
+ *
12
+ * Descriptors are tiny and imported eagerly so CLI startup can register every
13
+ * cloud-only tool. Patterns are large and read lazily from disk only when a
14
+ * flow actually needs them (currently `init --auto`).
15
+ */
16
+
17
+ /**
18
+ * Descriptors for every tracked cloud-only tool. Each has `unsupported: true`.
19
+ * Tools with curated framework mappings get them attached here so auto-init can
20
+ * gate their framework-specific patterns on detected frameworks/libraries.
21
+ */
22
+ declare const unsupportedDescriptors: AdapterDescriptor[];
23
+ /**
24
+ * Lazily loads the committed pattern set for an unsupported tool by its tool ID.
25
+ * Returns an empty array when the tool has no committed patterns (or the file is
26
+ * missing). Results are cached. Reads from `dist/patterns/` at runtime (the
27
+ * directory is copied there at build time) and `src/patterns/` during tests.
28
+ */
29
+ declare function loadUnsupportedPatterns(toolId: string): readonly PatternEntry[];
30
+
31
+ export { loadUnsupportedPatterns, unsupportedDescriptors };
package/dist/index.js ADDED
@@ -0,0 +1,261 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ loadUnsupportedPatterns: () => loadUnsupportedPatterns,
34
+ unsupportedDescriptors: () => unsupportedDescriptors
35
+ });
36
+ module.exports = __toCommonJS(index_exports);
37
+ var import_fs = __toESM(require("fs"));
38
+ var import_path = __toESM(require("path"));
39
+
40
+ // src/descriptors.json
41
+ var descriptors_default = [
42
+ {
43
+ id: "ameba",
44
+ displayName: "Ameba",
45
+ preferredVersion: "1.6.4",
46
+ languages: ["Crystal"],
47
+ filePatterns: ["*"],
48
+ supportedOS: ["linux", "darwin", "win32"],
49
+ supportedArch: ["x64", "arm64"],
50
+ supportedRunners: ["container"],
51
+ uuid: "29815f43-c1d4-40e9-a9ad-27423209fa7b",
52
+ unsupported: true
53
+ },
54
+ {
55
+ id: "codacy-scalameta-pro",
56
+ displayName: "Codacy ScalaMeta Pro",
57
+ preferredVersion: "",
58
+ languages: ["Scala"],
59
+ filePatterns: ["*"],
60
+ supportedOS: ["linux", "darwin", "win32"],
61
+ supportedArch: ["x64", "arm64"],
62
+ supportedRunners: ["container"],
63
+ uuid: "647dddc1-17c4-4840-acea-4c2c2bbecb45",
64
+ unsupported: true
65
+ },
66
+ {
67
+ id: "CodeNarc",
68
+ displayName: "CodeNarc",
69
+ preferredVersion: "3.6.0",
70
+ languages: ["Groovy"],
71
+ filePatterns: ["*"],
72
+ supportedOS: ["linux", "darwin", "win32"],
73
+ supportedArch: ["x64", "arm64"],
74
+ supportedRunners: ["container"],
75
+ uuid: "d87d5570-a63c-4014-98ab-f446816ae67b",
76
+ unsupported: true
77
+ },
78
+ {
79
+ id: "coffeelint",
80
+ displayName: "CoffeeLint",
81
+ preferredVersion: "5.2.11",
82
+ languages: ["CoffeeScript"],
83
+ filePatterns: ["*"],
84
+ supportedOS: ["linux", "darwin", "win32"],
85
+ supportedArch: ["x64", "arm64"],
86
+ supportedRunners: ["container"],
87
+ uuid: "6d94ef22-1eb6-4968-821e-291c26dd9d4c",
88
+ unsupported: true
89
+ },
90
+ {
91
+ id: "Credo",
92
+ displayName: "Credo",
93
+ preferredVersion: "1.7.12",
94
+ languages: ["Elixir"],
95
+ filePatterns: ["*"],
96
+ supportedOS: ["linux", "darwin", "win32"],
97
+ supportedArch: ["x64", "arm64"],
98
+ supportedRunners: ["container"],
99
+ uuid: "68feeeae-4432-41aa-bee0-95d979c930de",
100
+ unsupported: true
101
+ },
102
+ {
103
+ id: "dartanalyzer",
104
+ displayName: "dartanalyzer",
105
+ preferredVersion: "3.9.3",
106
+ languages: ["Dart"],
107
+ filePatterns: ["*"],
108
+ supportedOS: ["linux", "darwin", "win32"],
109
+ supportedArch: ["x64", "arm64"],
110
+ supportedRunners: ["container"],
111
+ uuid: "d203d615-6cf1-41f9-be5f-e2f660f7850f",
112
+ unsupported: true
113
+ },
114
+ {
115
+ id: "PHPCS",
116
+ displayName: "PHP_CodeSniffer",
117
+ preferredVersion: "3.10.1",
118
+ languages: ["PHP"],
119
+ filePatterns: ["*"],
120
+ supportedOS: ["linux", "darwin", "win32"],
121
+ supportedArch: ["x64", "arm64"],
122
+ supportedRunners: ["container"],
123
+ uuid: "f67f7669-fff1-4f28-8a37-b665e5ebd182",
124
+ unsupported: true
125
+ },
126
+ {
127
+ id: "phpmd",
128
+ displayName: "PHP Mess Detector",
129
+ preferredVersion: "2.14.1",
130
+ languages: ["PHP"],
131
+ filePatterns: ["*"],
132
+ supportedOS: ["linux", "darwin", "win32"],
133
+ supportedArch: ["x64", "arm64"],
134
+ supportedRunners: ["container"],
135
+ uuid: "3d0db474-e352-4afb-90a2-9c0785b8d2fd",
136
+ unsupported: true
137
+ },
138
+ {
139
+ id: "psscriptanalyzer",
140
+ displayName: "PSScriptAnalyzer",
141
+ preferredVersion: "1.24.0",
142
+ languages: ["Powershell"],
143
+ filePatterns: ["*"],
144
+ supportedOS: ["linux", "darwin", "win32"],
145
+ supportedArch: ["x64", "arm64"],
146
+ supportedRunners: ["container"],
147
+ uuid: "8fb0fb29-fa6e-43f2-9a73-9cd3873b4d8a",
148
+ unsupported: true
149
+ },
150
+ {
151
+ id: "remark-lint",
152
+ displayName: "remark-lint",
153
+ preferredVersion: "10.0.1",
154
+ languages: ["Markdown"],
155
+ filePatterns: ["*"],
156
+ supportedOS: ["linux", "darwin", "win32"],
157
+ supportedArch: ["x64", "arm64"],
158
+ supportedRunners: ["container"],
159
+ uuid: "f1eec388-0526-4c6c-954e-9b20b51bd9e7",
160
+ unsupported: true
161
+ },
162
+ {
163
+ id: "SonarCSharp",
164
+ displayName: "SonarC#",
165
+ preferredVersion: "9.32",
166
+ languages: ["CSharp"],
167
+ filePatterns: ["*"],
168
+ supportedOS: ["linux", "darwin", "win32"],
169
+ supportedArch: ["x64", "arm64"],
170
+ supportedRunners: ["container"],
171
+ uuid: "8954dff3-f19c-429c-ac76-c45fa5e73b62",
172
+ unsupported: true
173
+ },
174
+ {
175
+ id: "SonarVisualBasic",
176
+ displayName: "SonarVB",
177
+ preferredVersion: "8.15",
178
+ languages: ["VisualBasic"],
179
+ filePatterns: ["*"],
180
+ supportedOS: ["linux", "darwin", "win32"],
181
+ supportedArch: ["x64", "arm64"],
182
+ supportedRunners: ["container"],
183
+ uuid: "a5feaa2e-4abd-4416-81aa-641d012ec1d1",
184
+ unsupported: true
185
+ },
186
+ {
187
+ id: "TSQLLint",
188
+ displayName: "TSQLLint",
189
+ preferredVersion: "1.16.0",
190
+ languages: ["SQL", "TSQL"],
191
+ filePatterns: ["*"],
192
+ supportedOS: ["linux", "darwin", "win32"],
193
+ supportedArch: ["x64", "arm64"],
194
+ supportedRunners: ["container"],
195
+ uuid: "35cf97c2-6548-483e-baf9-549433891295",
196
+ unsupported: true
197
+ }
198
+ ];
199
+
200
+ // src/framework-mappings.json
201
+ var framework_mappings_default = {
202
+ PHPCS: {
203
+ CakePHP: { prefixes: ["PHPCS_CakePHP_"] },
204
+ WordPress: { prefixes: ["PHPCS_WordPress_", "PHPCS_WordPressVIPMinimum_"] },
205
+ Drupal: { prefixes: ["PHPCS_Drupal_"] },
206
+ Magento: { prefixes: ["PHPCS_Magento2_", "PHPCS_Magento2Framework_", "PHPCS_MEQP1_"] },
207
+ Symfony: { prefixes: ["PHPCS_Symfony_"] }
208
+ },
209
+ dartanalyzer: {
210
+ Flutter: { tags: ["flutter"] },
211
+ Angular: { tags: ["angular"] }
212
+ },
213
+ SonarCSharp: {
214
+ "ASP.NET Core": { tags: ["aspnetcore"] },
215
+ Blazor: { tags: ["blazor"] },
216
+ "Entity Framework": { tags: ["entityframework", "entityframeworkcore"] },
217
+ xUnit: { tags: ["xunit"] },
218
+ NUnit: { tags: ["nunit"] },
219
+ MSTest: { tags: ["mstest"] },
220
+ Moq: { tags: ["moq"] },
221
+ NSubstitute: { tags: ["nsubstitute"] },
222
+ FluentAssertions: { tags: ["fluentassertions"] },
223
+ Shouldly: { tags: ["shouldly"] },
224
+ Serilog: { tags: ["serilog"] },
225
+ NLog: { tags: ["nlog"] },
226
+ log4net: { tags: ["log4net", "apachelog4net"] }
227
+ },
228
+ CodeNarc: {
229
+ Grails: { tags: ["grails"] },
230
+ GORM: { tags: ["gorm"] },
231
+ Spock: { tags: ["spock"] },
232
+ Jenkins: { tags: ["jenkins", "jenkinspipeline"] },
233
+ JUnit: { tags: ["junit"] }
234
+ }
235
+ };
236
+
237
+ // src/index.ts
238
+ var frameworkMappingsByTool = framework_mappings_default;
239
+ var unsupportedDescriptors = descriptors_default.map((descriptor) => {
240
+ const frameworkMappings = frameworkMappingsByTool[descriptor.id];
241
+ return frameworkMappings ? { ...descriptor, frameworkMappings } : descriptor;
242
+ });
243
+ var patternsCache = /* @__PURE__ */ new Map();
244
+ function loadUnsupportedPatterns(toolId) {
245
+ const cached = patternsCache.get(toolId);
246
+ if (cached) return cached;
247
+ const file = import_path.default.join(__dirname, "patterns", `${import_path.default.basename(toolId)}.json`);
248
+ let patterns = [];
249
+ try {
250
+ patterns = JSON.parse(import_fs.default.readFileSync(file, "utf-8"));
251
+ } catch {
252
+ patterns = [];
253
+ }
254
+ patternsCache.set(toolId, patterns);
255
+ return patterns;
256
+ }
257
+ // Annotate the CommonJS export names for ESM import in node:
258
+ 0 && (module.exports = {
259
+ loadUnsupportedPatterns,
260
+ unsupportedDescriptors
261
+ });