loadwise 0.5.1 → 0.6.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 +542 -627
- package/bin/loadwise.js +4 -0
- package/lib/accessibility/frontend-detect.js +2 -1
- package/lib/accessibility/rule-ids.js +12 -9
- package/{editor/accessibility-examples.cjs → lib/editor/accessibility-examples.js} +20 -21
- package/lib/editor/actions.js +117 -0
- package/{editor/apply-fix.cjs → lib/editor/apply-fix.js} +1 -6
- package/{editor/control-flow-comparison.cjs → lib/editor/control-flow-comparison.js} +1 -3
- package/lib/editor/diagnostics.js +365 -0
- package/lib/editor/dismissals.js +111 -0
- package/lib/editor/editor-document.js +99 -0
- package/{editor/finding-comparison.cjs → lib/editor/finding-comparison.js} +4 -7
- package/lib/editor/fix-edits.js +200 -0
- package/lib/editor/language-server.js +437 -0
- package/{editor/maintainability-examples.cjs → lib/editor/maintainability-examples.js} +1 -3
- package/{editor/perf-site-comparison.cjs → lib/editor/perf-site-comparison.js} +1 -3
- package/lib/editor/perf-watch.js +78 -0
- package/{editor/performance-examples.cjs → lib/editor/performance-examples.js} +129 -128
- package/{editor/reliability-examples.cjs → lib/editor/reliability-examples.js} +100 -41
- package/lib/editor/scan-session.js +334 -0
- package/{editor/security-examples.cjs → lib/editor/security-examples.js} +28 -32
- package/lib/editor/server-commands.js +232 -0
- package/{editor/source-example.cjs → lib/editor/source-example.js} +3 -5
- package/{editor/standalone-performance-examples.cjs → lib/editor/standalone-performance-examples.js} +349 -333
- package/lib/editor/types/dismissal.js +1 -0
- package/lib/editor/types/fix-example.js +1 -0
- package/lib/editor/types/source-document.js +1 -0
- package/lib/editor/workspace-files.js +78 -0
- package/lib/editor/workspace-paths.js +22 -0
- package/lib/maintainability/analyze-source.js +2 -0
- package/lib/maintainability/apply-fix.js +1 -1
- package/lib/maintainability/cli.js +1 -1
- package/lib/maintainability/examples.js +58 -41
- package/lib/maintainability/rule-ids.js +29 -14
- package/lib/maintainability/scan-changed.js +3 -0
- package/lib/maintainability/scan.js +13 -9
- package/lib/maintainability/tsconfig-strict.js +69 -0
- package/lib/maintainability/type-safety-hygiene.js +204 -0
- package/lib/performance/analyze.js +2 -0
- package/lib/performance/cli-arguments.js +0 -2
- package/lib/performance/cli-policy.js +17 -9
- package/lib/performance/cli-scan.js +10 -8
- package/lib/performance/cli.js +4 -23
- package/lib/performance/editor-signal.js +1 -1
- package/lib/performance/finding-text.js +3 -3
- package/lib/performance/fix-cli.js +1 -1
- package/lib/performance/frontend-perf.js +7 -0
- package/lib/performance/frontend-render-perf.js +200 -0
- package/lib/performance/llm-max-tokens.js +56 -0
- package/lib/performance/native.js +46 -26
- package/lib/performance/polyglot.js +22 -1
- package/lib/performance/pooling.js +38 -23
- package/lib/performance/projects.js +42 -21
- package/lib/performance/rule-ids.js +236 -222
- package/lib/performance/site-fixes/database.js +3 -1
- package/lib/performance/site-fixes/integrity.js +15 -1
- package/lib/performance/source-inputs.js +18 -6
- package/lib/performance/unscanned-javascript.js +66 -19
- package/lib/reliability/analyze.js +12 -0
- package/lib/reliability/child-process.js +106 -0
- package/lib/reliability/error-values.js +177 -0
- package/lib/reliability/pool-timeout.js +79 -0
- package/lib/reliability/react-bugs.js +602 -0
- package/lib/reliability/resource-leaks.js +3 -6
- package/lib/reliability/rule-ids.js +169 -127
- package/lib/reliability/switch-exhaustive.js +284 -0
- package/lib/reliability/uncaught-exception.js +223 -0
- package/lib/security/auth-crypto/rule-ids.js +3 -2
- package/lib/security/cli.js +6 -5
- package/lib/security/deps/rule-ids.js +1 -0
- package/lib/security/examples/auth-crypto.cjs +5 -4
- package/lib/security/examples/deps.cjs +1 -0
- package/lib/security/examples/exposure.cjs +55 -42
- package/lib/security/examples/files.cjs +1 -0
- package/lib/security/examples/injection.cjs +1 -0
- package/lib/security/examples/moved.cjs +5 -4
- package/lib/security/examples/request-forgery.cjs +1 -0
- package/lib/security/exposure/client-env.js +113 -0
- package/lib/security/exposure/frontend-security.js +12 -10
- package/lib/security/exposure/index.js +14 -3
- package/lib/security/exposure/jsx-url.js +267 -0
- package/lib/security/exposure/next-image-config.js +34 -0
- package/lib/security/exposure/package-manifest.js +45 -0
- package/lib/security/exposure/react-version.js +45 -0
- package/lib/security/exposure/rule-ids.js +16 -12
- package/lib/security/files/index.js +1 -1
- package/lib/security/files/rule-ids.js +1 -0
- package/lib/security/injection/code.js +24 -10
- package/lib/security/injection/command.js +81 -28
- package/lib/security/injection/nosql.js +109 -22
- package/lib/security/injection/redos.js +152 -308
- package/lib/security/injection/regex-pattern.js +290 -0
- package/lib/security/injection/regex.js +30 -11
- package/lib/security/injection/rule-ids.js +2 -1
- package/lib/security/injection/shared.js +19 -1
- package/lib/security/injection/sql.js +83 -2
- package/lib/security/request-forgery/rule-ids.js +1 -0
- package/lib/security/rule-descriptions.js +36 -32
- package/lib/security/rule-ids.js +74 -67
- package/lib/security/taint/filename-guard.js +3 -1
- package/lib/security/taint/guards.js +84 -10
- package/lib/security/taint/index.js +124 -13
- package/lib/security/taint/propagate.js +10 -7
- package/lib/security/taint/sanitizers.js +7 -3
- package/lib/security/taint/sources.js +6 -3
- package/lib/security/taint/summaries.js +13 -1
- package/lib/security/taint/url-parts.js +14 -5
- package/lib/shared/agent-session.js +2 -2
- package/lib/shared/check.js +9 -6
- package/lib/shared/explain.js +5 -5
- package/lib/shared/fix-convergence.js +1 -1
- package/lib/shared/formats/finding-location.js +6 -2
- package/lib/shared/formats/sarif.js +3 -3
- package/lib/shared/heap-limit.js +6 -0
- package/lib/shared/pillars.js +7 -7
- package/lib/shared/rule-docs.js +12 -0
- package/lib/shared/scan-cache.js +0 -1
- package/lib/shared/workspaces.js +31 -9
- package/package.json +9 -16
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/schema/loadwise.config.schema.json +44 -0
- package/editor/README.md +0 -47
- package/examples/redis-keys.otlp.json +0 -22
- package/lib/maintainability/notify-editor.js +0 -1
- package/lib/performance/editor-report.js +0 -191
- package/lib/performance/editor-setup.js +0 -189
- package/lib/performance/editor-watch-supervisor.js +0 -104
- package/lib/performance/editor-watch.js +0 -193
- package/lib/performance/notify-editor.js +0 -1
- package/lib/performance/recursive-watch.js +0 -181
- /package/lib/{performance/types/editor-report.js → editor/types/comparison.js} +0 -0
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ By default `loadwise check` reports actionable findings across Performance, Reli
|
|
|
38
38
|
|
|
39
39
|
**With an AI coding agent**, say **“Run Loadwise”** in your project chat. The agent can run the installed CLI directly. It should check the findings against the code, explain what it would fix or leave alone and why, and let you choose before making edits. [Active-agent workflow and optional MCP setup](#using-loadwise-with-an-active-coding-agent)
|
|
40
40
|
|
|
41
|
-
**Working manually**, run `npx loadwise check` to see recommendations or `npx loadwise fix --yes` to apply eligible fixes. In
|
|
41
|
+
**Working manually**, run `npx loadwise check` to see recommendations or `npx loadwise fix --yes` to apply eligible fixes. In any editor with a language server client, `loadwise lsp` shows findings as diagnostics with hovers and fixes. [Editor setup](#editor-language-server)
|
|
42
42
|
|
|
43
43
|
### Try a finding and a fix
|
|
44
44
|
|
|
@@ -142,7 +142,7 @@ To apply automatic fixes across your project, run `npx loadwise fix --yes` from
|
|
|
142
142
|
- `--fail-on contract|all` sets the exit threshold. By default, performance, reliability, security and accessibility fail on displayed findings, and a full maintainability scan fails on contract violations. Changed-line maintainability scans fail on any displayed finding. Configured rule levels can change these defaults.
|
|
143
143
|
- `--write-baseline [file]` records the current findings and `--baseline [file]` reports only findings not recorded. The default file is `loadwise-baseline.json` in the checked directory, with one section per checker; `loadwise perf`, `loadwise rel`, `loadwise maint`, `loadwise sec` and `loadwise a11y` take the same flags and read or write only their own section. Entries match on rule, file and flagged code (the finding id), never the line number, with a count per entry so N recorded copies allow N findings. Text output ends with `N baseline findings hidden.` and `--json` adds `baselineHidden`. A full comparison reports the number of unmatched entries in `baselineStale`. A partial comparison, such as a changed-line or single-file scan, reports `null` because unscanned findings may still exist. Refresh the baseline using its original scope and settings. Not combinable with `--fix`, and `--write-baseline` not with `--staged` or `--changed-since`. `loadwise rel migrations` keeps its own per-file baseline.
|
|
144
144
|
|
|
145
|
-
The performance, reliability, security and accessibility checkers use the directory's `tsconfig.json` or `jsconfig.json`; without one, `check` looks for workspace packages (`package.json` `workspaces`, `pnpm-workspace.yaml` or `lerna.json`) and checks each one's config in one report, grouped per package; `--workspace <name|path>` (repeatable) limits every checker to some packages. For a
|
|
145
|
+
The performance, reliability, security and accessibility checkers use the directory's `tsconfig.json` or `jsconfig.json`; without one, `check` looks for workspace packages (`package.json` `workspaces`, `pnpm-workspace.yaml` or `lerna.json`) and checks each one's config in one report, grouped per package (a package without a config is checked with the standalone defaults below); `--workspace <name|path>` (repeatable) limits every checker to some packages. For a package with a `package.json` and no config, `check` and `fix` infer its JavaScript and TypeScript source files from the project inventory without writing a config, and check them with ES2022 and NodeNext defaults. A package whose TypeScript sits under a sub-folder's own `tsconfig.json` still needs a config at its root, since those defaults would miss that config's settings. For a JavaScript file without a project config, use `npx loadwise perf path/to/file.js` and `npx loadwise sec path/to/file.js`. For Python, Go, Java, C# or Rust performance checks, run `npx loadwise perf polyglot src` explicitly, and `npx loadwise rel polyglot src` for the reliability patterns. The security checker can still scan Dockerfiles, Compose files and tracked environment files. When performance and reliability are selected together, they share a type-check unless a baseline is being written. Source scans are read-only. When fixes are available, text reports include a `Fix all:` command, such as `npx loadwise perf -p tsconfig.json --fix --only <ids>`, that applies its fixes.
|
|
146
146
|
|
|
147
147
|
Exit codes: **0** passed, **1** a checker met its exit threshold, **2** invalid input or configuration in any checker, or a scan that skipped a file (see below).
|
|
148
148
|
|
|
@@ -265,7 +265,7 @@ If you ran a terminal command yourself and want to share it later, use `npx load
|
|
|
265
265
|
|
|
266
266
|
### Using Loadwise without AI
|
|
267
267
|
|
|
268
|
-
Run `npx loadwise check` to see findings or `npx loadwise fix --yes` to scan and apply automatic fixes. With
|
|
268
|
+
Run `npx loadwise check` to see findings or `npx loadwise fix --yes` to scan and apply automatic fixes. With the language server running in your editor, hover over a finding to see its recommendation. Findings that require judgment remain available for manual review. [Editor setup](#editor-language-server)
|
|
269
269
|
|
|
270
270
|
### Claude Code plugin
|
|
271
271
|
|
|
@@ -290,26 +290,132 @@ npx loadwise agent init --hook off # removes only this block
|
|
|
290
290
|
|
|
291
291
|
The hook runs `loadwise check --staged` from the project folder, so every tool that commits through git sees findings from the selected checkers on the staged lines. It writes a marked block into the hooks folder (honouring `core.hooksPath`) or into `.husky/pre-commit` when `.husky/` exists, appends to a hook you already have, and rerunning it replaces only its own block, including blocks written by earlier releases. With lefthook it edits nothing and prints the command to add. `git commit --no-verify` skips the hook.
|
|
292
292
|
|
|
293
|
-
## Editor
|
|
293
|
+
## Editor (language server)
|
|
294
294
|
|
|
295
|
-
|
|
295
|
+
`loadwise lsp` is a language server for any editor with a Language Server Protocol client. It shows findings from all five checkers (performance, reliability, maintainability, security and accessibility) as diagnostics, with hovers, fixes, dismissals and code lenses. It needs Node.js 22+ and this package in the project (`npm install --save-dev loadwise`) or on the PATH. Every editor starts it the same way:
|
|
296
296
|
|
|
297
297
|
```sh
|
|
298
|
-
npx loadwise
|
|
298
|
+
npx loadwise lsp --stdio
|
|
299
299
|
```
|
|
300
300
|
|
|
301
|
-
|
|
301
|
+
On Windows, use `npx.cmd` where the editor does not resolve `npx` itself. Choose the file types each editor attaches it to; the snippets below cover JavaScript, TypeScript and Python, and the checkers also read Go, Java, C#, Rust, HTML, Vue and Svelte.
|
|
302
302
|
|
|
303
|
-
|
|
303
|
+
**Neovim 0.11+** (`init.lua`):
|
|
304
304
|
|
|
305
|
-
|
|
305
|
+
```lua
|
|
306
|
+
vim.lsp.config('loadwise', {
|
|
307
|
+
cmd = { 'npx', 'loadwise', 'lsp', '--stdio' },
|
|
308
|
+
filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact', 'python' },
|
|
309
|
+
root_markers = { 'loadwise.config.json', 'tsconfig.json', 'jsconfig.json', 'package.json', '.git' },
|
|
310
|
+
init_options = { loadwise = { severity = 'default' } },
|
|
311
|
+
})
|
|
312
|
+
vim.lsp.enable('loadwise')
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
With an older Neovim and nvim-lspconfig, register the same settings as a custom server:
|
|
316
|
+
|
|
317
|
+
```lua
|
|
318
|
+
require('lspconfig.configs').loadwise = {
|
|
319
|
+
default_config = {
|
|
320
|
+
cmd = { 'npx', 'loadwise', 'lsp', '--stdio' },
|
|
321
|
+
filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact', 'python' },
|
|
322
|
+
root_dir = require('lspconfig.util').root_pattern('loadwise.config.json', 'tsconfig.json', 'package.json', '.git'),
|
|
323
|
+
},
|
|
324
|
+
}
|
|
325
|
+
require('lspconfig').loadwise.setup({})
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
**Helix** (`languages.toml`), added beside each language's own server:
|
|
329
|
+
|
|
330
|
+
```toml
|
|
331
|
+
[language-server.loadwise]
|
|
332
|
+
command = "npx"
|
|
333
|
+
args = ["loadwise", "lsp", "--stdio"]
|
|
334
|
+
|
|
335
|
+
[[language]]
|
|
336
|
+
name = "typescript"
|
|
337
|
+
language-servers = ["typescript-language-server", "loadwise"]
|
|
338
|
+
|
|
339
|
+
[[language]]
|
|
340
|
+
name = "python"
|
|
341
|
+
language-servers = ["pylsp", "loadwise"]
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
**Zed** (`settings.json`). Zed starts only language servers that an extension registers; with one that registers `loadwise`, these settings choose the command and the languages it runs for:
|
|
345
|
+
|
|
346
|
+
```json
|
|
347
|
+
{
|
|
348
|
+
"lsp": {
|
|
349
|
+
"loadwise": {
|
|
350
|
+
"binary": { "path": "npx", "arguments": ["loadwise", "lsp", "--stdio"] },
|
|
351
|
+
"initialization_options": { "loadwise": { "severity": "default" } }
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
"languages": {
|
|
355
|
+
"TypeScript": { "language_servers": ["...", "loadwise"] },
|
|
356
|
+
"Python": { "language_servers": ["...", "loadwise"] }
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
**Sublime Text** with the LSP package (**Preferences > Package Settings > LSP > Settings**):
|
|
362
|
+
|
|
363
|
+
```json
|
|
364
|
+
{
|
|
365
|
+
"clients": {
|
|
366
|
+
"loadwise": {
|
|
367
|
+
"enabled": true,
|
|
368
|
+
"command": ["npx", "loadwise", "lsp", "--stdio"],
|
|
369
|
+
"selector": "source.js | source.jsx | source.ts | source.tsx | source.python",
|
|
370
|
+
"initializationOptions": { "loadwise": { "severity": "default" } }
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
**Emacs** with eglot. Eglot runs one server per buffer, so for these modes Loadwise takes the place of another server:
|
|
377
|
+
|
|
378
|
+
```elisp
|
|
379
|
+
(with-eval-after-load 'eglot
|
|
380
|
+
(add-to-list 'eglot-server-programs
|
|
381
|
+
'((js-mode js-ts-mode typescript-ts-mode tsx-ts-mode python-mode python-ts-mode)
|
|
382
|
+
. ("npx" "loadwise" "lsp" "--stdio"))))
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
**VS Code and VSCodium**: install a generic Language Server Protocol client extension from Open VSX and set its server command to `npx loadwise lsp --stdio`. To apply eligible fixes on save, add `"editor.codeActionsOnSave": { "source.fixAll.loadwise": "explicit" }` to your settings.
|
|
306
386
|
|
|
307
|
-
|
|
387
|
+
### What you see
|
|
308
388
|
|
|
309
|
-
- Each
|
|
310
|
-
-
|
|
311
|
-
- **
|
|
312
|
-
-
|
|
389
|
+
- Each finding is a diagnostic with its checker as the source (`loadwise perf`, `loadwise maint`, `loadwise sec`) and its rule as the code, linked to the rule's documentation. Related locations, such as the other imports of a dependency cycle, are listed with it. Rule levels from `loadwise.config.json` decide the severity: by default declared contract violations are errors and other findings warnings. Live-database findings, which name a table rather than a file, appear on the first line of `package.json`.
|
|
390
|
+
- Hover over a finding to read the recommendation on the first line (a source-based rewrite, an illustrative example or a review action), then the original finding and the before and after code, highlighted for the file's language.
|
|
391
|
+
- The code actions on a flagged line are **Apply fix: <rule>** when the checker has a rewrite, **Dismiss this finding** and **Dismiss <rule> in this file**, and **Apply all Loadwise fixes in this file** when there are several. Fixes that span several files, or create a migration file, apply all-or-nothing. A fix never overwrites an existing file, and it refuses code that changed since the scan, comparing against the editor's unsaved text. The `source.fixAll.loadwise` action applies every eligible fix in the file as one undoable edit and leaves fixes that need individual review for **Apply fix**.
|
|
392
|
+
- Code lenses put **Apply fix** and **Dismiss** above each fixable line, and **Apply all** on the first line of a file with several fixes.
|
|
393
|
+
- A dismissed finding stays hidden until its flagged line changes; a rule dismissed for a file stays hidden in that file. Dismissals are saved in `.loadwise/dismissed.json` at the workspace folder root, never in your code, and you can commit the file to share them.
|
|
394
|
+
|
|
395
|
+
### What gets scanned
|
|
396
|
+
|
|
397
|
+
Each workspace folder is scanned when the server starts and again after every change: a save in the editor, or a change by git, another editor or a code generator to a source file, `schema.prisma`, a SQL migration, `package.json`, `tsconfig*.json`, `jsconfig*.json`, `loadwise.config.json` or `.loadwise/dismissed.json`. Rapid changes are grouped, and a completed source scan in the project terminal refreshes the editor too. Performance, reliability and accessibility come from the incremental `loadwise perf --watch` process, which re-analyzes only changed files, restarts when a config file or package changes, and falls back to full rescans if it stops. Maintainability and security rerun on each change, and the polyglot rules run when the folder has Python, Go, Java, C# or Rust files. The default project is a root `tsconfig.json` or `jsconfig.json`; in a monorepo, open individual packages as workspace folders or set `project`. Progress appears while a scan runs, and scan counts and errors go to the editor's language server log.
|
|
398
|
+
|
|
399
|
+
### Commands and settings
|
|
400
|
+
|
|
401
|
+
| Command | Action |
|
|
402
|
+
| --------------------------- | ---------------------------------------------------------- |
|
|
403
|
+
| `loadwise.scan` | Rescan every workspace folder now |
|
|
404
|
+
| `loadwise.applyFix` | Apply one fix (from a code action or code lens) |
|
|
405
|
+
| `loadwise.applyAllFixes` | Apply every eligible fix in a file (its URI as argument) |
|
|
406
|
+
| `loadwise.dismiss` | Dismiss a finding or a rule in a file |
|
|
407
|
+
| `loadwise.showDismissed` | List dismissed findings, with Restore and Restore all |
|
|
408
|
+
| `loadwise.restoreDismissed` | Restore the given dismissal, or every one without argument |
|
|
409
|
+
|
|
410
|
+
Settings go in the client's `initializationOptions` or its `loadwise` configuration section (per workspace folder when the editor supports it):
|
|
411
|
+
|
|
412
|
+
| Setting | Default | Effect |
|
|
413
|
+
| ---------- | ----------- | ----------------------------------------------------------------------------- |
|
|
414
|
+
| `enabled` | `true` | Show diagnostics for the folder |
|
|
415
|
+
| `project` | `""` | TypeScript or JavaScript project config, relative to the folder |
|
|
416
|
+
| `cli` | `""` | Absolute path to another `bin/loadwise.js`, such as a development build |
|
|
417
|
+
| `severity` | `"default"` | `error`, `warning`, `information` or `hint` shows every finding at that level |
|
|
418
|
+
| `codeLens` | `true` | Show the Apply fix and Dismiss code lenses |
|
|
313
419
|
|
|
314
420
|
# Performance checker
|
|
315
421
|
|
|
@@ -367,59 +473,79 @@ The default `--fail-on all` applies to the displayed findings. For a complete ad
|
|
|
367
473
|
|
|
368
474
|
## Source checks
|
|
369
475
|
|
|
370
|
-
Run in the directory containing `tsconfig.json` or `jsconfig.json`, pass `-p path/to/config.json`, or give explicit JS/TS files. A project check scans the config's input files and follows project references. Declaration files supply types. A standalone file check uses ES2022 and NodeNext compiler defaults. Use a project config for aliases, custom libraries and JS projects with `allowJs`. When
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
|
375
|
-
|
|
|
376
|
-
| <a id="
|
|
377
|
-
| <a id="
|
|
378
|
-
| <a id="
|
|
379
|
-
| <a id="
|
|
380
|
-
| <a id="
|
|
381
|
-
| <a id="
|
|
382
|
-
| <a id="
|
|
383
|
-
| <a id="
|
|
384
|
-
| <a id="
|
|
385
|
-
| <a id="
|
|
386
|
-
| <a id="
|
|
387
|
-
| <a id="
|
|
388
|
-
| <a id="
|
|
389
|
-
| <a id="
|
|
390
|
-
| <a id="
|
|
391
|
-
| <a id="
|
|
392
|
-
| <a id="
|
|
393
|
-
| <a id="
|
|
394
|
-
| <a id="
|
|
395
|
-
| <a id="
|
|
396
|
-
| <a id="
|
|
397
|
-
| <a id="
|
|
398
|
-
| <a id="
|
|
399
|
-
| <a id="
|
|
400
|
-
| <a id="
|
|
401
|
-
| <a id="
|
|
402
|
-
| <a id="
|
|
403
|
-
| <a id="
|
|
404
|
-
| <a id="
|
|
405
|
-
| <a id="
|
|
406
|
-
| <a id="
|
|
407
|
-
| <a id="
|
|
408
|
-
| <a id="
|
|
409
|
-
| <a id="
|
|
410
|
-
| <a id="
|
|
411
|
-
| <a id="
|
|
412
|
-
| <a id="
|
|
413
|
-
| <a id="
|
|
414
|
-
| <a id="
|
|
415
|
-
| <a id="
|
|
416
|
-
| <a id="
|
|
417
|
-
| <a id="
|
|
418
|
-
| <a id="
|
|
419
|
-
| <a id="
|
|
420
|
-
| <a id="
|
|
421
|
-
| <a id="
|
|
422
|
-
| <a id="
|
|
476
|
+
Run in the directory containing `tsconfig.json` or `jsconfig.json`, pass `-p path/to/config.json`, or give explicit JS/TS files. A project check scans the config's input files and follows project references. Declaration files supply types. A standalone file check uses ES2022 and NodeNext compiler defaults. Use a project config for aliases, custom libraries and JS projects with `allowJs`. When the config Loadwise finds leaves JavaScript files in its folder out because `allowJs` is off, Loadwise still checks them with those standalone defaults and a note names them; set `allowJs` or add a `jsconfig.json` to check them with the project's settings. A config passed with `-p` is checked exactly as it lists its files, and the note names the JavaScript it leaves out.
|
|
477
|
+
|
|
478
|
+
<!-- loadwise:rules:start checker=performance group=source-checks -->
|
|
479
|
+
|
|
480
|
+
| Rule | Impact | What it flags |
|
|
481
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
482
|
+
| <a id="angular-default-change-detection"></a>[`angular-default-change-detection`](docs/rules/angular-default-change-detection.md) | low | An Angular component uses default change detection instead of OnPush, so its subtree is re-checked on every event. |
|
|
483
|
+
| <a id="angular-ngfor-missing-trackby"></a>[`angular-ngfor-missing-trackby`](docs/rules/angular-ngfor-missing-trackby.md) | low | An *ngFor has no trackBy, so a list replaced with new objects recreates the DOM of every item. |
|
|
484
|
+
| <a id="angular-subscribe-without-cleanup"></a>[`angular-subscribe-without-cleanup`](docs/rules/angular-subscribe-without-cleanup.md) | medium | An RxJS subscription in a component has no completing operator or ngOnDestroy unsubscribe and keeps running after destruction. |
|
|
485
|
+
| <a id="array-repeated-find"></a>[`array-repeated-find`](docs/rules/array-repeated-find.md) | medium | An array is searched with find or findIndex repeatedly where a Map lookup would do. |
|
|
486
|
+
| <a id="array-repeated-membership"></a>[`array-repeated-membership`](docs/rules/array-repeated-membership.md) | medium | An array is tested with includes or indexOf repeatedly where a Set would do. |
|
|
487
|
+
| <a id="dom-layout-thrashing"></a>[`dom-layout-thrashing`](docs/rules/dom-layout-thrashing.md) | medium | A loop reads layout metrics and mutates DOM styles or classes, forcing a reflow on each iteration. |
|
|
488
|
+
| <a id="dom-listener-without-cleanup"></a>[`dom-listener-without-cleanup`](docs/rules/dom-listener-without-cleanup.md) | low | A window or document listener uses an inline function with no AbortSignal or once, so it can never be removed. |
|
|
489
|
+
| <a id="dom-unthrottled-scroll-resize"></a>[`dom-unthrottled-scroll-resize`](docs/rules/dom-unthrottled-scroll-resize.md) | low | A scroll, resize, mousemove, wheel or touch listener runs unthrottled work (or is non-passive) on the main thread. |
|
|
490
|
+
| <a id="express-missing-compression"></a>[`express-missing-compression`](docs/rules/express-missing-compression.md) | low | An Express server registers no response compression middleware. |
|
|
491
|
+
| <a id="external-call-in-transaction"></a>[`external-call-in-transaction`](docs/rules/external-call-in-transaction.md) | high | An external call is awaited inside a database transaction, holding its connection and locks. |
|
|
492
|
+
| <a id="filter-for-existence"></a>[`filter-for-existence`](docs/rules/filter-for-existence.md) | low | filter(...).length is used only to test whether any element matches. |
|
|
493
|
+
| <a id="frontend-barrel-heavy-import"></a>[`frontend-barrel-heavy-import`](docs/rules/frontend-barrel-heavy-import.md) | low | A client module imports the whole of lodash or moment instead of subpaths or a lighter library. |
|
|
494
|
+
| <a id="graphql-n-plus-one-resolver"></a>[`graphql-n-plus-one-resolver`](docs/rules/graphql-n-plus-one-resolver.md) | high | A GraphQL field resolver executes a database or HTTP query per parent item without DataLoader batching. |
|
|
495
|
+
| <a id="heavy-media-in-request-handler"></a>[`heavy-media-in-request-handler`](docs/rules/heavy-media-in-request-handler.md) | medium | Heavy image (sharp) or PDF rendering runs directly inside an HTTP request handler. |
|
|
496
|
+
| <a id="json-roundtrip-clone"></a>[`json-roundtrip-clone`](docs/rules/json-roundtrip-clone.md) | low | A value is deep-cloned with JSON.parse(JSON.stringify(...)) on a request path. |
|
|
497
|
+
| <a id="json-stringify-in-loop"></a>[`json-stringify-in-loop`](docs/rules/json-stringify-in-loop.md) | medium | JSON.stringify runs inside a loop instead of serializing once or streaming. |
|
|
498
|
+
| <a id="list-count-per-request"></a>[`list-count-per-request`](docs/rules/list-count-per-request.md) | medium | A list endpoint runs a full count query on every request. |
|
|
499
|
+
| <a id="list-query-overfetch"></a>[`list-query-overfetch`](docs/rules/list-query-overfetch.md) | medium | A list query loads large columns or nested relations without a narrow projection. |
|
|
500
|
+
| <a id="llm-call-without-max-tokens"></a>[`llm-call-without-max-tokens`](docs/rules/llm-call-without-max-tokens.md) | medium | An OpenAI chat or responses call sets no output token limit. |
|
|
501
|
+
| <a id="loop-copy-accumulator"></a>[`loop-copy-accumulator`](docs/rules/loop-copy-accumulator.md) | medium | A loop copies its growing result on every iteration. |
|
|
502
|
+
| <a id="mongoose-hydrate-for-to-object"></a>[`mongoose-hydrate-for-to-object`](docs/rules/mongoose-hydrate-for-to-object.md) | medium | A Mongoose query hydrates full Documents only to convert them immediately via .toObject() or .toJSON(). |
|
|
503
|
+
| <a id="mongoose-missing-lean"></a>[`mongoose-missing-lean`](docs/rules/mongoose-missing-lean.md) | medium | A Mongoose read query is returned or serialized without .lean(), paying full Document hydration overhead. |
|
|
504
|
+
| <a id="node-event-listener-leak"></a>[`node-event-listener-leak`](docs/rules/node-event-listener-leak.md) | high | An event listener is registered inside a repeated or per-request context without matching cleanup. |
|
|
505
|
+
| <a id="node-sync-compression-in-async"></a>[`node-sync-compression-in-async`](docs/rules/node-sync-compression-in-async.md) | medium | A synchronous zlib call blocks the event loop inside an async function. |
|
|
506
|
+
| <a id="node-sync-crypto-in-async"></a>[`node-sync-crypto-in-async`](docs/rules/node-sync-crypto-in-async.md) | high | A synchronous crypto call blocks the event loop inside an async function. |
|
|
507
|
+
| <a id="node-sync-fs-in-async"></a>[`node-sync-fs-in-async`](docs/rules/node-sync-fs-in-async.md) | medium | A synchronous fs call blocks the event loop inside an async function. |
|
|
508
|
+
| <a id="node-sync-process-in-async"></a>[`node-sync-process-in-async`](docs/rules/node-sync-process-in-async.md) | high | A synchronous child_process call blocks the event loop inside an async function. |
|
|
509
|
+
| <a id="notification-send-in-loop"></a>[`notification-send-in-loop`](docs/rules/notification-send-in-loop.md) | high | A push, email or Firebase message is sent once per loop iteration instead of in one batch. |
|
|
510
|
+
| <a id="orm-cartesian-include"></a>[`orm-cartesian-include`](docs/rules/orm-cartesian-include.md) | high | One query joins two or more one-to-many relations, so the returned rows multiply. |
|
|
511
|
+
| <a id="orm-deep-offset"></a>[`orm-deep-offset`](docs/rules/orm-deep-offset.md) | high | A list query pages with a large or unbounded offset, so the database reads and discards every skipped row. |
|
|
512
|
+
| <a id="password-hash-pure-js"></a>[`password-hash-pure-js`](docs/rules/password-hash-pure-js.md) | medium | bcryptjs hashes passwords in pure JavaScript on the main thread. |
|
|
513
|
+
| <a id="password-hash-sync-in-async"></a>[`password-hash-sync-in-async`](docs/rules/password-hash-sync-in-async.md) | high | A synchronous bcrypt call blocks the event loop inside an async function. |
|
|
514
|
+
| <a id="pg-count-materialization"></a>[`pg-count-materialization`](docs/rules/pg-count-materialization.md) | medium | A pg query loads rows only to count them. |
|
|
515
|
+
| <a id="pg-filter-materialization"></a>[`pg-filter-materialization`](docs/rules/pg-filter-materialization.md) | medium | A pg query loads an unbounded result that JavaScript then filters by equality. |
|
|
516
|
+
| <a id="pg-first-materialization"></a>[`pg-first-materialization`](docs/rules/pg-first-materialization.md) | medium | A pg query loads an unbounded result to read only its first row. |
|
|
517
|
+
| <a id="pg-query-in-loop"></a>[`pg-query-in-loop`](docs/rules/pg-query-in-loop.md) | high | A pg query runs once per loop iteration. |
|
|
518
|
+
| <a id="pg-top-k-materialization"></a>[`pg-top-k-materialization`](docs/rules/pg-top-k-materialization.md) | medium | A pg query loads an unbounded result that JavaScript sorts to keep the top rows. |
|
|
519
|
+
| <a id="pg-unreleased-checkout"></a>[`pg-unreleased-checkout`](docs/rules/pg-unreleased-checkout.md) | critical | A chained pool checkout loses the client, so it is never released. |
|
|
520
|
+
| <a id="pool-created-per-request-or-item"></a>[`pool-created-per-request-or-item`](docs/rules/pool-created-per-request-or-item.md) | critical | A database, Redis, S3, OpenAI, Anthropic or Stripe client or pool is created on a per-request or per-item path. |
|
|
521
|
+
| <a id="prisma-count-materialization"></a>[`prisma-count-materialization`](docs/rules/prisma-count-materialization.md) | medium | A Prisma query loads rows only to count them. |
|
|
522
|
+
| <a id="prisma-filter-materialization"></a>[`prisma-filter-materialization`](docs/rules/prisma-filter-materialization.md) | medium | A Prisma query loads an unbounded result that JavaScript then filters by equality. |
|
|
523
|
+
| <a id="prisma-first-materialization"></a>[`prisma-first-materialization`](docs/rules/prisma-first-materialization.md) | medium | A Prisma query loads an unbounded result to read only its first row. |
|
|
524
|
+
| <a id="prisma-query-in-loop"></a>[`prisma-query-in-loop`](docs/rules/prisma-query-in-loop.md) | high | A Prisma query runs once per loop iteration. |
|
|
525
|
+
| <a id="prisma-top-k-materialization"></a>[`prisma-top-k-materialization`](docs/rules/prisma-top-k-materialization.md) | medium | A Prisma query loads an unbounded result that JavaScript sorts to keep the top rows. |
|
|
526
|
+
| <a id="queue-add-in-loop"></a>[`queue-add-in-loop`](docs/rules/queue-add-in-loop.md) | high | A job queue add runs once per item instead of one addBulk. |
|
|
527
|
+
| <a id="react-component-defined-in-component"></a>[`react-component-defined-in-component`](docs/rules/react-component-defined-in-component.md) | medium | A component is declared inside another component and rendered as an element, so it remounts on every render and loses its state and DOM. |
|
|
528
|
+
| <a id="react-context-value-recreated"></a>[`react-context-value-recreated`](docs/rules/react-context-value-recreated.md) | low | An inline object or array literal in Context.Provider value creates a new reference on every render. |
|
|
529
|
+
| <a id="react-fetch-in-effect-no-abort"></a>[`react-fetch-in-effect-no-abort`](docs/rules/react-fetch-in-effect-no-abort.md) | low | A fetch in an effect has no AbortController or cleanup, so dependency changes can race and apply stale results. |
|
|
530
|
+
| <a id="react-index-as-key"></a>[`react-index-as-key`](docs/rules/react-index-as-key.md) | low | A list item uses the map index as its React key, which breaks reconciliation when items are inserted or reordered. |
|
|
531
|
+
| <a id="react-inline-object-in-jsx-prop"></a>[`react-inline-object-in-jsx-prop`](docs/rules/react-inline-object-in-jsx-prop.md) | low | An inline object literal is passed to a memo() component, creating a new reference each render and defeating the memo. |
|
|
532
|
+
| <a id="react-missing-cleanup"></a>[`react-missing-cleanup`](docs/rules/react-missing-cleanup.md) | medium | An effect starts a global listener, interval, socket or endless subscription and returns no cleanup, so it leaks on every remount. |
|
|
533
|
+
| <a id="rebuild-lookup-in-loop"></a>[`rebuild-lookup-in-loop`](docs/rules/rebuild-lookup-in-loop.md) | high | A Set or Map is rebuilt from the same data on every loop iteration. |
|
|
534
|
+
| <a id="redis-command-in-loop"></a>[`redis-command-in-loop`](docs/rules/redis-command-in-loop.md) | high | A per-key Redis command runs once per loop iteration. |
|
|
535
|
+
| <a id="redis-keys-command"></a>[`redis-keys-command`](docs/rules/redis-keys-command.md) | high | A Redis KEYS call blocks the server while it scans the keyspace. |
|
|
536
|
+
| <a id="reduce-copy-accumulator"></a>[`reduce-copy-accumulator`](docs/rules/reduce-copy-accumulator.md) | medium | A reduce callback copies its growing accumulator on every step. |
|
|
537
|
+
| <a id="sequential-http-in-loop"></a>[`sequential-http-in-loop`](docs/rules/sequential-http-in-loop.md) | high | Independent HTTP requests are awaited one at a time inside a loop. |
|
|
538
|
+
| <a id="serial-awaits-in-literal"></a>[`serial-awaits-in-literal`](docs/rules/serial-awaits-in-literal.md) | medium | An array or object literal awaits two or more independent values one after another. |
|
|
539
|
+
| <a id="service-query-in-loop"></a>[`service-query-in-loop`](docs/rules/service-query-in-loop.md) | high | A loop calls a project function that runs several database operations per item. |
|
|
540
|
+
| <a id="session-memory-store"></a>[`session-memory-store`](docs/rules/session-memory-store.md) | high | An express-session middleware has no store, so sessions live in process memory. |
|
|
541
|
+
| <a id="sql-select-star-in-query"></a>[`sql-select-star-in-query`](docs/rules/sql-select-star-in-query.md) | low | A raw SQL query selects every column with SELECT * instead of the columns it needs. |
|
|
542
|
+
| <a id="unbounded-list-query"></a>[`unbounded-list-query`](docs/rules/unbounded-list-query.md) | high | A request handler returns query results without an apparent row limit. |
|
|
543
|
+
| <a id="unbounded-module-cache"></a>[`unbounded-module-cache`](docs/rules/unbounded-module-cache.md) | medium | A long-lived cache accepts dynamic keys without an apparent bound or eviction. |
|
|
544
|
+
| <a id="vue-v-for-missing-key"></a>[`vue-v-for-missing-key`](docs/rules/vue-v-for-missing-key.md) | low | A list rendered with h() has no key prop, forcing inefficient patching. |
|
|
545
|
+
| <a id="vue-watch-missing-cleanup"></a>[`vue-watch-missing-cleanup`](docs/rules/vue-watch-missing-cleanup.md) | medium | onMounted registers a global listener, timer or observer with no unmount cleanup. |
|
|
546
|
+
| <a id="whole-payload-in-memory"></a>[`whole-payload-in-memory`](docs/rules/whole-payload-in-memory.md) | medium | An operation loads an entire file, stream, or response into memory. |
|
|
547
|
+
|
|
548
|
+
<!-- loadwise:rules:end -->
|
|
423
549
|
|
|
424
550
|
Source diagnostics include a one-based line and column. Repeat `--ignore RULE` to omit specific JS/TS rules from a run. Keep your project's own type check in CI.
|
|
425
551
|
|
|
@@ -452,14 +578,22 @@ The JS/TS checker resolves declarations from installed drivers and generated cli
|
|
|
452
578
|
| Knex and Kysely | Consumed Knex builders and Kysely SELECT execution methods inside repeated work. Simple single-table queries materialized only to read their length. |
|
|
453
579
|
| node-postgres | Per-item queries, client-side result processing, pool handoff and transaction commands issued through a pool. |
|
|
454
580
|
|
|
455
|
-
|
|
581
|
+
<!-- loadwise:rules:start checker=performance group=orm-and-query-integrity-checks -->
|
|
456
582
|
|
|
457
|
-
|
|
|
458
|
-
|
|
|
459
|
-
| <a id="
|
|
460
|
-
| <a id="
|
|
461
|
-
| <a id="
|
|
462
|
-
| <a id="
|
|
583
|
+
| Rule | Impact | What it flags |
|
|
584
|
+
| ------------------------------------------------------------------------------------------------------------------------------------ | ------ | ---------------------------------------------------------------------------------------- |
|
|
585
|
+
| <a id="drizzle-query-in-loop"></a>[`drizzle-query-in-loop`](docs/rules/drizzle-query-in-loop.md) | high | A Drizzle statement executes once per loop iteration. |
|
|
586
|
+
| <a id="guard-query-per-request"></a>[`guard-query-per-request`](docs/rules/guard-query-per-request.md) | medium | A guard or per-request hook runs a database query before every handler. |
|
|
587
|
+
| <a id="orm-count-materialization"></a>[`orm-count-materialization`](docs/rules/orm-count-materialization.md) | medium | A TypeORM, Sequelize, Mongoose, Knex or Kysely query loads rows only to count them. |
|
|
588
|
+
| <a id="orm-query-in-loop"></a>[`orm-query-in-loop`](docs/rules/orm-query-in-loop.md) | high | A TypeORM, Sequelize, Mongoose, Knex or Kysely operation runs once per loop iteration. |
|
|
589
|
+
| <a id="prisma-distinct-in-memory"></a>[`prisma-distinct-in-memory`](docs/rules/prisma-distinct-in-memory.md) | medium | Prisma findMany with distinct reads every matching row and de-duplicates in memory. |
|
|
590
|
+
| <a id="prisma-relation-count-in-list"></a>[`prisma-relation-count-in-list`](docs/rules/prisma-relation-count-in-list.md) | medium | A paged Prisma findMany selects a relation _count computed over the whole related table. |
|
|
591
|
+
| <a id="typeorm-existence-materialization"></a>[`typeorm-existence-materialization`](docs/rules/typeorm-existence-materialization.md) | medium | A TypeORM entity is loaded only to check whether it exists. |
|
|
592
|
+
| <a id="typeorm-load-then-save"></a>[`typeorm-load-then-save`](docs/rules/typeorm-load-then-save.md) | high | A TypeORM entity is loaded only to change a few fields and save it back. |
|
|
593
|
+
| <a id="typeorm-transaction-in-loop"></a>[`typeorm-transaction-in-loop`](docs/rules/typeorm-transaction-in-loop.md) | high | A loop calls a helper that starts one TypeORM transaction per item. |
|
|
594
|
+
| <a id="typeorm-wide-projection"></a>[`typeorm-wide-projection`](docs/rules/typeorm-wide-projection.md) | low | A TypeORM DTO projection loads wide columns it never uses. |
|
|
595
|
+
|
|
596
|
+
<!-- loadwise:rules:end -->
|
|
463
597
|
|
|
464
598
|
For Prisma, building an array of lazy queries alone is quiet. A sequential `await` inside a loop can trigger the rule. Same-tick `findUnique` callbacks can use Prisma's own batching, so these are left to runtime traces. [Prisma Client reference](https://www.prisma.io/docs/orm/reference/prisma-client-reference#prismapromise-behavior) · [Prisma transactions](https://www.prisma.io/docs/orm/prisma-client/queries/transactions) · [node-postgres transactions](https://node-postgres.com/features/transactions) · [Drizzle conditional filters](https://orm.drizzle.team/docs/guides/conditional-filters-in-query)
|
|
465
599
|
|
|
@@ -469,17 +603,21 @@ Put the policy in the `performance` section of `loadwise.config.json` beside the
|
|
|
469
603
|
|
|
470
604
|
### Async work and sorting
|
|
471
605
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
|
475
|
-
|
|
|
476
|
-
| <a id="
|
|
477
|
-
| <a id="count-then-page-serial"></a
|
|
478
|
-
| <a id="
|
|
479
|
-
| <a id="
|
|
480
|
-
| <a id="
|
|
481
|
-
| <a id="
|
|
482
|
-
| <a id="
|
|
606
|
+
<!-- loadwise:rules:start checker=performance group=async-work-and-sorting -->
|
|
607
|
+
|
|
608
|
+
| Rule | Impact | What it flags |
|
|
609
|
+
| ------------------------------------------------------------------------------------------------------------------------------ | ------ | -------------------------------------------------------------------------------------------- |
|
|
610
|
+
| <a id="await-before-early-exit"></a>[`await-before-early-exit`](docs/rules/await-before-early-exit.md) | medium | An awaited read runs before a guard that returns or throws without using its result. |
|
|
611
|
+
| <a id="count-then-page-serial"></a>[`count-then-page-serial`](docs/rules/count-then-page-serial.md) | low | A count and a page query with the same filter run one after the other. |
|
|
612
|
+
| <a id="drizzle-last-insert-id"></a>[`drizzle-last-insert-id`](docs/rules/drizzle-last-insert-id.md) | medium | A MySQL insert is followed by an extra query for its generated ID. |
|
|
613
|
+
| <a id="known-reads-awaited-serially"></a>[`known-reads-awaited-serially`](docs/rules/known-reads-awaited-serially.md) | medium | Two independent reads from a configured parallelReads group are awaited one after the other. |
|
|
614
|
+
| <a id="numeric-sort-for-extreme"></a>[`numeric-sort-for-extreme`](docs/rules/numeric-sort-for-extreme.md) | low | A numeric sort is used only to read the smallest or largest value. |
|
|
615
|
+
| <a id="prisma-count-for-existence"></a>[`prisma-count-for-existence`](docs/rules/prisma-count-for-existence.md) | medium | A Prisma query counts all matches only to check whether any row exists. |
|
|
616
|
+
| <a id="promise-combinator-serial-await"></a>[`promise-combinator-serial-await`](docs/rules/promise-combinator-serial-await.md) | medium | Promise.all receives calls that were already awaited one by one. |
|
|
617
|
+
| <a id="repeated-workbook-decode"></a>[`repeated-workbook-decode`](docs/rules/repeated-workbook-decode.md) | medium | A workflow decodes the same input with ExcelJS more than once. |
|
|
618
|
+
| <a id="typeorm-unused-count"></a>[`typeorm-unused-count`](docs/rules/typeorm-unused-count.md) | medium | A TypeORM count-and-list query discards its total in immediate tuple destructuring. |
|
|
619
|
+
|
|
620
|
+
<!-- loadwise:rules:end -->
|
|
483
621
|
|
|
484
622
|
The example policy declares that `fetchUser` and `fetchPosts` from `@app/reads` may start together. Only group operations whose ordering, shared connections, rate limits and failure effects your project has reviewed. With that declaration, the checker can flag the pair below. Ordinary adjacent calls such as `saveSettings()` followed by `reloadSettings()` carry no such contract.
|
|
485
623
|
|
|
@@ -504,7 +642,7 @@ npx loadwise perf -p tsconfig.json --fix # asks y/n/a/q for each fix; ne
|
|
|
504
642
|
npx loadwise perf -p tsconfig.json --fix --yes # applies eligible fixes without asking
|
|
505
643
|
```
|
|
506
644
|
|
|
507
|
-
`--fix` answers are **y**es, **n**o, **a**ll remaining and **q**uit. Without a terminal it requires `--yes`. `--fix` cannot be combined with `--watch`, or with `--json` except with `--only`, and `--yes` is valid only with `--fix`. A fix applies only where the original lines still exist, so code that changed since the scan is refused and a change already in the file is reported as already applied. A fix never overwrites an existing file. Like `loadwise fix`, it adds a why-comment above each fixed statement and formats the changed lines with the project's Prettier; `--no-comments` and `--no-format` turn these off. Review the diff and run your tests afterwards. Rewrites that narrow a whole-table Drizzle update to rows with differing values require individual review because the change can affect locking, triggers and affected-row counts. Upload size limits also require individual review. The 10 MiB example can reject valid uploads, so check the endpoint's file requirements and any existing gateway or Multer limits before applying it.
|
|
645
|
+
`--fix` answers are **y**es, **n**o, **a**ll remaining and **q**uit. Without a terminal it requires `--yes`. `--fix` cannot be combined with `--watch`, or with `--json` except with `--only`, and `--yes` is valid only with `--fix`. A fix applies only where the original lines still exist, so code that changed since the scan is refused and a change already in the file is reported as already applied. A fix never overwrites an existing file. Like `loadwise fix`, it adds a why-comment above each fixed statement and formats the changed lines with the project's Prettier; `--no-comments` and `--no-format` turn these off. Review the diff and run your tests afterwards. Rewrites that narrow a whole-table Drizzle update to rows with differing values require individual review because the change can affect locking, triggers and affected-row counts. Upload size limits also require individual review. So does the Mongoose `.lean()` rewrite, because a lean result skips schema defaults, getters and virtuals. The 10 MiB example can reject valid uploads, so check the endpoint's file requirements and any existing gateway or Multer limits before applying it.
|
|
508
646
|
|
|
509
647
|
## Apply fixes by id
|
|
510
648
|
|
|
@@ -530,14 +668,18 @@ Both flags report only findings on changed lines, each with its id, the exact `-
|
|
|
530
668
|
|
|
531
669
|
The source checker reads the project's ORM schema (Prisma, Drizzle, TypeORM, Sequelize, Mongoose) and compares declared indexes with the queries it finds.
|
|
532
670
|
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
|
536
|
-
|
|
|
537
|
-
| <a id="index-missing-
|
|
538
|
-
| <a id="index-
|
|
539
|
-
| <a id="index-
|
|
540
|
-
| <a id="index-redundant-prefix"></a
|
|
671
|
+
<!-- loadwise:rules:start checker=performance group=schema-aware-index-checks -->
|
|
672
|
+
|
|
673
|
+
| Rule | Impact | What it flags |
|
|
674
|
+
| ------------------------------------------------------------------------------------------------------------ | ------ | ---------------------------------------------------------------------------------------------------------------- |
|
|
675
|
+
| <a id="index-missing-filter"></a>[`index-missing-filter`](docs/rules/index-missing-filter.md) | high | A query filters on a column that no index leads with. |
|
|
676
|
+
| <a id="index-missing-foreign-key"></a>[`index-missing-foreign-key`](docs/rules/index-missing-foreign-key.md) | high | A foreign key column in the schema has no index. |
|
|
677
|
+
| <a id="index-missing-order"></a>[`index-missing-order`](docs/rules/index-missing-order.md) | medium | A query orders by columns that no index serves in that order. |
|
|
678
|
+
| <a id="index-redundant-prefix"></a>[`index-redundant-prefix`](docs/rules/index-redundant-prefix.md) | low | An index repeats the leading columns of a longer index on the same table, adding write cost for no read benefit. |
|
|
679
|
+
| <a id="index-unusable-expression"></a>[`index-unusable-expression`](docs/rules/index-unusable-expression.md) | high | A function or expression on an indexed column keeps the index from being used. |
|
|
680
|
+
| <a id="index-unusable-pattern"></a>[`index-unusable-pattern`](docs/rules/index-unusable-pattern.md) | high | A predicate such as a leading-wildcard LIKE cannot use an ordinary index. |
|
|
681
|
+
|
|
682
|
+
<!-- loadwise:rules:end -->
|
|
541
683
|
|
|
542
684
|
Each suggested index carries one explicit name, used both in the ORM snippet (`@@index([a, b], map: "<name>")`, `@Index('<name>', ['a', 'b'])`, `{ name: '<name>', fields: [...] }`, `index('<name>')`, `schema.index({ a: 1 }, { name: '<name>' })`) and in the `CREATE INDEX CONCURRENTLY` statement for a live database, so building it by hand and then generating a migration does not create a duplicate. A fix that adds an index to a Prisma, TypeORM or Drizzle model says to generate a migration for it.
|
|
543
685
|
|
|
@@ -549,25 +691,29 @@ Pass `--schema snapshot.json` (written by `db --schema-snapshot`) to refine them
|
|
|
549
691
|
|
|
550
692
|
Performance and maintainability scans retry files when the bundled parser rejects a Java marker annotation before varargs or a C# 14 conditional member assignment (`=`) in a simple identifier chain. The retry uses a position-preserving copy in memory and still fails if the parser reports a syntax error.
|
|
551
693
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
|
555
|
-
|
|
|
556
|
-
| <a id="
|
|
557
|
-
| <a id="
|
|
558
|
-
| <a id="go-fixed-regexp-in-loop"></a
|
|
559
|
-
| <a id="
|
|
560
|
-
| <a id="
|
|
561
|
-
| <a id="
|
|
562
|
-
| <a id="
|
|
563
|
-
| <a id="
|
|
564
|
-
| <a id="
|
|
565
|
-
| <a id="
|
|
566
|
-
| <a id="
|
|
567
|
-
| <a id="
|
|
568
|
-
| <a id="
|
|
569
|
-
| <a id="
|
|
570
|
-
| <a id="rust-
|
|
694
|
+
<!-- loadwise:rules:start checker=performance group=polyglot-source-checks -->
|
|
695
|
+
|
|
696
|
+
| Rule | Impact | What it flags |
|
|
697
|
+
| --------------------------------------------------------------------------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------- |
|
|
698
|
+
| <a id="csharp-fixed-regex-in-loop"></a>[`csharp-fixed-regex-in-loop`](docs/rules/csharp-fixed-regex-in-loop.md) | medium | A C# Regex with a fixed pattern is constructed inside a loop. |
|
|
699
|
+
| <a id="csharp-string-concat-in-loop"></a>[`csharp-string-concat-in-loop`](docs/rules/csharp-string-concat-in-loop.md) | medium | String concatenation in a C# loop allocates repeatedly; use StringBuilder. |
|
|
700
|
+
| <a id="go-fixed-regexp-in-loop"></a>[`go-fixed-regexp-in-loop`](docs/rules/go-fixed-regexp-in-loop.md) | medium | A Go regexp with a fixed pattern is compiled inside a loop. |
|
|
701
|
+
| <a id="go-sql-query-in-loop"></a>[`go-sql-query-in-loop`](docs/rules/go-sql-query-in-loop.md) | high | A Go database query executes inside a loop instead of batching. |
|
|
702
|
+
| <a id="go-string-concat-in-loop"></a>[`go-string-concat-in-loop`](docs/rules/go-string-concat-in-loop.md) | medium | String concatenation in a Go loop allocates repeatedly; use strings.Builder. |
|
|
703
|
+
| <a id="java-fixed-regex-in-loop"></a>[`java-fixed-regex-in-loop`](docs/rules/java-fixed-regex-in-loop.md) | medium | A Java Pattern with a fixed pattern is compiled inside a loop. |
|
|
704
|
+
| <a id="java-jdbc-query-in-loop"></a>[`java-jdbc-query-in-loop`](docs/rules/java-jdbc-query-in-loop.md) | high | A JDBC query executes inside a Java loop instead of batching. |
|
|
705
|
+
| <a id="java-string-concat-in-loop"></a>[`java-string-concat-in-loop`](docs/rules/java-string-concat-in-loop.md) | medium | String concatenation in a Java loop allocates repeatedly; use StringBuilder. |
|
|
706
|
+
| <a id="python-blocking-sleep-in-async"></a>[`python-blocking-sleep-in-async`](docs/rules/python-blocking-sleep-in-async.md) | high | A blocking time.sleep call runs inside a Python async def function. |
|
|
707
|
+
| <a id="python-copy-growing-list"></a>[`python-copy-growing-list`](docs/rules/python-copy-growing-list.md) | medium | A Python loop rebuilds a growing list with items = items + [value]. |
|
|
708
|
+
| <a id="python-fixed-regex-in-loop"></a>[`python-fixed-regex-in-loop`](docs/rules/python-fixed-regex-in-loop.md) | low | A Python loop compiles a fixed pattern with re.compile on every iteration. |
|
|
709
|
+
| <a id="python-n-plus-one-orm-loop"></a>[`python-n-plus-one-orm-loop`](docs/rules/python-n-plus-one-orm-loop.md) | high | An ORM query executes inside a Python loop instead of using eager loading or batching. |
|
|
710
|
+
| <a id="python-sync-requests-in-async"></a>[`python-sync-requests-in-async`](docs/rules/python-sync-requests-in-async.md) | high | A blocking requests HTTP call runs inside a Python async def function. |
|
|
711
|
+
| <a id="python-unbounded-comprehension"></a>[`python-unbounded-comprehension`](docs/rules/python-unbounded-comprehension.md) | medium | A Python list comprehension materializes an unbounded collection in memory. |
|
|
712
|
+
| <a id="rust-clone-in-loop"></a>[`rust-clone-in-loop`](docs/rules/rust-clone-in-loop.md) | low | Cloning values inside a Rust loop adds avoidable heap allocations. |
|
|
713
|
+
| <a id="rust-fixed-regex-in-loop"></a>[`rust-fixed-regex-in-loop`](docs/rules/rust-fixed-regex-in-loop.md) | medium | A Rust Regex with a fixed pattern is compiled inside a loop. |
|
|
714
|
+
| <a id="rust-format-in-loop"></a>[`rust-format-in-loop`](docs/rules/rust-format-in-loop.md) | low | Calling format! inside a Rust loop allocates a new String on every iteration. |
|
|
715
|
+
|
|
716
|
+
<!-- loadwise:rules:end -->
|
|
571
717
|
|
|
572
718
|
## Trace checks in other languages and databases
|
|
573
719
|
|
|
@@ -575,12 +721,16 @@ Supply a local **OTLP/JSON trace export** with `resourceSpans → scopeSpans →
|
|
|
575
721
|
|
|
576
722
|
Try `npx loadwise perf traces node_modules/loadwise/examples/repeated-db.otlp.json`. The example reports five similar MongoDB operations under one parent. The trace rules use current and legacy database attributes and deduplicate span IDs.
|
|
577
723
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
|
581
|
-
|
|
|
582
|
-
| <a id="
|
|
583
|
-
| <a id="
|
|
724
|
+
<!-- loadwise:rules:start checker=performance group=trace-checks-in-other-languages-and-databases -->
|
|
725
|
+
|
|
726
|
+
| Rule | Impact | What it flags |
|
|
727
|
+
| ------------------------------------------------------------------------------------------ | ------ | ------------------------------------------------------------------- |
|
|
728
|
+
| <a id="duplicate-key-read"></a>[`duplicate-key-read`](docs/rules/duplicate-key-read.md) | medium | A trace repeats the same key or row read under one parent span. |
|
|
729
|
+
| <a id="redis-keys-scan"></a>[`redis-keys-scan`](docs/rules/redis-keys-scan.md) | high | A trace shows a Redis KEYS command scanning the keyspace. |
|
|
730
|
+
| <a id="redis-repeated-read"></a>[`redis-repeated-read`](docs/rules/redis-repeated-read.md) | medium | A trace shows repeated sibling Redis GET or HGET calls. |
|
|
731
|
+
| <a id="repeated-db-span"></a>[`repeated-db-span`](docs/rules/repeated-db-span.md) | high | A trace shows many similar sibling database calls under one parent. |
|
|
732
|
+
|
|
733
|
+
<!-- loadwise:rules:end -->
|
|
584
734
|
|
|
585
735
|
Matching keys in two reads are a reason to consider **request-local** reuse when authorization, freshness and ordering allow it. Keep existing telemetry redaction. A redacted key can still support a batching finding. Reports contain span IDs and counts and omit raw SQL, parameters and keys. Check `scannedSpans` and `eligibleDbSpans` when interpreting a clean result. Sampling, missing parents, different literal values and coarse summaries affect grouping. [OpenTelemetry database spans](https://opentelemetry.io/docs/specs/semconv/db/database-spans/) · [OTLP JSON encoding](https://opentelemetry.io/docs/specs/otlp/#json-protobuf-encoding)
|
|
586
736
|
|
|
@@ -588,11 +738,18 @@ Matching keys in two reads are a reason to consider **request-local** reuse when
|
|
|
588
738
|
|
|
589
739
|
Feed the CLI a JSON file from PostgreSQL `EXPLAIN (ANALYZE, FORMAT JSON)` or MongoDB `explain("executionStats")`. For example, run `npx loadwise perf plan node_modules/loadwise/examples/postgres-plan.json`. The checker reads the file locally. PostgreSQL's `ANALYZE` option executes the statement when you collect the plan. [PostgreSQL EXPLAIN](https://www.postgresql.org/docs/current/using-explain.html) · [MongoDB explain results](https://www.mongodb.com/docs/manual/reference/explain-results/)
|
|
590
740
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
|
594
|
-
|
|
|
595
|
-
| <a id="
|
|
741
|
+
<!-- loadwise:rules:start checker=performance group=executed-query-plans -->
|
|
742
|
+
|
|
743
|
+
| Rule | Impact | What it flags |
|
|
744
|
+
| ------------------------------------------------------------------------------------------------ | ------ | -------------------------------------------------------------------- |
|
|
745
|
+
| <a id="mongo-collection-scan"></a>[`mongo-collection-scan`](docs/rules/mongo-collection-scan.md) | high | A MongoDB plan scans many documents for each one it returns. |
|
|
746
|
+
| <a id="mongo-deep-skip"></a>[`mongo-deep-skip`](docs/rules/mongo-deep-skip.md) | high | A MongoDB query skips past many documents to return a page. |
|
|
747
|
+
| <a id="mongo-disk-sort"></a>[`mongo-disk-sort`](docs/rules/mongo-disk-sort.md) | medium | A MongoDB sort spilled to disk. |
|
|
748
|
+
| <a id="pg-deep-offset"></a>[`pg-deep-offset`](docs/rules/pg-deep-offset.md) | high | A PostgreSQL plan walks past many rows with OFFSET to return a page. |
|
|
749
|
+
| <a id="pg-disk-sort"></a>[`pg-disk-sort`](docs/rules/pg-disk-sort.md) | medium | A PostgreSQL sort spilled to disk. |
|
|
750
|
+
| <a id="pg-sequential-scan"></a>[`pg-sequential-scan`](docs/rules/pg-sequential-scan.md) | high | A PostgreSQL plan scans many rows for each one it returns. |
|
|
751
|
+
|
|
752
|
+
<!-- loadwise:rules:end -->
|
|
596
753
|
|
|
597
754
|
Results include the stage path and observed counts. PostgreSQL and MongoDB planner estimates alone return exit 2. MongoDB coverage includes classic executed query stages and selected slot-based scan/filter and skip shapes. Unsupported layouts return an input error where a scan cannot be attributed.
|
|
598
755
|
|
|
@@ -617,7 +774,21 @@ npx loadwise perf --schema snapshot.json
|
|
|
617
774
|
| `--measure --i-understand-this-locks-tables` | PostgreSQL staging only. Time each suggested index for `--queries` by building it in a rolled-back transaction. |
|
|
618
775
|
| `--runs N` | `EXPLAIN ANALYZE` runs per side for `--measure` (default 5). |
|
|
619
776
|
|
|
620
|
-
|
|
777
|
+
Rules: `db-unindexed-foreign-key`, `db-unused-index`, `db-duplicate-index`, `db-seq-scan-heavy-table`, `db-slow-query-plan`, `db-missing-index` and, for MongoDB, `mongo-collection-scan-observed`. `--include-contextual`, `--ignore RULE` and `--json` work as in the other commands.
|
|
778
|
+
|
|
779
|
+
<!-- loadwise:rules:start checker=performance group=database-inspection-optional -->
|
|
780
|
+
|
|
781
|
+
| Rule | Impact | What it flags |
|
|
782
|
+
| --------------------------------------------------------------------------------------------------------------------------- | ------ | ---------------------------------------------------------------------------- |
|
|
783
|
+
| <a id="db-duplicate-index"></a>[`db-duplicate-index`](docs/rules/db-duplicate-index.md) | low | A database index is covered by another index on the same table. |
|
|
784
|
+
| <a id="db-missing-index"></a>[`db-missing-index`](docs/rules/db-missing-index.md) | high | A query plan scans a table that a suggested index would let it seek. |
|
|
785
|
+
| <a id="db-seq-scan-heavy-table"></a>[`db-seq-scan-heavy-table`](docs/rules/db-seq-scan-heavy-table.md) | high | A large table is read by many sequential scans on the live database. |
|
|
786
|
+
| <a id="db-slow-query-plan"></a>[`db-slow-query-plan`](docs/rules/db-slow-query-plan.md) | high | One of the slowest statements reads a table with a full table scan. |
|
|
787
|
+
| <a id="db-unindexed-foreign-key"></a>[`db-unindexed-foreign-key`](docs/rules/db-unindexed-foreign-key.md) | high | A foreign key on the live database has no index that leads with its columns. |
|
|
788
|
+
| <a id="db-unused-index"></a>[`db-unused-index`](docs/rules/db-unused-index.md) | low | A database index has not been scanned since statistics were last reset. |
|
|
789
|
+
| <a id="mongo-collection-scan-observed"></a>[`mongo-collection-scan-observed`](docs/rules/mongo-collection-scan-observed.md) | high | Profiled MongoDB operations scanned a whole collection. |
|
|
790
|
+
|
|
791
|
+
<!-- loadwise:rules:end -->
|
|
621
792
|
|
|
622
793
|
**Safety guarantees.** Statements go through a read-only gateway: sessions and transactions are read-only, with a 5 s statement timeout on PostgreSQL, and only SELECT, INSERT, UPDATE and DELETE can be explained. `EXPLAIN ANALYZE` runs only for a plain SELECT (a `WITH` that modifies data is refused). MongoDB uses a command allowlist. Error text is redacted: the connection URL, host, user, password and resolved IP addresses are replaced with `[redacted]`. Usage counters come from the node that answered, so an index unused here may still be used on a replica.
|
|
623
794
|
|
|
@@ -640,130 +811,6 @@ Every finding carries an impact level. `--min-impact <low|medium|high|critical>`
|
|
|
640
811
|
- `medium`: a measurable but local cost, or significant maintainability debt.
|
|
641
812
|
- `low`: a micro-optimization or a readability issue.
|
|
642
813
|
|
|
643
|
-
| Rule | Impact |
|
|
644
|
-
| ----------------------------------- | -------- |
|
|
645
|
-
| `pg-unreleased-checkout` | critical |
|
|
646
|
-
| `pool-created-per-request-or-item` | critical |
|
|
647
|
-
| `db-missing-index` | high |
|
|
648
|
-
| `db-seq-scan-heavy-table` | high |
|
|
649
|
-
| `db-slow-query-plan` | high |
|
|
650
|
-
| `db-unindexed-foreign-key` | high |
|
|
651
|
-
| `drizzle-query-in-loop` | high |
|
|
652
|
-
| `external-call-in-transaction` | high |
|
|
653
|
-
| `unbounded-list-query` | high |
|
|
654
|
-
| `unbounded-module-cache` | medium |
|
|
655
|
-
| `whole-payload-in-memory` | medium |
|
|
656
|
-
| `list-query-overfetch` | medium |
|
|
657
|
-
| `orm-deep-offset` | high |
|
|
658
|
-
| `list-count-per-request` | medium |
|
|
659
|
-
| `notification-send-in-loop` | high |
|
|
660
|
-
| `session-memory-store` | high |
|
|
661
|
-
| `orm-cartesian-include` | high |
|
|
662
|
-
| `json-roundtrip-clone` | low |
|
|
663
|
-
| `mongoose-hydrate-for-to-object` | medium |
|
|
664
|
-
| `express-missing-compression` | low |
|
|
665
|
-
| `heavy-media-in-request-handler` | medium |
|
|
666
|
-
| `react-index-as-key` | low |
|
|
667
|
-
| `react-fetch-in-effect-no-abort` | low |
|
|
668
|
-
| `react-inline-object-in-jsx-prop` | low |
|
|
669
|
-
| `angular-default-change-detection` | low |
|
|
670
|
-
| `vue-v-for-missing-key` | low |
|
|
671
|
-
| `dom-listener-without-cleanup` | low |
|
|
672
|
-
| `dom-unthrottled-scroll-resize` | low |
|
|
673
|
-
| `frontend-barrel-heavy-import` | low |
|
|
674
|
-
| `sql-select-star-in-query` | low |
|
|
675
|
-
| `react-missing-cleanup` | medium |
|
|
676
|
-
| `angular-subscribe-without-cleanup` | medium |
|
|
677
|
-
| `vue-watch-missing-cleanup` | medium |
|
|
678
|
-
| `dom-layout-thrashing` | medium |
|
|
679
|
-
| `mongoose-missing-lean` | medium |
|
|
680
|
-
| `graphql-n-plus-one-resolver` | high |
|
|
681
|
-
| `react-context-value-recreated` | low |
|
|
682
|
-
| `node-event-listener-leak` | high |
|
|
683
|
-
| `json-stringify-in-loop` | medium |
|
|
684
|
-
| `sequential-http-in-loop` | high |
|
|
685
|
-
| `index-redundant-prefix` | low |
|
|
686
|
-
| `drizzle-last-insert-id` | medium |
|
|
687
|
-
| `repeated-workbook-decode` | medium |
|
|
688
|
-
| `index-missing-filter` | high |
|
|
689
|
-
| `index-missing-foreign-key` | high |
|
|
690
|
-
| `index-unusable-expression` | high |
|
|
691
|
-
| `index-unusable-pattern` | high |
|
|
692
|
-
| `mongo-collection-scan` | high |
|
|
693
|
-
| `mongo-collection-scan-observed` | high |
|
|
694
|
-
| `mongo-deep-skip` | high |
|
|
695
|
-
| `node-sync-crypto-in-async` | high |
|
|
696
|
-
| `node-sync-process-in-async` | high |
|
|
697
|
-
| `orm-query-in-loop` | high |
|
|
698
|
-
| `password-hash-sync-in-async` | high |
|
|
699
|
-
| `pg-deep-offset` | high |
|
|
700
|
-
| `pg-query-in-loop` | high |
|
|
701
|
-
| `pg-sequential-scan` | high |
|
|
702
|
-
| `prisma-query-in-loop` | high |
|
|
703
|
-
| `queue-add-in-loop` | high |
|
|
704
|
-
| `rebuild-lookup-in-loop` | high |
|
|
705
|
-
| `redis-command-in-loop` | high |
|
|
706
|
-
| `redis-keys-command` | high |
|
|
707
|
-
| `redis-keys-scan` | high |
|
|
708
|
-
| `repeated-db-span` | high |
|
|
709
|
-
| `service-query-in-loop` | high |
|
|
710
|
-
| `typeorm-load-then-save` | high |
|
|
711
|
-
| `typeorm-transaction-in-loop` | high |
|
|
712
|
-
| `array-repeated-find` | medium |
|
|
713
|
-
| `array-repeated-membership` | medium |
|
|
714
|
-
| `await-before-early-exit` | medium |
|
|
715
|
-
| `csharp-fixed-regex-in-loop` | medium |
|
|
716
|
-
| `duplicate-key-read` | medium |
|
|
717
|
-
| `go-fixed-regexp-in-loop` | medium |
|
|
718
|
-
| `guard-query-per-request` | medium |
|
|
719
|
-
| `index-missing-order` | medium |
|
|
720
|
-
| `java-fixed-regex-in-loop` | medium |
|
|
721
|
-
| `known-reads-awaited-serially` | medium |
|
|
722
|
-
| `loop-copy-accumulator` | medium |
|
|
723
|
-
| `mongo-disk-sort` | medium |
|
|
724
|
-
| `node-sync-compression-in-async` | medium |
|
|
725
|
-
| `node-sync-fs-in-async` | medium |
|
|
726
|
-
| `orm-count-materialization` | medium |
|
|
727
|
-
| `password-hash-pure-js` | medium |
|
|
728
|
-
| `pg-count-materialization` | medium |
|
|
729
|
-
| `pg-disk-sort` | medium |
|
|
730
|
-
| `pg-filter-materialization` | medium |
|
|
731
|
-
| `pg-first-materialization` | medium |
|
|
732
|
-
| `pg-top-k-materialization` | medium |
|
|
733
|
-
| `prisma-count-materialization` | medium |
|
|
734
|
-
| `prisma-distinct-in-memory` | medium |
|
|
735
|
-
| `prisma-filter-materialization` | medium |
|
|
736
|
-
| `prisma-first-materialization` | medium |
|
|
737
|
-
| `prisma-relation-count-in-list` | medium |
|
|
738
|
-
| `prisma-top-k-materialization` | medium |
|
|
739
|
-
| `promise-combinator-serial-await` | medium |
|
|
740
|
-
| `python-copy-growing-list` | medium |
|
|
741
|
-
| `python-sync-requests-in-async` | high |
|
|
742
|
-
| `python-blocking-sleep-in-async` | high |
|
|
743
|
-
| `python-fixed-regex-in-loop` | low |
|
|
744
|
-
| `python-n-plus-one-orm-loop` | high |
|
|
745
|
-
| `python-unbounded-comprehension` | medium |
|
|
746
|
-
| `go-sql-query-in-loop` | high |
|
|
747
|
-
| `go-string-concat-in-loop` | medium |
|
|
748
|
-
| `java-string-concat-in-loop` | medium |
|
|
749
|
-
| `java-jdbc-query-in-loop` | high |
|
|
750
|
-
| `csharp-string-concat-in-loop` | medium |
|
|
751
|
-
| `rust-clone-in-loop` | low |
|
|
752
|
-
| `rust-format-in-loop` | low |
|
|
753
|
-
| `redis-repeated-read` | medium |
|
|
754
|
-
| `reduce-copy-accumulator` | medium |
|
|
755
|
-
| `rust-fixed-regex-in-loop` | medium |
|
|
756
|
-
| `serial-awaits-in-literal` | medium |
|
|
757
|
-
| `typeorm-existence-materialization` | medium |
|
|
758
|
-
| `count-then-page-serial` | low |
|
|
759
|
-
| `typeorm-unused-count` | medium |
|
|
760
|
-
| `prisma-count-for-existence` | medium |
|
|
761
|
-
| `db-duplicate-index` | low |
|
|
762
|
-
| `db-unused-index` | low |
|
|
763
|
-
| `filter-for-existence` | low |
|
|
764
|
-
| `numeric-sort-for-extreme` | low |
|
|
765
|
-
| `typeorm-wide-projection` | low |
|
|
766
|
-
|
|
767
814
|
## Verification and benchmarks
|
|
768
815
|
|
|
769
816
|
Integration checks used PostgreSQL 18.0 and MongoDB 8.2.3. Each engine examined 20,000 records for one match before an index was added. The corresponding indexed read passed. In both databases a deep page walked 15,010 entries to return ten, and the equivalent keyset query passed. Both engines also produced a disk-sort finding. MongoDB's live test used classic execution stages.
|
|
@@ -774,9 +821,9 @@ Use Node.js 22.13+ for the full development workflow, including the in-memory SQ
|
|
|
774
821
|
|
|
775
822
|
### Source conventions
|
|
776
823
|
|
|
777
|
-
The CLI and checkers are TypeScript (`.ts`) compiled in place to ES modules (`.js`, not committed) by `npm run build`, while
|
|
824
|
+
The CLI and checkers are TypeScript (`.ts`) compiled in place to ES modules (`.js`, not committed) by `npm run build`, while the security example tables under `lib/security/examples/` are `.cts` compiled to CommonJS (`.cjs`); `npm test` builds first and `npm run typecheck` checks without emitting. Import with the runtime extension (`.js` or `.cjs`). The compiler runs in `strict` mode.
|
|
778
825
|
|
|
779
|
-
- Write ES `import`/`export`, with imports at the top of the file. `require()
|
|
826
|
+
- Write ES `import`/`export`, with imports at the top of the file. Oxlint rejects `require()`. Where load order or startup cost forbids a top-level import (the compiler must be chosen before the rules load, and `maint --staged` must not load TypeScript), load lazily in an async function with `await import()`.
|
|
780
827
|
- No `any` and no `as` assertions (`as const` is fine) in new code. Narrow with type guards, give a function a precise type, or use overloads. A deliberate exception needs a lint-disable comment that says why.
|
|
781
828
|
- Types shared by two or more files live in the `types/` folder of their area (`lib/performance/types/`, `lib/security/types/`, `lib/maintainability/types/`, `lib/shared/types/`, `test/types/`), one topic per file. Cross-pillar types are in `lib/shared/types.ts`. A type used by one file stays in that file.
|
|
782
829
|
- Comments wrap at 100 columns, and Prettier formats everything. `.vscode/settings.json` formats on save, and the pre-commit hook in `hooks/` formats and lints staged files (`npm install` enables it).
|
|
@@ -821,70 +868,97 @@ Sentry also has an N+1 detector that considers sequential spans and their total
|
|
|
821
868
|
|
|
822
869
|
The rules from `pg-transaction-on-pool` to `swallowed-error` moved from the performance and maintainability checkers with the same ids, so existing `// loadwise-reviewed` comments, `--ignore` flags and config `rules` entries keep working. Migration and API contract rules are described in [Migration safety](#migration-safety) and [API contract safety](#api-contract-safety). `csharp-async-void` and the `python-`, `go-`, `java-`, `csharp-` and `rust-` rules come from `loadwise rel polyglot`, which needs the optional ast-grep executable.
|
|
823
870
|
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
|
827
|
-
|
|
|
828
|
-
| <a id="
|
|
829
|
-
| <a id="
|
|
830
|
-
| <a id="
|
|
831
|
-
| <a id="
|
|
832
|
-
| <a id="
|
|
833
|
-
| <a id="
|
|
834
|
-
| <a id="
|
|
835
|
-
| <a id="
|
|
836
|
-
| <a id="
|
|
837
|
-
| <a id="
|
|
838
|
-
| <a id="drizzle-write-preflight"></a
|
|
839
|
-
| <a id="
|
|
840
|
-
| <a id="
|
|
841
|
-
| <a id="
|
|
842
|
-
| <a id="
|
|
843
|
-
| <a id="
|
|
844
|
-
| <a id="
|
|
845
|
-
| <a id="
|
|
846
|
-
| <a id="
|
|
847
|
-
| <a id="
|
|
848
|
-
| <a id="
|
|
849
|
-
| <a id="
|
|
850
|
-
| <a id="json-parse-unguarded"></a
|
|
851
|
-
| <a id="
|
|
852
|
-
| <a id="
|
|
853
|
-
| <a id="
|
|
854
|
-
| <a id="
|
|
855
|
-
| <a id="
|
|
856
|
-
| <a id="
|
|
857
|
-
| <a id="
|
|
858
|
-
| <a id="
|
|
859
|
-
| <a id="
|
|
860
|
-
| <a id="
|
|
861
|
-
| <a id="
|
|
862
|
-
| <a id="
|
|
863
|
-
| <a id="
|
|
864
|
-
| <a id="
|
|
865
|
-
| <a id="
|
|
866
|
-
| <a id="
|
|
867
|
-
| <a id="
|
|
868
|
-
| <a id="
|
|
869
|
-
| <a id="
|
|
870
|
-
| <a id="
|
|
871
|
-
| <a id="
|
|
872
|
-
| <a id="
|
|
871
|
+
<!-- loadwise:rules:start checker=reliability group=source-rules -->
|
|
872
|
+
|
|
873
|
+
| Rule | Impact | What it flags |
|
|
874
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
875
|
+
| <a id="assignment-in-condition"></a>[`assignment-in-condition`](docs/rules/assignment-in-condition.md) | high | A condition assigns with = where a comparison was probably meant. |
|
|
876
|
+
| <a id="async-callback-unhandled-rejection"></a>[`async-callback-unhandled-rejection`](docs/rules/async-callback-unhandled-rejection.md) | high | An async callback given to an event emitter, timer or scheduler has no error handling, so a rejection is unhandled. |
|
|
877
|
+
| <a id="async-route-unhandled-rejection"></a>[`async-route-unhandled-rejection`](docs/rules/async-route-unhandled-rejection.md) | high | An Express 4 async route handler has no error handling, so a rejection never reaches the error middleware. |
|
|
878
|
+
| <a id="browser-not-closed"></a>[`browser-not-closed`](docs/rules/browser-not-closed.md) | high | A Playwright or Puppeteer browser is not closed in a finally block, so an error leaves the process running. |
|
|
879
|
+
| <a id="check-then-update-race"></a>[`check-then-update-race`](docs/rules/check-then-update-race.md) | high | A Mongoose or Sequelize document's numeric field is read, changed in JavaScript and saved without a transaction, losing concurrent updates. |
|
|
880
|
+
| <a id="child-process-without-error-listener"></a>[`child-process-without-error-listener`](docs/rules/child-process-without-error-listener.md) | high | A spawned child process has no 'error' listener, so a failed spawn crashes the parent process. |
|
|
881
|
+
| <a id="csharp-async-void"></a>[`csharp-async-void`](docs/rules/csharp-async-void.md) | high | An async void method cannot be awaited and can crash the process on unhandled exceptions. |
|
|
882
|
+
| <a id="csharp-disposable-without-using"></a>[`csharp-disposable-without-using`](docs/rules/csharp-disposable-without-using.md) | medium | A C# stream, connection or other IDisposable is created without using, so an exception leaks it. |
|
|
883
|
+
| <a id="discarded-error-result"></a>[`discarded-error-result`](docs/rules/discarded-error-result.md) | high | A call discards a typed Either or Result that can carry a failure as a value. |
|
|
884
|
+
| <a id="drizzle-unfiltered-write"></a>[`drizzle-unfiltered-write`](docs/rules/drizzle-unfiltered-write.md) | critical | A Drizzle update or delete executes without an effective where clause. |
|
|
885
|
+
| <a id="drizzle-write-preflight"></a>[`drizzle-write-preflight`](docs/rules/drizzle-write-preflight.md) | medium | A separate existence check before a Drizzle write can race with another request. |
|
|
886
|
+
| <a id="error-logged-without-stack"></a>[`error-logged-without-stack`](docs/rules/error-logged-without-stack.md) | low | A catch block logs only error.message and carries on, so the stack trace is lost. |
|
|
887
|
+
| <a id="error-rethrown-without-cause"></a>[`error-rethrown-without-cause`](docs/rules/error-rethrown-without-cause.md) | low | A catch block throws a new error without the caught one, so the original message and stack are lost. |
|
|
888
|
+
| <a id="file-handle-not-closed"></a>[`file-handle-not-closed`](docs/rules/file-handle-not-closed.md) | high | A FileHandle from fs/promises open() is not closed on every path, leaking a file descriptor. |
|
|
889
|
+
| <a id="find-then-create-race"></a>[`find-then-create-race`](docs/rules/find-then-create-race.md) | high | A lookup by key is followed by an insert with that key, with no unique constraint to stop duplicates. |
|
|
890
|
+
| <a id="floating-promise"></a>[`floating-promise`](docs/rules/floating-promise.md) | high | A promise-returning call is neither awaited, returned nor handled, so its failure goes unseen. |
|
|
891
|
+
| <a id="go-defer-before-error-check"></a>[`go-defer-before-error-check`](docs/rules/go-defer-before-error-check.md) | high | A Go defer closes a resource before its error is checked, so a failed open dereferences nil. |
|
|
892
|
+
| <a id="go-error-discarded"></a>[`go-error-discarded`](docs/rules/go-error-discarded.md) | high | A Go error result is assigned to the blank identifier and never checked. |
|
|
893
|
+
| <a id="http-call-without-timeout"></a>[`http-call-without-timeout`](docs/rules/http-call-without-timeout.md) | high | A fetch or axios call has no timeout or abort signal. |
|
|
894
|
+
| <a id="interval-not-cleared"></a>[`interval-not-cleared`](docs/rules/interval-not-cleared.md) | medium | A setInterval handle is discarded or never cleared, so the timer outlives its owner. |
|
|
895
|
+
| <a id="invalid-typeof-comparison"></a>[`invalid-typeof-comparison`](docs/rules/invalid-typeof-comparison.md) | high | A typeof result is compared to a string typeof never returns, so the check never matches. |
|
|
896
|
+
| <a id="java-resource-without-try"></a>[`java-resource-without-try`](docs/rules/java-resource-without-try.md) | high | A Java stream, reader or connection is opened outside try-with-resources, so an exception leaks it. |
|
|
897
|
+
| <a id="json-parse-unguarded"></a>[`json-parse-unguarded`](docs/rules/json-parse-unguarded.md) | medium | JSON.parse runs on outside input with no try/catch, so malformed input throws where it is not handled. |
|
|
898
|
+
| <a id="loop-index-past-length"></a>[`loop-index-past-length`](docs/rules/loop-index-past-length.md) | high | A loop runs its index up to and including length, so the last pass reads past the end. |
|
|
899
|
+
| <a id="mongoose-aggregate-uncast-id"></a>[`mongoose-aggregate-uncast-id`](docs/rules/mongoose-aggregate-uncast-id.md) | high | A Mongoose aggregate $match compares _id to an uncast string instead of an ObjectId. |
|
|
900
|
+
| <a id="nan-comparison"></a>[`nan-comparison`](docs/rules/nan-comparison.md) | high | A value is compared to NaN with an equality operator, which is never true. |
|
|
901
|
+
| <a id="next-server-env-in-client"></a>[`next-server-env-in-client`](docs/rules/next-server-env-in-client.md) | high | A 'use client' file reads a process.env variable without the NEXT_PUBLIC_ prefix, so it is unavailable in the browser by default. |
|
|
902
|
+
| <a id="payment-missing-idempotency-key"></a>[`payment-missing-idempotency-key`](docs/rules/payment-missing-idempotency-key.md) | high | A Stripe call that moves money has no idempotency key, so a retry can charge or pay out twice. |
|
|
903
|
+
| <a id="pg-transaction-on-pool"></a>[`pg-transaction-on-pool`](docs/rules/pg-transaction-on-pool.md) | critical | A transaction statement is sent to a pool, so its statements can run on different connections. |
|
|
904
|
+
| <a id="pool-without-connection-timeout"></a>[`pool-without-connection-timeout`](docs/rules/pool-without-connection-timeout.md) | medium | A pg Pool or Client sets no connectionTimeoutMillis, so its default of 0 waits for a connection forever. |
|
|
905
|
+
| <a id="prisma-dependent-writes"></a>[`prisma-dependent-writes`](docs/rules/prisma-dependent-writes.md) | high | Adjacent Prisma creates pass a value from the first record into the next write. |
|
|
906
|
+
| <a id="prisma-read-modify-write"></a>[`prisma-read-modify-write`](docs/rules/prisma-read-modify-write.md) | critical | A Prisma read feeds a numeric update of the same row, losing concurrent updates. |
|
|
907
|
+
| <a id="prisma-transaction-client-escape"></a>[`prisma-transaction-client-escape`](docs/rules/prisma-transaction-client-escape.md) | critical | A Prisma call inside an interactive transaction uses the outer client instead of the transaction client. |
|
|
908
|
+
| <a id="promise-return-escapes-catch"></a>[`promise-return-escapes-catch`](docs/rules/promise-return-escapes-catch.md) | high | Returning a promise directly from a protected try block can bypass its catch on rejection. |
|
|
909
|
+
| <a id="python-bare-except"></a>[`python-bare-except`](docs/rules/python-bare-except.md) | medium | A bare except also catches SystemExit and KeyboardInterrupt, hiding shutdowns and bugs. |
|
|
910
|
+
| <a id="python-swallowed-exception"></a>[`python-swallowed-exception`](docs/rules/python-swallowed-exception.md) | medium | A Python except block only passes, so the failure is dropped silently. |
|
|
911
|
+
| <a id="query-runner-not-released"></a>[`query-runner-not-released`](docs/rules/query-runner-not-released.md) | critical | A TypeORM QueryRunner is not released in a finally block, so an error leaks its pooled connection. |
|
|
912
|
+
| <a id="react-async-effect-callback"></a>[`react-async-effect-callback`](docs/rules/react-async-effect-callback.md) | medium | An async function is passed to useEffect, so its promise is treated as the cleanup function and its errors go unhandled. |
|
|
913
|
+
| <a id="react-effect-sets-state-every-render"></a>[`react-effect-sets-state-every-render`](docs/rules/react-effect-sets-state-every-render.md) | high | An effect with no dependency array sets state to a new value on every run, so the component re-renders forever. |
|
|
914
|
+
| <a id="react-list-missing-key"></a>[`react-list-missing-key`](docs/rules/react-list-missing-key.md) | medium | An element or fragment returned from .map() has no key prop, so React cannot track items when the list changes. |
|
|
915
|
+
| <a id="react-state-mutated-in-place"></a>[`react-state-mutated-in-place`](docs/rules/react-state-mutated-in-place.md) | high | A useState value is mutated in place and passed to its own setter, so React sees the same reference and skips the re-render. |
|
|
916
|
+
| <a id="redis-incr-then-expire"></a>[`redis-incr-then-expire`](docs/rules/redis-incr-then-expire.md) | medium | A Redis counter increment and its expire on the same key are two round trips and not atomic. |
|
|
917
|
+
| <a id="request-number-unvalidated"></a>[`request-number-unvalidated`](docs/rules/request-number-unvalidated.md) | medium | A number parsed from request input reaches a query or calculation with no NaN or range check. |
|
|
918
|
+
| <a id="retry-without-backoff"></a>[`retry-without-backoff`](docs/rules/retry-without-backoff.md) | medium | A retry loop calls the network again with no delay between attempts. |
|
|
919
|
+
| <a id="return-in-finally"></a>[`return-in-finally`](docs/rules/return-in-finally.md) | high | Returning from finally can replace a pending return value or suppress a thrown error. |
|
|
920
|
+
| <a id="return-newline"></a>[`return-newline`](docs/rules/return-newline.md) | high | A line break after return ends the statement before the apparent return value. |
|
|
921
|
+
| <a id="rust-unwrap-in-production"></a>[`rust-unwrap-in-production`](docs/rules/rust-unwrap-in-production.md) | medium | Rust code outside tests calls unwrap(), turning an Err or None into a panic. |
|
|
922
|
+
| <a id="sql-insert-truncated-at-semicolon"></a>[`sql-insert-truncated-at-semicolon`](docs/rules/sql-insert-truncated-at-semicolon.md) | high | A SQL dump parser ends INSERT values at a semicolon inside quoted text. |
|
|
923
|
+
| <a id="stream-pipe-unhandled-error"></a>[`stream-pipe-unhandled-error`](docs/rules/stream-pipe-unhandled-error.md) | high | A stream is piped with .pipe() and no error handling, so a stream error can crash the process or leak the file. |
|
|
924
|
+
| <a id="swallowed-error"></a>[`swallowed-error`](docs/rules/swallowed-error.md) | medium | A catch block drops the error and the code after the try carries on as if it succeeded. |
|
|
925
|
+
| <a id="switch-not-exhaustive"></a>[`switch-not-exhaustive`](docs/rules/switch-not-exhaustive.md) | medium | A switch over a union or enum has no default and misses members, so the missing value leaves the result undefined. |
|
|
926
|
+
| <a id="throw-non-error"></a>[`throw-non-error`](docs/rules/throw-non-error.md) | medium | A string, number or object literal is thrown instead of an Error, so there is no stack trace. |
|
|
927
|
+
| <a id="typeorm-transaction-client-escape"></a>[`typeorm-transaction-client-escape`](docs/rules/typeorm-transaction-client-escape.md) | critical | A write inside a TypeORM transaction goes through a repository not bound to it. |
|
|
928
|
+
| <a id="unbounded-promise-all"></a>[`unbounded-promise-all`](docs/rules/unbounded-promise-all.md) | high | Promise.all runs over an unbounded collection without a concurrency limit, risking memory spikes or downstream saturation. |
|
|
929
|
+
| <a id="uncaught-exception-continues"></a>[`uncaught-exception-continues`](docs/rules/uncaught-exception-continues.md) | high | An uncaughtException handler neither exits nor rethrows, so the process keeps running in an undefined state. |
|
|
930
|
+
| <a id="unguarded-boundary-access"></a>[`unguarded-boundary-access`](docs/rules/unguarded-boundary-access.md) | medium | A nested property is read from outside input or a lookup that can be missing, so absent data throws a TypeError. |
|
|
931
|
+
| <a id="unreachable-code"></a>[`unreachable-code`](docs/rules/unreachable-code.md) | medium | Statements follow a return, throw, break or continue in the same block and never run. |
|
|
932
|
+
| <a id="upload-without-size-limit"></a>[`upload-without-size-limit`](docs/rules/upload-without-size-limit.md) | high | A multer or Nest upload interceptor has no file size limit. |
|
|
933
|
+
| <a id="webhook-missing-idempotency-check"></a>[`webhook-missing-idempotency-check`](docs/rules/webhook-missing-idempotency-check.md) | medium | A webhook route inserts rows without first checking whether the event was already processed. |
|
|
934
|
+
|
|
935
|
+
<!-- loadwise:rules:end -->
|
|
873
936
|
|
|
874
937
|
## Migration safety
|
|
875
938
|
|
|
876
939
|
`npx loadwise rel migrations` reads Prisma, Drizzle, TypeORM, Knex and Sequelize migrations (SQL or code) and flags statements that lock or rewrite a table. It reads files only. `--dialect postgres|mysql` selects the rule set, `--json` for structured output and `--ignore RULE` to skip a rule. The older `loadwise perf migrations` and `loadwise perf contracts` still work and print a note pointing to `rel`.
|
|
877
940
|
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
|
881
|
-
|
|
|
882
|
-
| <a id="migration-
|
|
883
|
-
| <a id="migration-
|
|
884
|
-
| <a id="migration-
|
|
885
|
-
| <a id="migration-
|
|
886
|
-
| <a id="migration-
|
|
887
|
-
| <a id="migration-
|
|
941
|
+
<!-- loadwise:rules:start checker=reliability group=migration-safety -->
|
|
942
|
+
|
|
943
|
+
| Rule | Impact | What it flags |
|
|
944
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------ | -------- | -------------------------------------------------------------------------------------- |
|
|
945
|
+
| <a id="migration-breaking-drop"></a>[`migration-breaking-drop`](docs/rules/migration-breaking-drop.md) | critical | A migration drops a column or table that running code may still use. |
|
|
946
|
+
| <a id="migration-breaking-rename"></a>[`migration-breaking-rename`](docs/rules/migration-breaking-rename.md) | high | A migration renames a column or table that running code may still use. |
|
|
947
|
+
| <a id="migration-column-type-rewrite"></a>[`migration-column-type-rewrite`](docs/rules/migration-column-type-rewrite.md) | critical | A migration changes a column type in a way that rewrites the table. |
|
|
948
|
+
| <a id="migration-concurrent-in-transaction"></a>[`migration-concurrent-in-transaction`](docs/rules/migration-concurrent-in-transaction.md) | high | A CONCURRENTLY index statement runs inside a transaction, where PostgreSQL rejects it. |
|
|
949
|
+
| <a id="migration-constraint-not-valid"></a>[`migration-constraint-not-valid`](docs/rules/migration-constraint-not-valid.md) | high | A constraint is added and validated in one step instead of NOT VALID first. |
|
|
950
|
+
| <a id="migration-constraint-without-index"></a>[`migration-constraint-without-index`](docs/rules/migration-constraint-without-index.md) | high | A unique or primary key constraint builds its index while blocking writes. |
|
|
951
|
+
| <a id="migration-index-not-concurrent"></a>[`migration-index-not-concurrent`](docs/rules/migration-index-not-concurrent.md) | critical | A PostgreSQL index is built without CONCURRENTLY, blocking writes to the table. |
|
|
952
|
+
| <a id="migration-missing-lock-timeout"></a>[`migration-missing-lock-timeout`](docs/rules/migration-missing-lock-timeout.md) | high | A migration statement takes a lock with no lock_timeout set. |
|
|
953
|
+
| <a id="migration-mysql-lock-unspecified"></a>[`migration-mysql-lock-unspecified`](docs/rules/migration-mysql-lock-unspecified.md) | high | A MySQL ALTER does not state its LOCK level. |
|
|
954
|
+
| <a id="migration-mysql-table-copy"></a>[`migration-mysql-table-copy`](docs/rules/migration-mysql-table-copy.md) | critical | A MySQL ALTER copies the whole table. |
|
|
955
|
+
| <a id="migration-not-null-without-default"></a>[`migration-not-null-without-default`](docs/rules/migration-not-null-without-default.md) | high | A NOT NULL column is added without a default, which fails once rows exist. |
|
|
956
|
+
| <a id="migration-set-not-null-scan"></a>[`migration-set-not-null-scan`](docs/rules/migration-set-not-null-scan.md) | high | SET NOT NULL scans the whole table while holding a lock. |
|
|
957
|
+
| <a id="migration-table-rewrite-command"></a>[`migration-table-rewrite-command`](docs/rules/migration-table-rewrite-command.md) | critical | A migration runs VACUUM FULL, CLUSTER or REINDEX, which rewrites or locks the table. |
|
|
958
|
+
| <a id="migration-unparsed"></a>[`migration-unparsed`](docs/rules/migration-unparsed.md) | low | A migration statement could not be parsed and needs a manual review. |
|
|
959
|
+
| <a id="migration-volatile-default"></a>[`migration-volatile-default`](docs/rules/migration-volatile-default.md) | high | A column is added with a volatile default, which rewrites the table. |
|
|
960
|
+
|
|
961
|
+
<!-- loadwise:rules:end -->
|
|
888
962
|
|
|
889
963
|
Only new migrations fail the run. Older migrations are contextual: counted, listed with `--include-contextual`, and never exit 1.
|
|
890
964
|
|
|
@@ -913,13 +987,17 @@ It compares three kinds of source:
|
|
|
913
987
|
- **GraphQL SDL** (`*.graphql`, `*.gql`, for example the `schema.gql` a code-first server emits). Query documents are skipped.
|
|
914
988
|
- **NestJS classes** used as `@Body()` types or as controller return types (also `@ApiResponse({ type })`), found in `*.controller.ts` and read from the file that declares them (relative imports only). Only property names, `?`, `@IsOptional()` and the written type text are compared.
|
|
915
989
|
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
|
919
|
-
|
|
|
920
|
-
| <a id="api-
|
|
921
|
-
| <a id="api-
|
|
922
|
-
| <a id="api-
|
|
990
|
+
<!-- loadwise:rules:start checker=reliability group=api-contract-safety -->
|
|
991
|
+
|
|
992
|
+
| Rule | Impact | What it flags |
|
|
993
|
+
| --------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------ |
|
|
994
|
+
| <a id="api-enum-value-removed"></a>[`api-enum-value-removed`](docs/rules/api-enum-value-removed.md) | high | An enum value or string-literal option that clients could send was removed. |
|
|
995
|
+
| <a id="api-removed-field"></a>[`api-removed-field`](docs/rules/api-removed-field.md) | high | A response field, GraphQL type, field, argument or union member, or returned DTO property was removed. |
|
|
996
|
+
| <a id="api-removed-operation"></a>[`api-removed-operation`](docs/rules/api-removed-operation.md) | critical | An OpenAPI operation or a GraphQL Query, Mutation or Subscription field was removed. |
|
|
997
|
+
| <a id="api-required-input"></a>[`api-required-input`](docs/rules/api-required-input.md) | high | A request field, parameter or GraphQL argument is new and required, or became required. |
|
|
998
|
+
| <a id="api-type-changed"></a>[`api-type-changed`](docs/rules/api-type-changed.md) | high | A field or parameter changed type, or a GraphQL type changed nullability in a breaking direction. |
|
|
999
|
+
|
|
1000
|
+
<!-- loadwise:rules:end -->
|
|
923
1001
|
|
|
924
1002
|
Removals point at the line in the old version (the message says so); every other finding points at the new line. A new version next to the old one (`/v2/users` added while `/v1/users` stays) breaks nothing and is not flagged. A removed request property is flagged only when the project builds a `ValidationPipe` with `forbidNonWhitelisted: true`, because only then do clients that still send it get a 400. Properties inherited from a base class in a relative import count as the class's own.
|
|
925
1003
|
|
|
@@ -930,77 +1008,7 @@ npx loadwise check --changed-since origin/main
|
|
|
930
1008
|
|
|
931
1009
|
## Impact levels
|
|
932
1010
|
|
|
933
|
-
The levels and the `--min-impact` flag work as described under the performance checker's impact levels. `loadwise rel` and the reliability section of `loadwise check` use
|
|
934
|
-
|
|
935
|
-
| Rule | Impact |
|
|
936
|
-
| ------------------------------------- | -------- |
|
|
937
|
-
| `api-removed-operation` | critical |
|
|
938
|
-
| `drizzle-unfiltered-write` | critical |
|
|
939
|
-
| `migration-breaking-drop` | critical |
|
|
940
|
-
| `migration-column-type-rewrite` | critical |
|
|
941
|
-
| `migration-index-not-concurrent` | critical |
|
|
942
|
-
| `migration-mysql-table-copy` | critical |
|
|
943
|
-
| `migration-table-rewrite-command` | critical |
|
|
944
|
-
| `pg-transaction-on-pool` | critical |
|
|
945
|
-
| `prisma-read-modify-write` | critical |
|
|
946
|
-
| `prisma-transaction-client-escape` | critical |
|
|
947
|
-
| `query-runner-not-released` | critical |
|
|
948
|
-
| `typeorm-transaction-client-escape` | critical |
|
|
949
|
-
| `api-enum-value-removed` | high |
|
|
950
|
-
| `api-removed-field` | high |
|
|
951
|
-
| `api-required-input` | high |
|
|
952
|
-
| `api-type-changed` | high |
|
|
953
|
-
| `assignment-in-condition` | high |
|
|
954
|
-
| `async-callback-unhandled-rejection` | high |
|
|
955
|
-
| `async-route-unhandled-rejection` | high |
|
|
956
|
-
| `browser-not-closed` | high |
|
|
957
|
-
| `check-then-update-race` | high |
|
|
958
|
-
| `csharp-async-void` | high |
|
|
959
|
-
| `discarded-error-result` | high |
|
|
960
|
-
| `file-handle-not-closed` | high |
|
|
961
|
-
| `find-then-create-race` | high |
|
|
962
|
-
| `floating-promise` | high |
|
|
963
|
-
| `go-defer-before-error-check` | high |
|
|
964
|
-
| `go-error-discarded` | high |
|
|
965
|
-
| `http-call-without-timeout` | high |
|
|
966
|
-
| `invalid-typeof-comparison` | high |
|
|
967
|
-
| `java-resource-without-try` | high |
|
|
968
|
-
| `loop-index-past-length` | high |
|
|
969
|
-
| `migration-breaking-rename` | high |
|
|
970
|
-
| `migration-concurrent-in-transaction` | high |
|
|
971
|
-
| `migration-constraint-not-valid` | high |
|
|
972
|
-
| `migration-constraint-without-index` | high |
|
|
973
|
-
| `migration-missing-lock-timeout` | high |
|
|
974
|
-
| `migration-mysql-lock-unspecified` | high |
|
|
975
|
-
| `migration-not-null-without-default` | high |
|
|
976
|
-
| `migration-set-not-null-scan` | high |
|
|
977
|
-
| `migration-volatile-default` | high |
|
|
978
|
-
| `mongoose-aggregate-uncast-id` | high |
|
|
979
|
-
| `nan-comparison` | high |
|
|
980
|
-
| `payment-missing-idempotency-key` | high |
|
|
981
|
-
| `prisma-dependent-writes` | high |
|
|
982
|
-
| `promise-return-escapes-catch` | high |
|
|
983
|
-
| `return-in-finally` | high |
|
|
984
|
-
| `return-newline` | high |
|
|
985
|
-
| `sql-insert-truncated-at-semicolon` | high |
|
|
986
|
-
| `stream-pipe-unhandled-error` | high |
|
|
987
|
-
| `unbounded-promise-all` | high |
|
|
988
|
-
| `upload-without-size-limit` | high |
|
|
989
|
-
| `csharp-disposable-without-using` | medium |
|
|
990
|
-
| `drizzle-write-preflight` | medium |
|
|
991
|
-
| `interval-not-cleared` | medium |
|
|
992
|
-
| `json-parse-unguarded` | medium |
|
|
993
|
-
| `python-bare-except` | medium |
|
|
994
|
-
| `python-swallowed-exception` | medium |
|
|
995
|
-
| `redis-incr-then-expire` | medium |
|
|
996
|
-
| `request-number-unvalidated` | medium |
|
|
997
|
-
| `retry-without-backoff` | medium |
|
|
998
|
-
| `rust-unwrap-in-production` | medium |
|
|
999
|
-
| `swallowed-error` | medium |
|
|
1000
|
-
| `unguarded-boundary-access` | medium |
|
|
1001
|
-
| `unreachable-code` | medium |
|
|
1002
|
-
| `webhook-missing-idempotency-check` | medium |
|
|
1003
|
-
| `migration-unparsed` | low |
|
|
1011
|
+
The levels and the `--min-impact` flag work as described under the performance checker's impact levels. `loadwise rel` and the reliability section of `loadwise check` use the impact levels in the rule index.
|
|
1004
1012
|
|
|
1005
1013
|
# Maintainability checker
|
|
1006
1014
|
|
|
@@ -1008,23 +1016,33 @@ The levels and the `--min-impact` flag work as described under the performance c
|
|
|
1008
1016
|
|
|
1009
1017
|
## What gets checked
|
|
1010
1018
|
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
|
1014
|
-
|
|
|
1015
|
-
| <a id="
|
|
1016
|
-
| <a id="
|
|
1017
|
-
| <a id="
|
|
1018
|
-
| <a id="
|
|
1019
|
-
| <a id="
|
|
1020
|
-
| <a id="
|
|
1021
|
-
| <a id="
|
|
1022
|
-
| <a id="
|
|
1023
|
-
| <a id="
|
|
1024
|
-
| <a id="
|
|
1025
|
-
| <a id="
|
|
1026
|
-
| <a id="
|
|
1027
|
-
| <a id="
|
|
1019
|
+
<!-- loadwise:rules:start checker=maintainability group=what-gets-checked -->
|
|
1020
|
+
|
|
1021
|
+
| Rule | Impact | What it flags |
|
|
1022
|
+
| ------------------------------------------------------------------------------------------------------------------------ | ------ | ----------------------------------------------------------------------------------------------- |
|
|
1023
|
+
| <a id="data-access-boundary"></a>[`data-access-boundary`](docs/rules/data-access-boundary.md) | medium | A file outside the approved paths imports a configured database driver or ORM. |
|
|
1024
|
+
| <a id="deep-control-flow"></a>[`deep-control-flow`](docs/rules/deep-control-flow.md) | low | Control structures are nested four levels deep. |
|
|
1025
|
+
| <a id="dependency-cycle"></a>[`dependency-cycle`](docs/rules/dependency-cycle.md) | high | An eager chain of internal imports leads back to the module it started from. |
|
|
1026
|
+
| <a id="deprecated-node-api"></a>[`deprecated-node-api`](docs/rules/deprecated-node-api.md) | medium | A deprecated Node.js API is used: new Buffer(), url.parse() or fs.exists(). |
|
|
1027
|
+
| <a id="double-type-assertion"></a>[`double-type-assertion`](docs/rules/double-type-assertion.md) | low | A value is cast through unknown or any to a second type, bypassing the type checker. |
|
|
1028
|
+
| <a id="duplicate-implementation"></a>[`duplicate-implementation`](docs/rules/duplicate-implementation.md) | medium | Substantial functions share the same implementation. |
|
|
1029
|
+
| <a id="file-placement"></a>[`file-placement`](docs/rules/file-placement.md) | low | A file with a configured suffix sits outside its allowed folders. |
|
|
1030
|
+
| <a id="focused-test-committed"></a>[`focused-test-committed`](docs/rules/focused-test-committed.md) | medium | A committed .only, fit or fdescribe makes the test runner skip every other test. |
|
|
1031
|
+
| <a id="folder-boundary"></a>[`folder-boundary`](docs/rules/folder-boundary.md) | medium | An import crosses a folder boundary the team declared. |
|
|
1032
|
+
| <a id="high-branch-complexity"></a>[`high-branch-complexity`](docs/rules/high-branch-complexity.md) | medium | A function reaches a branch complexity score of 15. |
|
|
1033
|
+
| <a id="large-class"></a>[`large-class`](docs/rules/large-class.md) | low | A class has more than 30 methods, accessors, constructors or function-valued fields. |
|
|
1034
|
+
| <a id="large-module"></a>[`large-module`](docs/rules/large-module.md) | low | A file has more than 600 lines of code. |
|
|
1035
|
+
| <a id="long-parameter-list"></a>[`long-parameter-list`](docs/rules/long-parameter-list.md) | low | A function takes more than 5 positional parameters. |
|
|
1036
|
+
| <a id="query-mutates-state"></a>[`query-mutates-state`](docs/rules/query-mutates-state.md) | medium | A method marked @maintainabilityQuery writes through this. |
|
|
1037
|
+
| <a id="stray-console"></a>[`stray-console`](docs/rules/stray-console.md) | low | A console call in production code bypasses the logger, so its output has no level or structure. |
|
|
1038
|
+
| <a id="ts-suppression-without-reason"></a>[`ts-suppression-without-reason`](docs/rules/ts-suppression-without-reason.md) | low | A @ts-ignore, @ts-expect-error or @ts-nocheck directive has no explanation. |
|
|
1039
|
+
| <a id="tsconfig-strict-disabled"></a>[`tsconfig-strict-disabled`](docs/rules/tsconfig-strict-disabled.md) | medium | A tsconfig turns off strict type checking. |
|
|
1040
|
+
| <a id="unreferenced-file"></a>[`unreferenced-file`](docs/rules/unreferenced-file.md) | low | A source file that nothing imports and that is not an entry point. |
|
|
1041
|
+
| <a id="unused-export"></a>[`unused-export`](docs/rules/unused-export.md) | low | An export that no scanned file imports. |
|
|
1042
|
+
| <a id="unused-import"></a>[`unused-import`](docs/rules/unused-import.md) | low | An imported name is never used in the file. |
|
|
1043
|
+
| <a id="unused-local-variable"></a>[`unused-local-variable`](docs/rules/unused-local-variable.md) | low | A local variable is assigned but never read. |
|
|
1044
|
+
|
|
1045
|
+
<!-- loadwise:rules:end -->
|
|
1028
1046
|
|
|
1029
1047
|
JS and TS source checks use the TypeScript parser. The optional ast-grep executable supplies native parsers for Python, Go, Java, C#, Rust, PHP, Ruby, Kotlin, C and C++. The nesting rule recognizes specific grammar constructs. Braceless forms and pattern-matching constructs have different coverage across languages. A `.h` file uses the C grammar. Use a C++ header extension for C++ grammar.
|
|
1030
1048
|
|
|
@@ -1061,12 +1079,7 @@ npx loadwise maint . --fix --yes # applies every fix without asking
|
|
|
1061
1079
|
|
|
1062
1080
|
`--fix` is refused with `--json` or `--graph`, and `--yes` alone is refused. Without a terminal, `--fix` requires `--yes`. A fix applies only where the original lines still exist. One that an earlier fix made stale is skipped and reappears, rebuilt, on the next run. Review the diff and run your tests afterwards.
|
|
1063
1081
|
|
|
1064
|
-
|
|
1065
|
-
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1066
|
-
| `deep-control-flow` | Lifts the deepest branch one level with a guard clause, a merged nested `if`, or by dropping an `else` after a branch that exits. |
|
|
1067
|
-
| `high-branch-complexity` | Combines nested conditional expressions with the same literal success label while preserving short-circuit order. Other fixes merge nested `if`s, join adjacent same-exit `if`s with `\|\|`, turn `x ? true : false` into `Boolean(x)`, and `if (!x) x = value` into `x \|\|= value`. |
|
|
1068
|
-
| `duplicate-implementation` | Keeps one top-level function and makes each other copy delegate to it, adding an import where needed. Applied only when every name the copies use resolves to the same binding. |
|
|
1069
|
-
| `dependency-cycle` | Turns an import whose names are used only as types into `import type`, which removes that edge from the runtime cycle. |
|
|
1082
|
+
The rules with an automatic rewrite are `deep-control-flow`, `high-branch-complexity`, `duplicate-implementation` and `dependency-cycle`. Each rule page describes its rewrite.
|
|
1070
1083
|
|
|
1071
1084
|
Other rules have no automatic rewrite.
|
|
1072
1085
|
|
|
@@ -1124,27 +1137,6 @@ Only the changed files are analysed, while imports still resolve through the who
|
|
|
1124
1137
|
|
|
1125
1138
|
The levels and the `--min-impact` flag work as described under the performance checker's impact levels.
|
|
1126
1139
|
|
|
1127
|
-
| Rule | Impact |
|
|
1128
|
-
| -------------------------- | ------ |
|
|
1129
|
-
| `dependency-cycle` | high |
|
|
1130
|
-
| `data-access-boundary` | medium |
|
|
1131
|
-
| `deprecated-node-api` | medium |
|
|
1132
|
-
| `duplicate-implementation` | medium |
|
|
1133
|
-
| `folder-boundary` | medium |
|
|
1134
|
-
| `high-branch-complexity` | medium |
|
|
1135
|
-
| `query-mutates-state` | medium |
|
|
1136
|
-
| `syntax-error` | medium |
|
|
1137
|
-
| `deep-control-flow` | low |
|
|
1138
|
-
| `file-placement` | low |
|
|
1139
|
-
| `large-class` | low |
|
|
1140
|
-
| `large-module` | low |
|
|
1141
|
-
| `long-parameter-list` | low |
|
|
1142
|
-
| `stray-console` | low |
|
|
1143
|
-
| `unreferenced-file` | low |
|
|
1144
|
-
| `unused-export` | low |
|
|
1145
|
-
| `unused-import` | low |
|
|
1146
|
-
| `unused-local-variable` | low |
|
|
1147
|
-
|
|
1148
1140
|
# Security checker
|
|
1149
1141
|
|
|
1150
1142
|
`loadwise sec` reports code paths where input or missing scope can expose data: runtime text composed into SQL and, when the project declares them, Prisma and Drizzle queries that do not prove their row scope. Findings are review prompts with a location, a rule ID, an impact level, a generic fix example and, where it is safe, a source-based fix.
|
|
@@ -1164,77 +1156,84 @@ It accepts the source-check flags of `loadwise perf`, including `--format`, `--m
|
|
|
1164
1156
|
|
|
1165
1157
|
## Rules
|
|
1166
1158
|
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
|
1170
|
-
|
|
|
1171
|
-
| <a id="
|
|
1172
|
-
| <a id="
|
|
1173
|
-
| <a id="
|
|
1174
|
-
| <a id="
|
|
1175
|
-
| <a id="
|
|
1176
|
-
| <a id="
|
|
1177
|
-
| <a id="
|
|
1178
|
-
| <a id="
|
|
1179
|
-
| <a id="
|
|
1180
|
-
| <a id="
|
|
1181
|
-
| <a id="
|
|
1182
|
-
| <a id="
|
|
1183
|
-
| <a id="
|
|
1184
|
-
| <a id="
|
|
1185
|
-
| <a id="
|
|
1186
|
-
| <a id="
|
|
1187
|
-
| <a id="
|
|
1188
|
-
| <a id="
|
|
1189
|
-
| <a id="
|
|
1190
|
-
| <a id="
|
|
1191
|
-
| <a id="
|
|
1192
|
-
| <a id="
|
|
1193
|
-
| <a id="
|
|
1194
|
-
| <a id="
|
|
1195
|
-
| <a id="
|
|
1196
|
-
| <a id="
|
|
1197
|
-
| <a id="secret
|
|
1198
|
-
| <a id="
|
|
1199
|
-
| <a id="
|
|
1200
|
-
| <a id="
|
|
1201
|
-
| <a id="
|
|
1202
|
-
| <a id="
|
|
1203
|
-
| <a id="
|
|
1204
|
-
| <a id="
|
|
1205
|
-
| <a id="
|
|
1206
|
-
| <a id="
|
|
1207
|
-
| <a id="mass-assignment"></a
|
|
1208
|
-
| <a id="
|
|
1209
|
-
| <a id="
|
|
1210
|
-
| <a id="
|
|
1211
|
-
| <a id="
|
|
1212
|
-
| <a id="
|
|
1213
|
-
| <a id="
|
|
1214
|
-
| <a id="
|
|
1215
|
-
| <a id="
|
|
1216
|
-
| <a id="
|
|
1217
|
-
| <a id="
|
|
1218
|
-
| <a id="
|
|
1219
|
-
| <a id="
|
|
1220
|
-
| <a id="
|
|
1221
|
-
| <a id="
|
|
1222
|
-
| <a id="
|
|
1223
|
-
| <a id="
|
|
1224
|
-
| <a id="
|
|
1225
|
-
| <a id="
|
|
1226
|
-
| <a id="
|
|
1227
|
-
| <a id="
|
|
1228
|
-
| <a id="
|
|
1229
|
-
| <a id="
|
|
1230
|
-
| <a id="
|
|
1231
|
-
| <a id="
|
|
1232
|
-
| <a id="
|
|
1233
|
-
| <a id="
|
|
1234
|
-
| <a id="
|
|
1235
|
-
| <a id="
|
|
1236
|
-
| <a id="
|
|
1237
|
-
| <a id="
|
|
1159
|
+
<!-- loadwise:rules:start checker=security group=rules -->
|
|
1160
|
+
|
|
1161
|
+
| Rule | Impact | What it flags |
|
|
1162
|
+
| ------------------------------------------------------------------------------------------------------------------------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1163
|
+
| <a id="angular-bypass-security-trust"></a>[`angular-bypass-security-trust`](docs/rules/angular-bypass-security-trust.md) | high | DomSanitizer.bypassSecurityTrust* is called on a dynamic value, which turns off Angular's built-in sanitization. |
|
|
1164
|
+
| <a id="auth-route-without-rate-limit"></a>[`auth-route-without-rate-limit`](docs/rules/auth-route-without-rate-limit.md) | medium | A login, signup or password-reset route has no rate limiter. |
|
|
1165
|
+
| <a id="bcrypt-low-cost"></a>[`bcrypt-low-cost`](docs/rules/bcrypt-low-cost.md) | medium | A bcrypt password hash uses a work factor below the recommended minimum. |
|
|
1166
|
+
| <a id="client-env-secret-exposed"></a>[`client-env-secret-exposed`](docs/rules/client-env-secret-exposed.md) | critical | A secret-named env variable is read under a browser prefix (NEXT_PUBLIC_, VITE_, REACT_APP_...), so the build ships it to every visitor. |
|
|
1167
|
+
| <a id="code-injection"></a>[`code-injection`](docs/rules/code-injection.md) | critical | Request-controlled input becomes source code evaluated by the application. |
|
|
1168
|
+
| <a id="command-injection"></a>[`command-injection`](docs/rules/command-injection.md) | critical | Request-controlled input reaches a shell command string. |
|
|
1169
|
+
| <a id="committed-secret"></a>[`committed-secret`](docs/rules/committed-secret.md) | critical | A tracked file contains a value that appears to be a credential. |
|
|
1170
|
+
| <a id="compose-hardcoded-secret"></a>[`compose-hardcoded-secret`](docs/rules/compose-hardcoded-secret.md) | high | A Docker Compose service supplies a secret as a literal environment value. |
|
|
1171
|
+
| <a id="cookie-missing-security-flags"></a>[`cookie-missing-security-flags`](docs/rules/cookie-missing-security-flags.md) | high | A sensitive cookie is set without the expected security attributes. |
|
|
1172
|
+
| <a id="cors-credentials-any-origin"></a>[`cors-credentials-any-origin`](docs/rules/cors-credentials-any-origin.md) | high | A credentialed CORS response allows arbitrary origins. |
|
|
1173
|
+
| <a id="cors-origin-regex-unanchored"></a>[`cors-origin-regex-unanchored`](docs/rules/cors-origin-regex-unanchored.md) | medium | A CORS origin regex also accepts look-alike hosts. |
|
|
1174
|
+
| <a id="database-error-in-response"></a>[`database-error-in-response`](docs/rules/database-error-in-response.md) | medium | An HTTP response includes a raw database error message. |
|
|
1175
|
+
| <a id="dockerfile-add-remote-url"></a>[`dockerfile-add-remote-url`](docs/rules/dockerfile-add-remote-url.md) | medium | A Dockerfile ADD instruction retrieves a resource from a remote URL. |
|
|
1176
|
+
| <a id="dockerfile-runs-as-root"></a>[`dockerfile-runs-as-root`](docs/rules/dockerfile-runs-as-root.md) | medium | The final image selects root or inherits an unverified base-image user. |
|
|
1177
|
+
| <a id="dockerfile-secret-in-build"></a>[`dockerfile-secret-in-build`](docs/rules/dockerfile-secret-in-build.md) | high | A Dockerfile exposes a secret through a build argument or environment variable. |
|
|
1178
|
+
| <a id="dockerfile-unpinned-base-image"></a>[`dockerfile-unpinned-base-image`](docs/rules/dockerfile-unpinned-base-image.md) | low | A Dockerfile uses a base image reference that can change between builds. |
|
|
1179
|
+
| <a id="dom-xss-sink"></a>[`dom-xss-sink`](docs/rules/dom-xss-sink.md) | high | Untrusted or dynamic HTML reaches innerHTML, outerHTML, insertAdjacentHTML, document.write or createContextualFragment (DOM XSS). |
|
|
1180
|
+
| <a id="drizzle-scope-unverified"></a>[`drizzle-scope-unverified`](docs/rules/drizzle-scope-unverified.md) | high | A Drizzle operation lacks the row scope required by the declared policy. |
|
|
1181
|
+
| <a id="drizzle-sql-raw-dynamic"></a>[`drizzle-sql-raw-dynamic`](docs/rules/drizzle-sql-raw-dynamic.md) | critical | A dynamic SQL fragment reaches Drizzle without parameter binding. |
|
|
1182
|
+
| <a id="error-stack-in-response"></a>[`error-stack-in-response`](docs/rules/error-stack-in-response.md) | medium | An HTTP response includes an internal error stack. |
|
|
1183
|
+
| <a id="express-cookie-auth-missing-csrf"></a>[`express-cookie-auth-missing-csrf`](docs/rules/express-cookie-auth-missing-csrf.md) | high | Cookie-based session or auth is paired with state-changing routes without CSRF protection or `sameSite: "strict"`. |
|
|
1184
|
+
| <a id="express-missing-helmet"></a>[`express-missing-helmet`](docs/rules/express-missing-helmet.md) | low | The Express or NestJS server starts without helmet security headers middleware (contextual: a proxy may set them). |
|
|
1185
|
+
| <a id="frontend-storage-secret-token"></a>[`frontend-storage-secret-token`](docs/rules/frontend-storage-secret-token.md) | medium | A token, JWT, password or API key is stored in localStorage or sessionStorage, readable by any script on the page. |
|
|
1186
|
+
| <a id="graphql-batching-unbounded"></a>[`graphql-batching-unbounded`](docs/rules/graphql-batching-unbounded.md) | medium | GraphQL query batching is enabled without a batch size, query depth, or cost/complexity limit. |
|
|
1187
|
+
| <a id="graphql-introspection-enabled"></a>[`graphql-introspection-enabled`](docs/rules/graphql-introspection-enabled.md) | medium | A GraphQL server explicitly enables schema introspection. |
|
|
1188
|
+
| <a id="graphql-query-depth-unbounded"></a>[`graphql-query-depth-unbounded`](docs/rules/graphql-query-depth-unbounded.md) | medium | A GraphQL server accepts queries of any depth. |
|
|
1189
|
+
| <a id="hardcoded-secret"></a>[`hardcoded-secret`](docs/rules/hardcoded-secret.md) | critical | The source supplies a literal credential or cryptographic secret. |
|
|
1190
|
+
| <a id="insecure-cipher"></a>[`insecure-cipher`](docs/rules/insecure-cipher.md) | medium | A cryptographic operation selects an insecure cipher or mode. |
|
|
1191
|
+
| <a id="insecure-random-for-secret"></a>[`insecure-random-for-secret`](docs/rules/insecure-random-for-secret.md) | high | A sensitive token or secret uses a non-cryptographic random source. |
|
|
1192
|
+
| <a id="jsx-javascript-url"></a>[`jsx-javascript-url`](docs/rules/jsx-javascript-url.md) | high | In React 18 and older or Preact, a URL search parameter or location hash starts a JSX href, action or iframe src (javascript: XSS). |
|
|
1193
|
+
| <a id="jwt-decode-for-auth"></a>[`jwt-decode-for-auth`](docs/rules/jwt-decode-for-auth.md) | high | Authentication uses decoded JWT claims without verifying the token signature. |
|
|
1194
|
+
| <a id="jwt-none-algorithm"></a>[`jwt-none-algorithm`](docs/rules/jwt-none-algorithm.md) | critical | JWT signing or verification allows an unsigned token. |
|
|
1195
|
+
| <a id="jwt-sign-without-expiry"></a>[`jwt-sign-without-expiry`](docs/rules/jwt-sign-without-expiry.md) | medium | A signed JWT has no explicit expiration. |
|
|
1196
|
+
| <a id="jwt-verify-without-algorithms"></a>[`jwt-verify-without-algorithms`](docs/rules/jwt-verify-without-algorithms.md) | high | JWT verification does not restrict the accepted signing algorithms. |
|
|
1197
|
+
| <a id="jwt-weak-secret-literal"></a>[`jwt-weak-secret-literal`](docs/rules/jwt-weak-secret-literal.md) | high | JWT signing or verification uses a short (< 32 chars) or weak literal secret susceptible to brute-force forgery. |
|
|
1198
|
+
| <a id="knex-raw-dynamic-text"></a>[`knex-raw-dynamic-text`](docs/rules/knex-raw-dynamic-text.md) | critical | A dynamic SQL fragment reaches Knex without parameter binding. |
|
|
1199
|
+
| <a id="mass-assignment"></a>[`mass-assignment`](docs/rules/mass-assignment.md) | high | An unfiltered request body reaches a persistence operation. |
|
|
1200
|
+
| <a id="mysql-dynamic-query-text"></a>[`mysql-dynamic-query-text`](docs/rules/mysql-dynamic-query-text.md) | critical | Dynamic SQL text reaches a MySQL client without parameter binding. |
|
|
1201
|
+
| <a id="nest-validation-without-whitelist"></a>[`nest-validation-without-whitelist`](docs/rules/nest-validation-without-whitelist.md) | medium | A NestJS ValidationPipe permits properties outside the validated DTO. |
|
|
1202
|
+
| <a id="next-image-any-remote-host"></a>[`next-image-any-remote-host`](docs/rules/next-image-any-remote-host.md) | medium | A Next.js images.remotePatterns entry sets hostname '**', so the image optimizer fetches and serves any host (open proxy). |
|
|
1203
|
+
| <a id="nosql-operator-injection"></a>[`nosql-operator-injection`](docs/rules/nosql-operator-injection.md) | high | Request data can introduce query operators into a NoSQL filter. |
|
|
1204
|
+
| <a id="open-redirect"></a>[`open-redirect`](docs/rules/open-redirect.md) | medium | An HTTP redirect destination is controlled by request data. |
|
|
1205
|
+
| <a id="password-hash-in-response"></a>[`password-hash-in-response`](docs/rules/password-hash-in-response.md) | high | A response returns a user record that still holds its password hash. |
|
|
1206
|
+
| <a id="path-traversal"></a>[`path-traversal`](docs/rules/path-traversal.md) | high | Request data controls a filesystem path without a recognized containment check. |
|
|
1207
|
+
| <a id="pg-dynamic-query-text"></a>[`pg-dynamic-query-text`](docs/rules/pg-dynamic-query-text.md) | medium | Dynamic SQL text reaches the PostgreSQL client without parameter binding. |
|
|
1208
|
+
| <a id="plaintext-password-storage"></a>[`plaintext-password-storage`](docs/rules/plaintext-password-storage.md) | critical | A password is stored or written without being hashed. |
|
|
1209
|
+
| <a id="postmessage-missing-origin-check"></a>[`postmessage-missing-origin-check`](docs/rules/postmessage-missing-origin-check.md) | medium | postMessage targets '*', or a window message listener reads event.data without checking origin or source. |
|
|
1210
|
+
| <a id="prisma-raw-unsafe-dynamic"></a>[`prisma-raw-unsafe-dynamic`](docs/rules/prisma-raw-unsafe-dynamic.md) | critical | Dynamic SQL text reaches an unsafe Prisma raw-query method. |
|
|
1211
|
+
| <a id="prisma-scope-unverified"></a>[`prisma-scope-unverified`](docs/rules/prisma-scope-unverified.md) | high | A Prisma operation lacks the row scope required by the declared policy. |
|
|
1212
|
+
| <a id="prototype-pollution"></a>[`prototype-pollution`](docs/rules/prototype-pollution.md) | high | Request data can supply keys to a write or merge that can modify an object prototype. |
|
|
1213
|
+
| <a id="react-dangerously-set-inner-html"></a>[`react-dangerously-set-inner-html`](docs/rules/react-dangerously-set-inner-html.md) | high | dangerouslySetInnerHTML receives HTML that is not a constant or sanitized. |
|
|
1214
|
+
| <a id="reflected-xss-response"></a>[`reflected-xss-response`](docs/rules/reflected-xss-response.md) | low | An HTML response reflects request data without recognized escaping. |
|
|
1215
|
+
| <a id="regex-catastrophic-backtracking"></a>[`regex-catastrophic-backtracking`](docs/rules/regex-catastrophic-backtracking.md) | high | A regular expression that can backtrack exponentially or in polynomial time runs on request input. |
|
|
1216
|
+
| <a id="regex-from-input"></a>[`regex-from-input`](docs/rules/regex-from-input.md) | medium | Request input supplies a regular expression pattern without recognized escaping. |
|
|
1217
|
+
| <a id="secret-compared-non-constant-time"></a>[`secret-compared-non-constant-time`](docs/rules/secret-compared-non-constant-time.md) | medium | A secret is compared with an operation that can vary in timing with its contents. |
|
|
1218
|
+
| <a id="secret-in-log"></a>[`secret-in-log`](docs/rules/secret-in-log.md) | high | A log statement can expose a credential, token, or other secret. |
|
|
1219
|
+
| <a id="secret-in-url-query"></a>[`secret-in-url-query`](docs/rules/secret-in-url-query.md) | medium | A password, token or API key is passed in a URL query string. |
|
|
1220
|
+
| <a id="sequelize-dynamic-query-text"></a>[`sequelize-dynamic-query-text`](docs/rules/sequelize-dynamic-query-text.md) | critical | Dynamic SQL text reaches Sequelize without parameter binding. |
|
|
1221
|
+
| <a id="server-action-missing-auth"></a>[`server-action-missing-auth`](docs/rules/server-action-missing-auth.md) | high | An exported Next.js Server Action performs work without verifying authentication or session state. |
|
|
1222
|
+
| <a id="ssrf-redirect-bypass"></a>[`ssrf-redirect-bypass`](docs/rules/ssrf-redirect-bypass.md) | high | An outbound HTTP request with a dynamic URL does not disable redirects, allowing SSRF allowlist bypasses. |
|
|
1223
|
+
| <a id="ssrf-request-url"></a>[`ssrf-request-url`](docs/rules/ssrf-request-url.md) | high | Request data controls the destination of a server-side network request. |
|
|
1224
|
+
| <a id="storage-object-public-acl"></a>[`storage-object-public-acl`](docs/rules/storage-object-public-acl.md) | high | A storage upload makes the object publicly readable. |
|
|
1225
|
+
| <a id="template-autoescape-disabled"></a>[`template-autoescape-disabled`](docs/rules/template-autoescape-disabled.md) | medium | A template engine is configured to render values without HTML escaping. |
|
|
1226
|
+
| <a id="template-injection"></a>[`template-injection`](docs/rules/template-injection.md) | critical | Request data is interpreted as template source rather than a template value. |
|
|
1227
|
+
| <a id="tls-verification-disabled"></a>[`tls-verification-disabled`](docs/rules/tls-verification-disabled.md) | high | A TLS client skips certificate or server hostname verification. |
|
|
1228
|
+
| <a id="typeorm-dynamic-query-text"></a>[`typeorm-dynamic-query-text`](docs/rules/typeorm-dynamic-query-text.md) | critical | A dynamic SQL fragment reaches TypeORM without parameter binding. |
|
|
1229
|
+
| <a id="upload-client-filename"></a>[`upload-client-filename`](docs/rules/upload-client-filename.md) | medium | A file upload is stored under the original name supplied by the client. |
|
|
1230
|
+
| <a id="vm-sandbox-escape"></a>[`vm-sandbox-escape`](docs/rules/vm-sandbox-escape.md) | critical | Node `vm` or `vm2` executes dynamic code or an untrusted context, risking sandbox escape and host RCE. |
|
|
1231
|
+
| <a id="vue-v-html-unsanitized"></a>[`vue-v-html-unsanitized`](docs/rules/vue-v-html-unsanitized.md) | high | A Vue render function binds unsanitized dynamic HTML to innerHTML. |
|
|
1232
|
+
| <a id="weak-password-hash"></a>[`weak-password-hash`](docs/rules/weak-password-hash.md) | high | A password is hashed with an algorithm unsuitable for password storage. |
|
|
1233
|
+
| <a id="xml-external-entities"></a>[`xml-external-entities`](docs/rules/xml-external-entities.md) | medium | An XML parser allows processing of external entities. |
|
|
1234
|
+
| <a id="zip-slip-extraction"></a>[`zip-slip-extraction`](docs/rules/zip-slip-extraction.md) | high | An archive entry controls an extraction path without a recognized containment check. |
|
|
1235
|
+
|
|
1236
|
+
<!-- loadwise:rules:end -->
|
|
1238
1237
|
|
|
1239
1238
|
The SQL rules report text assembled from a runtime value. When a part of that text traces to request data the finding is default and names the source; when no part does, it is contextual, because the value is usually an internal schema or table name. Every injection rule other than the SQL rules reports only values traced to request data.
|
|
1240
1239
|
|
|
@@ -1248,19 +1247,23 @@ Example: `pool.query('SELECT * FROM orders ORDER BY ' + req.query.sort)` reports
|
|
|
1248
1247
|
|
|
1249
1248
|
`npx loadwise sec polyglot src/` accepts directories or individual `.py`, `.go`, `.java`, `.cs` and `.rs` files. It uses the optional ast-grep native binary and its syntax-tree patterns. These are syntactic patterns without taint tracking, so each finding is a review prompt: confirm that untrusted input can reach the call. They are not `--ignore` rule ids of the TypeScript source checks. [ast-grep](https://ast-grep.github.io/)
|
|
1250
1249
|
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
|
1254
|
-
|
|
|
1255
|
-
| <a id="
|
|
1256
|
-
| <a id="
|
|
1257
|
-
| <a id="
|
|
1258
|
-
| <a id="
|
|
1259
|
-
| <a id="
|
|
1260
|
-
| <a id="
|
|
1261
|
-
| <a id="python-
|
|
1262
|
-
| <a id="
|
|
1263
|
-
| <a id="
|
|
1250
|
+
<!-- loadwise:rules:start checker=security group=polyglot-source-checks -->
|
|
1251
|
+
|
|
1252
|
+
| Rule | Impact | What it flags |
|
|
1253
|
+
| ------------------------------------------------------------------------------------------------------------------------------ | ------ | -------------------------------------------------------------------------------------------------- |
|
|
1254
|
+
| <a id="csharp-ef-from-sql-raw"></a>[`csharp-ef-from-sql-raw`](docs/rules/csharp-ef-from-sql-raw.md) | high | FromSqlRaw or ExecuteSqlRaw receives a concatenated or interpolated string, risking SQL injection. |
|
|
1255
|
+
| <a id="csharp-process-start"></a>[`csharp-process-start`](docs/rules/csharp-process-start.md) | medium | Process.Start launches an external process and risks command injection with untrusted arguments. |
|
|
1256
|
+
| <a id="go-exec-command-shell"></a>[`go-exec-command-shell`](docs/rules/go-exec-command-shell.md) | high | exec.Command invokes a shell, which risks command injection. |
|
|
1257
|
+
| <a id="go-sql-sprintf-injection"></a>[`go-sql-sprintf-injection`](docs/rules/go-sql-sprintf-injection.md) | high | SQL text formatted with fmt.Sprintf risks SQL injection. |
|
|
1258
|
+
| <a id="java-runtime-exec"></a>[`java-runtime-exec`](docs/rules/java-runtime-exec.md) | medium | Runtime.getRuntime().exec runs an OS command and risks command injection with untrusted arguments. |
|
|
1259
|
+
| <a id="java-sql-string-concat"></a>[`java-sql-string-concat`](docs/rules/java-sql-string-concat.md) | high | A SQL query built by string concatenation risks SQL injection. |
|
|
1260
|
+
| <a id="python-insecure-deserialization"></a>[`python-insecure-deserialization`](docs/rules/python-insecure-deserialization.md) | high | pickle or marshal deserialization of untrusted data can execute arbitrary code. |
|
|
1261
|
+
| <a id="python-subprocess-shell-true"></a>[`python-subprocess-shell-true`](docs/rules/python-subprocess-shell-true.md) | high | subprocess with shell=True or os.system passes input through a shell, risking command injection. |
|
|
1262
|
+
| <a id="python-unsafe-yaml-load"></a>[`python-unsafe-yaml-load`](docs/rules/python-unsafe-yaml-load.md) | high | yaml.load without SafeLoader can construct arbitrary Python objects. |
|
|
1263
|
+
| <a id="rust-command-shell"></a>[`rust-command-shell`](docs/rules/rust-command-shell.md) | high | Command::new("sh") or Command::new("bash") spawns a shell and risks command injection. |
|
|
1264
|
+
| <a id="rust-unsafe-raw-pointer-deref"></a>[`rust-unsafe-raw-pointer-deref`](docs/rules/rust-unsafe-raw-pointer-deref.md) | medium | A raw pointer dereference in an unsafe block bypasses Rust memory safety guarantees. |
|
|
1265
|
+
|
|
1266
|
+
<!-- loadwise:rules:end -->
|
|
1264
1267
|
|
|
1265
1268
|
## Dependency checks
|
|
1266
1269
|
|
|
@@ -1268,98 +1271,18 @@ Example: `pool.query('SELECT * FROM orders ORDER BY ' + req.query.sort)` reports
|
|
|
1268
1271
|
|
|
1269
1272
|
The network is opt-in: `loadwise sec --online` and `loadwise check --online` add these findings to their security report, and without `--online` they print one note that dependency checks were skipped.
|
|
1270
1273
|
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
|
1274
|
+
<!-- loadwise:rules:start checker=security group=dependency-checks -->
|
|
1275
|
+
|
|
1276
|
+
| Rule | Impact | What it flags |
|
|
1277
|
+
| --------------------------------------------------------------------------------------------------------------------------- | ------ | ------------------------------------------------------------------------------ |
|
|
1278
|
+
| <a id="dependency-known-vulnerability"></a>[`dependency-known-vulnerability`](docs/rules/dependency-known-vulnerability.md) | medium | A resolved dependency version is listed in a published vulnerability advisory. |
|
|
1279
|
+
|
|
1280
|
+
<!-- loadwise:rules:end -->
|
|
1274
1281
|
|
|
1275
1282
|
## Security impact levels
|
|
1276
1283
|
|
|
1277
1284
|
`--min-impact` sets the minimum level to report. Dependency findings use the advisory severity.
|
|
1278
1285
|
|
|
1279
|
-
| Rule | Impact |
|
|
1280
|
-
| ----------------------------------- | ------------------------------------------- |
|
|
1281
|
-
| `pg-dynamic-query-text` | medium |
|
|
1282
|
-
| `prisma-scope-unverified` | high |
|
|
1283
|
-
| `drizzle-scope-unverified` | high |
|
|
1284
|
-
| `code-injection` | critical |
|
|
1285
|
-
| `command-injection` | critical |
|
|
1286
|
-
| `drizzle-sql-raw-dynamic` | critical |
|
|
1287
|
-
| `knex-raw-dynamic-text` | critical |
|
|
1288
|
-
| `mysql-dynamic-query-text` | critical |
|
|
1289
|
-
| `nosql-operator-injection` | high |
|
|
1290
|
-
| `prisma-raw-unsafe-dynamic` | critical |
|
|
1291
|
-
| `regex-from-input` | medium |
|
|
1292
|
-
| `regex-catastrophic-backtracking` | high |
|
|
1293
|
-
| `sequelize-dynamic-query-text` | critical |
|
|
1294
|
-
| `template-injection` | critical |
|
|
1295
|
-
| `typeorm-dynamic-query-text` | critical |
|
|
1296
|
-
| `open-redirect` | medium |
|
|
1297
|
-
| `path-traversal` | high |
|
|
1298
|
-
| `ssrf-request-url` | high |
|
|
1299
|
-
| `upload-client-filename` | medium |
|
|
1300
|
-
| `zip-slip-extraction` | high |
|
|
1301
|
-
| `bcrypt-low-cost` | medium |
|
|
1302
|
-
| `hardcoded-secret` | critical |
|
|
1303
|
-
| `insecure-cipher` | medium |
|
|
1304
|
-
| `insecure-random-for-secret` | high |
|
|
1305
|
-
| `jwt-decode-for-auth` | high |
|
|
1306
|
-
| `jwt-none-algorithm` | critical |
|
|
1307
|
-
| `jwt-sign-without-expiry` | medium |
|
|
1308
|
-
| `jwt-verify-without-algorithms` | high |
|
|
1309
|
-
| `secret-compared-non-constant-time` | medium |
|
|
1310
|
-
| `tls-verification-disabled` | high |
|
|
1311
|
-
| `weak-password-hash` | high |
|
|
1312
|
-
| `plaintext-password-storage` | critical |
|
|
1313
|
-
| `cookie-missing-security-flags` | high |
|
|
1314
|
-
| `cors-credentials-any-origin` | high |
|
|
1315
|
-
| `cors-origin-regex-unanchored` | medium |
|
|
1316
|
-
| `error-stack-in-response` | medium |
|
|
1317
|
-
| `graphql-introspection-enabled` | medium |
|
|
1318
|
-
| `mass-assignment` | high |
|
|
1319
|
-
| `nest-validation-without-whitelist` | medium |
|
|
1320
|
-
| `prototype-pollution` | high |
|
|
1321
|
-
| `reflected-xss-response` | low |
|
|
1322
|
-
| `secret-in-log` | high |
|
|
1323
|
-
| `template-autoescape-disabled` | medium |
|
|
1324
|
-
| `xml-external-entities` | medium |
|
|
1325
|
-
| `password-hash-in-response` | high |
|
|
1326
|
-
| `storage-object-public-acl` | high |
|
|
1327
|
-
| `secret-in-url-query` | medium |
|
|
1328
|
-
| `auth-route-without-rate-limit` | medium |
|
|
1329
|
-
| `graphql-query-depth-unbounded` | medium |
|
|
1330
|
-
| `database-error-in-response` | medium |
|
|
1331
|
-
| `dom-xss-sink` | high |
|
|
1332
|
-
| `react-dangerously-set-inner-html` | high |
|
|
1333
|
-
| `angular-bypass-security-trust` | high |
|
|
1334
|
-
| `vue-v-html-unsanitized` | high |
|
|
1335
|
-
| `frontend-storage-secret-token` | medium |
|
|
1336
|
-
| `postmessage-missing-origin-check` | medium |
|
|
1337
|
-
| `express-missing-helmet` | low |
|
|
1338
|
-
| `dependency-known-vulnerability` | Advisory severity (medium when unavailable) |
|
|
1339
|
-
| `committed-secret` | critical |
|
|
1340
|
-
| `compose-hardcoded-secret` | high |
|
|
1341
|
-
| `dockerfile-add-remote-url` | medium |
|
|
1342
|
-
| `dockerfile-runs-as-root` | medium |
|
|
1343
|
-
| `dockerfile-secret-in-build` | high |
|
|
1344
|
-
| `dockerfile-unpinned-base-image` | low |
|
|
1345
|
-
| `server-action-missing-auth` | high |
|
|
1346
|
-
| `ssrf-redirect-bypass` | high |
|
|
1347
|
-
| `vm-sandbox-escape` | critical |
|
|
1348
|
-
| `jwt-weak-secret-literal` | high |
|
|
1349
|
-
| `graphql-batching-unbounded` | medium |
|
|
1350
|
-
| `express-cookie-auth-missing-csrf` | high |
|
|
1351
|
-
| `csharp-process-start` | medium |
|
|
1352
|
-
| `csharp-ef-from-sql-raw` | high |
|
|
1353
|
-
| `go-exec-command-shell` | high |
|
|
1354
|
-
| `go-sql-sprintf-injection` | high |
|
|
1355
|
-
| `java-runtime-exec` | medium |
|
|
1356
|
-
| `java-sql-string-concat` | high |
|
|
1357
|
-
| `python-insecure-deserialization` | high |
|
|
1358
|
-
| `python-unsafe-yaml-load` | high |
|
|
1359
|
-
| `python-subprocess-shell-true` | high |
|
|
1360
|
-
| `rust-command-shell` | high |
|
|
1361
|
-
| `rust-unsafe-raw-pointer-deref` | medium |
|
|
1362
|
-
|
|
1363
1286
|
## Project-defined row scopes
|
|
1364
1287
|
|
|
1365
1288
|
Row-scope checks read `prismaScopes` and `drizzleScopes` from the `performance` section of `loadwise.config.json`, found the same way as for the performance checker (see [Project-defined access policy](#project-defined-access-policy)). Every other rule runs without a scope policy. Row-scope checks start when the project identifies the existing model or table, its scoped property, and the helper that supplies an authorized scalar. Columns such as `tenantId`, `organizationId` and `workspace_id` have no special meaning to the checker on their own. Database mappings can keep the original storage column name. [Prisma database mapping](https://www.prisma.io/docs/orm/prisma-schema/data-model/database-mapping) · [Drizzle schema declarations](https://orm.drizzle.team/docs/sql-schema-declaration)
|
|
@@ -1389,33 +1312,25 @@ npx loadwise a11y --fix --only <id> # apply one generated fix
|
|
|
1389
1312
|
|
|
1390
1313
|
## Rules
|
|
1391
1314
|
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
|
1395
|
-
|
|
|
1396
|
-
| <a id="a11y-
|
|
1397
|
-
| <a id="a11y-
|
|
1398
|
-
| <a id="a11y-missing-
|
|
1399
|
-
| <a id="a11y-
|
|
1400
|
-
| <a id="a11y-
|
|
1401
|
-
| <a id="a11y-
|
|
1402
|
-
| <a id="a11y-
|
|
1315
|
+
<!-- loadwise:rules:start checker=accessibility group=rules -->
|
|
1316
|
+
|
|
1317
|
+
| Rule | Impact | What it flags |
|
|
1318
|
+
| --------------------------------------------------------------------------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
1319
|
+
| <a id="a11y-button-missing-type"></a>[`a11y-button-missing-type`](docs/rules/a11y-button-missing-type.md) | medium | A button inside a form has no type, so it submits the form even when it only meant to run a handler. |
|
|
1320
|
+
| <a id="a11y-clickable-non-interactive"></a>[`a11y-clickable-non-interactive`](docs/rules/a11y-clickable-non-interactive.md) | high | A click handler sits on a non-interactive element without a role and keyboard support, so keyboard users cannot activate it. |
|
|
1321
|
+
| <a id="a11y-html-missing-lang"></a>[`a11y-html-missing-lang`](docs/rules/a11y-html-missing-lang.md) | medium | The html element has no lang attribute, so screen readers guess the pronunciation. |
|
|
1322
|
+
| <a id="a11y-iframe-missing-title"></a>[`a11y-iframe-missing-title`](docs/rules/a11y-iframe-missing-title.md) | medium | An iframe has no title, so screen readers cannot say what it contains. |
|
|
1323
|
+
| <a id="a11y-img-missing-alt"></a>[`a11y-img-missing-alt`](docs/rules/a11y-img-missing-alt.md) | high | An image has no alt text, so screen readers announce its file name or nothing. |
|
|
1324
|
+
| <a id="a11y-invalid-aria"></a>[`a11y-invalid-aria`](docs/rules/a11y-invalid-aria.md) | high | An ARIA attribute or role is misspelled or invalid, so assistive technology ignores it. |
|
|
1325
|
+
| <a id="a11y-missing-form-label"></a>[`a11y-missing-form-label`](docs/rules/a11y-missing-form-label.md) | high | A form control has no label, so screen readers announce it without its purpose. |
|
|
1326
|
+
| <a id="a11y-positive-tabindex"></a>[`a11y-positive-tabindex`](docs/rules/a11y-positive-tabindex.md) | medium | A positive tabindex reorders keyboard focus away from the visual order. |
|
|
1327
|
+
| <a id="a11y-viewport-zoom-disabled"></a>[`a11y-viewport-zoom-disabled`](docs/rules/a11y-viewport-zoom-disabled.md) | high | The viewport meta tag disables zoom, so people with low vision cannot enlarge the page. |
|
|
1328
|
+
|
|
1329
|
+
<!-- loadwise:rules:end -->
|
|
1403
1330
|
|
|
1404
1331
|
## Impact levels
|
|
1405
1332
|
|
|
1406
|
-
The levels and the `--min-impact` flag work as described under the performance checker's impact levels. `loadwise a11y` and the accessibility section of `loadwise check` use
|
|
1407
|
-
|
|
1408
|
-
| Rule | Impact |
|
|
1409
|
-
| -------------------------------- | ------ |
|
|
1410
|
-
| `a11y-clickable-non-interactive` | high |
|
|
1411
|
-
| `a11y-img-missing-alt` | high |
|
|
1412
|
-
| `a11y-invalid-aria` | high |
|
|
1413
|
-
| `a11y-missing-form-label` | high |
|
|
1414
|
-
| `a11y-viewport-zoom-disabled` | high |
|
|
1415
|
-
| `a11y-button-missing-type` | medium |
|
|
1416
|
-
| `a11y-html-missing-lang` | medium |
|
|
1417
|
-
| `a11y-iframe-missing-title` | medium |
|
|
1418
|
-
| `a11y-positive-tabindex` | medium |
|
|
1333
|
+
The levels and the `--min-impact` flag work as described under the performance checker's impact levels. `loadwise a11y` and the accessibility section of `loadwise check` use the impact levels in the rule index.
|
|
1419
1334
|
|
|
1420
1335
|
# Developing locally
|
|
1421
1336
|
|