@codacy/verity-cli 0.29.2 → 0.29.4-experimental.9a4e14c
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/bin/verity.js +2330 -1970
- package/data/skills/verity-setup/SKILL.md +91 -2
- package/package.json +1 -1
|
@@ -221,7 +221,43 @@ it from the installed adapter. Then **always validate** (next section).
|
|
|
221
221
|
about signal rather than a complete enumeration. Copy the pattern list for each
|
|
222
222
|
tool selected for this mode. `--list <toolId> <regex>` will confirm any single ID
|
|
223
223
|
or let you derive additions.
|
|
224
|
-
|
|
224
|
+
> ⚠ **Semgrep ids carry a doubled suffix.** The rule name appears twice — once as
|
|
225
|
+
> the path segment and once as the rule id:
|
|
226
|
+
> `Semgrep_javascript.browser.security.raw-html-concat.raw-html-concat`. Deriving
|
|
227
|
+
> them with `--list Semgrep '<regex>'` gives the correct form; constructing them by
|
|
228
|
+
> hand from the rule name does not.
|
|
229
|
+
|
|
230
|
+
3. ⚠ **NEVER point `localConfigurationFile` at the project's own config** (VRT-108).
|
|
231
|
+
Doing so hands the tool the project's rule set, and Verity's `patterns` array
|
|
232
|
+
degrades to a **filter over rules someone else enabled** — it can no longer turn
|
|
233
|
+
a rule ON. A project that disables a rule makes it permanently unreachable by
|
|
234
|
+
the gate, silently. Measured: a repo whose `eslint.config.js` sets
|
|
235
|
+
`"@typescript-eslint/no-unused-vars": "off"` and omits `no-eval`/`eqeqeq`/`no-var`
|
|
236
|
+
had all four listed in its Verity config and **only** `no-explicit-any` could fire.
|
|
237
|
+
|
|
238
|
+
Setting the path is not even sufficient on its own. `useLocalConfigurationFile`
|
|
239
|
+
**defaults to true**, and the adapter auto-discovers `./eslint.config.js` and
|
|
240
|
+
overrides your value unless the flag is explicitly `false`:
|
|
241
|
+
|
|
242
|
+
```js
|
|
243
|
+
// @codacy/analysis-cli — defaults to true unless EXPLICITLY false
|
|
244
|
+
if (!existing || existing.useLocalConfigurationFile !== false) {
|
|
245
|
+
config.useLocalConfigurationFile = true;
|
|
246
|
+
}
|
|
247
|
+
// patterns become the ENABLED set only when the flag is false
|
|
248
|
+
if (!codacyToolConfig.useLocalConfigurationFile && codacyToolConfig.patterns.length === …)
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
So for ESLint9 always emit **both**:
|
|
252
|
+
|
|
253
|
+
- `"useLocalConfigurationFile": false` — makes `patterns` the enabled rule set
|
|
254
|
+
- `"localConfigurationFile": "./.codacy/tools-configs/eslint.config.mjs"` — a
|
|
255
|
+
**Verity-owned** config, written by this skill, so the gate does not inherit
|
|
256
|
+
the project's lint policy
|
|
257
|
+
|
|
258
|
+
The project's own `eslint.config.js` is left untouched and keeps serving
|
|
259
|
+
`npm run lint`. The two are deliberately independent: a team may reasonably turn
|
|
260
|
+
a rule off for their editor and still want the gate to enforce it.
|
|
225
261
|
4. For tools **without** a local config: populate the full curated pattern list from `patterns-reference.yaml`
|
|
226
262
|
5. **Validate** (next section). This is not optional — it is the only thing that
|
|
227
263
|
catches a stale or mistyped ID, and the failure mode is silent.
|
|
@@ -245,7 +281,8 @@ Delete `.codacy/codacy.config.json` and write a new one. This example is for Typ
|
|
|
245
281
|
"tools": [
|
|
246
282
|
{
|
|
247
283
|
"toolId": "ESLint9",
|
|
248
|
-
"localConfigurationFile": "
|
|
284
|
+
"localConfigurationFile": "./.codacy/tools-configs/eslint.config.mjs",
|
|
285
|
+
"useLocalConfigurationFile": false,
|
|
249
286
|
"patterns": [
|
|
250
287
|
{ "patternId": "ESLint9_no-eval" },
|
|
251
288
|
{ "patternId": "ESLint9_no-implied-eval" },
|
|
@@ -295,6 +332,58 @@ Delete `.codacy/codacy.config.json` and write a new one. This example is for Typ
|
|
|
295
332
|
}
|
|
296
333
|
```
|
|
297
334
|
|
|
335
|
+
### Also write the Verity-owned ESLint config
|
|
336
|
+
|
|
337
|
+
Because `useLocalConfigurationFile` is `false`, the adapter builds ESLint's rule set
|
|
338
|
+
from the `patterns` array — but ESLint still needs a config for parser, globals and
|
|
339
|
+
ignores. Write `.codacy/tools-configs/eslint.config.mjs`, adapted to the project's
|
|
340
|
+
frameworks and ignore paths:
|
|
341
|
+
|
|
342
|
+
```js
|
|
343
|
+
// Verity-owned ESLint config for the quality gate.
|
|
344
|
+
//
|
|
345
|
+
// Deliberately SEPARATE from the project's ./eslint.config.js. Pointing the gate at
|
|
346
|
+
// the project config makes Verity's pattern list a FILTER over rules the project
|
|
347
|
+
// enabled, so any rule the project disables becomes unreachable (VRT-108).
|
|
348
|
+
//
|
|
349
|
+
// Keep the rules here in sync with the ESLint9 patterns in codacy.config.json.
|
|
350
|
+
import js from "@eslint/js";
|
|
351
|
+
import globals from "globals";
|
|
352
|
+
import tseslint from "typescript-eslint";
|
|
353
|
+
|
|
354
|
+
export default tseslint.config(
|
|
355
|
+
{ ignores: ["dist/**", "build/**", "node_modules/**", "coverage/**", ".codacy/**"] },
|
|
356
|
+
{
|
|
357
|
+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
|
358
|
+
files: ["**/*.{ts,tsx,js,jsx}"],
|
|
359
|
+
languageOptions: {
|
|
360
|
+
ecmaVersion: 2022,
|
|
361
|
+
sourceType: "module",
|
|
362
|
+
globals: { ...globals.browser, ...globals.node },
|
|
363
|
+
},
|
|
364
|
+
rules: {
|
|
365
|
+
// Mirror the ESLint9 patterns in codacy.config.json.
|
|
366
|
+
"no-eval": "error",
|
|
367
|
+
"no-implied-eval": "error",
|
|
368
|
+
"no-new-func": "error",
|
|
369
|
+
"no-script-url": "error",
|
|
370
|
+
eqeqeq: ["error", "smart"],
|
|
371
|
+
"no-var": "error",
|
|
372
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
373
|
+
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
);
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
⚠ **Do not enable type-checked rules** (`no-unsafe-assignment`, `no-unsafe-call`,
|
|
380
|
+
`no-unsafe-return`). They require `parserOptions.projectService`, which makes a
|
|
381
|
+
per-turn gate far too slow on a large repo. Cover those through AI review in the
|
|
382
|
+
Standard instead.
|
|
383
|
+
|
|
384
|
+
⚠ **Generated files belong in `ignores`** — `src/integrations/supabase/types.ts` and
|
|
385
|
+
similar. They are not the agent's work and will otherwise dominate the findings.
|
|
386
|
+
|
|
298
387
|
### Validate the config — REQUIRED, do not skip
|
|
299
388
|
|
|
300
389
|
Immediately after writing `.codacy/codacy.config.json`, run the validator that ships
|