loadwise 0.8.0 → 0.9.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.
Files changed (584) hide show
  1. package/PERFORMANCE.md +17 -0
  2. package/README.md +238 -713
  3. package/agent/hooks/check-edited-file.mjs +682 -0
  4. package/dist/bin/github-action.js +143 -18
  5. package/dist/bin/loadwise.js +15 -28
  6. package/dist/lib/accessibility/angular-literal.js +1 -1
  7. package/dist/lib/accessibility/astro-template.js +111 -0
  8. package/dist/lib/accessibility/autofocus.js +94 -0
  9. package/dist/lib/accessibility/document-reference-rules.js +133 -0
  10. package/dist/lib/accessibility/form-context.js +7 -2
  11. package/dist/lib/accessibility/frontend-detect.js +18 -8
  12. package/dist/lib/accessibility/heading-order.js +59 -0
  13. package/dist/lib/accessibility/interaction-semantics.js +90 -0
  14. package/dist/lib/accessibility/jinja-template.js +150 -0
  15. package/dist/lib/accessibility/jsx-elements.js +134 -9
  16. package/dist/lib/accessibility/language-tags.js +18 -0
  17. package/dist/lib/accessibility/markup-files.js +44 -17
  18. package/dist/lib/accessibility/markup.js +4 -1
  19. package/dist/lib/accessibility/media-rules.js +81 -0
  20. package/dist/lib/accessibility/native-interactive.js +107 -0
  21. package/dist/lib/accessibility/rule-ids.js +30 -0
  22. package/dist/lib/accessibility/rule-utilities.js +92 -0
  23. package/dist/lib/accessibility/rules.js +74 -139
  24. package/dist/lib/accessibility/site-fixes/buttons.js +4 -11
  25. package/dist/lib/accessibility/site-fixes/email-autocomplete.js +103 -0
  26. package/dist/lib/accessibility/site-fixes/html-language.js +48 -0
  27. package/dist/lib/accessibility/site-fixes/media-autoplay.js +87 -0
  28. package/dist/lib/accessibility/site-fixes/positive-tabindex.js +102 -0
  29. package/dist/lib/accessibility/site-fixes/source-position.js +11 -0
  30. package/dist/lib/accessibility/site-fixes/viewport.js +107 -0
  31. package/dist/lib/accessibility/table-headers.js +70 -0
  32. package/dist/lib/accessibility/template-attributes.js +13 -2
  33. package/dist/lib/accessibility/template-binding-scope.js +122 -0
  34. package/dist/lib/accessibility/template-elements.js +257 -109
  35. package/dist/lib/accessibility/template-file.js +111 -22
  36. package/dist/lib/accessibility/template-tag-tables.js +86 -0
  37. package/dist/lib/accessibility/usage.js +1 -1
  38. package/dist/lib/editor/accessibility-examples.js +5 -0
  39. package/dist/lib/editor/actions.js +11 -5
  40. package/dist/lib/editor/apply-fix.js +30 -2
  41. package/dist/lib/editor/configured-setup.js +9 -14
  42. package/dist/lib/editor/diagnostics.js +9 -26
  43. package/dist/lib/editor/dismissals.js +21 -10
  44. package/dist/lib/editor/doctor.js +167 -0
  45. package/dist/lib/editor/editor-document.js +17 -1
  46. package/dist/lib/editor/editor-launcher.js +60 -26
  47. package/dist/lib/editor/fix-edits.js +87 -8
  48. package/dist/lib/editor/jetbrains-setup.js +2 -1
  49. package/dist/lib/editor/language-server.js +220 -47
  50. package/dist/lib/editor/native-setup.js +7 -2
  51. package/dist/lib/editor/perf-watch.js +7 -5
  52. package/dist/lib/editor/performance-examples.js +31 -0
  53. package/dist/lib/editor/polyglot-selection.js +193 -0
  54. package/dist/lib/editor/project-policy.js +146 -0
  55. package/dist/lib/editor/project-watches.js +86 -0
  56. package/dist/lib/editor/release-vsix.js +23 -1
  57. package/dist/lib/editor/reliability-examples.js +36 -0
  58. package/dist/lib/editor/scan-session.js +210 -61
  59. package/dist/lib/editor/security-examples.js +24 -14
  60. package/dist/lib/editor/server-commands.js +24 -11
  61. package/dist/lib/editor/setup.js +7 -12
  62. package/dist/lib/editor/standalone-performance-examples.js +3 -0
  63. package/dist/lib/editor/workspace-files.js +32 -8
  64. package/dist/lib/editor/workspace-paths.js +29 -7
  65. package/dist/lib/editor/zed-settings.js +118 -0
  66. package/dist/lib/editor/zed-setup.js +88 -0
  67. package/dist/lib/maintainability/analysis/analyze-source.js +6 -3
  68. package/dist/lib/maintainability/analysis/source-exclusions.js +2 -1
  69. package/dist/lib/maintainability/analysis/source-facts.js +2 -2
  70. package/dist/lib/maintainability/architecture/graph.js +2 -1
  71. package/dist/lib/maintainability/architecture/layout.js +2 -1
  72. package/dist/lib/maintainability/cli/apply-fix.js +32 -7
  73. package/dist/lib/maintainability/cli/changed-lines.js +7 -113
  74. package/dist/lib/maintainability/cli/finding-ids.js +3 -6
  75. package/dist/lib/maintainability/cli/fix-cli.js +1 -9
  76. package/dist/lib/maintainability/cli/git-inventory.js +5 -6
  77. package/dist/lib/maintainability/cli/inputs.js +12 -11
  78. package/dist/lib/maintainability/cli/scan-arguments.js +33 -0
  79. package/dist/lib/maintainability/cli/site-fix.js +28 -13
  80. package/dist/lib/maintainability/cli.js +25 -35
  81. package/dist/lib/maintainability/entry-points/entry-points.js +27 -68
  82. package/dist/lib/maintainability/examples.js +12 -0
  83. package/dist/lib/maintainability/polyglot-duplicates.js +1 -0
  84. package/dist/lib/maintainability/polyglot.js +337 -12
  85. package/dist/lib/maintainability/project.js +4 -4
  86. package/dist/lib/maintainability/quality/console-tooling.js +114 -0
  87. package/dist/lib/maintainability/quality/declarative-imports.js +18 -0
  88. package/dist/lib/maintainability/quality/deprecated-apis.js +227 -40
  89. package/dist/lib/maintainability/quality/duplicates.js +5 -11
  90. package/dist/lib/maintainability/quality/generic-assertion-target.js +75 -0
  91. package/dist/lib/maintainability/quality/limits.js +5 -1
  92. package/dist/lib/maintainability/quality/size-limits.js +2 -1
  93. package/dist/lib/maintainability/quality/stray-console.js +31 -7
  94. package/dist/lib/maintainability/quality/tsconfig-strict.js +125 -6
  95. package/dist/lib/maintainability/quality/type-escape-hatches.js +411 -0
  96. package/dist/lib/maintainability/quality/type-safety-hygiene.js +132 -42
  97. package/dist/lib/maintainability/quality/unowned-source.js +15 -0
  98. package/dist/lib/maintainability/rule-ids.js +9 -0
  99. package/dist/lib/maintainability/scan-changed.js +6 -1
  100. package/dist/lib/maintainability/scan-worker.js +3 -5
  101. package/dist/lib/maintainability/scan.js +16 -3
  102. package/dist/lib/maintainability/site-fixes/duplicate-edits.js +3 -2
  103. package/dist/lib/maintainability/site-fixes/duplicate-methods.js +7 -2
  104. package/dist/lib/maintainability/site-fixes/duplicates.js +3 -2
  105. package/dist/lib/maintainability/site-fixes/focused-test.js +230 -0
  106. package/dist/lib/maintainability/site-fixes/helpers.js +2 -6
  107. package/dist/lib/maintainability/site-fixes/if-rewrites.js +1 -7
  108. package/dist/lib/maintainability/site-fixes/large-module.js +2 -1
  109. package/dist/lib/maintainability/unused/ancestor-aliases.js +2 -2
  110. package/dist/lib/maintainability/unused/module-usage-dynamic.js +2 -1
  111. package/dist/lib/maintainability/unused/module-usage-named-exports.js +125 -0
  112. package/dist/lib/maintainability/unused/module-usage.js +8 -3
  113. package/dist/lib/maintainability/unused/unused-modules.js +35 -1
  114. package/dist/lib/performance/analysis/call-syntax.js +2 -1
  115. package/dist/lib/performance/analysis/function-kinds.js +1 -5
  116. package/dist/lib/performance/analysis/missing-packages.js +10 -7
  117. package/dist/lib/performance/analysis/package-types.js +10 -2
  118. package/dist/lib/performance/analysis/schema-tooling.js +157 -8
  119. package/dist/lib/performance/analysis/source-inputs.js +17 -12
  120. package/dist/lib/performance/analysis/unscanned-javascript.js +6 -5
  121. package/dist/lib/performance/analyze.js +22 -6
  122. package/dist/lib/performance/async/async-errors.js +162 -14
  123. package/dist/lib/performance/async/await-before-early-exit.js +1 -6
  124. package/dist/lib/performance/async/floating-promises.js +2 -2
  125. package/dist/lib/performance/async/promise-return-escapes-catch.js +35 -2
  126. package/dist/lib/performance/async/stream-errors.js +1 -3
  127. package/dist/lib/performance/cli/changed-lines.js +14 -111
  128. package/dist/lib/performance/cli/cli-arguments.js +11 -9
  129. package/dist/lib/performance/cli/cli-markup.js +42 -0
  130. package/dist/lib/performance/cli/cli-policy.js +150 -16
  131. package/dist/lib/performance/cli/cli-scan.js +148 -118
  132. package/dist/lib/performance/cli/finding-ids.js +7 -7
  133. package/dist/lib/performance/cli/fix-cli.js +83 -34
  134. package/dist/lib/performance/cli/prisma-schema-findings.js +23 -0
  135. package/dist/lib/performance/cli/watch-security.js +33 -0
  136. package/dist/lib/performance/cli/watch.js +17 -9
  137. package/dist/lib/performance/cli.js +8 -7
  138. package/dist/lib/performance/collections/array-drains.js +354 -0
  139. package/dist/lib/performance/collections/collection-bindings.js +1 -2
  140. package/dist/lib/performance/collections/collection-bounds.js +3 -2
  141. package/dist/lib/performance/collections/collection-copy.js +51 -1
  142. package/dist/lib/performance/collections/collection-lookups.js +47 -3
  143. package/dist/lib/performance/collections/collection-reduce.js +0 -4
  144. package/dist/lib/performance/collections/collections.js +6 -2
  145. package/dist/lib/performance/collections/json-clone.js +137 -17
  146. package/dist/lib/performance/collections/regex-allocation.js +156 -0
  147. package/dist/lib/performance/collections/repeated.js +2 -8
  148. package/dist/lib/performance/collections/sort-extreme.js +18 -1
  149. package/dist/lib/performance/collections/workbook-decodes.js +3 -2
  150. package/dist/lib/performance/contracts/cli.js +329 -21
  151. package/dist/lib/performance/contracts/git-files.js +57 -5
  152. package/dist/lib/performance/contracts/openapi-schema.js +187 -0
  153. package/dist/lib/performance/contracts/openapi-sources.js +260 -0
  154. package/dist/lib/performance/contracts/openapi.js +172 -233
  155. package/dist/lib/performance/contracts/protobuf.js +301 -0
  156. package/dist/lib/performance/contracts/trpc-moves.js +46 -0
  157. package/dist/lib/performance/contracts/trpc.js +477 -0
  158. package/dist/lib/performance/datastores/pg-integrity.js +2 -1
  159. package/dist/lib/performance/datastores/pooling.js +2 -1
  160. package/dist/lib/performance/datastores/redis-keys.js +4 -3
  161. package/dist/lib/performance/datastores/redis.js +8 -1
  162. package/dist/lib/performance/datastores/repeated-reads.js +104 -0
  163. package/dist/lib/performance/datastores/search-clients.js +9 -0
  164. package/dist/lib/performance/datastores/session-store.js +166 -7
  165. package/dist/lib/performance/datastores/supabase.js +73 -0
  166. package/dist/lib/performance/db/checks.js +1 -1
  167. package/dist/lib/performance/db/cli-mysql.js +12 -2
  168. package/dist/lib/performance/db/cli.js +38 -5
  169. package/dist/lib/performance/db/drivers.js +20 -4
  170. package/dist/lib/performance/db/measure.js +1 -1
  171. package/dist/lib/performance/db/mysql-catalog.js +1 -1
  172. package/dist/lib/performance/db/plan-estimates.js +46 -7
  173. package/dist/lib/performance/db/redact.js +1 -3
  174. package/dist/lib/performance/db/snapshot.js +1 -1
  175. package/dist/lib/performance/db/sqlite-plan.js +95 -0
  176. package/dist/lib/performance/engine/compiler.js +3 -2
  177. package/dist/lib/performance/engine/native-checker.js +85 -10
  178. package/dist/lib/performance/engine/native-syntax.js +17 -0
  179. package/dist/lib/performance/engine/native-workspaces.js +36 -8
  180. package/dist/lib/performance/engine/native.js +38 -16
  181. package/dist/lib/performance/engine/review-config-inputs.js +57 -0
  182. package/dist/lib/performance/evidence/plans.js +14 -16
  183. package/dist/lib/performance/evidence/trace-formats.js +182 -0
  184. package/dist/lib/performance/evidence/traces.js +6 -6
  185. package/dist/lib/performance/frontend/angular-bootstrap.js +309 -0
  186. package/dist/lib/performance/frontend/barrel-subpaths.js +204 -0
  187. package/dist/lib/performance/frontend/effect-cleanup.js +30 -4
  188. package/dist/lib/performance/frontend/frontend-dom-perf.js +11 -7
  189. package/dist/lib/performance/frontend/frontend-perf.js +4 -5
  190. package/dist/lib/performance/frontend/frontend-render-perf.js +10 -10
  191. package/dist/lib/performance/frontend/layout-binary-probe.js +186 -0
  192. package/dist/lib/performance/frontend/next-fetch-waterfall.js +88 -0
  193. package/dist/lib/performance/frontend/template-tracking.js +131 -0
  194. package/dist/lib/performance/index-rules/index-rules-table.js +3 -3
  195. package/dist/lib/performance/index-rules/redundant-indexes.js +6 -13
  196. package/dist/lib/performance/migrations/cli.js +65 -14
  197. package/dist/lib/performance/migrations/discover.js +63 -32
  198. package/dist/lib/performance/migrations/enforce.js +5 -12
  199. package/dist/lib/performance/migrations/extract-code-sql.js +10 -7
  200. package/dist/lib/performance/migrations/extract-code.js +1 -0
  201. package/dist/lib/performance/migrations/extract-sql.js +45 -4
  202. package/dist/lib/performance/migrations/extract-sqlite.js +302 -0
  203. package/dist/lib/performance/migrations/operations.js +122 -8
  204. package/dist/lib/performance/migrations/postgres-registry.js +6 -6
  205. package/dist/lib/performance/migrations/postgres-table-history.js +147 -0
  206. package/dist/lib/performance/migrations/rules-postgres-shared.js +4 -6
  207. package/dist/lib/performance/migrations/rules-postgres.js +67 -13
  208. package/dist/lib/performance/migrations/rules-sqlite.js +118 -0
  209. package/dist/lib/performance/migrations/sqlserver-creation.js +131 -0
  210. package/dist/lib/performance/migrations/sqlserver.js +81 -0
  211. package/dist/lib/performance/models/client-imports.js +286 -0
  212. package/dist/lib/performance/models/index.js +46 -8
  213. package/dist/lib/performance/orm/cartesian-includes.js +49 -22
  214. package/dist/lib/performance/orm/drizzle.js +86 -27
  215. package/dist/lib/performance/orm/knex-loop-operations.js +96 -0
  216. package/dist/lib/performance/orm/orm-owners.js +3 -5
  217. package/dist/lib/performance/orm/orm-queries.js +50 -152
  218. package/dist/lib/performance/orm/orm-result-uses.js +116 -0
  219. package/dist/lib/performance/orm/prisma-integrity.js +24 -3
  220. package/dist/lib/performance/orm/prisma.js +31 -8
  221. package/dist/lib/performance/orm/typeorm-batch-filter.js +43 -0
  222. package/dist/lib/performance/orm/typeorm-projection.js +2 -2
  223. package/dist/lib/performance/orm/typeorm-transaction-loops.js +3 -4
  224. package/dist/lib/performance/orm/typeorm-updates.js +1 -3
  225. package/dist/lib/performance/orm/unbounded-list-page-size.js +179 -0
  226. package/dist/lib/performance/orm/unbounded-list-queries.js +63 -146
  227. package/dist/lib/performance/polyglot.js +173 -61
  228. package/dist/lib/performance/probe-caches.js +42 -0
  229. package/dist/lib/performance/program-batches.js +138 -0
  230. package/dist/lib/performance/projects.js +85 -89
  231. package/dist/lib/performance/query-loops/guard-queries.js +2 -1
  232. package/dist/lib/performance/query-loops/parallel-reads-policy.js +1 -3
  233. package/dist/lib/performance/query-loops/query-loop-batch.js +81 -7
  234. package/dist/lib/performance/query-loops/query-loop-bounds.js +1 -13
  235. package/dist/lib/performance/query-loops/query-policy.js +19 -20
  236. package/dist/lib/performance/query-loops/query-results.js +1 -6
  237. package/dist/lib/performance/query-loops/query-write-context.js +89 -0
  238. package/dist/lib/performance/query-loops/sequential-loops.js +6 -24
  239. package/dist/lib/performance/query-loops/service-call-resolution.js +17 -2
  240. package/dist/lib/performance/query-loops/service-loop-source.js +124 -0
  241. package/dist/lib/performance/query-loops/service-loops.js +48 -17
  242. package/dist/lib/performance/query-loops/throw-on-miss-loops.js +141 -0
  243. package/dist/lib/performance/request/backend-mastery.js +18 -30
  244. package/dist/lib/performance/request/fixed-emitter-loop.js +98 -0
  245. package/dist/lib/performance/request/fresh-mapped-elements.js +137 -0
  246. package/dist/lib/performance/request/graphql-list-lookups.js +258 -0
  247. package/dist/lib/performance/request/http-options-writes.js +2 -8
  248. package/dist/lib/performance/request/http-timeouts.js +3 -2
  249. package/dist/lib/performance/request/json-stringify-output.js +139 -0
  250. package/dist/lib/performance/request/llm-max-tokens.js +27 -8
  251. package/dist/lib/performance/request/mongoose-lean.js +15 -10
  252. package/dist/lib/performance/request/node-event-listener-leak.js +190 -35
  253. package/dist/lib/performance/request/node-fs-context.js +6 -8
  254. package/dist/lib/performance/request/node-fs.js +4 -6
  255. package/dist/lib/performance/request/password-hashing.js +4 -3
  256. package/dist/lib/performance/request/phase5-ast.js +3 -9
  257. package/dist/lib/performance/request/phase5-rules.js +50 -102
  258. package/dist/lib/performance/request/pure-js-hashing.js +2 -1
  259. package/dist/lib/performance/request/request-handlers.js +1 -3
  260. package/dist/lib/performance/request/request-inputs.js +121 -26
  261. package/dist/lib/performance/request/unbounded-promise-all.js +132 -3
  262. package/dist/lib/performance/rule-ids.js +47 -4
  263. package/dist/lib/performance/schema/context.js +7 -16
  264. package/dist/lib/performance/schema/model.js +1 -9
  265. package/dist/lib/performance/schema/prisma-owners.js +15 -1
  266. package/dist/lib/performance/schema/prisma-schema.js +5 -6
  267. package/dist/lib/performance/schema/project-indexes-events.js +8 -2
  268. package/dist/lib/performance/schema/project-indexes.js +4 -2
  269. package/dist/lib/performance/schema/query-site-support.js +1 -1
  270. package/dist/lib/performance/schema/sequelize-schema.js +1 -3
  271. package/dist/lib/performance/schema/ts-helpers.js +3 -7
  272. package/dist/lib/performance/shared-libs.js +48 -0
  273. package/dist/lib/performance/site-fix.js +32 -7
  274. package/dist/lib/performance/site-fixes/collection-copy.js +2 -1
  275. package/dist/lib/performance/site-fixes/collection-existence.js +2 -1
  276. package/dist/lib/performance/site-fixes/collection-find.js +2 -1
  277. package/dist/lib/performance/site-fixes/collection-helpers.js +0 -6
  278. package/dist/lib/performance/site-fixes/collection-lookups.js +2 -1
  279. package/dist/lib/performance/site-fixes/database.js +7 -16
  280. package/dist/lib/performance/site-fixes/drizzle-index.js +2 -9
  281. package/dist/lib/performance/site-fixes/frontend-fixes.js +47 -15
  282. package/dist/lib/performance/site-fixes/helpers.js +19 -18
  283. package/dist/lib/performance/site-fixes/last-insert-id.js +2 -1
  284. package/dist/lib/performance/site-fixes/llm-max-tokens.js +56 -0
  285. package/dist/lib/performance/site-fixes/migration-column-rules.js +11 -7
  286. package/dist/lib/performance/site-fixes/migration-lock-rules.js +6 -3
  287. package/dist/lib/performance/site-fixes/migrations.js +4 -0
  288. package/dist/lib/performance/site-fixes/pure-js-hashing.js +2 -2
  289. package/dist/lib/performance/site-fixes/query-shapes.js +1 -4
  290. package/dist/lib/performance/site-fixes/service-loop-ast.js +1 -9
  291. package/dist/lib/performance/site-fixes/small-rewrites.js +28 -2
  292. package/dist/lib/performance/site-fixes/template-tracking-fixes.js +82 -0
  293. package/dist/lib/performance/site-fixes/writes.js +1 -6
  294. package/dist/lib/performance/sql/local-statements.js +108 -0
  295. package/dist/lib/performance/sql/mysql-tokens.js +1 -4
  296. package/dist/lib/performance/sql/pg-parser.js +3 -5
  297. package/dist/lib/performance/sql/sqlserver-control.js +43 -0
  298. package/dist/lib/reliability/analyze.js +48 -5
  299. package/dist/lib/reliability/boundary-access.js +34 -27
  300. package/dist/lib/reliability/callback-completion.js +10 -2
  301. package/dist/lib/reliability/child-process.js +2 -2
  302. package/dist/lib/reliability/crlf-line-split.js +124 -73
  303. package/dist/lib/reliability/crlf-references.js +78 -0
  304. package/dist/lib/reliability/default-numeric-sort.js +25 -0
  305. package/dist/lib/reliability/error-cause-plan.js +29 -0
  306. package/dist/lib/reliability/error-values.js +68 -27
  307. package/dist/lib/reliability/json-cast.js +368 -0
  308. package/dist/lib/reliability/key-test-callee.js +50 -0
  309. package/dist/lib/reliability/lossy-text-rewrite.js +94 -0
  310. package/dist/lib/reliability/manifest-boundary.js +466 -0
  311. package/dist/lib/reliability/manifest-snapshot.js +40 -0
  312. package/dist/lib/reliability/parse-failure-flow.js +5 -2
  313. package/dist/lib/reliability/parse-failure-paths.js +39 -8
  314. package/dist/lib/reliability/parse-failure-reset.js +5 -17
  315. package/dist/lib/reliability/pool-timeout.js +31 -7
  316. package/dist/lib/reliability/promise-usage.js +281 -0
  317. package/dist/lib/reliability/react-bugs.js +7 -6
  318. package/dist/lib/reliability/react-state-order.js +2 -2
  319. package/dist/lib/reliability/react-state-paths.js +2 -2
  320. package/dist/lib/reliability/react-state-setter.js +5 -11
  321. package/dist/lib/reliability/react-state-walker.js +3 -3
  322. package/dist/lib/reliability/required-member.js +19 -0
  323. package/dist/lib/reliability/resource-leak-intervals.js +4 -7
  324. package/dist/lib/reliability/resource-leaks.js +4 -7
  325. package/dist/lib/reliability/rule-ids.js +70 -1
  326. package/dist/lib/reliability/same-file-io.js +135 -0
  327. package/dist/lib/reliability/short-write.js +220 -0
  328. package/dist/lib/reliability/site-fixes/crlf-line-split.js +71 -0
  329. package/dist/lib/reliability/site-fixes/error-values.js +40 -0
  330. package/dist/lib/reliability/site-fixes/pool-timeout.js +51 -0
  331. package/dist/lib/reliability/source-helpers.js +18 -8
  332. package/dist/lib/reliability/standalone-sources.js +8 -6
  333. package/dist/lib/reliability/suspicious-logic.js +6 -8
  334. package/dist/lib/reliability/swallowed-errors.js +3 -7
  335. package/dist/lib/reliability/switch-exhaustive.js +195 -5
  336. package/dist/lib/reliability/test-cleanup-after-await.js +2 -2
  337. package/dist/lib/reliability/throw-string-plan.js +121 -0
  338. package/dist/lib/reliability/uncaught-exception.js +2 -7
  339. package/dist/lib/reliability/usage.js +1 -1
  340. package/dist/lib/reliability/working-directory.js +101 -0
  341. package/dist/lib/security/analyze.js +2 -0
  342. package/dist/lib/security/auth-crypto/hashing.js +21 -4
  343. package/dist/lib/security/auth-crypto/index.js +6 -1
  344. package/dist/lib/security/auth-crypto/jwt-decode-helpers.js +163 -0
  345. package/dist/lib/security/auth-crypto/jwt.js +52 -36
  346. package/dist/lib/security/auth-crypto/plaintext-password.js +2 -1
  347. package/dist/lib/security/auth-crypto/random.js +2 -1
  348. package/dist/lib/security/auth-crypto/rate-limits.js +79 -8
  349. package/dist/lib/security/auth-crypto/rule-ids.js +2 -0
  350. package/dist/lib/security/auth-crypto/secrets.js +11 -3
  351. package/dist/lib/security/auth-crypto/shared.js +1 -4
  352. package/dist/lib/security/auth-crypto/signature-verification.js +29 -0
  353. package/dist/lib/security/auth-crypto/transport-and-ciphers.js +43 -3
  354. package/dist/lib/security/auth-crypto/weak-hash.js +183 -0
  355. package/dist/lib/security/bindings.js +41 -9
  356. package/dist/lib/security/cli.js +83 -26
  357. package/dist/lib/security/cookie-csrf.js +316 -7
  358. package/dist/lib/security/deps/cargo-lock.js +78 -0
  359. package/dist/lib/security/deps/cli.js +4 -4
  360. package/dist/lib/security/deps/fixed-version.js +2 -2
  361. package/dist/lib/security/deps/lockfiles.js +204 -16
  362. package/dist/lib/security/deps/osv.js +190 -59
  363. package/dist/lib/security/deps/scan.js +87 -19
  364. package/dist/lib/security/examples/{auth-crypto.cjs → auth-crypto.js} +11 -5
  365. package/dist/lib/security/examples/{deps.cjs → deps.js} +1 -3
  366. package/dist/lib/security/examples/{exposure.cjs → exposure.js} +17 -3
  367. package/dist/lib/security/examples/{files.cjs → files.js} +9 -3
  368. package/dist/lib/security/examples/{injection.cjs → injection.js} +13 -3
  369. package/dist/lib/security/examples/{moved.cjs → moved.js} +1 -3
  370. package/dist/lib/security/examples/{request-forgery.cjs → request-forgery.js} +1 -3
  371. package/dist/lib/security/exposure/backend-security-mastery.js +2 -1
  372. package/dist/lib/security/exposure/client-env.js +2 -1
  373. package/dist/lib/security/exposure/content-disposition.js +71 -0
  374. package/dist/lib/security/exposure/cookies.js +200 -1
  375. package/dist/lib/security/exposure/cors.js +63 -4
  376. package/dist/lib/security/exposure/frontend-security.js +7 -60
  377. package/dist/lib/security/exposure/index.js +9 -0
  378. package/dist/lib/security/exposure/js-yaml.js +203 -0
  379. package/dist/lib/security/exposure/message-effects.js +266 -0
  380. package/dist/lib/security/exposure/package-manifest.js +2 -2
  381. package/dist/lib/security/exposure/prototype-pollution.js +26 -1
  382. package/dist/lib/security/exposure/reflected-xss.js +47 -12
  383. package/dist/lib/security/exposure/response-content-type.js +181 -0
  384. package/dist/lib/security/exposure/rule-ids.js +4 -0
  385. package/dist/lib/security/exposure/trust-boundary.js +142 -0
  386. package/dist/lib/security/exposure/url-secrets.js +38 -2
  387. package/dist/lib/security/exposure/webhook-verification.js +231 -0
  388. package/dist/lib/security/express-registration.js +45 -0
  389. package/dist/lib/security/express-router-factories.js +118 -0
  390. package/dist/lib/security/files/component-markup.js +66 -0
  391. package/dist/lib/security/files/compose.js +2 -1
  392. package/dist/lib/security/files/index.js +121 -27
  393. package/dist/lib/security/files/kubernetes.js +136 -0
  394. package/dist/lib/security/files/project-files.js +98 -31
  395. package/dist/lib/security/files/rule-ids.js +2 -0
  396. package/dist/lib/security/files/secrets.js +9 -5
  397. package/dist/lib/security/injection/code.js +33 -5
  398. package/dist/lib/security/injection/command.js +51 -4
  399. package/dist/lib/security/injection/escape-preserving.js +219 -0
  400. package/dist/lib/security/injection/escape-replace.js +174 -2
  401. package/dist/lib/security/injection/index.js +5 -1
  402. package/dist/lib/security/injection/nosql.js +1 -1
  403. package/dist/lib/security/injection/redos.js +25 -4
  404. package/dist/lib/security/injection/rule-ids.js +3 -0
  405. package/dist/lib/security/injection/shell-output-guard.js +97 -0
  406. package/dist/lib/security/injection/sql.js +51 -0
  407. package/dist/lib/security/injection/xpath.js +35 -0
  408. package/dist/lib/security/pg-identifier-guards.js +58 -6
  409. package/dist/lib/security/phase5-rules.js +1 -0
  410. package/dist/lib/security/polyglot.js +35 -3
  411. package/dist/lib/security/provider-credentials.js +29 -0
  412. package/dist/lib/security/redirect-settings.js +131 -6
  413. package/dist/lib/security/request-forgery/contained-helper.js +75 -0
  414. package/dist/lib/security/request-forgery/open-redirect-query.js +2 -1
  415. package/dist/lib/security/request-forgery/open-redirect.js +25 -2
  416. package/dist/lib/security/request-forgery/parsed-host-guard.js +213 -0
  417. package/dist/lib/security/request-forgery/path-traversal.js +36 -1
  418. package/dist/lib/security/request-forgery/shared.js +187 -27
  419. package/dist/lib/security/request-forgery/ssrf.js +145 -1
  420. package/dist/lib/security/rule-descriptions.js +17 -1
  421. package/dist/lib/security/rule-ids.js +21 -0
  422. package/dist/lib/security/scope/drizzle-policy.js +2 -1
  423. package/dist/lib/security/scope/kysely-policy.js +173 -0
  424. package/dist/lib/security/site-fixes/auth-crypto.js +3 -1
  425. package/dist/lib/security/taint/accessors.js +364 -0
  426. package/dist/lib/security/taint/array-writes.js +139 -0
  427. package/dist/lib/security/taint/binding-inputs.js +4 -3
  428. package/dist/lib/security/taint/field-access.js +80 -0
  429. package/dist/lib/security/taint/filename-guard.js +81 -6
  430. package/dist/lib/security/taint/guards.js +150 -17
  431. package/dist/lib/security/taint/index.js +41 -116
  432. package/dist/lib/security/taint/propagate.js +5 -6
  433. package/dist/lib/security/taint/resolution-cache.js +10 -1
  434. package/dist/lib/security/taint/sanitizers.js +5 -5
  435. package/dist/lib/security/taint/shape-flows.js +128 -0
  436. package/dist/lib/security/taint/sink-alphabets.js +237 -0
  437. package/dist/lib/security/taint/sources.js +151 -8
  438. package/dist/lib/security/taint/trace-nodes.js +35 -2
  439. package/dist/lib/security/taint/validators.js +58 -19
  440. package/dist/lib/security/trusted-bindings.js +44 -0
  441. package/dist/lib/shared/agent/agent-init.js +84 -9
  442. package/dist/lib/shared/agent/agent-integrations.js +626 -0
  443. package/dist/lib/shared/agent/agent-prompt.js +2 -1
  444. package/dist/lib/shared/agent/agent-session.js +1 -1
  445. package/dist/lib/shared/agent/agent-toml.js +98 -0
  446. package/dist/lib/shared/agent/agent-verify.js +21 -3
  447. package/dist/lib/shared/agent/git-hook.js +31 -4
  448. package/dist/lib/shared/agent/notify-editor.js +2 -1
  449. package/dist/lib/shared/agent/review-mcp.js +67 -13
  450. package/dist/lib/shared/agent/review-request.js +4 -0
  451. package/dist/lib/shared/analysis/ast-helpers.js +50 -0
  452. package/dist/lib/shared/analysis/ast-semantics.js +7 -1
  453. package/dist/lib/shared/analysis/binding-names.js +13 -0
  454. package/dist/lib/shared/analysis/execution-context.js +49 -9
  455. package/dist/lib/shared/analysis/polyglot-compatibility.js +102 -23
  456. package/dist/lib/shared/analysis/scan-cache-storage.js +180 -0
  457. package/dist/lib/shared/analysis/scan-cache.js +342 -119
  458. package/dist/lib/shared/analysis/valid-javascript.js +118 -0
  459. package/dist/lib/shared/changed-lines.js +129 -0
  460. package/dist/lib/shared/check-options.js +63 -0
  461. package/dist/lib/shared/check-watch-inputs.js +152 -0
  462. package/dist/lib/shared/check-watch-process.js +57 -0
  463. package/dist/lib/shared/check-watch.js +136 -0
  464. package/dist/lib/shared/check.js +73 -37
  465. package/dist/lib/shared/completion-shells.js +127 -0
  466. package/dist/lib/shared/completion.js +124 -0
  467. package/dist/lib/shared/config-rule-validation.js +135 -0
  468. package/dist/lib/shared/config.js +330 -163
  469. package/dist/lib/shared/declarative-rule-packs.js +173 -0
  470. package/dist/lib/shared/explain.js +47 -9
  471. package/dist/lib/shared/fix/fix-convergence.js +45 -128
  472. package/dist/lib/shared/fix/fix-history.js +130 -26
  473. package/dist/lib/shared/fix/fix-interactive.js +78 -0
  474. package/dist/lib/shared/fix/fix-patch.js +89 -0
  475. package/dist/lib/shared/fix/fix-polyglot-preview.js +166 -0
  476. package/dist/lib/shared/fix/fix-presentation-biome.js +120 -0
  477. package/dist/lib/shared/fix/fix-presentation-prettier.js +27 -10
  478. package/dist/lib/shared/fix/fix-presentation-rows.js +5 -1
  479. package/dist/lib/shared/fix/fix-presentation.js +22 -15
  480. package/dist/lib/shared/fix/fix-project-membership.js +79 -0
  481. package/dist/lib/shared/fix/fix-reversal-proof.js +107 -0
  482. package/dist/lib/shared/fix/fix-reverse.js +37 -0
  483. package/dist/lib/shared/fix/fix-safety.js +4 -4
  484. package/dist/lib/shared/fix/fix-scope.js +13 -9
  485. package/dist/lib/shared/fix/fix-source-snapshot.js +92 -0
  486. package/dist/lib/shared/fix/fix-staging.js +129 -0
  487. package/dist/lib/shared/fix/fix-terminal.js +34 -9
  488. package/dist/lib/shared/fix/fix-typecheck.js +21 -8
  489. package/dist/lib/shared/fix/project-file-access.js +44 -11
  490. package/dist/lib/shared/fix/read-fix-text.js +23 -0
  491. package/dist/lib/shared/fix/reversal-lock.js +37 -0
  492. package/dist/lib/shared/fix/review-fix-mode.js +9 -0
  493. package/dist/lib/shared/fix.js +162 -26
  494. package/dist/lib/shared/formats/ci-consumers.js +84 -0
  495. package/dist/lib/shared/formats/finding-location.js +52 -3
  496. package/dist/lib/shared/formats/github.js +22 -7
  497. package/dist/lib/shared/formats/index.js +21 -5
  498. package/dist/lib/shared/formats/readable.js +63 -0
  499. package/dist/lib/shared/formats/report-rows.js +38 -0
  500. package/dist/lib/shared/formats/sarif-fixes.js +261 -0
  501. package/dist/lib/shared/formats/sarif.js +175 -33
  502. package/dist/lib/shared/formats/security-cwe.js +113 -0
  503. package/dist/lib/shared/node-scan.js +64 -0
  504. package/dist/lib/shared/package-root.js +2 -0
  505. package/dist/lib/shared/project-root.js +27 -1
  506. package/dist/lib/shared/reporting/action-summary.js +31 -0
  507. package/dist/lib/shared/reporting/baseline.js +12 -12
  508. package/dist/lib/shared/reporting/finding-id-hash.js +7 -0
  509. package/dist/lib/shared/reporting/impact-levels.js +1 -1
  510. package/dist/lib/shared/reporting/pillar-rules.js +13 -1
  511. package/dist/lib/shared/reporting/pillars.js +37 -19
  512. package/dist/lib/shared/reporting/rule-docs.js +2 -2
  513. package/dist/lib/shared/reporting/rule-pack-fingerprint.js +21 -0
  514. package/dist/lib/shared/reporting/source-report.js +16 -2
  515. package/dist/lib/shared/reporting/stray-console-methods.js +1 -0
  516. package/dist/lib/shared/rule-registry.js +6 -1
  517. package/dist/lib/shared/system/atomic-write.js +12 -6
  518. package/dist/lib/shared/system/component-source.js +28 -0
  519. package/dist/lib/shared/system/environment.js +12 -0
  520. package/dist/lib/shared/system/file-key.js +8 -0
  521. package/dist/lib/shared/system/git.js +47 -0
  522. package/dist/lib/shared/system/glob.js +92 -14
  523. package/dist/lib/shared/system/jsonc-config.js +63 -0
  524. package/dist/lib/shared/system/path-inside.js +19 -0
  525. package/dist/lib/shared/system/posix-path.js +22 -0
  526. package/dist/lib/shared/system/read-json.js +10 -0
  527. package/dist/lib/shared/system/sentry.js +6 -3
  528. package/dist/lib/shared/system/text-helpers.js +40 -0
  529. package/dist/lib/shared/system/windows-orphans-script.js +75 -0
  530. package/dist/lib/shared/system/windows-orphans.js +28 -0
  531. package/dist/lib/shared/types/changed-lines.js +1 -0
  532. package/dist/lib/shared/types/completion.js +1 -0
  533. package/dist/lib/shared/workspace-selection.js +67 -0
  534. package/dist/lib/shared/workspaces.js +210 -68
  535. package/dist/polyglot/maintainability/rules.js +119 -3
  536. package/examples/README.md +45 -0
  537. package/examples/clean/avatar.html +1 -0
  538. package/examples/clean/source.ts +10 -0
  539. package/examples/clean/tsconfig.json +4 -0
  540. package/examples/findings/avatar.html +1 -0
  541. package/examples/findings/source.ts +11 -0
  542. package/examples/findings/tsconfig.json +4 -0
  543. package/examples/labels-clean.py +5 -0
  544. package/integrations/zed/Cargo.lock +1 -1
  545. package/integrations/zed/Cargo.toml +1 -1
  546. package/integrations/zed/LICENSE +201 -0
  547. package/integrations/zed/extension.toml +3 -3
  548. package/integrations/zed/extension.wasm +0 -0
  549. package/integrations/zed/src/lib.rs +108 -8
  550. package/package.json +25 -14
  551. package/polyglot/performance/rules/csharp.yml +173 -10
  552. package/polyglot/performance/rules/go.yml +15 -7
  553. package/polyglot/performance/rules/input.yml +12 -0
  554. package/polyglot/performance/rules/java.yml +52 -1
  555. package/polyglot/performance/rules/php.yml +146 -0
  556. package/polyglot/performance/rules/python.yml +7 -3
  557. package/polyglot/performance/rules/ruby.yml +81 -0
  558. package/polyglot/performance/sgconfig.yml +2 -0
  559. package/polyglot/reliability/rules/csharp.yml +105 -0
  560. package/polyglot/reliability/rules/go.yml +339 -0
  561. package/polyglot/reliability/rules/input.yml +6 -0
  562. package/polyglot/reliability/rules/java.yml +218 -0
  563. package/polyglot/reliability/rules/kotlin.yml +49 -0
  564. package/polyglot/reliability/rules/python.yml +288 -0
  565. package/polyglot/reliability/rules/rust.yml +83 -0
  566. package/polyglot/reliability/sgconfig.yml +1 -0
  567. package/polyglot/security/rules/csharp.yml +143 -3
  568. package/polyglot/security/rules/go.yml +59 -4
  569. package/polyglot/security/rules/java.yml +103 -0
  570. package/polyglot/security/rules/python.yml +413 -21
  571. package/polyglot/security/rules/rust.yml +176 -3
  572. package/polyglot/security/sgconfig.yml +2 -0
  573. package/polyglot/security/utils/java-imported-jca-cipher.yml +32 -0
  574. package/polyglot/security/utils/java-unshadowed-javax.yml +29 -0
  575. package/schema/loadwise.config.schema.json +1051 -600
  576. package/schema/loadwise.outcomes.schema.json +43 -0
  577. package/types/scan.d.ts +53 -0
  578. package/dist/lib/maintainability/site-fixes/exports.js +0 -25
  579. package/docs/assets/cli-workflow.gif +0 -0
  580. package/plugin/.claude-plugin/plugin.json +0 -9
  581. package/plugin/commands/loadwise.md +0 -29
  582. package/plugin/hooks/check-edited-file.mjs +0 -173
  583. package/plugin/hooks/hooks.json +0 -17
  584. /package/dist/lib/{maintainability/types/changed-lines.js → editor/types/workspace-fix.js} +0 -0
package/README.md CHANGED
@@ -1,17 +1,37 @@
1
1
  # Loadwise
2
2
 
3
- [![npm](https://img.shields.io/npm/v/loadwise)](https://www.npmjs.com/package/loadwise) [![check](https://github.com/IbrahimHafez1/loadwise/actions/workflows/check.yml/badge.svg)](https://github.com/IbrahimHafez1/loadwise/actions/workflows/check.yml) [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/IbrahimHafez1/loadwise/badge)](https://scorecard.dev/viewer/?uri=github.com/IbrahimHafez1/loadwise) [![license](https://img.shields.io/npm/l/loadwise?cacheSeconds=3600)](LICENSE)
3
+ [![npm](https://img.shields.io/npm/v/loadwise)](https://www.npmjs.com/package/loadwise) [![check](https://github.com/IbrahimHafez1/loadwise/actions/workflows/check.yml/badge.svg)](https://github.com/IbrahimHafez1/loadwise/actions/workflows/check.yml) [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/IbrahimHafez1/loadwise/badge)](https://scorecard.dev/viewer/?uri=github.com/IbrahimHafez1/loadwise) [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/17450/badge)](https://www.bestpractices.dev/projects/17450) [![license](https://img.shields.io/npm/l/loadwise?cacheSeconds=3600)](https://github.com/IbrahimHafez1/loadwise/blob/main/LICENSE)
4
4
 
5
5
  **[npm package](https://www.npmjs.com/package/loadwise)** · **[Documentation](https://loadwise.mintlify.app/)** · **[Accuracy Scorecard](https://github.com/IbrahimHafez1/loadwise/blob/main/bench/corpus/scorecard.md)** · **[Sponsor](https://github.com/sponsors/IbrahimHafez1)**
6
6
 
7
- [Quick Start](#install--quick-start) · [Commands](#commands) · [GitHub Action](#github-action) · [AI Agents & Editor](#use-with-ai-coding-agents) · [Rule Reference](#full-rule--checker-reference) · [Sponsors](#sponsors)
7
+ [Quick Start](#quick-start) · [Checkers](#what-it-checks) · [Fixes](#how-fixes-work) · [Editors](#editors) · [AI Agents](#ai-coding-agents) · [GitHub Action](#github-action) · [Commands](#command-reference) · [Rule Reference](#full-rule--checker-reference)
8
8
 
9
- ![Loadwise finds repeated array lookups, previews a Set-based edit with loadwise fix, applies it with --apply, and checks the project again](docs/assets/cli-workflow.gif)
9
+ ![Loadwise 0.9.0 finds a repeated array lookup, previews and applies a Set-based fix, then checks again with zero findings](https://raw.githubusercontent.com/IbrahimHafez1/loadwise/refs/tags/v0.9.0/docs/assets/cli-workflow.gif)
10
10
 
11
- You already run `tsc`, ESLint, and CI. None of them stop a pull request that starts a PostgreSQL transaction on a connection pool and accidentally sends `BEGIN`, `UPDATE`, and `COMMIT` to different connections:
11
+ Loadwise is a command-line checker for TypeScript and JavaScript projects. It reports performance, reliability, maintainability, security and accessibility problems, explains each one, and previews an edit when it can generate one. It runs locally with no config file, no API key and no network upload by default.
12
+
13
+ > **Pre-1.0.** Rule IDs, CLI flags, the JSON report and the config schema can change in a minor release (see [CHANGELOG.md](https://github.com/IbrahimHafez1/loadwise/blob/main/CHANGELOG.md)). False-positive reports are the most useful feedback: [open one](https://github.com/IbrahimHafez1/loadwise/issues/new?template=false-positive.yml).
14
+
15
+ ## Quick start
16
+
17
+ You need **Node.js 22.13.0 or later**. From a project folder:
18
+
19
+ ```sh
20
+ npx loadwise check # scan the project; source files stay untouched
21
+ npx loadwise explain array-repeated-membership # read about a rule
22
+ npx loadwise explain --list --checker perf # browse rule IDs
23
+ npx loadwise fix # preview automatic edits
24
+ npx loadwise fix --apply # apply them
25
+ ```
26
+
27
+ To pin Loadwise to the project, run `npm install --save-dev loadwise`. Use `npx loadwise check --uncommitted` to scan only your local changes. Opt-in crash reporting stays off unless you run `npx loadwise --report-crashes check`, set `LOADWISE_CRASH_REPORTS=1` or configure a valid `LOADWISE_SENTRY_DSN`.
28
+
29
+ ### Example
30
+
31
+ This file passes `tsc` and ESLint. Each `pool.query()` can run on a different connection, so `BEGIN`, `UPDATE` and `COMMIT` may not share one transaction:
12
32
 
13
33
  ```ts
14
- // transfer.ts — passes tsc and ESLint cleanly
34
+ // transfer.ts
15
35
  import type { Pool } from 'pg';
16
36
 
17
37
  export async function transfer(pool: Pool, fromId: string, toId: string, amount: number) {
@@ -22,8 +42,6 @@ export async function transfer(pool: Pool, fromId: string, toId: string, amount:
22
42
  }
23
43
  ```
24
44
 
25
- With **Node.js 22.13.0 or later**, run `npx loadwise check` locally—no config file, no API key, no network upload by default (opt-in crash reporting stays off unless you run `npx loadwise --report-crashes check`, set `LOADWISE_CRASH_REPORTS=1`, or configure a valid `LOADWISE_SENTRY_DSN`), and your source files stay untouched. This excerpt focuses on the reliability checker.
26
-
27
45
  ```text
28
46
  $ npx loadwise check --only rel
29
47
  Scope: . (all files)
@@ -37,237 +55,93 @@ Checkers: rel
37
55
  transfer.ts:5:14 #245ca194d514
38
56
  ```
39
57
 
40
- Both findings point to the same review-marked fix. Preview the edit for the first finding and apply it after reviewing the diff.
58
+ Both findings point to the same review-marked fix. Preview the edit for the first finding, read the diff, then apply it:
41
59
 
42
60
  ```sh
43
61
  npx loadwise fix --only rel --id 245ca194d514 --dry-run
44
62
  npx loadwise fix --only rel --id 245ca194d514
45
63
  ```
46
64
 
47
- The full rescan reports zero findings.
48
-
49
- ```text
50
- $ npx loadwise check
51
- Scope: . (all files)
52
- Checkers: perf, rel, maint, sec, a11y
53
-
54
- == Performance ==
55
- 1 file checked, 0 findings.
56
-
57
- == Reliability ==
58
- 1 file checked, 0 findings.
59
-
60
- == Maintainability ==
61
- 1 source file, 0 findings, 0 contract findings.
62
-
63
- == Security ==
64
- 1 file checked, 0 findings.
65
- ```
66
-
67
- _Loadwise skips accessibility on projects without frontend sources._
65
+ A full `npx loadwise check` then reports zero findings. Loadwise skips accessibility on projects without frontend sources.
68
66
 
69
- ## Five Checkers in One CLI
67
+ ### Try it on a bundled example
70
68
 
71
- Loadwise checks TypeScript and JavaScript projects—deepest on backend and database code, plus React, Next.js, Vue, and Angular frontends:
72
-
73
- - **Performance** (`loadwise perf`): N+1 queries, ORM/SQL query integrity, blocking sync calls, quadratic collection loops, React/Vue/Angular render & cleanup issues, schema-aware indexes, OpenTelemetry traces, and optional read-only DB inspection.
74
- - **Reliability** (`loadwise rel`): transaction-client escapes (`pg`, Prisma, TypeORM), unreleased checkouts, unhandled rejections and swallowed errors, missing HTTP/pool timeouts, idempotency keys, migration lock risks, and breaking OpenAPI changes.
75
- - **Maintainability** (`loadwise maint`): deep nesting, branch complexity, duplicate implementations, dependency cycles, and declared architecture boundaries.
76
- - **Security** (`loadwise sec`): request-to-sink injection, auth/crypto flaws, exposed secrets (including client bundles), unsafe HTML/URLs, Docker/Compose checks, row-scope verification, and optional `--online` advisories.
77
- - **Accessibility** (`loadwise a11y`): missing alt text, unlabelled controls, non-interactive click handlers, invalid ARIA, and missing page language in JSX, HTML, Vue, Svelte, and Angular templates.
78
-
79
- See the **[corpus rule scorecard](https://github.com/IbrahimHafez1/loadwise/blob/main/bench/corpus/scorecard.md)** for measured precision and recall across 17 pinned open-source repositories, and **[docs/rules](https://github.com/IbrahimHafez1/loadwise/tree/main/docs/rules)** for per-rule documentation.
80
-
81
- > **Pre-1.0.** Loadwise is under active development. Rule IDs, CLI flags, the JSON report, and config schema can change in a minor release (see [CHANGELOG.md](https://github.com/IbrahimHafez1/loadwise/blob/main/CHANGELOG.md)). False-positive reports are the most useful feedback: [open one](https://github.com/IbrahimHafez1/loadwise/issues/new?template=false-positive.yml).
82
-
83
- ## Install & Quick Start
84
-
85
- Use Node.js 22.13.0 or later. Install Loadwise in the project with `npm install --save-dev loadwise`, or use `npx` for a one-off run.
69
+ From a project with `loadwise` installed, copy an example to a disposable file and scan it:
86
70
 
87
71
  ```sh
88
- npx loadwise check # scan the project
89
- npx loadwise explain array-repeated-membership # understand a rule
90
- npx loadwise fix # preview automatic edits
91
- ```
92
-
93
- Run `npx loadwise fix --apply` to apply the automatic edits. To work on local changes only, use `npx loadwise check --uncommitted` and `npx loadwise fix --uncommitted`. Use `npx loadwise --version` to see the installed version.
94
-
95
- After your first scan, [share a useful finding or a false positive](https://github.com/IbrahimHafez1/loadwise/issues/203). One rule ID and a sentence about what you fixed or why the code was safe are enough. If Loadwise helped, [give it a star on GitHub](https://github.com/IbrahimHafez1/loadwise). To contribute code or docs, [pick a good first issue](https://github.com/IbrahimHafez1/loadwise/issues?q=is%3Aissue%20is%3Aopen%20label%3A%22good%20first%20issue%22).
96
-
97
- **With an AI coding agent**, say **“Run Loadwise”** in your project chat. The agent runs the installed CLI directly, verifies findings against callers and tests, and asks before making edits. [Active-agent workflow and optional MCP setup](#using-loadwise-with-an-active-coding-agent)
98
-
99
- ### Try a finding and a fix
100
-
101
- From a project with `loadwise` installed, copy the bundled example to a disposable file and scan it:
102
-
103
- ```sh
104
- node -e "require('node:fs').copyFileSync('node_modules/loadwise/examples/slow.ts', 'loadwise-demo.ts', require('node:fs').constants.COPYFILE_EXCL)"
72
+ node -e "require('node:fs').copyFileSync(require.resolve('loadwise/examples/slow.ts'), 'loadwise-demo.ts', require('node:fs').constants.COPYFILE_EXCL)"
105
73
  npx loadwise perf loadwise-demo.ts
106
- npx loadwise explain array-repeated-membership
107
74
  npx loadwise perf loadwise-demo.ts --fix --only FINDING_ID
108
- npx loadwise perf loadwise-demo.ts
109
75
  ```
110
76
 
111
- Replace `FINDING_ID` with the `#id` printed by the first scan, then remove `loadwise-demo.ts` when finished. In your own application, install dependencies and generate any ORM client (`npx prisma generate`) first, then check stderr coverage notes for any skipped inputs. Start with `--min-impact high` to triage large reports.
112
-
113
- ## Commands
114
-
115
- | Task | Commands |
116
- | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
117
- | Scan a project or branch | `loadwise check [directory]`, `loadwise check --uncommitted`, `loadwise check --changed-since origin/main`, `loadwise check --staged` |
118
- | Understand a finding | `loadwise explain <rule-id>` |
119
- | Preview or apply edits | `loadwise fix` previews automatic fixes. `loadwise fix --apply` writes them. `loadwise fix --id <finding-id>` writes one selected fix. |
120
- | Focus on one checker | `loadwise check --only perf`. Choose from `perf`, `rel`, `maint`, `sec`, and `a11y`. Each also has a direct command for specialized options. |
121
- | Review migrations or API changes | `loadwise rel migrations`, `loadwise rel contracts` |
122
- | Investigate slow database operations | `loadwise perf db` for database inspection, `loadwise perf plan <file>` for an execution plan, `loadwise perf traces <file>` for an OTLP trace |
123
- | Check dependencies or other languages | `loadwise sec deps --online`, or `polyglot` under `loadwise perf`, `loadwise rel`, or `loadwise sec` |
124
- | Inspect module dependencies | `loadwise maint --graph <file>` |
125
- | Install editor diagnostics | `loadwise editor setup` detects the editor or lets you select one. Use `--editor stdio` for a custom language client. |
126
- | Connect a coding agent | `loadwise agent mcp --print-config`, `loadwise agent init`. Use `agent init --mode ask` or `--mode auto` to configure edit permissions. See `loadwise agent --help` for review prompts, pending reports, history, and verification. |
127
- | Report a false positive | `loadwise report-fp --rule <rule-id>` |
77
+ Replace `FINDING_ID` with the id printed after `#` by the first scan, without the `#`, then delete `loadwise-demo.ts`. The [examples guide](https://github.com/IbrahimHafez1/loadwise/blob/main/examples/README.md) has an offline exercise and a clean control for each checker, plus a Python scan. In your own application, install dependencies and generate any ORM client (`npx prisma generate`) first, and read the stderr coverage notes for skipped inputs. Start with `--min-impact high` to triage large reports.
128
78
 
129
- Run `loadwise check --help` for scan options and `loadwise fix --help` for edit options. Bare `loadwise` runs the configured checks in the current directory. Use `--skip maint` to run every checker except maintainability. Both `--only` and `--skip` on `check` accept short and full checker names, such as `--only perf,security`.
79
+ ## What it checks
130
80
 
131
- `check` accepts these flags and passes them to every selected checker:
81
+ Loadwise is deepest on backend and database code, and also covers React, Next.js, Vue and Angular frontends. Each checker has its own command and a docs page.
132
82
 
133
- - `--json` prints one object with a key per selected checker, `{ "performance": report, "reliability": report, "maintainability": report, "security": report, "accessibility": report }`. A checker that was skipped or could not run has `null`. The optional `_coverage` object records why accessibility did not apply (`not-applicable` with reason `no-frontend-sources`) or identifies a partial report (`incomplete` with its exit code). A bare `null` still counts as unavailable in `agent verify`.
134
- - `--format text|json|sarif|github` picks the output; `--json` is `--format json`. `sarif` prints SARIF 2.1.0 with one run per checker for GitHub code scanning, and `github` prints `::warning`/`::error`/`::notice` workflow annotations. The checker commands accept it too. Exit codes do not depend on the format.
135
- - `--include-contextual` also shows lower-priority findings (one-off blocking calls in CLI startup, test and seed sources and similar), each with its reason. JSON counts the hidden ones in `contextualFindingCount`; in the expanded view they appear in `findings` with a `contextualReason`.
136
- - `--uncommitted` checks all local changes since `HEAD`, including staged and unstaged lines and untracked files. It requires an initial commit. Choose one change filter per run. `--staged` or `--changed-since <git-ref>` reports only findings on changed lines (see [Changed lines](#changed-lines)).
137
- - `--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.
138
- - `--min-impact <low|medium|high|critical>` reports only findings at that level or above (see [Impact levels](#impact-levels)).
139
- - `--config <file>`, `--ignore <rule-id>` and `--workspace <name|path>` are described under [Configuration](#configuration); `--online` adds the [dependency checks](#dependency-checks).
140
- - `--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; the checker commands take the same flags and read or write only their own section. Entries match on rule, file and flagged code, with a count per entry so N recorded copies allow N findings. Refreshed JavaScript and TypeScript baselines also match after spacing changes and removal of optional statement-ending semicolons. Text output ends with `N baseline findings hidden.` and `--json` adds `baselineHidden`. A full comparison reports unmatched entries in `baselineStale`; a partial one, such as a changed-line or single-file scan, reports `null`. 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 baseline.
83
+ - **[Performance](https://loadwise.mintlify.app/checkers/performance)** (`loadwise perf`): N+1 queries, ORM and SQL query integrity, blocking sync calls, quadratic collection loops, framework render and cleanup issues, schema-aware indexes, OpenTelemetry traces, and optional read-only database inspection.
84
+ - **[Reliability](https://loadwise.mintlify.app/checkers/reliability)** (`loadwise rel`): transaction-client escapes (`pg`, Prisma, TypeORM), unreleased checkouts, unhandled rejections and swallowed errors, missing HTTP and pool timeouts, idempotency keys, migration lock risks, and breaking OpenAPI changes.
85
+ - **[Maintainability](https://loadwise.mintlify.app/checkers/maintainability)** (`loadwise maint`): deep nesting, branch complexity, duplicate implementations, dependency cycles, and declared architecture boundaries.
86
+ - **[Security](https://loadwise.mintlify.app/checkers/security)** (`loadwise sec`): request-to-sink injection, auth and crypto flaws, exposed secrets (including client bundles), unsafe HTML and URLs, Docker and Compose checks, row-scope verification, and optional `--online` advisories.
87
+ - **[Accessibility](https://loadwise.mintlify.app/checkers/accessibility)** (`loadwise a11y`): missing alt text, unlabelled controls, non-interactive click handlers, invalid ARIA, and missing page language in JSX, HTML, Vue, Svelte and Angular templates.
141
88
 
142
- **Exit codes:** **0** passed, **1** a checker met its exit threshold, **2** invalid input or configuration in any checker, a checker that produced no result, or a scan that skipped a file. A JavaScript or TypeScript file that does not parse, or whose analysis fails, is skipped while every other file is still reported; it is named on stderr and in a `skippedFiles` array of `{ file, reason }` in `--json` output (also with `--fix` and `--write-baseline`). `check` keeps that checker's findings, marks its SARIF run as not successful and emits a GitHub warning for each skipped file. A file that exists but cannot be read (the schema snapshot, `package.json`, a review directive) prints a note on stderr; an absent file stays silent.
89
+ Some performance and reliability rules also cover Python, Go, Java, C#, Rust, Ruby, PHP and Kotlin through `polyglot` subcommands; see the [rule reference](#full-rule--checker-reference). The [corpus rule scorecard](https://github.com/IbrahimHafez1/loadwise/blob/main/bench/corpus/scorecard.md) lists measured precision and recall across 17 pinned open-source repositories, and [docs/rules](https://github.com/IbrahimHafez1/loadwise/tree/main/docs/rules) documents each rule.
143
90
 
144
- **Projects and workspaces.** The source 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 with a `package.json` and no config has its JavaScript and TypeScript sources inferred from the project inventory and checked 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. When performance and reliability are selected together, they share a type-check unless a baseline is being written. A complete text scan with automatic fixes prints a scoped `loadwise fix` preview command when the fix command supports the scan filters. For specialized filters, review the individual findings and their checker-specific fix commands.
91
+ Every finding has an impact level (`critical`, `high`, `medium` or `low`). Filter with `--min-impact <level>`; the [impact levels](https://loadwise.mintlify.app/configuration#impact-levels) section defines them.
145
92
 
146
- **Cache.** `loadwise check` reuses the previous result for an unchanged Git project from the `loadwise` folder of the OS cache directory. Any edit to a tracked or untracked (not ignored) file, a package install that rewrites `node_modules`, a different flag or a new Loadwise version runs a fresh scan; `LOADWISE_NO_CACHE=1` always scans afresh. Fixes, `--staged`, `--changed-since`, `--online` and `--write-baseline` runs are never cached.
93
+ ## How fixes work
147
94
 
148
- **Memory.** On large projects the checkers run with a larger Node memory limit, 60% of the machine's memory, at least 4096 MB and at most 16384 MB (never below Node's own default). A `--max-old-space-size` you set in `NODE_OPTIONS` is never overridden. Direct `loadwise perf`, `loadwise sec` and `loadwise maint` runs re-launch once to apply the limit. If a checker still runs out of memory, `check` names it and the limit it had, tells you to raise it with `NODE_OPTIONS=--max-old-space-size=<megabytes>`, and exits 2. The native engine (`--engine native`) uses much less memory on most projects.
149
-
150
- ### Fixes
151
-
152
- ```bash
153
- npx loadwise fix # preview automatic edits
154
- npx loadwise fix --apply # apply automatic edits
155
- npx loadwise fix --all # all generated edits, including review suggestions
156
- npx loadwise fix --all performance security # only the named checkers
157
- npx loadwise fix --all --dry-run # preview even edits marked for review
158
- ```
159
-
160
- A preview prints the diff and a matching apply command when automatic edits are available. The existing `--yes` spelling also applies automatic fixes. Add `--dry-run` to preview an explicit write mode such as `--all` or `--id`.
161
-
162
- Use the same directory, project configuration, workspace, and changed-line selection when going from a scan to a fix:
95
+ `loadwise fix` previews the generated edits as a diff and changes nothing. Loadwise writes edits only in an explicit mode, and checks source lines, scope and types before it writes.
163
96
 
164
97
  ```sh
165
- npx loadwise check ./apps/store --only perf --changed-since origin/main
166
- npx loadwise fix ./apps/store --only perf --changed-since origin/main
167
- npx loadwise fix ./apps/store --only perf --changed-since origin/main --id FINDING_ID
98
+ npx loadwise fix # preview automatic edits
99
+ npx loadwise fix --apply # apply automatic edits
100
+ npx loadwise fix --interactive # approve one finding at a time
101
+ npx loadwise fix --only perf --id <id> # apply exactly one finding, by the #id in the report
102
+ npx loadwise perf --fix --only <id> # the same edit through a checker command
168
103
  ```
169
104
 
170
- `--config <file>` selects the project configuration. Repeat `--workspace <name-or-path>` to select packages. Use `--uncommitted`, `--staged`, or `--changed-since <ref>` to limit edits to changed lines. A generated edit that needs lines outside that scope is skipped as a whole. With `--staged`, a file that also contains unstaged edits is deferred because its working-tree line numbers can differ from the index. Fixes edit the working tree and leave staging to you. Prefix a directory that shares a checker name with `./`, as in `loadwise fix ./perf --dry-run`.
171
-
172
- On combined commands, `--only` selects checkers. On `fix`, `--id` selects individual findings and `--rule` filters by rule. Repeat `--id` or pass comma-separated IDs to select several. Selecting a review-marked edit by ID authorizes that edit. Preview it with `--dry-run`. If any requested ID is missing, ambiguous, or cannot be applied, the selection exits with code 2 before writing edits. The direct checker spelling, such as `loadwise perf --fix --only <id>`, also works.
173
-
174
- Checker names (`performance`, `reliability`, `maintainability`, `security`, `accessibility`) are separated by spaces; with none, Loadwise uses the project's configured checkers. `fix` lists manual changes and findings that need individual review by location and ID; a fix that touches lines reserved for review also needs individual review. Loadwise checks the remaining edits together before writing, and performance and security share a type-check when both are selected. It exits 2 if a selected checker fails or is skipped, source lines have changed, or automatic fixes conflict, and 0 on success even when manual findings remain. Manual findings have no generated edit; with `--all`, inspect the diff and run your tests, especially for schema changes and edits that alter behavior. `fix --json` includes `dryRun`, `changedFiles`, proposed or applied edits in `applied`, outstanding manual and review findings, refused fixes in `notApplied`, and follow-up instructions. In a preview, `changedFiles` counts files the edits would change.
175
-
176
- Bare `loadwise fix` and `--dry-run` show the generated edits before project formatting. Applying the edits can change their whitespace or quoting. Each applied fix in a JavaScript or TypeScript file gets a `// Loadwise <rule-id>: <why>` comment above the fixed statement, and the changed lines are formatted with the project's own Prettier, honouring its config and `.prettierignore`; the rest of the file stays byte-identical. Without Prettier the edits are written as generated, with a note. `--no-comments` and `--no-format` turn these off, also on the per-checker `--fix`. `fix` also takes repeatable `--rule <rule-id>` filtering and `--no-verify-types` (skip the post-edit TypeScript check).
177
-
178
- Maintainability `--fix` limits edits to the checked project. Performance, reliability, security, and accessibility `--fix` use the containing Git repositories of the checked projects or explicitly named source files, so fixes can include shared files such as a schema at a monorepo root. Outside a Git repository, they use the project root. Per-checker fixes refuse hard-linked files and symbolic links that are dangling or resolve outside those limits. Existing files keep their permissions when replaced.
105
+ - A finding marked for review needs its own approval. Naming its `--id` counts as approval, and `--dry-run` previews it first.
106
+ - `--all` applies every generated edit eligible for bulk application. Run your tests afterwards.
107
+ - Findings without a generated edit are manual. `loadwise fix --handoff` prints them as a Markdown brief.
108
+ - Use the same directory, `--config`, `--workspace` and changed-line filters (`--uncommitted`, `--staged`, `--changed-since <ref>`) for the scan and the fix.
109
+ - `--patch` writes a Git patch without touching files. `--record-reversal` keeps a receipt that `--reverse <run-id>` can preview undoing.
110
+ - To keep an intentional site, put `// loadwise-reviewed <rule-id> -- <reason>` on the line before it.
179
111
 
180
- Some transformations always need individual review: making a locally used constant private can affect consumers outside the scan; sharing a private helper between sibling TypeScript modules changes the files included in the build; narrowing a whole-table Drizzle update to rows with differing values can affect locking, triggers and affected-row counts; an upload size limit (the 10 MiB example can reject valid uploads, so check existing gateway or Multer limits); and the Mongoose `.lean()` rewrite, because a lean result skips schema defaults, getters and virtuals. For private TypeScript applications that control their consumers, `npx loadwise fix --all --recipe verified-private-types` also makes locally used type declarations private, after checking the edits with the bundled TypeScript compiler; omit it when other repositories import your types.
112
+ The [fixes guide](https://loadwise.mintlify.app/commands#fixes) covers recipes, `--json` output, formatting and the review rules in full.
181
113
 
182
- A local CommonJS recipe encodes your own policy for a manual finding, run alongside the built-in fixes with `npx loadwise fix --all reliability --recipe ./loadwise-fixes.cjs`:
114
+ ## Editors
183
115
 
184
- ```js
185
- module.exports = {
186
- 'rel/swallowed-error'({ finding, source }) {
187
- if (finding.file !== 'scripts/refresh-cache.ts') return null;
188
- const before = source.split(/\r?\n/)[finding.line - 1];
189
- if (before?.trim() !== '} catch {}') return null;
190
- return [{
191
- line: finding.line,
192
- before,
193
- after: before.replace('catch {}', "catch (error) { throw new Error('Cache refresh failed', { cause: error }); }"),
194
- }];
195
- },
196
- };
116
+ ```sh
117
+ npx loadwise@latest editor setup
197
118
  ```
198
119
 
199
- Keys are `perf`, `rel`, `maint`, `sec` or `a11y` followed by `/` and the rule ID. A handler receives the finding and the source file text and returns exact, whole-line replacements in that file, or `null` to leave the site manual. Recipes run only where there is no built-in fix, and their edits are validated together before writing. Explicitly supplied recipe files execute as local JavaScript during both preview and apply. Use only trusted recipes and keep handlers free of side effects.
200
-
201
- ### Per-checker fixes and dismissals
120
+ Setup installs the extension or prepares a language client for VS Code, VSCodium, Grok Build (formerly Cursor), Devin (formerly Windsurf), Antigravity IDE, Zed, Sublime Text, Neovim, Helix, Emacs, Vim and JetBrains IDEs. Choose one with `--editor <name>`, or use `--editor stdio` for any other LSP client. A client can also launch `loadwise lsp --stdio` directly. Zed installs from the npm package (`loadwise editor setup --editor zed`). Diagnostics carry the rule as their code, with hovers, quick fixes, **Apply all** and dismissals. Requirements per editor are in the [editor guide](https://loadwise.mintlify.app/editor).
202
121
 
203
- The source-check commands (`perf`, `rel`, `maint`, `sec` and `a11y` on a project or files, not subcommands such as `perf traces`, `rel migrations` or `sec deps`) take `--fix` (asks **y**es, **n**o, **a**ll remaining or **q**uit for each fix; needs a terminal), `--fix --yes` (applies eligible fixes without asking) and `--fix --only <id>[,<id>...]` (applies exactly those fixes, no prompt or terminal needed). With `--json`, `--only` prints `{ applied, alreadyApplied, failed }`: an id whose change an earlier id already made, such as a shared `Set`, is in `alreadyApplied`; an unknown id, a finding without a fix or a stale fix is in `failed` and the exit code is 2. `--fix` cannot be combined with `--watch` or `--graph`, or with `--json` except with `--only`, and `--yes` is valid only with `--fix`. A fix applies only where the original lines still exist and never overwrites an existing file. With `--json`, a fix is `fix = { changes: [{ file, line, before, after, create? }], note? }`, where `create` holds a whole new file such as a migration; findings also carry `fixable`. The id hashes the rule, the file and the flagged line's text, so it survives edits above the finding. If identical findings occur in differently named JavaScript or TypeScript declarations, the ids also hash those names. Remaining collisions receive numbered suffixes.
122
+ ## AI coding agents
204
123
 
205
- To keep an intentional site, put a comment on its own line immediately before the diagnostic line (line 1 for a whole-file finding such as `large-module`), naming one exact rule and a reason. The comment makes every eligible finding of that rule on the diagnostic line contextual, including findings introduced by later edits to that line. Use `--include-contextual` to see those findings. Declared contracts (CI contract rules, `file-placement`, `folder-boundary`, `data-access-boundary`, `query-mutates-state`, configured row scopes) and Prisma transaction-client escapes and read-modify-write findings cannot be lowered this way.
206
-
207
- ```ts
208
- // loadwise-reviewed pg-query-in-loop -- Each iteration measures a separate query-plan sample.
209
- await client.query(statement);
210
- ```
211
-
212
- ### Changed lines
124
+ Ask your agent to "Run Loadwise". When it runs a check or fix, the CLI gives a recognized agent a review workflow on stderr, and the agent asks before it edits.
213
125
 
214
126
  ```sh
215
- npx loadwise perf --staged # lines added or modified in the git index
216
- npx loadwise perf --changed-since origin/main # lines changed in the working tree since a ref
217
- npx loadwise maint --staged .
218
- ```
219
-
220
- These report only findings on changed lines, each with its id, the exact `--fix --only <id>` command when an automatic fix exists, and the `loadwise-reviewed` comment that dismisses it. `--json` keeps the usual shape, filtered, and the exit code is 1 when findings remain. With no changed supported source files the command exits 0 before TypeScript loads. Only the changed files are analysed as roots while imports still resolve through the project; untracked files count as fully changed with `--changed-since`, and a file with unstaged edits can report lines that differ from the staged version. `schema.prisma` findings are not part of this mode. The direct `perf`, `rel`, `sec` and `a11y` source commands accept these Git filters when scanning a project. Use the unified fix command to keep the same filter when applying an edit, for example `loadwise fix --staged --only perf --id FINDING_ID`. Maintainability also supports `loadwise maint --staged --fix --only FINDING_ID` and the equivalent `--changed-since` form.
221
-
222
- For maintainability, a JS/TS function-level finding (`high-branch-complexity`, `deep-control-flow`) is kept when a changed line falls anywhere inside its function, and `--fail-on` defaults to `all`. When at least 600 files changed, the full scan runs and is filtered to the changed lines; otherwise `duplicate-implementation` is skipped and `dependency-cycle` only sees cycles made of the changed files' imports.
223
-
224
- ## Configuration
225
-
226
- One optional file, `loadwise.config.json`, sets the defaults for every checker. `loadwise check` looks for it in the checked directory and each checker command (`loadwise perf`, `rel`, `maint`, `sec` or `a11y`) in the project folder; `--config <file>` on `check` (`--loadwise-config <file>` on the checker commands) names another one. Add `$schema` for editor completion and validation.
227
-
228
- ```json
229
- {
230
- "$schema": "./node_modules/loadwise/schema/loadwise.config.schema.json",
231
- "checkers": ["perf", "rel", "maint"],
232
- "ignore": ["generated/**", "scripts/**"],
233
- "rules": {
234
- "duplicate-implementation": "warn",
235
- "array-repeated-find": "off",
236
- "pg-query-in-loop": { "level": "error" }
237
- },
238
- "overrides": [{ "files": ["src/legacy/**"], "rules": { "high-branch-complexity": "off" } }],
239
- "performance": {
240
- "parallelReads": [{ "from": "@app/reads", "exports": ["fetchUser", "fetchPosts"] }]
241
- },
242
- "maintainability": {
243
- "exclude": ["vendor"],
244
- "placement": [{ "suffix": ".controller.ts", "under": ["src/controllers"] }]
245
- }
246
- }
127
+ npm install --save-dev loadwise
128
+ npx loadwise agent init
247
129
  ```
248
130
 
249
- - `checkers` is the default selection for `loadwise check`; `--only` and `--skip` override it.
250
- - `ignore` lists globs, relative to the config file, that no checker scans or reports on; they leave the scan itself, so they cost no time and never count toward duplicates, cycles or architecture. `*` matches within a folder, `**` any depth, `?` one character and `{a,b}` alternatives; naming a folder covers everything below it.
251
- - `rules` sets each rule to `"off"` (its findings are dropped), `"warn"` (reported, but never changes the exit code) or `"error"` (reported findings always count, even under `--fail-on contract`). A hidden contextual finding is not reported, so it never counts. The object form `{ "level": "warn", "options": { ... } }` sets thresholds for rules that take them, such as `maxDepth` or `maxComplexity`; the [config schema](schema/loadwise.config.schema.json) lists each rule's options, and an unknown option exits with code 2.
252
- - `overrides` apply `rules` to the files matching `files`; a later override wins over an earlier one and over `rules`.
253
- - `performance` holds the query policy (see [Project-defined access policy](#project-defined-access-policy)), and `maintainability` holds the maintainability policy (see [Project rules](#project-rules)). `--policy file.json` and `--config file.json` name a policy file for one run and beat the config sections.
254
- - `--ignore <rule-id>` (repeatable, on `check` and every checker) adds a rule to `"off"` for one run and beats the config.
255
- - `--workspace <name|path>` (repeatable) limits every checker to some workspace packages.
131
+ `agent init` adds an after-edit hook and a local MCP server named `loadwise` for Claude Code, GitHub Copilot, Grok Build, Gemini CLI, Codex, Devin and Cline, plus a managed section in `AGENTS.md` imported from `CLAUDE.md`. After each edit, the hook runs the project's installed `loadwise` on that file with a 20-second limit and returns findings with their `--fix --only <id>` commands. The hook does nothing until Loadwise is installed. The earlier Claude Code plugin and its `/loadwise` command are removed; run `/plugin uninstall loadwise` if you installed the plugin.
256
132
 
257
- An unknown key or rule id, a wrong level or a malformed section exits with code 2 and lists each problem. Rule ids come from the registered checkers, so a rule id that no checker has yet is rejected. The config applies to source checks and the `polyglot` commands. `rel contracts` reads `loadwise.config.json` in the current directory, or the file named by `--loadwise-config <file>`, and applies `ignore` and the rule levels in `rules` and `overrides`. An ignored file can still supply inherited properties when an included NestJS DTO extends a class from that file. In that case, any finding points to the included DTO. `rel migrations`, `perf db`, `perf traces` and `perf plan` do not read the config.
133
+ - `loadwise agent init --hook block` (or `warn`, `off`) manages a Git pre-commit hook that runs `loadwise check --staged`.
134
+ - `agent init --tools <list>` configures tools whose folder does not exist yet, and `--global` writes the Cline MCP file in your home folder. `--no-edit-hooks` and `--no-mcp` skip those files, while `--edit-hooks off` and `--mcp off` remove only the Loadwise entries.
135
+ - `loadwise agent mcp --print-config` prints the stdio server entry for another MCP client.
136
+ - `loadwise agent instructions` prints the review workflow, `loadwise agent prompt` prints a prompt to paste into any agent, and `loadwise agent pending` lists saved handoff reports.
137
+ - `loadwise agent history` reads past fixes and review decisions. `loadwise agent verify` checks that every finding has a recorded outcome.
138
+ - Detection uses agent environment variables. Set `LOADWISE_AGENT=1` to force it on and `LOADWISE_AGENT=0` to turn it off.
258
139
 
259
- ## Impact levels
260
-
261
- Every finding carries an impact level, shown after the rule in text output, where the most severe finding comes first within each file. JSON findings carry it as `impactLevel` (`impact` is the before/after estimate). `--min-impact <low|medium|high|critical>` reports only findings at that level or above, and the filtered ones do not count toward the exit code; an unknown level exits 2. The rule tables list each rule's default level, and dependency findings use the advisory severity.
262
-
263
- - `critical`: data loss or corruption, an outage or a lock risk in production.
264
- - `high`: a per-request scaling problem such as an N+1 or query in a loop, a deep offset, a missing foreign-key or filter index, an HTTP call without a timeout, or a dependency cycle with load-time effects.
265
- - `medium`: a measurable but local cost, or significant maintainability debt.
266
- - `low`: a micro-optimization or a readability issue.
140
+ Hook files per tool, flags and known limits are in [AI coding agents](https://loadwise.mintlify.app/ai-agents).
267
141
 
268
142
  ## GitHub Action
269
143
 
270
- The repository root is a composite action that runs `loadwise check`, prints annotations on the pull request and uploads SARIF to code scanning.
144
+ The repository root is a composite action. It runs `loadwise check`, prints annotations on the pull request and uploads SARIF to code scanning.
271
145
 
272
146
  ```yaml
273
147
  name: loadwise
@@ -288,113 +162,53 @@ jobs:
288
162
  fail-on: contract
289
163
  ```
290
164
 
291
- | Input | Default | Meaning |
292
- | -------------- | --------------- | ----------------------------------------------------------------------------------------------------- |
293
- | `checkers` | all | Passed to `--only`, for example `perf,rel,a11y`. |
294
- | `path` | `.` | Directory to check. |
295
- | `changed-only` | `false` | `true` passes `--changed-since` with the pull request base commit. |
296
- | `fail-on` | checker default | Passed to `--fail-on` (`contract` or `all`). |
297
- | `upload-sarif` | `true` | Uploads the SARIF report with `github/codeql-action/upload-sarif@v4`; needs `security-events: write`. |
298
- | `annotations` | `true` | Prints findings as workflow annotations. |
299
-
300
- The action installs its locked runtime dependencies in a runner temporary directory and runs the source at the selected action ref. SARIF and workflow annotations share one scan. The checker exit code is applied after the SARIF upload step.
301
-
302
- ## Use with AI coding agents
303
-
304
- Ask your coding agent to run Loadwise. On its first check or fix, the CLI gives a recognized agent the review workflow on stderr: a check lets the agent inspect every scoped finding, earlier edit, caller and test, and a fix request also lets it apply or adapt justified changes. The agent can read the full workflow with `loadwise agent instructions`. The first run works in a fresh checkout and leaves project instruction files and Git hooks alone.
305
-
306
- Loadwise recognizes agent shell markers from Codex, Claude Code, Cursor, Gemini CLI and GitHub Copilot, as well as tools that identify themselves with `AI_AGENT`. An integration that supplies no marker can set `LOADWISE_AGENT=1` in its tool subprocess. Set `LOADWISE_AGENT=0` on a command to disable detection. Commands typed in plain Git Bash or an ordinary IDE terminal run normally. A shell opened inside an agent can inherit its markers.
307
-
308
- For persistent project instructions, or to have a future agent review fixes you run manually in a terminal, run `npx loadwise agent init`. It updates the managed section of `AGENTS.md`, imports it from `CLAUDE.md` and enables history for manual CLI fixes too.
309
-
310
- Agent-run CLI fixes save their actual edited hunks locally from the first fix. For earlier fixes and saved review decisions, run `loadwise agent history` from the checked project, optionally with a checker name such as `maintainability`. History stays under the user's local state directory and can include excerpts of project source. For unrecorded edits, including edits made on another machine, use an earlier report or a known diff.
311
-
312
- Agents check that every finding has a disposition with the original scan, the relevant history and the rescan. The outcomes file is an object with an `outcomes` array whose entries supply `checker`, `id`, `status` (`fixed`, `verified`, `intentional`, `false-positive` or `deferred`) and specific `evidence`. For a narrower request, provide only the authorized findings in those reports; put report files in a local scratch directory.
313
-
314
- ```sh
315
- npx loadwise agent verify --outcomes outcomes.json before.json history.json after.json
316
- npx loadwise agent verify --save --outcomes outcomes.json before.json history.json after.json
317
- ```
318
-
319
- The first command checks coverage. `--save` also retains successful review decisions for the next session in a recognized agent session or an explicitly initialized checkout. A missing decision or skipped checker is reported as incomplete; a reasoned deferral counts as reviewed and stays visible as deferred. Code review and relevant tests establish whether a change works. For a standalone JSON scan, pass its checker, for example `--checker maint`: `perf` for performance and database reports, `rel` for reliability, migration and contract reports, `maint`, `sec` or `a11y`, one checker per invocation. Combined scans and history keep their original checker selection.
320
-
321
- Use the handoff command printed by the fix run to preserve its scope. For a project-wide maintainability fix, save the manual findings with `npx loadwise fix --handoff maintainability > loadwise-manual.md`.
322
-
323
- ### Using Loadwise with an active coding agent
324
-
325
- Ask the agent you are already working with to check the project with Loadwise. A shell-capable agent can run `npx loadwise check --json` and review the findings directly in the conversation. Ask it to verify findings against your code, suggest improvements, or implement the changes you choose. A check is read-only. A request to apply fixes can use `npx loadwise fix --yes --json` and review the actual edits and remaining findings in the same chat.
326
-
327
- To copy a ready-made prompt into any AI coding tool (Claude Code, Cursor, Codex, Copilot, Windsurf, or Gemini CLI), run `npx loadwise agent prompt`:
328
-
329
- ```sh
330
- npx loadwise agent prompt --pr --checkers perf,rel --report-fp
331
- ```
332
-
333
- - `--pr` scopes the prompt's scan to `--changed-since origin/main` (or pass `--changed-since <git-ref>` directly).
334
- - `--checkers <list>` picks the checkers to emphasize (default `perf,rel`).
335
- - `--report-fp` appends an opt-in step so the agent asks before running `npx loadwise report-fp --rule <rule-id> --command "<cmd>" --expected "<text>" --note "<generic reason>" [--open]`. `report-fp` never sends telemetry automatically and redacts paths, emails, credentialed URLs, `KEY=value` secret env vars, and common API/JWT tokens—GitHub receives the pre-filled text when `--open` loads the form. Omit `--open` to inspect the link locally before opening it.
165
+ Inputs are `checkers`, `path`, `changed-only`, `base-sha`, `fail-on`, `upload-sarif`, `annotations`, `config`, `baseline`, `workspaces`, `skip`, `min-impact`, `ignore`, `include-contextual` and `online`. Defaults and details are in the [GitHub Action guide](https://loadwise.mintlify.app/github-action). Outside GitHub, `check --format` also writes `sarif`, `gitlab`, `junit`, `checkstyle`, `markdown` and `html` reports.
336
166
 
337
- For an agent that uses Model Context Protocol (MCP), install Loadwise in the project, run `npx loadwise agent mcp --print-config`, and register the printed command and arguments as a local stdio server named `loadwise`. The agent can call `loadwise_check` to run a fresh offline scan and read larger reports in pages with `loadwise_read_report`. Loadwise does not start a chat or send findings to another session.
167
+ ## Command reference
338
168
 
339
- If you ran a terminal command yourself and want to share it later, use `npx loadwise check --review` or `npx loadwise fix --yes --review`. Paste the printed handoff into the chat you choose, or attach the report. `loadwise agent pending` and the MCP tool `loadwise_list_reports` list saved reports for that project.
169
+ Run `loadwise <command> --help` for the options of each command. `loadwise` with no command runs `check`, and `loadwise --version` prints the installed version.
340
170
 
341
- ### Claude Code plugin
171
+ | Task | Commands |
172
+ | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
173
+ | Scan a project or branch | `loadwise check [directory]`, `loadwise check --uncommitted`, `loadwise check --changed-since origin/main`, `loadwise check --staged` |
174
+ | Understand a finding | `loadwise explain <rule-id>` |
175
+ | Preview or apply edits | `loadwise fix`, `loadwise fix --apply`, `loadwise fix --id <finding-id>` |
176
+ | Focus on one checker | `loadwise check --only perf` or `--skip maint`. Choose from `perf`, `rel`, `maint`, `sec` and `a11y`; full names also work. |
177
+ | Review migrations or API changes | `loadwise rel migrations`, `loadwise rel contracts` |
178
+ | Investigate slow database operations | `loadwise perf db`, `loadwise perf plan <file>`, `loadwise perf traces <file>` |
179
+ | Check dependencies or other languages | `loadwise sec deps --online`, or `polyglot` under `loadwise perf`, `loadwise rel` or `loadwise sec` |
180
+ | Inspect module dependencies | `loadwise maint --graph <file>` |
181
+ | Set up an editor | `loadwise editor setup`, `loadwise editor doctor`, `loadwise lsp --stdio` |
182
+ | Connect a coding agent | `loadwise agent init`, `loadwise agent mcp --print-config` |
183
+ | Report a false positive | `loadwise report-fp --rule <rule-id>` |
184
+ | Shell completion | `loadwise completion bash` or `loadwise completion powershell` |
342
185
 
343
- `agent init` gives Claude Code instructions; the plugin makes the check automatic. Install it from inside Claude Code:
186
+ `check` flags apply to every selected checker:
344
187
 
345
- ```
346
- /plugin marketplace add IbrahimHafez1/loadwise
347
- /plugin install loadwise@loadwise
348
- ```
349
-
350
- After every `Edit`, `Write` or `MultiEdit` on a `.ts`, `.tsx`, `.js`, `.jsx`, `.mjs`, `.cjs`, `.mts` or `.cts` file, or a `.html`, `.htm`, `.vue` or `.svelte` file, a hook runs the project's locally installed `loadwise` on that file (`perf`, `rel` and `sec` on the file, `maint` on the uncommitted changes, keeping that file's findings, and `a11y` on `.tsx`, `.jsx`, `.html`, `.htm`, `.vue` and `.svelte` files) with a 20 second limit. Findings go back to Claude with their ids and `--fix --only <id>` commands; a clean file prints nothing. The hook never downloads anything: without a local install, outside a project, on other file types, on a timeout or on any error it exits silently. The plugin also adds a `/loadwise [args]` command for read-only checks and a `/loadwise fix [checker names]` workflow for agent-reviewed remediation. Use `/loadwise fix --dry-run` for a preview or `/loadwise fix --apply` for automatic edits. Add `--uncommitted` to focus either operation on local changes. To turn the hook off, run `/plugin disable loadwise` (or `/plugin uninstall loadwise`).
351
-
352
- ### Git pre-commit hook
353
-
354
- ```sh
355
- npx loadwise agent init --hook block # a commit with new findings fails
356
- npx loadwise agent init --hook warn # findings are printed, the commit goes through (also plain --hook)
357
- npx loadwise agent init --hook off # removes only this block
358
- ```
188
+ - `--json` prints one object with a key per checker (`performance`, `reliability`, `maintainability`, `security`, `accessibility`). `--format text|json|sarif|github|gitlab|junit|checkstyle|markdown|html` picks the combined report format.
189
+ - `--only <checkers>` and `--skip <checkers>` select checkers. `--config <file>` and `--workspace <name|path>` select configuration and packages.
190
+ - `--uncommitted`, `--staged` and `--changed-since <git-ref>` limit findings to changed lines. Choose one per run.
191
+ - `--min-impact <level>` filters by impact. `--fail-on contract|all` sets the exit threshold. `--ignore <rule-id>` turns a rule off for one run. `--include-contextual` also shows lower-priority findings with their reasons.
192
+ - `--write-baseline [file]` records current findings and `--baseline [file]` reports only new ones. The default file is `loadwise-baseline.json`.
193
+ - `--online` adds dependency advisory lookups. `--watch` rescans after saves. `--review` saves the report and prints an agent handoff.
359
194
 
360
- 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.
361
-
362
- ## Editor (language server)
363
-
364
- From your editor’s terminal, run:
365
-
366
- ```sh
367
- npx loadwise@latest editor setup
368
- ```
195
+ When a broad root `jsconfig.json` includes sources covered by a workspace package's `tsconfig.json`, Loadwise checks those sources with the package's compiler options and still checks the files owned by the root project.
369
196
 
370
- Editor setup requires Loadwise 0.7.0 or later. If bare `npx loadwise editor setup` says `check accepts at most one directory`, npm selected an older project dependency. The `@latest` command uses the latest published CLI for setup and leaves the project pin intact. Use the bare command to select a compatible project-pinned version.
197
+ `fix` flags: `--apply` (alias `--yes`), `--interactive`, `--all`, `--dry-run`, `--id`, `--rule`, `--only`, `--handoff`, `--review`, `--json`, `--patch`, `--record-reversal`, `--reverse <run-id>`, `--polyglot-preview <sha256>`, `--recipe`, `--no-verify-types`, `--no-comments` and `--no-format`, plus the scope flags above.
371
198
 
372
- Setup installs the extension for VS Code, VSCodium, Cursor, Windsurf or Antigravity IDE, or prepares the language client for your editor. Use `--editor <name>` to choose explicitly. JetBrains, Zed, Sublime Text and some terminal editors have a plugin or configuration step. For another stdio client, `--editor stdio` prints its exact launch command. [Editor setup and verification](docs/editor.mdx)
199
+ **Exit codes:** `0` passed, `1` a checker met its exit threshold, `2` invalid input or configuration, a checker that produced no result, or a scan that skipped a file. Skipped files are named on stderr and in `skippedFiles` in `--json` output.
373
200
 
374
- If Loadwise is already on the editor's PATH, a custom client can launch `loadwise lsp --stdio` directly.
201
+ **Configuration.** An optional `loadwise.config.json` sets defaults for every checker: selected checkers, ignored paths, rule levels, per-path overrides and checker policies. Add `"$schema": "./node_modules/loadwise/schema/loadwise.config.schema.json"` for editor completion. See the [configuration guide](https://loadwise.mintlify.app/configuration) and the [schema](https://github.com/IbrahimHafez1/loadwise/blob/main/schema/loadwise.config.schema.json). `--config` and `--ignore` override the file for one run.
375
202
 
376
- **What you see.** 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 page, with related locations such as the other imports of a dependency cycle. Rule levels from `loadwise.config.json` decide the severity: by default declared contract violations are errors and other findings warnings. Live-database findings appear on the first line of `package.json`. Hovers show the recommendation, the finding and the before and after code. Code actions are **Apply fix: <rule>**, **Dismiss this finding**, **Dismiss <rule> in this file** and **Apply all Loadwise fixes in this file**, and code lenses put **Apply fix**, **Dismiss** and **Apply all** above fixable lines. Multi-file fixes apply all-or-nothing, never overwrite an existing file and refuse code that changed since the scan, including unsaved editor text. `source.fixAll.loadwise` applies every eligible fix in the file as one undoable edit and leaves fixes that need individual review for **Apply fix**. A dismissed finding stays hidden until its flagged line changes; dismissals are saved in `.loadwise/dismissed.json` at the workspace folder root, which you can commit to share them.
203
+ **Cache and memory.** `loadwise check` reuses the previous result for an unchanged Git project; `LOADWISE_NO_CACHE=1` always scans afresh. Large projects run with a larger Node memory limit, and a checker that still runs out of memory exits 2 with the limit it had. Raise it with `NODE_OPTIONS=--max-old-space-size=<megabytes>`. Details are in the [commands guide](https://loadwise.mintlify.app/commands).
377
204
 
378
- **What gets scanned.** Each workspace folder is scanned on start and after every change to a source file, `schema.prisma`, a SQL migration, `package.json`, `tsconfig*.json`, `jsconfig*.json`, `loadwise.config.json` or `.loadwise/dismissed.json`, whether from the editor, git or another tool; a completed source scan in the project terminal refreshes it too. Performance, reliability and accessibility come from an incremental `loadwise perf --watch` process; 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 packages as workspace folders or set `project`. Scan counts and errors go to the editor's language server log.
205
+ ## Security and releases
379
206
 
380
- | Command | Action |
381
- | --------------------------- | ---------------------------------------------------------- |
382
- | `loadwise.scan` | Rescan every workspace folder now |
383
- | `loadwise.applyFix` | Apply one fix (from a code action or code lens) |
384
- | `loadwise.applyAllFixes` | Apply every eligible fix in a file (its URI as argument) |
385
- | `loadwise.dismiss` | Dismiss a finding or a rule in a file |
386
- | `loadwise.showDismissed` | List dismissed findings, with Restore and Restore all |
387
- | `loadwise.restoreDismissed` | Restore the given dismissal, or every one without argument |
207
+ Releases carry Sigstore attestations. [Release signatures](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/release-signatures.md) shows how to verify a download with `gh attestation verify`. Report vulnerabilities as described in [SECURITY.md](https://github.com/IbrahimHafez1/loadwise/blob/main/SECURITY.md).
388
208
 
389
- Settings go in the client's `initializationOptions` or its `loadwise` configuration section (per workspace folder when the editor supports it):
209
+ ## Contributing
390
210
 
391
- | Setting | Default | Effect |
392
- | ---------- | ----------- | ----------------------------------------------------------------------------- |
393
- | `enabled` | `true` | Show diagnostics for the folder |
394
- | `project` | `""` | TypeScript or JavaScript project config, relative to the folder |
395
- | `cli` | `""` | Absolute path to another `dist/bin/loadwise.js`, such as a development build |
396
- | `severity` | `"default"` | `error`, `warning`, `information` or `hint` shows every finding at that level |
397
- | `codeLens` | `true` | Show the Apply fix and Dismiss code lenses |
211
+ See [CONTRIBUTING.md](https://github.com/IbrahimHafez1/loadwise/blob/main/CONTRIBUTING.md) and the [contributing guide](https://loadwise.mintlify.app/contributing). After your first scan, [share a useful finding or a false positive](https://github.com/IbrahimHafez1/loadwise/issues/203), or [pick a good first issue](https://github.com/IbrahimHafez1/loadwise/issues?q=is%3Aissue%20is%3Aopen%20label%3A%22good%20first%20issue%22).
398
212
 
399
213
  ## Full Rule & Checker Reference
400
214
 
@@ -419,86 +233,35 @@ examples/slow.ts:7:48 [array-repeated-find #9ab891a8b8f7] medium: Each item can
419
233
  | --------------------------------------- | ------------------------------------------------------------------ | --------------------------------- |
420
234
  | JavaScript or TypeScript | `-p tsconfig.json`, `--watch -p tsconfig.json` or `src/handler.ts` | No |
421
235
  | Schema-aware index checks | `--schema snapshot.json` | No (snapshot) |
422
- | Python, Go, Java, C#, Rust | `polyglot src` | No |
236
+ | Python, Go, Java, C#, Rust, Ruby, PHP | `polyglot src` | No |
423
237
  | OTLP/JSON from any application language | `traces request.otlp.json --threshold 5` | No |
424
238
  | Executed PostgreSQL or MongoDB plan | `plan explain.json` | No |
425
239
  | Live database inspection | `db` | Yes, read-only unless `--measure` |
426
240
 
427
241
  ## Source checks
428
242
 
429
- Run in the directory containing `tsconfig.json` or `jsconfig.json`, pass `-p path/to/config.json`, or give explicit JS/TS files (checked with ES2022 and NodeNext defaults). A project check follows project references. JavaScript files that the found config leaves out because `allowJs` is off are still checked with the standalone defaults and named in a note; a config passed with `-p` is checked exactly as it lists its files. Install the application's driver declarations and generate its Prisma client first: unresolved types, wrappers and deferred callbacks can hide findings. Test, seed and operator-tooling sources (`scripts`, `seeds`, `prisma/seed.ts`, `*.seed.ts`, deployment, migrations) make per-item query, index, serial-await, Redis `KEYS`, pure-JavaScript hashing, Prisma dependent-write and Drizzle whole-table-write findings contextual. `prisma-count-for-existence` findings may carry `idField`, the model's single primary-key field that the fix selects.
430
-
431
- Engines: one-shot checks use Microsoft's Go-based [TypeScript 7](https://github.com/microsoft/typescript-go) compiler on Node.js 22.13+ with the optional native package for your platform (same findings; 1.7–2.2 times faster on the 3,200-file benchmark in [PERFORMANCE.md](PERFORMANCE.md), and the gain depends on the project) and fall back to TypeScript 6.0.3 with a stderr note when TypeScript 7 rejects the configuration (for example `baseUrl` or `moduleResolution: "node10"`). `--engine native` (alias `--native`) requires TypeScript 7 and reports incompatible configuration as exit 2; `--engine js` always uses TypeScript 6.0.3. `perf --json` names the engine in `engine` (`"js"` or `"native"`). `--watch` uses TypeScript 6.0.3 on a single project; with `--watch --json` each completed scan writes one JSON line.
243
+ Run it where `tsconfig.json` or `jsconfig.json` lives, pass `-p path/to/config.json`, or give explicit JS/TS files. One-shot checks use the TypeScript 7 native engine when its optional package is installed and fall back to TypeScript 6.0.3; `--engine js` or `--engine native` (alias `--native`) picks one, and `--watch` rescans after saves. Project discovery, engines and installs without optional packages are in [Source checks](https://loadwise.mintlify.app/checkers/performance#source-checks).
432
244
 
433
245
  <!-- loadwise:rules:start checker=performance group=source-checks -->
434
246
 
435
- | Rule | Impact | What it flags |
436
- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
437
- | <a id="angular-default-change-detection"></a>[`angular-default-change-detection`](docs/rules/performance/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. |
438
- | <a id="angular-ngfor-missing-trackby"></a>[`angular-ngfor-missing-trackby`](docs/rules/performance/angular-ngfor-missing-trackby.md) | low | An *ngFor has no trackBy, so a list replaced with new objects recreates the DOM of every item. |
439
- | <a id="angular-subscribe-without-cleanup"></a>[`angular-subscribe-without-cleanup`](docs/rules/performance/angular-subscribe-without-cleanup.md) | medium | An RxJS subscription in a component has no completing operator or ngOnDestroy unsubscribe and keeps running after destruction. |
440
- | <a id="array-repeated-find"></a>[`array-repeated-find`](docs/rules/performance/array-repeated-find.md) | medium | An array is searched with find or findIndex repeatedly where a Map lookup would do. |
441
- | <a id="array-repeated-membership"></a>[`array-repeated-membership`](docs/rules/performance/array-repeated-membership.md) | medium | An array is tested with includes or indexOf repeatedly where a Set would do. |
442
- | <a id="dom-layout-thrashing"></a>[`dom-layout-thrashing`](docs/rules/performance/dom-layout-thrashing.md) | medium | A loop reads layout metrics and mutates DOM styles or classes, forcing a reflow on each iteration. |
443
- | <a id="dom-listener-without-cleanup"></a>[`dom-listener-without-cleanup`](docs/rules/performance/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. |
444
- | <a id="dom-unthrottled-scroll-resize"></a>[`dom-unthrottled-scroll-resize`](docs/rules/performance/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. |
445
- | <a id="express-missing-compression"></a>[`express-missing-compression`](docs/rules/performance/express-missing-compression.md) | low | An Express server registers no response compression middleware. |
446
- | <a id="external-call-in-transaction"></a>[`external-call-in-transaction`](docs/rules/performance/external-call-in-transaction.md) | high | An external call is awaited inside a database transaction, holding its connection and locks. |
447
- | <a id="filter-for-existence"></a>[`filter-for-existence`](docs/rules/performance/filter-for-existence.md) | low | filter(...).length is used only to test whether any element matches. |
448
- | <a id="frontend-barrel-heavy-import"></a>[`frontend-barrel-heavy-import`](docs/rules/performance/frontend-barrel-heavy-import.md) | low | A client module imports the whole of lodash or moment instead of subpaths or a lighter library. |
449
- | <a id="graphql-n-plus-one-resolver"></a>[`graphql-n-plus-one-resolver`](docs/rules/performance/graphql-n-plus-one-resolver.md) | high | A GraphQL field resolver executes a database or HTTP query per parent item without DataLoader batching. |
450
- | <a id="heavy-media-in-request-handler"></a>[`heavy-media-in-request-handler`](docs/rules/performance/heavy-media-in-request-handler.md) | medium | Heavy image (sharp) or PDF rendering runs directly inside an HTTP request handler. |
451
- | <a id="json-roundtrip-clone"></a>[`json-roundtrip-clone`](docs/rules/performance/json-roundtrip-clone.md) | low | A value is deep-cloned with JSON.parse(JSON.stringify(...)) on a request path. |
452
- | <a id="json-stringify-in-loop"></a>[`json-stringify-in-loop`](docs/rules/performance/json-stringify-in-loop.md) | medium | JSON.stringify runs inside a loop instead of serializing once or streaming. |
453
- | <a id="list-count-per-request"></a>[`list-count-per-request`](docs/rules/performance/list-count-per-request.md) | medium | A list endpoint runs a full count query on every request. |
454
- | <a id="list-query-overfetch"></a>[`list-query-overfetch`](docs/rules/performance/list-query-overfetch.md) | medium | A list query loads large columns or nested relations without a narrow projection. |
455
- | <a id="llm-call-without-max-tokens"></a>[`llm-call-without-max-tokens`](docs/rules/performance/llm-call-without-max-tokens.md) | medium | An OpenAI chat or responses call sets no output token limit. |
456
- | <a id="loop-copy-accumulator"></a>[`loop-copy-accumulator`](docs/rules/performance/loop-copy-accumulator.md) | medium | A loop copies its growing result on every iteration. |
457
- | <a id="mongoose-hydrate-for-to-object"></a>[`mongoose-hydrate-for-to-object`](docs/rules/performance/mongoose-hydrate-for-to-object.md) | medium | A Mongoose query hydrates full Documents only to convert them immediately via .toObject() or .toJSON(). |
458
- | <a id="mongoose-missing-lean"></a>[`mongoose-missing-lean`](docs/rules/performance/mongoose-missing-lean.md) | medium | A Mongoose read query is returned or serialized without .lean(), paying full Document hydration overhead. |
459
- | <a id="node-event-listener-leak"></a>[`node-event-listener-leak`](docs/rules/performance/node-event-listener-leak.md) | high | An event listener is registered inside a repeated or per-request context without matching cleanup. |
460
- | <a id="node-sync-compression-in-async"></a>[`node-sync-compression-in-async`](docs/rules/performance/node-sync-compression-in-async.md) | medium | A synchronous zlib call blocks the event loop inside an async function. |
461
- | <a id="node-sync-crypto-in-async"></a>[`node-sync-crypto-in-async`](docs/rules/performance/node-sync-crypto-in-async.md) | high | A synchronous crypto call blocks the event loop inside an async function. |
462
- | <a id="node-sync-fs-in-async"></a>[`node-sync-fs-in-async`](docs/rules/performance/node-sync-fs-in-async.md) | medium | A synchronous fs call blocks the event loop inside an async function. |
463
- | <a id="node-sync-process-in-async"></a>[`node-sync-process-in-async`](docs/rules/performance/node-sync-process-in-async.md) | high | A synchronous child_process call blocks the event loop inside an async function. |
464
- | <a id="notification-send-in-loop"></a>[`notification-send-in-loop`](docs/rules/performance/notification-send-in-loop.md) | high | A push, email or Firebase message is sent once per loop iteration instead of in one batch. |
465
- | <a id="orm-cartesian-include"></a>[`orm-cartesian-include`](docs/rules/performance/orm-cartesian-include.md) | high | One query joins two or more one-to-many relations, so the returned rows multiply. |
466
- | <a id="orm-deep-offset"></a>[`orm-deep-offset`](docs/rules/performance/orm-deep-offset.md) | high | A list query pages with a large or unbounded offset, so the database reads and discards every skipped row. |
467
- | <a id="password-hash-pure-js"></a>[`password-hash-pure-js`](docs/rules/performance/password-hash-pure-js.md) | medium | bcryptjs hashes passwords in pure JavaScript on the main thread. |
468
- | <a id="password-hash-sync-in-async"></a>[`password-hash-sync-in-async`](docs/rules/performance/password-hash-sync-in-async.md) | high | A synchronous bcrypt call blocks the event loop inside an async function. |
469
- | <a id="pg-count-materialization"></a>[`pg-count-materialization`](docs/rules/performance/pg-count-materialization.md) | medium | A pg query loads rows only to count them. |
470
- | <a id="pg-filter-materialization"></a>[`pg-filter-materialization`](docs/rules/performance/pg-filter-materialization.md) | medium | A pg query loads an unbounded result that JavaScript then filters by equality. |
471
- | <a id="pg-first-materialization"></a>[`pg-first-materialization`](docs/rules/performance/pg-first-materialization.md) | medium | A pg query loads an unbounded result to read only its first row. |
472
- | <a id="pg-query-in-loop"></a>[`pg-query-in-loop`](docs/rules/performance/pg-query-in-loop.md) | high | A pg query runs once per loop iteration. |
473
- | <a id="pg-top-k-materialization"></a>[`pg-top-k-materialization`](docs/rules/performance/pg-top-k-materialization.md) | medium | A pg query loads an unbounded result that JavaScript sorts to keep the top rows. |
474
- | <a id="pg-unreleased-checkout"></a>[`pg-unreleased-checkout`](docs/rules/performance/pg-unreleased-checkout.md) | critical | A chained pool checkout loses the client, so it is never released. |
475
- | <a id="pool-created-per-request-or-item"></a>[`pool-created-per-request-or-item`](docs/rules/performance/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. |
476
- | <a id="prisma-count-materialization"></a>[`prisma-count-materialization`](docs/rules/performance/prisma-count-materialization.md) | medium | A Prisma query loads rows only to count them. |
477
- | <a id="prisma-filter-materialization"></a>[`prisma-filter-materialization`](docs/rules/performance/prisma-filter-materialization.md) | medium | A Prisma query loads an unbounded result that JavaScript then filters by equality. |
478
- | <a id="prisma-first-materialization"></a>[`prisma-first-materialization`](docs/rules/performance/prisma-first-materialization.md) | medium | A Prisma query loads an unbounded result to read only its first row. |
479
- | <a id="prisma-query-in-loop"></a>[`prisma-query-in-loop`](docs/rules/performance/prisma-query-in-loop.md) | high | A Prisma query runs once per loop iteration. |
480
- | <a id="prisma-top-k-materialization"></a>[`prisma-top-k-materialization`](docs/rules/performance/prisma-top-k-materialization.md) | medium | A Prisma query loads an unbounded result that JavaScript sorts to keep the top rows. |
481
- | <a id="queue-add-in-loop"></a>[`queue-add-in-loop`](docs/rules/performance/queue-add-in-loop.md) | high | A job queue add runs once per item instead of one addBulk. |
482
- | <a id="react-component-defined-in-component"></a>[`react-component-defined-in-component`](docs/rules/performance/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. |
483
- | <a id="react-context-value-recreated"></a>[`react-context-value-recreated`](docs/rules/performance/react-context-value-recreated.md) | low | An inline object or array literal in Context.Provider value creates a new reference on every render. |
484
- | <a id="react-fetch-in-effect-no-abort"></a>[`react-fetch-in-effect-no-abort`](docs/rules/performance/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. |
485
- | <a id="react-index-as-key"></a>[`react-index-as-key`](docs/rules/performance/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. |
486
- | <a id="react-inline-object-in-jsx-prop"></a>[`react-inline-object-in-jsx-prop`](docs/rules/performance/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. |
487
- | <a id="react-missing-cleanup"></a>[`react-missing-cleanup`](docs/rules/performance/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. |
488
- | <a id="rebuild-lookup-in-loop"></a>[`rebuild-lookup-in-loop`](docs/rules/performance/rebuild-lookup-in-loop.md) | high | A Set or Map is rebuilt from the same data on every loop iteration. |
489
- | <a id="redis-command-in-loop"></a>[`redis-command-in-loop`](docs/rules/performance/redis-command-in-loop.md) | high | A per-key Redis command runs once per loop iteration. |
490
- | <a id="redis-keys-command"></a>[`redis-keys-command`](docs/rules/performance/redis-keys-command.md) | high | A Redis KEYS call blocks the server while it scans the keyspace. |
491
- | <a id="reduce-copy-accumulator"></a>[`reduce-copy-accumulator`](docs/rules/performance/reduce-copy-accumulator.md) | medium | A reduce callback copies its growing accumulator on every step. |
492
- | <a id="sequential-http-in-loop"></a>[`sequential-http-in-loop`](docs/rules/performance/sequential-http-in-loop.md) | high | Independent HTTP requests are awaited one at a time inside a loop. |
493
- | <a id="serial-awaits-in-literal"></a>[`serial-awaits-in-literal`](docs/rules/performance/serial-awaits-in-literal.md) | medium | An array or object literal awaits two or more independent values one after another. |
494
- | <a id="service-query-in-loop"></a>[`service-query-in-loop`](docs/rules/performance/service-query-in-loop.md) | high | A loop calls a project function that runs several database operations per item. |
495
- | <a id="session-memory-store"></a>[`session-memory-store`](docs/rules/performance/session-memory-store.md) | high | An express-session middleware has no store, so sessions live in process memory. |
496
- | <a id="sql-select-star-in-query"></a>[`sql-select-star-in-query`](docs/rules/performance/sql-select-star-in-query.md) | low | A raw SQL query selects every column with SELECT * instead of the columns it needs. |
497
- | <a id="unbounded-list-query"></a>[`unbounded-list-query`](docs/rules/performance/unbounded-list-query.md) | high | A request handler returns query results without an apparent row limit. |
498
- | <a id="unbounded-module-cache"></a>[`unbounded-module-cache`](docs/rules/performance/unbounded-module-cache.md) | medium | A long-lived cache accepts dynamic keys without an apparent bound or eviction. |
499
- | <a id="vue-v-for-missing-key"></a>[`vue-v-for-missing-key`](docs/rules/performance/vue-v-for-missing-key.md) | low | A list rendered with h() has no key prop, forcing inefficient patching. |
500
- | <a id="vue-watch-missing-cleanup"></a>[`vue-watch-missing-cleanup`](docs/rules/performance/vue-watch-missing-cleanup.md) | medium | onMounted registers a global listener, timer or observer with no unmount cleanup. |
501
- | <a id="whole-payload-in-memory"></a>[`whole-payload-in-memory`](docs/rules/performance/whole-payload-in-memory.md) | medium | An operation loads an entire file, stream, or response into memory. |
247
+ <a id="angular-default-change-detection"></a>[`angular-default-change-detection`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/angular-default-change-detection.md) · <a id="angular-ngfor-missing-trackby"></a>[`angular-ngfor-missing-trackby`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/angular-ngfor-missing-trackby.md) · <a id="angular-subscribe-without-cleanup"></a>[`angular-subscribe-without-cleanup`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/angular-subscribe-without-cleanup.md) · <a id="array-repeated-find"></a>[`array-repeated-find`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/array-repeated-find.md) · <a id="array-repeated-membership"></a>[`array-repeated-membership`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/array-repeated-membership.md) · <a id="array-shift-in-fifo-drain"></a>[`array-shift-in-fifo-drain`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/array-shift-in-fifo-drain.md) ·
248
+ <a id="dom-layout-thrashing"></a>[`dom-layout-thrashing`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/dom-layout-thrashing.md) · <a id="dom-listener-without-cleanup"></a>[`dom-listener-without-cleanup`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/dom-listener-without-cleanup.md) · <a id="dom-unthrottled-scroll-resize"></a>[`dom-unthrottled-scroll-resize`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/dom-unthrottled-scroll-resize.md) ·
249
+ <a id="express-missing-compression"></a>[`express-missing-compression`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/express-missing-compression.md) · <a id="external-call-in-transaction"></a>[`external-call-in-transaction`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/external-call-in-transaction.md) ·
250
+ <a id="filter-for-existence"></a>[`filter-for-existence`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/filter-for-existence.md) · <a id="frontend-barrel-heavy-import"></a>[`frontend-barrel-heavy-import`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/frontend-barrel-heavy-import.md) ·
251
+ <a id="graphql-n-plus-one-resolver"></a>[`graphql-n-plus-one-resolver`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/graphql-n-plus-one-resolver.md) ·
252
+ <a id="heavy-media-in-request-handler"></a>[`heavy-media-in-request-handler`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/heavy-media-in-request-handler.md) ·
253
+ <a id="js-fixed-regexp-in-loop"></a>[`js-fixed-regexp-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/js-fixed-regexp-in-loop.md) · <a id="json-roundtrip-clone"></a>[`json-roundtrip-clone`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/json-roundtrip-clone.md) · <a id="json-stringify-in-loop"></a>[`json-stringify-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/json-stringify-in-loop.md) ·
254
+ <a id="list-count-per-request"></a>[`list-count-per-request`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/list-count-per-request.md) · <a id="list-query-overfetch"></a>[`list-query-overfetch`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/list-query-overfetch.md) · <a id="llm-call-without-max-tokens"></a>[`llm-call-without-max-tokens`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/llm-call-without-max-tokens.md) · <a id="loop-copy-accumulator"></a>[`loop-copy-accumulator`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/loop-copy-accumulator.md) ·
255
+ <a id="mongoose-hydrate-for-to-object"></a>[`mongoose-hydrate-for-to-object`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/mongoose-hydrate-for-to-object.md) · <a id="mongoose-missing-lean"></a>[`mongoose-missing-lean`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/mongoose-missing-lean.md) ·
256
+ <a id="node-event-listener-leak"></a>[`node-event-listener-leak`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/node-event-listener-leak.md) · <a id="node-sync-compression-in-async"></a>[`node-sync-compression-in-async`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/node-sync-compression-in-async.md) · <a id="node-sync-crypto-in-async"></a>[`node-sync-crypto-in-async`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/node-sync-crypto-in-async.md) · <a id="node-sync-fs-in-async"></a>[`node-sync-fs-in-async`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/node-sync-fs-in-async.md) · <a id="node-sync-process-in-async"></a>[`node-sync-process-in-async`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/node-sync-process-in-async.md) · <a id="notification-send-in-loop"></a>[`notification-send-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/notification-send-in-loop.md) ·
257
+ <a id="orm-cartesian-include"></a>[`orm-cartesian-include`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/orm-cartesian-include.md) · <a id="orm-deep-offset"></a>[`orm-deep-offset`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/orm-deep-offset.md) ·
258
+ <a id="password-hash-pure-js"></a>[`password-hash-pure-js`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/password-hash-pure-js.md) · <a id="password-hash-sync-in-async"></a>[`password-hash-sync-in-async`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/password-hash-sync-in-async.md) · <a id="pg-count-materialization"></a>[`pg-count-materialization`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/pg-count-materialization.md) · <a id="pg-filter-materialization"></a>[`pg-filter-materialization`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/pg-filter-materialization.md) · <a id="pg-first-materialization"></a>[`pg-first-materialization`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/pg-first-materialization.md) · <a id="pg-query-in-loop"></a>[`pg-query-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/pg-query-in-loop.md) · <a id="pg-top-k-materialization"></a>[`pg-top-k-materialization`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/pg-top-k-materialization.md) · <a id="pg-unreleased-checkout"></a>[`pg-unreleased-checkout`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/pg-unreleased-checkout.md) · <a id="pool-created-per-request-or-item"></a>[`pool-created-per-request-or-item`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/pool-created-per-request-or-item.md) · <a id="prisma-count-materialization"></a>[`prisma-count-materialization`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/prisma-count-materialization.md) · <a id="prisma-filter-materialization"></a>[`prisma-filter-materialization`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/prisma-filter-materialization.md) · <a id="prisma-first-materialization"></a>[`prisma-first-materialization`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/prisma-first-materialization.md) · <a id="prisma-query-in-loop"></a>[`prisma-query-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/prisma-query-in-loop.md) · <a id="prisma-top-k-materialization"></a>[`prisma-top-k-materialization`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/prisma-top-k-materialization.md) ·
259
+ <a id="queue-add-in-loop"></a>[`queue-add-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/queue-add-in-loop.md) ·
260
+ <a id="react-component-defined-in-component"></a>[`react-component-defined-in-component`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/react-component-defined-in-component.md) · <a id="react-context-value-recreated"></a>[`react-context-value-recreated`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/react-context-value-recreated.md) · <a id="react-fetch-in-effect-no-abort"></a>[`react-fetch-in-effect-no-abort`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/react-fetch-in-effect-no-abort.md) · <a id="react-index-as-key"></a>[`react-index-as-key`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/react-index-as-key.md) · <a id="react-inline-object-in-jsx-prop"></a>[`react-inline-object-in-jsx-prop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/react-inline-object-in-jsx-prop.md) · <a id="react-missing-cleanup"></a>[`react-missing-cleanup`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/react-missing-cleanup.md) · <a id="rebuild-lookup-in-loop"></a>[`rebuild-lookup-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/rebuild-lookup-in-loop.md) · <a id="redis-command-in-loop"></a>[`redis-command-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/redis-command-in-loop.md) · <a id="redis-keys-command"></a>[`redis-keys-command`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/redis-keys-command.md) · <a id="reduce-copy-accumulator"></a>[`reduce-copy-accumulator`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/reduce-copy-accumulator.md) ·
261
+ <a id="sequential-http-in-loop"></a>[`sequential-http-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/sequential-http-in-loop.md) · <a id="serial-awaits-in-literal"></a>[`serial-awaits-in-literal`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/serial-awaits-in-literal.md) · <a id="service-query-in-loop"></a>[`service-query-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/service-query-in-loop.md) · <a id="session-memory-store"></a>[`session-memory-store`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/session-memory-store.md) · <a id="sql-select-star-in-query"></a>[`sql-select-star-in-query`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/sql-select-star-in-query.md) ·
262
+ <a id="unbounded-list-query"></a>[`unbounded-list-query`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/unbounded-list-query.md) · <a id="unbounded-module-cache"></a>[`unbounded-module-cache`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/unbounded-module-cache.md) ·
263
+ <a id="vue-v-for-missing-key"></a>[`vue-v-for-missing-key`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/vue-v-for-missing-key.md) · <a id="vue-watch-missing-cleanup"></a>[`vue-watch-missing-cleanup`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/vue-watch-missing-cleanup.md) ·
264
+ <a id="whole-payload-in-memory"></a>[`whole-payload-in-memory`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/whole-payload-in-memory.md)
502
265
 
503
266
  <!-- loadwise:rules:end -->
504
267
 
@@ -508,117 +271,76 @@ Covered libraries: Prisma, Drizzle ORM (PostgreSQL, MySQL and SQLite core APIs),
508
271
 
509
272
  <!-- loadwise:rules:start checker=performance group=orm-and-query-integrity-checks -->
510
273
 
511
- | Rule | Impact | What it flags |
512
- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------ | ---------------------------------------------------------------------------------------- |
513
- | <a id="drizzle-query-in-loop"></a>[`drizzle-query-in-loop`](docs/rules/performance/drizzle-query-in-loop.md) | high | A Drizzle statement executes once per loop iteration. |
514
- | <a id="guard-query-per-request"></a>[`guard-query-per-request`](docs/rules/performance/guard-query-per-request.md) | medium | A guard or per-request hook runs a database query before every handler. |
515
- | <a id="orm-count-materialization"></a>[`orm-count-materialization`](docs/rules/performance/orm-count-materialization.md) | medium | A TypeORM, Sequelize, Mongoose, Knex or Kysely query loads rows only to count them. |
516
- | <a id="orm-query-in-loop"></a>[`orm-query-in-loop`](docs/rules/performance/orm-query-in-loop.md) | high | A TypeORM, Sequelize, Mongoose, Knex or Kysely operation runs once per loop iteration. |
517
- | <a id="prisma-distinct-in-memory"></a>[`prisma-distinct-in-memory`](docs/rules/performance/prisma-distinct-in-memory.md) | medium | Prisma findMany with distinct reads every matching row and de-duplicates in memory. |
518
- | <a id="prisma-relation-count-in-list"></a>[`prisma-relation-count-in-list`](docs/rules/performance/prisma-relation-count-in-list.md) | medium | A paged Prisma findMany selects a relation _count computed over the whole related table. |
519
- | <a id="typeorm-existence-materialization"></a>[`typeorm-existence-materialization`](docs/rules/performance/typeorm-existence-materialization.md) | medium | A TypeORM entity is loaded only to check whether it exists. |
520
- | <a id="typeorm-load-then-save"></a>[`typeorm-load-then-save`](docs/rules/performance/typeorm-load-then-save.md) | high | A TypeORM entity is loaded only to change a few fields and save it back. |
521
- | <a id="typeorm-transaction-in-loop"></a>[`typeorm-transaction-in-loop`](docs/rules/performance/typeorm-transaction-in-loop.md) | high | A loop calls a helper that starts one TypeORM transaction per item. |
522
- | <a id="typeorm-wide-projection"></a>[`typeorm-wide-projection`](docs/rules/performance/typeorm-wide-projection.md) | low | A TypeORM DTO projection loads wide columns it never uses. |
274
+ <a id="drizzle-query-in-loop"></a>[`drizzle-query-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/drizzle-query-in-loop.md) ·
275
+ <a id="guard-query-per-request"></a>[`guard-query-per-request`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/guard-query-per-request.md) ·
276
+ <a id="orm-count-materialization"></a>[`orm-count-materialization`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/orm-count-materialization.md) · <a id="orm-query-in-loop"></a>[`orm-query-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/orm-query-in-loop.md) ·
277
+ <a id="prisma-distinct-in-memory"></a>[`prisma-distinct-in-memory`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/prisma-distinct-in-memory.md) · <a id="prisma-relation-count-in-list"></a>[`prisma-relation-count-in-list`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/prisma-relation-count-in-list.md) ·
278
+ <a id="typeorm-existence-materialization"></a>[`typeorm-existence-materialization`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/typeorm-existence-materialization.md) · <a id="typeorm-load-then-save"></a>[`typeorm-load-then-save`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/typeorm-load-then-save.md) · <a id="typeorm-transaction-in-loop"></a>[`typeorm-transaction-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/typeorm-transaction-in-loop.md) · <a id="typeorm-wide-projection"></a>[`typeorm-wide-projection`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/typeorm-wide-projection.md)
523
279
 
524
280
  <!-- loadwise:rules:end -->
525
281
 
526
282
  ### Project-defined access policy
527
283
 
528
- Put the policy in the `performance` section of `loadwise.config.json` beside the selected project config (in the working directory for explicit source files), or pass `--policy path/to/file.json`. A policy can use just the sections the project needs: `parallelReads` (groups of exports that may start together, used by `known-reads-awaited-serially`), `fireAndForget` (helper names that `floating-promise` accepts without an await), and `prismaScopes` and `drizzleScopes` (see [Project-defined row scopes](#project-defined-row-scopes)). Duplicate JSON keys within the same object produce a configuration error. [Example policy](examples/query-policy.json)
284
+ Put a policy in the `performance` section of `loadwise.config.json`, or pass `--policy path/to/file.json`. The [access policy guide](https://loadwise.mintlify.app/checkers/performance#project-defined-access-policy) lists its sections, and [examples/query-policy.json](https://github.com/IbrahimHafez1/loadwise/blob/main/examples/query-policy.json) is a starting point.
529
285
 
530
286
  ### Async work and sorting
531
287
 
532
288
  <!-- loadwise:rules:start checker=performance group=async-work-and-sorting -->
533
289
 
534
- | Rule | Impact | What it flags |
535
- | ------------------------------------------------------------------------------------------------------------------------------------------ | ------ | -------------------------------------------------------------------------------------------- |
536
- | <a id="await-before-early-exit"></a>[`await-before-early-exit`](docs/rules/performance/await-before-early-exit.md) | medium | An awaited read runs before a guard that returns or throws without using its result. |
537
- | <a id="count-then-page-serial"></a>[`count-then-page-serial`](docs/rules/performance/count-then-page-serial.md) | low | A count and a page query with the same filter run one after the other. |
538
- | <a id="drizzle-last-insert-id"></a>[`drizzle-last-insert-id`](docs/rules/performance/drizzle-last-insert-id.md) | medium | A MySQL insert is followed by an extra query for its generated ID. |
539
- | <a id="known-reads-awaited-serially"></a>[`known-reads-awaited-serially`](docs/rules/performance/known-reads-awaited-serially.md) | medium | Two independent reads from a configured parallelReads group are awaited one after the other. |
540
- | <a id="numeric-sort-for-extreme"></a>[`numeric-sort-for-extreme`](docs/rules/performance/numeric-sort-for-extreme.md) | low | A numeric sort is used only to read the smallest or largest value. |
541
- | <a id="prisma-count-for-existence"></a>[`prisma-count-for-existence`](docs/rules/performance/prisma-count-for-existence.md) | medium | A Prisma query counts all matches only to check whether any row exists. |
542
- | <a id="promise-combinator-serial-await"></a>[`promise-combinator-serial-await`](docs/rules/performance/promise-combinator-serial-await.md) | medium | Promise.all receives calls that were already awaited one by one. |
543
- | <a id="repeated-workbook-decode"></a>[`repeated-workbook-decode`](docs/rules/performance/repeated-workbook-decode.md) | medium | A workflow decodes the same input with ExcelJS more than once. |
544
- | <a id="typeorm-unused-count"></a>[`typeorm-unused-count`](docs/rules/performance/typeorm-unused-count.md) | medium | A TypeORM count-and-list query discards its total in immediate tuple destructuring. |
290
+ <a id="await-before-early-exit"></a>[`await-before-early-exit`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/await-before-early-exit.md) ·
291
+ <a id="count-then-page-serial"></a>[`count-then-page-serial`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/count-then-page-serial.md) ·
292
+ <a id="drizzle-last-insert-id"></a>[`drizzle-last-insert-id`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/drizzle-last-insert-id.md) ·
293
+ <a id="known-reads-awaited-serially"></a>[`known-reads-awaited-serially`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/known-reads-awaited-serially.md) ·
294
+ <a id="next-server-fetch-waterfall"></a>[`next-server-fetch-waterfall`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/next-server-fetch-waterfall.md) · <a id="numeric-sort-for-extreme"></a>[`numeric-sort-for-extreme`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/numeric-sort-for-extreme.md) ·
295
+ <a id="prisma-count-for-existence"></a>[`prisma-count-for-existence`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/prisma-count-for-existence.md) · <a id="promise-combinator-serial-await"></a>[`promise-combinator-serial-await`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/promise-combinator-serial-await.md) ·
296
+ <a id="repeated-workbook-decode"></a>[`repeated-workbook-decode`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/repeated-workbook-decode.md) ·
297
+ <a id="typeorm-unused-count"></a>[`typeorm-unused-count`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/typeorm-unused-count.md)
545
298
 
546
299
  <!-- loadwise:rules:end -->
547
300
 
548
301
  ## Schema-aware index checks
549
302
 
550
- The source checker reads the project's ORM schema (Prisma, Drizzle, TypeORM, Sequelize, Mongoose) and compares declared indexes with the queries it finds. Each suggested index carries one explicit name, used both in the ORM snippet and in the `CREATE INDEX CONCURRENTLY` statement, so building it by hand and then generating a migration does not create a duplicate. Pass `--schema snapshot.json` (written by `perf db --schema-snapshot`) to refine findings with real table sizes and the measured round trip, which also feeds the Impact line of `*-query-in-loop` findings.
303
+ The source checker compares the indexes declared in the project's ORM schema (Prisma, Drizzle, TypeORM, Sequelize, Mongoose) with the queries it finds. Pass `--schema snapshot.json` (written by `perf db --schema-snapshot`) to use real table sizes. Details are in [Schema-aware index checks](https://loadwise.mintlify.app/checkers/performance#schema-aware-index-checks).
551
304
 
552
305
  <!-- loadwise:rules:start checker=performance group=schema-aware-index-checks -->
553
306
 
554
- | Rule | Impact | What it flags |
555
- | ------------------------------------------------------------------------------------------------------------------------ | ------ | ---------------------------------------------------------------------------------------------------------------- |
556
- | <a id="index-missing-filter"></a>[`index-missing-filter`](docs/rules/performance/index-missing-filter.md) | high | A query filters on a column that no index leads with. |
557
- | <a id="index-missing-foreign-key"></a>[`index-missing-foreign-key`](docs/rules/performance/index-missing-foreign-key.md) | high | A foreign key column in the schema has no index. |
558
- | <a id="index-missing-order"></a>[`index-missing-order`](docs/rules/performance/index-missing-order.md) | medium | A query orders by columns that no index serves in that order. |
559
- | <a id="index-redundant-prefix"></a>[`index-redundant-prefix`](docs/rules/performance/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. |
560
- | <a id="index-unusable-expression"></a>[`index-unusable-expression`](docs/rules/performance/index-unusable-expression.md) | high | A function or expression on an indexed column keeps the index from being used. |
561
- | <a id="index-unusable-pattern"></a>[`index-unusable-pattern`](docs/rules/performance/index-unusable-pattern.md) | high | A predicate such as a leading-wildcard LIKE cannot use an ordinary index. |
307
+ <a id="index-missing-filter"></a>[`index-missing-filter`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/index-missing-filter.md) · <a id="index-missing-foreign-key"></a>[`index-missing-foreign-key`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/index-missing-foreign-key.md) · <a id="index-missing-order"></a>[`index-missing-order`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/index-missing-order.md) · <a id="index-redundant-prefix"></a>[`index-redundant-prefix`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/index-redundant-prefix.md) · <a id="index-unusable-expression"></a>[`index-unusable-expression`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/index-unusable-expression.md) · <a id="index-unusable-pattern"></a>[`index-unusable-pattern`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/index-unusable-pattern.md)
562
308
 
563
309
  <!-- loadwise:rules:end -->
564
310
 
565
311
  ## Polyglot source checks
566
312
 
567
- `npx loadwise perf polyglot src` accepts directories or individual `.py`, `.go`, `.java`, `.cs` and `.rs` files and needs the optional [ast-grep](https://ast-grep.github.io/) native binary. `npx loadwise rel polyglot src` runs the reliability patterns on the same files. Language-specific aliases and wrappers can fall outside a pattern.
313
+ `npx loadwise perf polyglot src` checks Python, Go, Java, C#, Rust, Ruby and PHP files with the optional [ast-grep](https://ast-grep.github.io/) binary, and `npx loadwise rel polyglot src` runs the reliability patterns. Details are in [Polyglot source checks](https://loadwise.mintlify.app/checkers/performance#polyglot-source-checks).
568
314
 
569
315
  <!-- loadwise:rules:start checker=performance group=polyglot-source-checks -->
570
316
 
571
- | Rule | Impact | What it flags |
572
- | --------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------- |
573
- | <a id="csharp-fixed-regex-in-loop"></a>[`csharp-fixed-regex-in-loop`](docs/rules/performance/csharp-fixed-regex-in-loop.md) | medium | A C# Regex with a fixed pattern is constructed inside a loop. |
574
- | <a id="csharp-string-concat-in-loop"></a>[`csharp-string-concat-in-loop`](docs/rules/performance/csharp-string-concat-in-loop.md) | medium | String concatenation in a C# loop allocates repeatedly; use StringBuilder. |
575
- | <a id="go-fixed-regexp-in-loop"></a>[`go-fixed-regexp-in-loop`](docs/rules/performance/go-fixed-regexp-in-loop.md) | medium | A Go regexp with a fixed pattern is compiled inside a loop. |
576
- | <a id="go-sql-query-in-loop"></a>[`go-sql-query-in-loop`](docs/rules/performance/go-sql-query-in-loop.md) | high | A Go database query executes inside a loop instead of batching. |
577
- | <a id="go-string-concat-in-loop"></a>[`go-string-concat-in-loop`](docs/rules/performance/go-string-concat-in-loop.md) | medium | String concatenation in a Go loop allocates repeatedly; use strings.Builder. |
578
- | <a id="java-fixed-regex-in-loop"></a>[`java-fixed-regex-in-loop`](docs/rules/performance/java-fixed-regex-in-loop.md) | medium | A Java Pattern with a fixed pattern is compiled inside a loop. |
579
- | <a id="java-jdbc-query-in-loop"></a>[`java-jdbc-query-in-loop`](docs/rules/performance/java-jdbc-query-in-loop.md) | high | A JDBC query executes inside a Java loop instead of batching. |
580
- | <a id="java-string-concat-in-loop"></a>[`java-string-concat-in-loop`](docs/rules/performance/java-string-concat-in-loop.md) | medium | String concatenation in a Java loop allocates repeatedly; use StringBuilder. |
581
- | <a id="python-blocking-sleep-in-async"></a>[`python-blocking-sleep-in-async`](docs/rules/performance/python-blocking-sleep-in-async.md) | high | A blocking time.sleep call runs inside a Python async def function. |
582
- | <a id="python-copy-growing-list"></a>[`python-copy-growing-list`](docs/rules/performance/python-copy-growing-list.md) | medium | A Python loop rebuilds a growing list with items = items + [value]. |
583
- | <a id="python-fixed-regex-in-loop"></a>[`python-fixed-regex-in-loop`](docs/rules/performance/python-fixed-regex-in-loop.md) | low | A Python loop compiles a fixed pattern with re.compile on every iteration. |
584
- | <a id="python-n-plus-one-orm-loop"></a>[`python-n-plus-one-orm-loop`](docs/rules/performance/python-n-plus-one-orm-loop.md) | high | An ORM query executes inside a Python loop instead of using eager loading or batching. |
585
- | <a id="python-sync-requests-in-async"></a>[`python-sync-requests-in-async`](docs/rules/performance/python-sync-requests-in-async.md) | high | A blocking requests HTTP call runs inside a Python async def function. |
586
- | <a id="python-unbounded-comprehension"></a>[`python-unbounded-comprehension`](docs/rules/performance/python-unbounded-comprehension.md) | medium | A Python list comprehension materializes an unbounded collection in memory. |
587
- | <a id="rust-clone-in-loop"></a>[`rust-clone-in-loop`](docs/rules/performance/rust-clone-in-loop.md) | low | Cloning values inside a Rust loop adds avoidable heap allocations. |
588
- | <a id="rust-fixed-regex-in-loop"></a>[`rust-fixed-regex-in-loop`](docs/rules/performance/rust-fixed-regex-in-loop.md) | medium | A Rust Regex with a fixed pattern is compiled inside a loop. |
589
- | <a id="rust-format-in-loop"></a>[`rust-format-in-loop`](docs/rules/performance/rust-format-in-loop.md) | low | Calling format! inside a Rust loop allocates a new String on every iteration. |
317
+ <a id="csharp-ef-count-materialized"></a>[`csharp-ef-count-materialized`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/csharp-ef-count-materialized.md) · <a id="csharp-ef-query-in-loop"></a>[`csharp-ef-query-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/csharp-ef-query-in-loop.md) · <a id="csharp-fixed-regex-in-loop"></a>[`csharp-fixed-regex-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/csharp-fixed-regex-in-loop.md) · <a id="csharp-string-concat-in-loop"></a>[`csharp-string-concat-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/csharp-string-concat-in-loop.md) ·
318
+ <a id="go-fixed-regexp-in-loop"></a>[`go-fixed-regexp-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/go-fixed-regexp-in-loop.md) · <a id="go-sql-query-in-loop"></a>[`go-sql-query-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/go-sql-query-in-loop.md) · <a id="go-string-concat-in-loop"></a>[`go-string-concat-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/go-string-concat-in-loop.md) ·
319
+ <a id="java-fixed-regex-in-loop"></a>[`java-fixed-regex-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/java-fixed-regex-in-loop.md) · <a id="java-jdbc-query-in-loop"></a>[`java-jdbc-query-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/java-jdbc-query-in-loop.md) · <a id="java-string-concat-in-loop"></a>[`java-string-concat-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/java-string-concat-in-loop.md) ·
320
+ <a id="php-eloquent-query-in-loop"></a>[`php-eloquent-query-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/php-eloquent-query-in-loop.md) · <a id="python-blocking-sleep-in-async"></a>[`python-blocking-sleep-in-async`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/python-blocking-sleep-in-async.md) · <a id="python-copy-growing-list"></a>[`python-copy-growing-list`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/python-copy-growing-list.md) · <a id="python-fixed-regex-in-loop"></a>[`python-fixed-regex-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/python-fixed-regex-in-loop.md) · <a id="python-n-plus-one-orm-loop"></a>[`python-n-plus-one-orm-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/python-n-plus-one-orm-loop.md) · <a id="python-sync-requests-in-async"></a>[`python-sync-requests-in-async`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/python-sync-requests-in-async.md) · <a id="python-unbounded-comprehension"></a>[`python-unbounded-comprehension`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/python-unbounded-comprehension.md) ·
321
+ <a id="ruby-active-record-query-in-loop"></a>[`ruby-active-record-query-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/ruby-active-record-query-in-loop.md) · <a id="rust-clone-in-loop"></a>[`rust-clone-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/rust-clone-in-loop.md) · <a id="rust-fixed-regex-in-loop"></a>[`rust-fixed-regex-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/rust-fixed-regex-in-loop.md) · <a id="rust-format-in-loop"></a>[`rust-format-in-loop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/rust-format-in-loop.md)
590
322
 
591
323
  <!-- loadwise:rules:end -->
592
324
 
593
325
  ## Trace checks in other languages and databases
594
326
 
595
- `npx loadwise perf traces <file>` reads one local OTLP/JSON trace export (`resourceSpans → scopeSpans → spans`), such as an OpenTelemetry Collector file export; for a collector output with multiple JSON lines, pass the export object for the request. `--threshold` sets how many similar sibling calls form a finding. Try `npx loadwise perf traces node_modules/loadwise/examples/repeated-db.otlp.json`. Reports contain span IDs and counts and omit raw SQL, parameters and keys; check `scannedSpans` and `eligibleDbSpans` when interpreting a clean result.
327
+ `npx loadwise perf traces <file>` reads one local OTLP, Jaeger or Zipkin v2 JSON export, and `--threshold` sets how many similar sibling calls form a finding. Details are in [Trace checks](https://loadwise.mintlify.app/checkers/performance#trace-checks-in-other-languages-and-databases).
596
328
 
597
329
  <!-- loadwise:rules:start checker=performance group=trace-checks-in-other-languages-and-databases -->
598
330
 
599
- | Rule | Impact | What it flags |
600
- | ------------------------------------------------------------------------------------------------------ | ------ | ------------------------------------------------------------------- |
601
- | <a id="duplicate-key-read"></a>[`duplicate-key-read`](docs/rules/performance/duplicate-key-read.md) | medium | A trace repeats the same key or row read under one parent span. |
602
- | <a id="redis-keys-scan"></a>[`redis-keys-scan`](docs/rules/performance/redis-keys-scan.md) | high | A trace shows a Redis KEYS command scanning the keyspace. |
603
- | <a id="redis-repeated-read"></a>[`redis-repeated-read`](docs/rules/performance/redis-repeated-read.md) | medium | A trace shows repeated sibling Redis GET or HGET calls. |
604
- | <a id="repeated-db-span"></a>[`repeated-db-span`](docs/rules/performance/repeated-db-span.md) | high | A trace shows many similar sibling database calls under one parent. |
331
+ <a id="duplicate-key-read"></a>[`duplicate-key-read`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/duplicate-key-read.md) ·
332
+ <a id="redis-keys-scan"></a>[`redis-keys-scan`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/redis-keys-scan.md) · <a id="redis-repeated-read"></a>[`redis-repeated-read`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/redis-repeated-read.md) · <a id="repeated-db-span"></a>[`repeated-db-span`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/repeated-db-span.md)
605
333
 
606
334
  <!-- loadwise:rules:end -->
607
335
 
608
336
  ## Executed query plans
609
337
 
610
- `npx loadwise perf plan <file>` reads a JSON file from PostgreSQL `EXPLAIN (ANALYZE, FORMAT JSON)` or MongoDB `explain("executionStats")`, for example `node_modules/loadwise/examples/postgres-plan.json`, and reports the stage path and observed counts (MongoDB: classic stages and selected slot-based scan, filter and skip shapes). Planner estimates alone, and layouts where a scan cannot be attributed, exit 2. PostgreSQL's `ANALYZE` option executes the statement when you collect the plan.
338
+ `npx loadwise perf plan <file>` reads PostgreSQL `EXPLAIN (ANALYZE, FORMAT JSON)` or MongoDB `explain("executionStats")` output and reports the stage path and observed counts. Details are in [Executed query plans](https://loadwise.mintlify.app/checkers/performance#executed-query-plans).
611
339
 
612
340
  <!-- loadwise:rules:start checker=performance group=executed-query-plans -->
613
341
 
614
- | Rule | Impact | What it flags |
615
- | ------------------------------------------------------------------------------------------------------------ | ------ | -------------------------------------------------------------------- |
616
- | <a id="mongo-collection-scan"></a>[`mongo-collection-scan`](docs/rules/performance/mongo-collection-scan.md) | high | A MongoDB plan scans many documents for each one it returns. |
617
- | <a id="mongo-deep-skip"></a>[`mongo-deep-skip`](docs/rules/performance/mongo-deep-skip.md) | high | A MongoDB query skips past many documents to return a page. |
618
- | <a id="mongo-disk-sort"></a>[`mongo-disk-sort`](docs/rules/performance/mongo-disk-sort.md) | medium | A MongoDB sort spilled to disk. |
619
- | <a id="pg-deep-offset"></a>[`pg-deep-offset`](docs/rules/performance/pg-deep-offset.md) | high | A PostgreSQL plan walks past many rows with OFFSET to return a page. |
620
- | <a id="pg-disk-sort"></a>[`pg-disk-sort`](docs/rules/performance/pg-disk-sort.md) | medium | A PostgreSQL sort spilled to disk. |
621
- | <a id="pg-sequential-scan"></a>[`pg-sequential-scan`](docs/rules/performance/pg-sequential-scan.md) | high | A PostgreSQL plan scans many rows for each one it returns. |
342
+ <a id="mongo-collection-scan"></a>[`mongo-collection-scan`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/mongo-collection-scan.md) · <a id="mongo-deep-skip"></a>[`mongo-deep-skip`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/mongo-deep-skip.md) · <a id="mongo-disk-sort"></a>[`mongo-disk-sort`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/mongo-disk-sort.md) ·
343
+ <a id="pg-deep-offset"></a>[`pg-deep-offset`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/pg-deep-offset.md) · <a id="pg-disk-sort"></a>[`pg-disk-sort`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/pg-disk-sort.md) · <a id="pg-sequential-scan"></a>[`pg-sequential-scan`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/pg-sequential-scan.md)
622
344
 
623
345
  <!-- loadwise:rules:end -->
624
346
 
@@ -626,7 +348,7 @@ The source checker reads the project's ORM schema (Prisma, Drizzle, TypeORM, Seq
626
348
 
627
349
  `npx loadwise perf db` is the only command that connects to a database. Point it at a staging or read replica database, never a primary you cannot afford to touch. It uses the project's own `pg`, `mysql2` or `mongodb` package.
628
350
 
629
- The connection comes from the environment, never a flag: `DATABASE_URL` (or the variable named by `--url-env`), else `DB_HOST`, `DB_PORT`, `DB_USER` or `DB_USERNAME`, `DB_PASSWORD` and `DB_NAME` or `DB_DATABASE`. `--env-file FILE` reads those variables from a file without loading them into the process environment. `--engine postgres|mysql|mongo` is needed with `DB_HOST` variables when `DB_PORT` is not the engine default.
351
+ The connection comes from the environment, never a flag: `DATABASE_URL` (or the variable named by `--url-env`) or `DB_*` variables, optionally read from `--env-file FILE`.
630
352
 
631
353
  ```sh
632
354
  npx loadwise perf db --env-file .env.staging --schema-snapshot snapshot.json
@@ -634,34 +356,14 @@ npx loadwise perf db --queries queries.sql --analyze
634
356
  npx loadwise perf --schema snapshot.json
635
357
  ```
636
358
 
637
- | Flag | Effect |
638
- | -------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
639
- | `--schema-snapshot FILE` | Write a schema snapshot (indexes, table sizes, measured round trip) for `--schema`. |
640
- | `--top N` | Explain the N slowest statements (default 20). |
641
- | `--queries FILE` | Explain these concrete SELECT statements. |
642
- | `--analyze` | Run `EXPLAIN ANALYZE` on the `--queries` SELECTs inside rolled-back read-only transactions. |
643
- | `--measure --i-understand-this-locks-tables` | PostgreSQL staging only. Time each suggested index for `--queries` by building it in a rolled-back transaction. |
644
- | `--runs N` | `EXPLAIN ANALYZE` runs per side for `--measure` (default 5). |
645
-
646
- `--include-contextual`, `--ignore RULE` and `--json` work as in the other commands.
647
-
648
359
  <!-- loadwise:rules:start checker=performance group=database-inspection-optional -->
649
360
 
650
- | Rule | Impact | What it flags |
651
- | --------------------------------------------------------------------------------------------------------------------------------------- | ------ | ---------------------------------------------------------------------------- |
652
- | <a id="db-duplicate-index"></a>[`db-duplicate-index`](docs/rules/performance/db-duplicate-index.md) | low | A database index is covered by another index on the same table. |
653
- | <a id="db-missing-index"></a>[`db-missing-index`](docs/rules/performance/db-missing-index.md) | high | A query plan scans a table that a suggested index would let it seek. |
654
- | <a id="db-seq-scan-heavy-table"></a>[`db-seq-scan-heavy-table`](docs/rules/performance/db-seq-scan-heavy-table.md) | high | A large table is read by many sequential scans on the live database. |
655
- | <a id="db-slow-query-plan"></a>[`db-slow-query-plan`](docs/rules/performance/db-slow-query-plan.md) | high | One of the slowest statements reads a table with a full table scan. |
656
- | <a id="db-unindexed-foreign-key"></a>[`db-unindexed-foreign-key`](docs/rules/performance/db-unindexed-foreign-key.md) | high | A foreign key on the live database has no index that leads with its columns. |
657
- | <a id="db-unused-index"></a>[`db-unused-index`](docs/rules/performance/db-unused-index.md) | low | A database index has not been scanned since statistics were last reset. |
658
- | <a id="mongo-collection-scan-observed"></a>[`mongo-collection-scan-observed`](docs/rules/performance/mongo-collection-scan-observed.md) | high | Profiled MongoDB operations scanned a whole collection. |
361
+ <a id="db-duplicate-index"></a>[`db-duplicate-index`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/db-duplicate-index.md) · <a id="db-missing-index"></a>[`db-missing-index`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/db-missing-index.md) · <a id="db-seq-scan-heavy-table"></a>[`db-seq-scan-heavy-table`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/db-seq-scan-heavy-table.md) · <a id="db-slow-query-plan"></a>[`db-slow-query-plan`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/db-slow-query-plan.md) · <a id="db-sqlite-large-scan"></a>[`db-sqlite-large-scan`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/db-sqlite-large-scan.md) · <a id="db-unindexed-foreign-key"></a>[`db-unindexed-foreign-key`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/db-unindexed-foreign-key.md) · <a id="db-unused-index"></a>[`db-unused-index`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/db-unused-index.md) ·
362
+ <a id="mongo-collection-scan-observed"></a>[`mongo-collection-scan-observed`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/performance/mongo-collection-scan-observed.md)
659
363
 
660
364
  <!-- loadwise:rules:end -->
661
365
 
662
- **Safety.** 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 replaces the connection URL, host, user, password and resolved IP addresses with `[redacted]`. Usage counters come from the node that answered, so an index unused here may still be used on a replica.
663
-
664
- **`--measure` blocks writes** to the table while each index builds. It refuses a connection variable or database name matching `/prod/i`, a replica, an unknown table size and any table over 5,000,000 estimated rows, and it needs the long confirmation flag. With the HypoPG extension, suggested indexes are also checked hypothetically. Output labels every figure as _measured_ (timed on your database) or _estimated_ (planner statistics, a model or HypoPG).
366
+ Sessions are read-only. `--measure --i-understand-this-locks-tables` blocks writes while it times each suggested index, so it runs only on PostgreSQL staging databases. The [database inspection guide](https://loadwise.mintlify.app/checkers/performance#database-inspection-optional) covers every flag (`--top`, `--queries`, `--analyze`, `--runs`), SQLite files, MySQL without TLS and the safety limits.
665
367
 
666
368
  # Reliability checker
667
369
 
@@ -673,99 +375,39 @@ Some rules moved here from the performance and maintainability checkers and kept
673
375
 
674
376
  <!-- loadwise:rules:start checker=reliability group=source-rules -->
675
377
 
676
- | Rule | Impact | What it flags |
677
- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
678
- | <a id="assignment-in-condition"></a>[`assignment-in-condition`](docs/rules/reliability/assignment-in-condition.md) | high | A condition assigns with = where a comparison was probably meant. |
679
- | <a id="async-callback-unhandled-rejection"></a>[`async-callback-unhandled-rejection`](docs/rules/reliability/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. |
680
- | <a id="async-route-unhandled-rejection"></a>[`async-route-unhandled-rejection`](docs/rules/reliability/async-route-unhandled-rejection.md) | high | An Express 4 async route handler has no error handling, so a rejection never reaches the error middleware. |
681
- | <a id="browser-not-closed"></a>[`browser-not-closed`](docs/rules/reliability/browser-not-closed.md) | high | A Playwright or Puppeteer browser is not closed in a finally block, so an error leaves the process running. |
682
- | <a id="check-then-update-race"></a>[`check-then-update-race`](docs/rules/reliability/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. |
683
- | <a id="child-process-without-error-listener"></a>[`child-process-without-error-listener`](docs/rules/reliability/child-process-without-error-listener.md) | high | A spawned child process has no 'error' listener, so a failed spawn crashes the parent process. |
684
- | <a id="crlf-unsafe-line-split"></a>[`crlf-unsafe-line-split`](docs/rules/reliability/crlf-unsafe-line-split.md) | medium | Splitting file text on a bare newline leaves carriage returns on CRLF lines and can change exact comparisons. |
685
- | <a id="csharp-async-void"></a>[`csharp-async-void`](docs/rules/reliability/csharp-async-void.md) | high | An async void method cannot be awaited and can crash the process on unhandled exceptions. |
686
- | <a id="csharp-disposable-without-using"></a>[`csharp-disposable-without-using`](docs/rules/reliability/csharp-disposable-without-using.md) | medium | A C# stream, connection or other IDisposable is created without using, so an exception leaks it. |
687
- | <a id="db-pool-client-not-released"></a>[`db-pool-client-not-released`](docs/rules/reliability/db-pool-client-not-released.md) | high | A locally checked-out database connection can leave its scope without being released. |
688
- | <a id="discarded-error-result"></a>[`discarded-error-result`](docs/rules/reliability/discarded-error-result.md) | high | A call discards a typed Either or Result that can carry a failure as a value. |
689
- | <a id="drizzle-unfiltered-write"></a>[`drizzle-unfiltered-write`](docs/rules/reliability/drizzle-unfiltered-write.md) | critical | A Drizzle update or delete executes without an effective where clause. |
690
- | <a id="drizzle-write-preflight"></a>[`drizzle-write-preflight`](docs/rules/reliability/drizzle-write-preflight.md) | medium | A separate existence check before a Drizzle write can race with another request. |
691
- | <a id="error-logged-without-stack"></a>[`error-logged-without-stack`](docs/rules/reliability/error-logged-without-stack.md) | low | A catch block logs only error.message and carries on, so the stack trace is lost. |
692
- | <a id="error-rethrown-without-cause"></a>[`error-rethrown-without-cause`](docs/rules/reliability/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. |
693
- | <a id="file-handle-not-closed"></a>[`file-handle-not-closed`](docs/rules/reliability/file-handle-not-closed.md) | high | A FileHandle from fs/promises open() is not closed on every path, leaking a file descriptor. |
694
- | <a id="find-then-create-race"></a>[`find-then-create-race`](docs/rules/reliability/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. |
695
- | <a id="floating-promise"></a>[`floating-promise`](docs/rules/reliability/floating-promise.md) | high | A promise-returning call is neither awaited, returned nor handled, so its failure goes unseen. |
696
- | <a id="go-defer-before-error-check"></a>[`go-defer-before-error-check`](docs/rules/reliability/go-defer-before-error-check.md) | high | A Go defer closes a resource before its error is checked, so a failed open dereferences nil. |
697
- | <a id="go-error-discarded"></a>[`go-error-discarded`](docs/rules/reliability/go-error-discarded.md) | high | A Go error result is assigned to the blank identifier and never checked. |
698
- | <a id="http-call-without-timeout"></a>[`http-call-without-timeout`](docs/rules/reliability/http-call-without-timeout.md) | high | A fetch or axios call has no timeout or abort signal. |
699
- | <a id="interval-not-cleared"></a>[`interval-not-cleared`](docs/rules/reliability/interval-not-cleared.md) | medium | A setInterval handle is discarded or never cleared, so the timer outlives its owner. |
700
- | <a id="invalid-typeof-comparison"></a>[`invalid-typeof-comparison`](docs/rules/reliability/invalid-typeof-comparison.md) | high | A typeof result is compared to a string typeof never returns, so the check never matches. |
701
- | <a id="java-resource-without-try"></a>[`java-resource-without-try`](docs/rules/reliability/java-resource-without-try.md) | high | A Java stream, reader or connection is opened outside try-with-resources, so an exception leaks it. |
702
- | <a id="json-parse-unguarded"></a>[`json-parse-unguarded`](docs/rules/reliability/json-parse-unguarded.md) | medium | JSON.parse runs on outside input with no try/catch, so malformed input throws where it is not handled. |
703
- | <a id="loop-index-past-length"></a>[`loop-index-past-length`](docs/rules/reliability/loop-index-past-length.md) | high | A loop runs its index up to and including length, so the last pass reads past the end. |
704
- | <a id="mongoose-aggregate-uncast-id"></a>[`mongoose-aggregate-uncast-id`](docs/rules/reliability/mongoose-aggregate-uncast-id.md) | high | A Mongoose aggregate $match compares _id to an uncast string instead of an ObjectId. |
705
- | <a id="nan-comparison"></a>[`nan-comparison`](docs/rules/reliability/nan-comparison.md) | high | A value is compared to NaN with an equality operator, which is never true. |
706
- | <a id="next-server-env-in-client"></a>[`next-server-env-in-client`](docs/rules/reliability/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. |
707
- | <a id="parse-failure-resets-file"></a>[`parse-failure-resets-file`](docs/rules/reliability/parse-failure-resets-file.md) | high | A write after a read or parse failure can replace unreadable contents at the same path. |
708
- | <a id="payment-missing-idempotency-key"></a>[`payment-missing-idempotency-key`](docs/rules/reliability/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. |
709
- | <a id="pg-advisory-lock-session"></a>[`pg-advisory-lock-session`](docs/rules/reliability/pg-advisory-lock-session.md) | high | A PostgreSQL session can return to the pool while it holds an advisory lock. |
710
- | <a id="pg-listen-session"></a>[`pg-listen-session`](docs/rules/reliability/pg-listen-session.md) | high | A PostgreSQL listener connection can return to the pool while it is still subscribed. |
711
- | <a id="pg-transaction-on-pool"></a>[`pg-transaction-on-pool`](docs/rules/reliability/pg-transaction-on-pool.md) | critical | A transaction statement is sent to a pool, so its statements can run on different connections. |
712
- | <a id="pool-without-connection-timeout"></a>[`pool-without-connection-timeout`](docs/rules/reliability/pool-without-connection-timeout.md) | medium | A pg Pool or Client sets no connectionTimeoutMillis, so its default of 0 waits for a connection forever. |
713
- | <a id="prisma-dependent-writes"></a>[`prisma-dependent-writes`](docs/rules/reliability/prisma-dependent-writes.md) | high | Adjacent Prisma creates pass a value from the first record into the next write. |
714
- | <a id="prisma-read-modify-write"></a>[`prisma-read-modify-write`](docs/rules/reliability/prisma-read-modify-write.md) | critical | A Prisma read feeds a numeric update of the same row, losing concurrent updates. |
715
- | <a id="prisma-transaction-client-escape"></a>[`prisma-transaction-client-escape`](docs/rules/reliability/prisma-transaction-client-escape.md) | critical | A Prisma call inside an interactive transaction uses the outer client instead of the transaction client. |
716
- | <a id="promise-return-escapes-catch"></a>[`promise-return-escapes-catch`](docs/rules/reliability/promise-return-escapes-catch.md) | high | Returning a promise directly from a protected try block can bypass its catch on rejection. |
717
- | <a id="python-bare-except"></a>[`python-bare-except`](docs/rules/reliability/python-bare-except.md) | medium | A bare except also catches SystemExit and KeyboardInterrupt, hiding shutdowns and bugs. |
718
- | <a id="python-swallowed-exception"></a>[`python-swallowed-exception`](docs/rules/reliability/python-swallowed-exception.md) | medium | A Python except block only passes, so the failure is dropped silently. |
719
- | <a id="query-runner-not-released"></a>[`query-runner-not-released`](docs/rules/reliability/query-runner-not-released.md) | critical | A TypeORM QueryRunner is not released in a finally block, so an error leaks its pooled connection. |
720
- | <a id="react-async-effect-callback"></a>[`react-async-effect-callback`](docs/rules/reliability/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. |
721
- | <a id="react-effect-sets-state-every-render"></a>[`react-effect-sets-state-every-render`](docs/rules/reliability/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. |
722
- | <a id="react-list-missing-key"></a>[`react-list-missing-key`](docs/rules/reliability/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. |
723
- | <a id="react-state-mutated-in-place"></a>[`react-state-mutated-in-place`](docs/rules/reliability/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. |
724
- | <a id="redis-incr-then-expire"></a>[`redis-incr-then-expire`](docs/rules/reliability/redis-incr-then-expire.md) | medium | A Redis counter increment and its expire on the same key are two round trips and not atomic. |
725
- | <a id="request-number-unvalidated"></a>[`request-number-unvalidated`](docs/rules/reliability/request-number-unvalidated.md) | medium | A number parsed from request input reaches a query or calculation with no NaN or range check. |
726
- | <a id="retry-without-backoff"></a>[`retry-without-backoff`](docs/rules/reliability/retry-without-backoff.md) | medium | A retry loop calls the network again with no delay between attempts. |
727
- | <a id="return-in-finally"></a>[`return-in-finally`](docs/rules/reliability/return-in-finally.md) | high | Returning from finally can replace a pending return value or suppress a thrown error. |
728
- | <a id="return-newline"></a>[`return-newline`](docs/rules/reliability/return-newline.md) | high | A line break after return ends the statement before the apparent return value. |
729
- | <a id="rust-unwrap-in-production"></a>[`rust-unwrap-in-production`](docs/rules/reliability/rust-unwrap-in-production.md) | medium | Rust code outside tests calls unwrap(), turning an Err or None into a panic. |
730
- | <a id="sql-insert-truncated-at-semicolon"></a>[`sql-insert-truncated-at-semicolon`](docs/rules/reliability/sql-insert-truncated-at-semicolon.md) | high | A SQL dump parser ends INSERT values at a semicolon inside quoted text. |
731
- | <a id="stream-pipe-unhandled-error"></a>[`stream-pipe-unhandled-error`](docs/rules/reliability/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. |
732
- | <a id="swallowed-error"></a>[`swallowed-error`](docs/rules/reliability/swallowed-error.md) | medium | A catch block drops the error and the code after the try carries on as if it succeeded. |
733
- | <a id="switch-not-exhaustive"></a>[`switch-not-exhaustive`](docs/rules/reliability/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. |
734
- | <a id="test-cleanup-after-await"></a>[`test-cleanup-after-await`](docs/rules/reliability/test-cleanup-after-await.md) | medium | A test waits before cleaning up a local resource, so a rejection can leave it running. |
735
- | <a id="throw-non-error"></a>[`throw-non-error`](docs/rules/reliability/throw-non-error.md) | medium | A string, number or object literal is thrown instead of an Error, so there is no stack trace. |
736
- | <a id="typeorm-transaction-client-escape"></a>[`typeorm-transaction-client-escape`](docs/rules/reliability/typeorm-transaction-client-escape.md) | critical | A write inside a TypeORM transaction goes through a repository not bound to it. |
737
- | <a id="unbounded-promise-all"></a>[`unbounded-promise-all`](docs/rules/reliability/unbounded-promise-all.md) | high | Promise.all runs over an unbounded collection without a concurrency limit, risking memory spikes or downstream saturation. |
738
- | <a id="uncaught-exception-continues"></a>[`uncaught-exception-continues`](docs/rules/reliability/uncaught-exception-continues.md) | high | An uncaughtException handler neither exits nor rethrows, so the process keeps running in an undefined state. |
739
- | <a id="unguarded-boundary-access"></a>[`unguarded-boundary-access`](docs/rules/reliability/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. |
740
- | <a id="unreachable-code"></a>[`unreachable-code`](docs/rules/reliability/unreachable-code.md) | medium | Statements follow a return, throw, break or continue in the same block and never run. |
741
- | <a id="upload-without-size-limit"></a>[`upload-without-size-limit`](docs/rules/reliability/upload-without-size-limit.md) | high | A multer or Nest upload interceptor has no file size limit. |
742
- | <a id="webhook-missing-idempotency-check"></a>[`webhook-missing-idempotency-check`](docs/rules/reliability/webhook-missing-idempotency-check.md) | medium | A webhook route inserts rows without visible atomic deduplication by event ID. |
378
+ <a id="assignment-in-condition"></a>[`assignment-in-condition`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/assignment-in-condition.md) · <a id="async-array-predicate"></a>[`async-array-predicate`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/async-array-predicate.md) · <a id="async-callback-unhandled-rejection"></a>[`async-callback-unhandled-rejection`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/async-callback-unhandled-rejection.md) · <a id="async-promise-executor"></a>[`async-promise-executor`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/async-promise-executor.md) · <a id="async-route-unhandled-rejection"></a>[`async-route-unhandled-rejection`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/async-route-unhandled-rejection.md) ·
379
+ <a id="browser-not-closed"></a>[`browser-not-closed`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/browser-not-closed.md) ·
380
+ <a id="check-then-update-race"></a>[`check-then-update-race`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/check-then-update-race.md) · <a id="child-process-without-error-listener"></a>[`child-process-without-error-listener`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/child-process-without-error-listener.md) · <a id="crlf-unsafe-line-split"></a>[`crlf-unsafe-line-split`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/crlf-unsafe-line-split.md) · <a id="csharp-async-void"></a>[`csharp-async-void`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/csharp-async-void.md) · <a id="csharp-disposable-without-using"></a>[`csharp-disposable-without-using`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/csharp-disposable-without-using.md) · <a id="csharp-sync-task-wait-in-async"></a>[`csharp-sync-task-wait-in-async`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/csharp-sync-task-wait-in-async.md) ·
381
+ <a id="db-pool-client-not-released"></a>[`db-pool-client-not-released`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/db-pool-client-not-released.md) · <a id="discarded-error-result"></a>[`discarded-error-result`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/discarded-error-result.md) · <a id="discarded-file-write-count"></a>[`discarded-file-write-count`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/discarded-file-write-count.md) · <a id="drizzle-unfiltered-write"></a>[`drizzle-unfiltered-write`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/drizzle-unfiltered-write.md) · <a id="drizzle-write-preflight"></a>[`drizzle-write-preflight`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/drizzle-write-preflight.md) ·
382
+ <a id="error-logged-without-stack"></a>[`error-logged-without-stack`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/error-logged-without-stack.md) · <a id="error-rethrown-without-cause"></a>[`error-rethrown-without-cause`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/error-rethrown-without-cause.md) ·
383
+ <a id="file-handle-not-closed"></a>[`file-handle-not-closed`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/file-handle-not-closed.md) · <a id="find-then-create-race"></a>[`find-then-create-race`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/find-then-create-race.md) · <a id="floating-promise"></a>[`floating-promise`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/floating-promise.md) ·
384
+ <a id="go-defer-before-error-check"></a>[`go-defer-before-error-check`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/go-defer-before-error-check.md) · <a id="go-error-discarded"></a>[`go-error-discarded`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/go-error-discarded.md) · <a id="go-http-call-without-deadline"></a>[`go-http-call-without-deadline`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/go-http-call-without-deadline.md) · <a id="go-http-response-body-not-closed"></a>[`go-http-response-body-not-closed`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/go-http-response-body-not-closed.md) · <a id="go-sql-rows-leaked"></a>[`go-sql-rows-leaked`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/go-sql-rows-leaked.md) · <a id="go-sql-rows-unchecked-err"></a>[`go-sql-rows-unchecked-err`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/go-sql-rows-unchecked-err.md) ·
385
+ <a id="http-call-without-timeout"></a>[`http-call-without-timeout`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/http-call-without-timeout.md) ·
386
+ <a id="interval-not-cleared"></a>[`interval-not-cleared`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/interval-not-cleared.md) · <a id="invalid-typeof-comparison"></a>[`invalid-typeof-comparison`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/invalid-typeof-comparison.md) ·
387
+ <a id="java-resource-without-try"></a>[`java-resource-without-try`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/java-resource-without-try.md) · <a id="java-shared-date-format"></a>[`java-shared-date-format`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/java-shared-date-format.md) · <a id="json-parse-unguarded"></a>[`json-parse-unguarded`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/json-parse-unguarded.md) ·
388
+ <a id="kotlin-run-blocking-in-suspend"></a>[`kotlin-run-blocking-in-suspend`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/kotlin-run-blocking-in-suspend.md) ·
389
+ <a id="loop-index-past-length"></a>[`loop-index-past-length`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/loop-index-past-length.md) · <a id="lossy-same-file-text-rewrite"></a>[`lossy-same-file-text-rewrite`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/lossy-same-file-text-rewrite.md) ·
390
+ <a id="mongoose-aggregate-uncast-id"></a>[`mongoose-aggregate-uncast-id`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/mongoose-aggregate-uncast-id.md) ·
391
+ <a id="nan-comparison"></a>[`nan-comparison`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/nan-comparison.md) · <a id="next-server-env-in-client"></a>[`next-server-env-in-client`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/next-server-env-in-client.md) · <a id="numeric-array-default-sort"></a>[`numeric-array-default-sort`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/numeric-array-default-sort.md) ·
392
+ <a id="parse-failure-resets-file"></a>[`parse-failure-resets-file`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/parse-failure-resets-file.md) · <a id="payment-missing-idempotency-key"></a>[`payment-missing-idempotency-key`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/payment-missing-idempotency-key.md) · <a id="pg-advisory-lock-session"></a>[`pg-advisory-lock-session`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/pg-advisory-lock-session.md) · <a id="pg-listen-session"></a>[`pg-listen-session`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/pg-listen-session.md) · <a id="pg-transaction-on-pool"></a>[`pg-transaction-on-pool`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/pg-transaction-on-pool.md) · <a id="pool-without-connection-timeout"></a>[`pool-without-connection-timeout`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/pool-without-connection-timeout.md) · <a id="prisma-dependent-writes"></a>[`prisma-dependent-writes`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/prisma-dependent-writes.md) · <a id="prisma-read-modify-write"></a>[`prisma-read-modify-write`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/prisma-read-modify-write.md) · <a id="prisma-transaction-client-escape"></a>[`prisma-transaction-client-escape`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/prisma-transaction-client-escape.md) · <a id="promise-return-escapes-catch"></a>[`promise-return-escapes-catch`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/promise-return-escapes-catch.md) · <a id="python-bare-except"></a>[`python-bare-except`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/python-bare-except.md) · <a id="python-file-not-closed"></a>[`python-file-not-closed`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/python-file-not-closed.md) · <a id="python-mutated-mutable-default"></a>[`python-mutated-mutable-default`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/python-mutated-mutable-default.md) · <a id="python-requests-without-timeout"></a>[`python-requests-without-timeout`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/python-requests-without-timeout.md) · <a id="python-swallowed-exception"></a>[`python-swallowed-exception`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/python-swallowed-exception.md) ·
393
+ <a id="query-runner-not-released"></a>[`query-runner-not-released`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/query-runner-not-released.md) ·
394
+ <a id="react-async-effect-callback"></a>[`react-async-effect-callback`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/react-async-effect-callback.md) · <a id="react-effect-sets-state-every-render"></a>[`react-effect-sets-state-every-render`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/react-effect-sets-state-every-render.md) · <a id="react-list-missing-key"></a>[`react-list-missing-key`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/react-list-missing-key.md) · <a id="react-state-mutated-in-place"></a>[`react-state-mutated-in-place`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/react-state-mutated-in-place.md) · <a id="redis-incr-then-expire"></a>[`redis-incr-then-expire`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/redis-incr-then-expire.md) · <a id="request-number-unvalidated"></a>[`request-number-unvalidated`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/request-number-unvalidated.md) · <a id="retry-without-backoff"></a>[`retry-without-backoff`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/retry-without-backoff.md) · <a id="return-in-finally"></a>[`return-in-finally`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/return-in-finally.md) · <a id="return-newline"></a>[`return-newline`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/return-newline.md) · <a id="rust-blocking-std-in-async"></a>[`rust-blocking-std-in-async`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/rust-blocking-std-in-async.md) · <a id="rust-mutex-guard-across-await"></a>[`rust-mutex-guard-across-await`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/rust-mutex-guard-across-await.md) · <a id="rust-unwrap-in-production"></a>[`rust-unwrap-in-production`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/rust-unwrap-in-production.md) ·
395
+ <a id="same-file-stream-truncation"></a>[`same-file-stream-truncation`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/same-file-stream-truncation.md) · <a id="sql-insert-truncated-at-semicolon"></a>[`sql-insert-truncated-at-semicolon`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/sql-insert-truncated-at-semicolon.md) · <a id="stream-pipe-unhandled-error"></a>[`stream-pipe-unhandled-error`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/stream-pipe-unhandled-error.md) · <a id="swallowed-error"></a>[`swallowed-error`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/swallowed-error.md) · <a id="switch-not-exhaustive"></a>[`switch-not-exhaustive`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/switch-not-exhaustive.md) ·
396
+ <a id="test-cleanup-after-await"></a>[`test-cleanup-after-await`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/test-cleanup-after-await.md) · <a id="throw-non-error"></a>[`throw-non-error`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/throw-non-error.md) · <a id="typeorm-transaction-client-escape"></a>[`typeorm-transaction-client-escape`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/typeorm-transaction-client-escape.md) ·
397
+ <a id="unbounded-promise-all"></a>[`unbounded-promise-all`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/unbounded-promise-all.md) · <a id="uncaught-exception-continues"></a>[`uncaught-exception-continues`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/uncaught-exception-continues.md) · <a id="unchecked-json-cast"></a>[`unchecked-json-cast`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/unchecked-json-cast.md) · <a id="unguarded-boundary-access"></a>[`unguarded-boundary-access`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/unguarded-boundary-access.md) · <a id="unreachable-code"></a>[`unreachable-code`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/unreachable-code.md) · <a id="upload-without-size-limit"></a>[`upload-without-size-limit`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/upload-without-size-limit.md) ·
398
+ <a id="webhook-missing-idempotency-check"></a>[`webhook-missing-idempotency-check`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/webhook-missing-idempotency-check.md)
743
399
 
744
400
  <!-- loadwise:rules:end -->
745
401
 
746
402
  ## Migration safety
747
403
 
748
- `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`.
404
+ `npx loadwise rel migrations` reads Prisma, Drizzle, TypeORM, Knex and Sequelize migrations (SQL or code) and flags potentially unsafe schema changes. It reads files only. `--dialect postgres|mysql|sqlite|sqlserver` selects the rule set, `--json` gives structured output, and `--ignore RULE` skips a rule. The older `loadwise perf migrations` and `loadwise perf contracts` still work and print a note pointing to `rel`.
405
+
406
+ SQLite rebuilds, SQL Server index builds, dialect discovery and which migration files are read are covered in [Migration safety](https://loadwise.mintlify.app/checkers/reliability#migration-safety).
749
407
 
750
408
  <!-- loadwise:rules:start checker=reliability group=migration-safety -->
751
409
 
752
- | Rule | Impact | What it flags |
753
- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | -------------------------------------------------------------------------------------- |
754
- | <a id="migration-breaking-drop"></a>[`migration-breaking-drop`](docs/rules/reliability/migration-breaking-drop.md) | critical | A migration drops a column or table that running code may still use. |
755
- | <a id="migration-breaking-rename"></a>[`migration-breaking-rename`](docs/rules/reliability/migration-breaking-rename.md) | high | A migration renames a column or table that running code may still use. |
756
- | <a id="migration-column-type-rewrite"></a>[`migration-column-type-rewrite`](docs/rules/reliability/migration-column-type-rewrite.md) | critical | A migration changes a column type in a way that rewrites the table. |
757
- | <a id="migration-concurrent-in-transaction"></a>[`migration-concurrent-in-transaction`](docs/rules/reliability/migration-concurrent-in-transaction.md) | high | A CONCURRENTLY index statement runs inside a transaction, where PostgreSQL rejects it. |
758
- | <a id="migration-constraint-not-valid"></a>[`migration-constraint-not-valid`](docs/rules/reliability/migration-constraint-not-valid.md) | high | A constraint is added and validated in one step instead of NOT VALID first. |
759
- | <a id="migration-constraint-without-index"></a>[`migration-constraint-without-index`](docs/rules/reliability/migration-constraint-without-index.md) | high | A unique or primary key constraint builds its index while blocking writes. |
760
- | <a id="migration-index-not-concurrent"></a>[`migration-index-not-concurrent`](docs/rules/reliability/migration-index-not-concurrent.md) | critical | A PostgreSQL index is built without CONCURRENTLY, blocking writes to the table. |
761
- | <a id="migration-missing-lock-timeout"></a>[`migration-missing-lock-timeout`](docs/rules/reliability/migration-missing-lock-timeout.md) | high | A migration statement takes a lock with no lock_timeout set. |
762
- | <a id="migration-mysql-lock-unspecified"></a>[`migration-mysql-lock-unspecified`](docs/rules/reliability/migration-mysql-lock-unspecified.md) | high | A MySQL ALTER does not state its LOCK level. |
763
- | <a id="migration-mysql-table-copy"></a>[`migration-mysql-table-copy`](docs/rules/reliability/migration-mysql-table-copy.md) | critical | A MySQL ALTER copies the whole table. |
764
- | <a id="migration-not-null-without-default"></a>[`migration-not-null-without-default`](docs/rules/reliability/migration-not-null-without-default.md) | high | A NOT NULL column is added without a default, which fails once rows exist. |
765
- | <a id="migration-set-not-null-scan"></a>[`migration-set-not-null-scan`](docs/rules/reliability/migration-set-not-null-scan.md) | high | SET NOT NULL scans the whole table while holding a lock. |
766
- | <a id="migration-table-rewrite-command"></a>[`migration-table-rewrite-command`](docs/rules/reliability/migration-table-rewrite-command.md) | critical | A migration runs VACUUM FULL, CLUSTER or REINDEX, which rewrites or locks the table. |
767
- | <a id="migration-unparsed"></a>[`migration-unparsed`](docs/rules/reliability/migration-unparsed.md) | low | A migration statement could not be parsed and needs a manual review. |
768
- | <a id="migration-volatile-default"></a>[`migration-volatile-default`](docs/rules/reliability/migration-volatile-default.md) | high | A column is added with a volatile default, which rewrites the table. |
410
+ <a id="migration-breaking-drop"></a>[`migration-breaking-drop`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/migration-breaking-drop.md) · <a id="migration-breaking-rename"></a>[`migration-breaking-rename`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/migration-breaking-rename.md) · <a id="migration-column-type-rewrite"></a>[`migration-column-type-rewrite`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/migration-column-type-rewrite.md) · <a id="migration-concurrent-in-transaction"></a>[`migration-concurrent-in-transaction`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/migration-concurrent-in-transaction.md) · <a id="migration-constraint-not-valid"></a>[`migration-constraint-not-valid`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/migration-constraint-not-valid.md) · <a id="migration-constraint-without-index"></a>[`migration-constraint-without-index`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/migration-constraint-without-index.md) · <a id="migration-index-not-concurrent"></a>[`migration-index-not-concurrent`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/migration-index-not-concurrent.md) · <a id="migration-missing-lock-timeout"></a>[`migration-missing-lock-timeout`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/migration-missing-lock-timeout.md) · <a id="migration-mysql-lock-unspecified"></a>[`migration-mysql-lock-unspecified`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/migration-mysql-lock-unspecified.md) · <a id="migration-mysql-table-copy"></a>[`migration-mysql-table-copy`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/migration-mysql-table-copy.md) · <a id="migration-not-null-without-default"></a>[`migration-not-null-without-default`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/migration-not-null-without-default.md) · <a id="migration-set-not-null-scan"></a>[`migration-set-not-null-scan`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/migration-set-not-null-scan.md) · <a id="migration-sqlserver-offline-index"></a>[`migration-sqlserver-offline-index`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/migration-sqlserver-offline-index.md) · <a id="migration-table-access-exclusive-lock"></a>[`migration-table-access-exclusive-lock`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/migration-table-access-exclusive-lock.md) · <a id="migration-table-rewrite-command"></a>[`migration-table-rewrite-command`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/migration-table-rewrite-command.md) · <a id="migration-unparsed"></a>[`migration-unparsed`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/migration-unparsed.md) · <a id="migration-volatile-default"></a>[`migration-volatile-default`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/migration-volatile-default.md)
769
411
 
770
412
  <!-- loadwise:rules:end -->
771
413
 
@@ -780,89 +422,50 @@ npx loadwise rel migrations # new migrations fail; baselined
780
422
 
781
423
  ## API contract safety
782
424
 
783
- `npx loadwise rel contracts [--changed-since REF] [--json]` compares the working tree with the merge base of `REF` (default `HEAD`) and flags changes that break API clients; `loadwise check --changed-since REF` includes the same findings in the reliability report. Both respect workspace selection, ignored paths and rules, configured rule levels and minimum impact, and need a full-history checkout so the ref resolves. It compares OpenAPI and Swagger JSON (`openapi.json`, `swagger.json`; YAML is skipped with a note), GraphQL SDL (`*.graphql`, `*.gql`; query documents are skipped) and NestJS classes used as `@Body()` types or controller return types (also `@ApiResponse({ type })`) in `*.controller.ts`, read through relative imports. Only property names, `?`, `@IsOptional()` and the written type text are compared, and properties inherited from a base class in a relative import count as the class's own. A removed request property is flagged only when the project builds a `ValidationPipe` with `forbidNonWhitelisted: true`. Removals point at the line in the old version; a new version next to the old one (`/v2/users` beside `/v1/users`) is not flagged.
425
+ `npx loadwise rel contracts [--changed-since REF] [--json]` compares the working tree with the merge base of `REF` (default `HEAD`) and flags changes that break API clients in OpenAPI and Swagger JSON, GraphQL SDL and NestJS request and response classes. `loadwise check --changed-since REF` includes the same findings. What is compared is in [API contract safety](https://loadwise.mintlify.app/checkers/reliability#api-contract-safety).
784
426
 
785
427
  <!-- loadwise:rules:start checker=reliability group=api-contract-safety -->
786
428
 
787
- | Rule | Impact | What it flags |
788
- | --------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------ |
789
- | <a id="api-enum-value-removed"></a>[`api-enum-value-removed`](docs/rules/reliability/api-enum-value-removed.md) | high | An enum value or string-literal option that clients could send was removed. |
790
- | <a id="api-removed-field"></a>[`api-removed-field`](docs/rules/reliability/api-removed-field.md) | high | A response field, GraphQL type, field, argument or union member, or returned DTO property was removed. |
791
- | <a id="api-removed-operation"></a>[`api-removed-operation`](docs/rules/reliability/api-removed-operation.md) | critical | An OpenAPI operation or a GraphQL Query, Mutation or Subscription field was removed. |
792
- | <a id="api-required-input"></a>[`api-required-input`](docs/rules/reliability/api-required-input.md) | high | A request field, parameter or GraphQL argument is new and required, or became required. |
793
- | <a id="api-type-changed"></a>[`api-type-changed`](docs/rules/reliability/api-type-changed.md) | high | A field or parameter changed type, or a GraphQL type changed nullability in a breaking direction. |
429
+ <a id="api-enum-value-removed"></a>[`api-enum-value-removed`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/api-enum-value-removed.md) · <a id="api-removed-field"></a>[`api-removed-field`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/api-removed-field.md) · <a id="api-removed-operation"></a>[`api-removed-operation`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/api-removed-operation.md) · <a id="api-required-input"></a>[`api-required-input`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/api-required-input.md) · <a id="api-type-changed"></a>[`api-type-changed`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/reliability/api-type-changed.md)
794
430
 
795
431
  <!-- loadwise:rules:end -->
796
432
 
797
433
  # Maintainability checker
798
434
 
799
- `loadwise maint` finds code that would benefit from a design review and enforces the architectural decisions a team has already made. Run it on a project folder with `npx loadwise maint .`, or `npx loadwise maint . --json`. The default `--fail-on contract` exits 1 only for a declared folder, data-access or query contract violation; design advisories stay visible and exit 0 on their own. A non-JavaScript file a native parser cannot read and missing required parser binaries exit 2. Contextual findings include documented independent test oracles, before/after source snapshots with a live counterpart, marked generated code, certain flat data mappings and literal message lists, and a Nest module cycle whose internal eager edges are all explicit `forwardRef` callbacks (not available for graph input).
435
+ `loadwise maint` finds code that would benefit from a design review and enforces the architectural decisions a team has already made. Run it on a project folder with `npx loadwise maint .`, or `npx loadwise maint . --json`. The default `--fail-on contract` exits 1 only for a declared folder, data-access or query contract violation; design advisories stay visible and exit 0 on their own.
800
436
 
801
437
  ## What gets checked
802
438
 
803
439
  <!-- loadwise:rules:start checker=maintainability group=what-gets-checked -->
804
440
 
805
- | Rule | Impact | What it flags |
806
- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------- |
807
- | <a id="data-access-boundary"></a>[`data-access-boundary`](docs/rules/maintainability/data-access-boundary.md) | medium | A file outside the approved paths imports a configured database driver or ORM. |
808
- | <a id="deep-control-flow"></a>[`deep-control-flow`](docs/rules/maintainability/deep-control-flow.md) | low | Control structures are nested four levels deep. |
809
- | <a id="dependency-cycle"></a>[`dependency-cycle`](docs/rules/maintainability/dependency-cycle.md) | high | An eager chain of internal imports leads back to the module it started from. |
810
- | <a id="deprecated-node-api"></a>[`deprecated-node-api`](docs/rules/maintainability/deprecated-node-api.md) | medium | A deprecated Node.js API is used: new Buffer(), url.parse() or fs.exists(). |
811
- | <a id="double-type-assertion"></a>[`double-type-assertion`](docs/rules/maintainability/double-type-assertion.md) | low | A value is cast through unknown or any to a second type, bypassing the type checker. |
812
- | <a id="duplicate-implementation"></a>[`duplicate-implementation`](docs/rules/maintainability/duplicate-implementation.md) | medium | Substantial functions share the same implementation. |
813
- | <a id="file-placement"></a>[`file-placement`](docs/rules/maintainability/file-placement.md) | low | A file with a configured suffix sits outside its allowed folders. |
814
- | <a id="focused-test-committed"></a>[`focused-test-committed`](docs/rules/maintainability/focused-test-committed.md) | medium | A committed .only, only: true, fit or fdescribe can make the test runner skip other tests. |
815
- | <a id="folder-boundary"></a>[`folder-boundary`](docs/rules/maintainability/folder-boundary.md) | medium | An import crosses a folder boundary the team declared. |
816
- | <a id="high-branch-complexity"></a>[`high-branch-complexity`](docs/rules/maintainability/high-branch-complexity.md) | medium | A function reaches a branch complexity score of 15. |
817
- | <a id="large-class"></a>[`large-class`](docs/rules/maintainability/large-class.md) | low | A class has more than 30 methods, accessors, constructors or function-valued fields. |
818
- | <a id="large-module"></a>[`large-module`](docs/rules/maintainability/large-module.md) | low | A file has more than 600 lines of code. |
819
- | <a id="long-parameter-list"></a>[`long-parameter-list`](docs/rules/maintainability/long-parameter-list.md) | low | A function takes more than 5 positional parameters. |
820
- | <a id="query-mutates-state"></a>[`query-mutates-state`](docs/rules/maintainability/query-mutates-state.md) | medium | A method marked @maintainabilityQuery writes through this. |
821
- | <a id="stray-console"></a>[`stray-console`](docs/rules/maintainability/stray-console.md) | low | A console call in production code bypasses the logger, so its output has no level or structure. |
822
- | <a id="ts-suppression-without-reason"></a>[`ts-suppression-without-reason`](docs/rules/maintainability/ts-suppression-without-reason.md) | low | A @ts-ignore, @ts-expect-error or @ts-nocheck directive has no explanation. |
823
- | <a id="tsconfig-strict-disabled"></a>[`tsconfig-strict-disabled`](docs/rules/maintainability/tsconfig-strict-disabled.md) | medium | A tsconfig turns off strict type checking. |
824
- | <a id="unreferenced-file"></a>[`unreferenced-file`](docs/rules/maintainability/unreferenced-file.md) | low | A source file that nothing imports and that is not an entry point. |
825
- | <a id="unused-export"></a>[`unused-export`](docs/rules/maintainability/unused-export.md) | low | An export that no scanned file imports. |
826
- | <a id="unused-import"></a>[`unused-import`](docs/rules/maintainability/unused-import.md) | low | An imported name is never used in the file. |
827
- | <a id="unused-local-function"></a>[`unused-local-function`](docs/rules/maintainability/unused-local-function.md) | low | A private function declaration has no references. |
828
- | <a id="unused-local-variable"></a>[`unused-local-variable`](docs/rules/maintainability/unused-local-variable.md) | low | A local variable is assigned but never read. |
441
+ <a id="data-access-boundary"></a>[`data-access-boundary`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/data-access-boundary.md) · <a id="deep-control-flow"></a>[`deep-control-flow`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/deep-control-flow.md) · <a id="dependency-cycle"></a>[`dependency-cycle`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/dependency-cycle.md) · <a id="deprecated-node-api"></a>[`deprecated-node-api`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/deprecated-node-api.md) · <a id="double-type-assertion"></a>[`double-type-assertion`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/double-type-assertion.md) · <a id="duplicate-implementation"></a>[`duplicate-implementation`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/duplicate-implementation.md) ·
442
+ <a id="explicit-any"></a>[`explicit-any`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/explicit-any.md) ·
443
+ <a id="file-placement"></a>[`file-placement`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/file-placement.md) · <a id="focused-test-committed"></a>[`focused-test-committed`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/focused-test-committed.md) · <a id="folder-boundary"></a>[`folder-boundary`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/folder-boundary.md) ·
444
+ <a id="high-branch-complexity"></a>[`high-branch-complexity`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/high-branch-complexity.md) ·
445
+ <a id="large-class"></a>[`large-class`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/large-class.md) · <a id="large-module"></a>[`large-module`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/large-module.md) · <a id="long-parameter-list"></a>[`long-parameter-list`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/long-parameter-list.md) ·
446
+ <a id="python-interactive-debugger"></a>[`python-interactive-debugger`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/python-interactive-debugger.md) ·
447
+ <a id="query-mutates-state"></a>[`query-mutates-state`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/query-mutates-state.md) ·
448
+ <a id="stray-console"></a>[`stray-console`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/stray-console.md) ·
449
+ <a id="ts-suppression-without-reason"></a>[`ts-suppression-without-reason`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/ts-suppression-without-reason.md) · <a id="tsconfig-strict-disabled"></a>[`tsconfig-strict-disabled`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/tsconfig-strict-disabled.md) ·
450
+ <a id="unreferenced-file"></a>[`unreferenced-file`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/unreferenced-file.md) · <a id="unsafe-wide-type"></a>[`unsafe-wide-type`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/unsafe-wide-type.md) · <a id="unused-export"></a>[`unused-export`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/unused-export.md) · <a id="unused-import"></a>[`unused-import`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/unused-import.md) · <a id="unused-local-function"></a>[`unused-local-function`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/unused-local-function.md) · <a id="unused-local-variable"></a>[`unused-local-variable`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/maintainability/unused-local-variable.md)
829
451
 
830
452
  <!-- loadwise:rules:end -->
831
453
 
832
- JS and TS use the TypeScript parser; the optional ast-grep executable supplies parsers for Python, Go, Java, C#, Rust, PHP, Ruby, Kotlin, C and C++ (a `.h` file uses the C grammar). Direct import extraction is provided for JS/TS: it resolves project-local modules and TypeScript paths and ignores type-only imports. Discovery uses tracked and nonignored untracked Git files where available and a directory walk elsewhere, skipping dependency directories and minified files; `build`, `dist`, `coverage`, `target` and `vendor` are skipped only at the scanned root or beside a project manifest such as `package.json`.
454
+ JS and TS use the TypeScript parser, and the optional ast-grep executable supplies parsers for Python, Go, Java, C#, Rust, PHP, Ruby, Kotlin, C and C++. File discovery is described in [What gets checked](https://loadwise.mintlify.app/checkers/maintainability#what-gets-checked).
833
455
 
834
456
  ## Project rules
835
457
 
836
- Save team decisions in the `maintainability` section of `loadwise.config.json` at the project root, or pass `--config path/to/policy.json`.
837
-
838
- ```json
839
- {
840
- "boundaries": [{ "from": "src/domain", "disallow": ["src/http"] }],
841
- "placement": [{ "suffix": "_adapter.py", "under": ["adapters", "integrations"] }],
842
- "dataAccess": { "modules": ["pg", "@prisma/client", "./src/generated"], "allowIn": ["src/data"] },
843
- "limits": { "largeModuleLines": 600, "largeClassMembers": 30, "longParameterCount": 5 },
844
- "exclude": ["third_party/legacy"]
845
- }
846
- ```
847
-
848
- `limits` sets the thresholds of `large-module`, `large-class` and `long-parameter-list` (positive integers; the values shown are the defaults). `dataAccess` restricts runtime imports of named packages, their subpaths, module aliases (`#models`, `@/db`) or project-local entry points (starting with `./`, matched by resolved file) to the paths in `allowIn`; both lists are required and nonempty, type-only imports are not reported, and findings are contract violations. Paths are project-relative, directory boundaries match complete segments, and the longest matching filename suffix wins.
458
+ Save team decisions (`boundaries`, `placement`, `dataAccess`, `limits` and `exclude`) in the `maintainability` section of `loadwise.config.json` at the project root, or pass `--config path/to/policy.json`. The [project rules guide](https://loadwise.mintlify.app/checkers/maintainability#project-rules) has an example and the meaning of each setting.
849
459
 
850
460
  ## A module graph in any language
851
461
 
852
- ```json
853
- {
854
- "files": ["src/domain/order.ex", "src/http/handler.ex"],
855
- "edges": [
856
- { "from": "src/domain/order.ex", "to": "src/http/handler.ex", "line": 3, "column": 1 }
857
- ]
858
- }
859
- ```
462
+ For a language without import extraction, pass a module inventory and its edges as JSON with `--graph`:
860
463
 
861
464
  ```sh
862
465
  npx loadwise maint . --graph modules.json --config policy.json
863
466
  ```
864
467
 
865
- List each project-relative module once. Edges use one-based source coordinates; set `"kind": "deferred"` for an edge that loads lazily. Graph mode operates entirely on the supplied inventory and edges, for a graph from a compiler, build system or dependency extractor.
468
+ The [module graph guide](https://loadwise.mintlify.app/checkers/maintainability#a-module-graph-in-any-language) describes the file format.
866
469
 
867
470
  # Security checker
868
471
 
@@ -879,137 +482,72 @@ npx loadwise sec polyglot src/ # ast-grep rules for Python, Go, Java, C#,
879
482
 
880
483
  Run `loadwise sec deps --help` or `loadwise sec polyglot --help` for the options specific to those checks.
881
484
 
882
- It accepts the source-check flags of `loadwise perf`, including `--format`, `--min-impact`, `--baseline`, `--write-baseline`, `--loadwise-config`, `--workspace`, `--policy`, `--json`, `--include-contextual`, `--ignore`, `--fail-on`, `--fix` with `--yes` or `--only` and `--no-comments` or `--no-format`, `--staged` and `--changed-since`. `--engine auto` (the default) and `--engine js` both run TypeScript 6, because the native engine finds less; `--engine native` (alias `--native`) prints a note that cross-file taint through JavaScript constructor functions and rate-limit detection are reduced. Rules that need a package's types stay silent until it is installed. Test, fixture, mock, example and story files are contextual (`Test or example source.`). `--fail-on contract` enforces no security rule by default. `--fix --yes` leaves ValidationPipe whitelisting for individual review because it can strip undecorated DTO properties.
485
+ It accepts the source-check flags of `loadwise perf`, including `--format`, `--min-impact`, `--baseline`, `--write-baseline`, `--loadwise-config`, `--workspace`, `--policy`, `--json`, `--include-contextual`, `--ignore`, `--fail-on`, `--fix` with `--yes` or `--only` and `--no-comments` or `--no-format`, `--staged` and `--changed-since`. `--engine auto` (the default) and `--engine js` run TypeScript 6, and `--engine native` (alias `--native`) runs TypeScript 7. Engine coverage, contextual files and fix limits are in the [security guide](https://loadwise.mintlify.app/checkers/security).
883
486
 
884
487
  ## Rules
885
488
 
886
489
  <!-- loadwise:rules:start checker=security group=rules -->
887
490
 
888
- | Rule | Impact | What it flags |
889
- | --------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
890
- | <a id="angular-bypass-security-trust"></a>[`angular-bypass-security-trust`](docs/rules/security/angular-bypass-security-trust.md) | high | DomSanitizer.bypassSecurityTrust* is called on a dynamic value, which turns off Angular's built-in sanitization. |
891
- | <a id="auth-route-without-rate-limit"></a>[`auth-route-without-rate-limit`](docs/rules/security/auth-route-without-rate-limit.md) | medium | A login, signup or password-reset route has no rate limiter. |
892
- | <a id="bcrypt-low-cost"></a>[`bcrypt-low-cost`](docs/rules/security/bcrypt-low-cost.md) | medium | A bcrypt password hash uses a work factor below the recommended minimum. |
893
- | <a id="client-env-secret-exposed"></a>[`client-env-secret-exposed`](docs/rules/security/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. |
894
- | <a id="code-injection"></a>[`code-injection`](docs/rules/security/code-injection.md) | critical | Request-controlled input becomes source code evaluated by the application. |
895
- | <a id="command-injection"></a>[`command-injection`](docs/rules/security/command-injection.md) | critical | Request-controlled input reaches a shell command string. |
896
- | <a id="committed-secret"></a>[`committed-secret`](docs/rules/security/committed-secret.md) | critical | A tracked file contains a value that appears to be a credential. |
897
- | <a id="compose-hardcoded-secret"></a>[`compose-hardcoded-secret`](docs/rules/security/compose-hardcoded-secret.md) | high | A Docker Compose service supplies a secret as a literal environment value. |
898
- | <a id="cookie-missing-security-flags"></a>[`cookie-missing-security-flags`](docs/rules/security/cookie-missing-security-flags.md) | high | A sensitive cookie is set without the expected security attributes. |
899
- | <a id="cors-credentials-any-origin"></a>[`cors-credentials-any-origin`](docs/rules/security/cors-credentials-any-origin.md) | high | A credentialed CORS response allows arbitrary origins. |
900
- | <a id="cors-origin-regex-unanchored"></a>[`cors-origin-regex-unanchored`](docs/rules/security/cors-origin-regex-unanchored.md) | medium | A CORS origin regex also accepts look-alike hosts. |
901
- | <a id="database-error-in-response"></a>[`database-error-in-response`](docs/rules/security/database-error-in-response.md) | medium | An HTTP response includes a raw database error message. |
902
- | <a id="dockerfile-add-remote-url"></a>[`dockerfile-add-remote-url`](docs/rules/security/dockerfile-add-remote-url.md) | medium | A Dockerfile ADD instruction retrieves a resource from a remote URL. |
903
- | <a id="dockerfile-runs-as-root"></a>[`dockerfile-runs-as-root`](docs/rules/security/dockerfile-runs-as-root.md) | medium | The final image selects root or inherits an unverified base-image user. |
904
- | <a id="dockerfile-secret-in-build"></a>[`dockerfile-secret-in-build`](docs/rules/security/dockerfile-secret-in-build.md) | high | A Dockerfile exposes a secret through a build argument or environment variable. |
905
- | <a id="dockerfile-unpinned-base-image"></a>[`dockerfile-unpinned-base-image`](docs/rules/security/dockerfile-unpinned-base-image.md) | low | A Dockerfile uses a base image reference that can change between builds. |
906
- | <a id="dom-xss-sink"></a>[`dom-xss-sink`](docs/rules/security/dom-xss-sink.md) | high | Untrusted or dynamic HTML reaches innerHTML, outerHTML, insertAdjacentHTML, document.write or createContextualFragment (DOM XSS). |
907
- | <a id="drizzle-scope-unverified"></a>[`drizzle-scope-unverified`](docs/rules/security/drizzle-scope-unverified.md) | high | A Drizzle operation lacks the row scope required by the declared policy. |
908
- | <a id="drizzle-sql-raw-dynamic"></a>[`drizzle-sql-raw-dynamic`](docs/rules/security/drizzle-sql-raw-dynamic.md) | critical | A dynamic SQL fragment reaches Drizzle without parameter binding. |
909
- | <a id="error-stack-in-response"></a>[`error-stack-in-response`](docs/rules/security/error-stack-in-response.md) | medium | An HTTP response includes an internal error stack. |
910
- | <a id="escape-replace-incomplete"></a>[`escape-replace-incomplete`](docs/rules/security/escape-replace-incomplete.md) | medium | A hand-written string escape replaces only the first match, or escapes a delimiter without escaping backslashes first. |
911
- | <a id="express-cookie-auth-missing-csrf"></a>[`express-cookie-auth-missing-csrf`](docs/rules/security/express-cookie-auth-missing-csrf.md) | high | Cookie-based session or auth is paired with state-changing routes without CSRF protection or `sameSite: "strict"`. |
912
- | <a id="express-missing-helmet"></a>[`express-missing-helmet`](docs/rules/security/express-missing-helmet.md) | low | The Express or NestJS server starts without helmet security headers middleware (contextual: a proxy may set them). |
913
- | <a id="frontend-storage-secret-token"></a>[`frontend-storage-secret-token`](docs/rules/security/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. |
914
- | <a id="graphql-batching-unbounded"></a>[`graphql-batching-unbounded`](docs/rules/security/graphql-batching-unbounded.md) | medium | GraphQL query batching is enabled without a batch size, query depth, or cost/complexity limit. |
915
- | <a id="graphql-introspection-enabled"></a>[`graphql-introspection-enabled`](docs/rules/security/graphql-introspection-enabled.md) | medium | A GraphQL server explicitly enables schema introspection. |
916
- | <a id="graphql-query-depth-unbounded"></a>[`graphql-query-depth-unbounded`](docs/rules/security/graphql-query-depth-unbounded.md) | medium | A GraphQL server accepts queries of any depth. |
917
- | <a id="hardcoded-secret"></a>[`hardcoded-secret`](docs/rules/security/hardcoded-secret.md) | critical | The source supplies a literal credential or cryptographic secret. |
918
- | <a id="insecure-cipher"></a>[`insecure-cipher`](docs/rules/security/insecure-cipher.md) | medium | A cryptographic operation selects an insecure cipher or mode. |
919
- | <a id="insecure-random-for-secret"></a>[`insecure-random-for-secret`](docs/rules/security/insecure-random-for-secret.md) | high | A sensitive token or secret uses a non-cryptographic random source. |
920
- | <a id="jsx-javascript-url"></a>[`jsx-javascript-url`](docs/rules/security/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). |
921
- | <a id="jwt-decode-for-auth"></a>[`jwt-decode-for-auth`](docs/rules/security/jwt-decode-for-auth.md) | high | Authentication uses decoded JWT claims without verifying the token signature. |
922
- | <a id="jwt-none-algorithm"></a>[`jwt-none-algorithm`](docs/rules/security/jwt-none-algorithm.md) | critical | JWT signing or verification allows an unsigned token. |
923
- | <a id="jwt-sign-without-expiry"></a>[`jwt-sign-without-expiry`](docs/rules/security/jwt-sign-without-expiry.md) | medium | A signed JWT has no explicit expiration. |
924
- | <a id="jwt-verify-without-algorithms"></a>[`jwt-verify-without-algorithms`](docs/rules/security/jwt-verify-without-algorithms.md) | high | JWT verification does not restrict the accepted signing algorithms. |
925
- | <a id="jwt-weak-secret-literal"></a>[`jwt-weak-secret-literal`](docs/rules/security/jwt-weak-secret-literal.md) | high | JWT signing or verification uses a short (< 32 chars) or weak literal secret susceptible to brute-force forgery. |
926
- | <a id="knex-raw-dynamic-text"></a>[`knex-raw-dynamic-text`](docs/rules/security/knex-raw-dynamic-text.md) | critical | A dynamic SQL fragment reaches Knex without parameter binding. |
927
- | <a id="ldap-filter-injection"></a>[`ldap-filter-injection`](docs/rules/security/ldap-filter-injection.md) | high | Request data reaches an LDAP search filter without RFC 4515 filter escaping or a filter builder. |
928
- | <a id="mass-assignment"></a>[`mass-assignment`](docs/rules/security/mass-assignment.md) | high | An unfiltered request body reaches a persistence operation. |
929
- | <a id="mysql-dynamic-query-text"></a>[`mysql-dynamic-query-text`](docs/rules/security/mysql-dynamic-query-text.md) | critical | Dynamic SQL text reaches a MySQL client without parameter binding. |
930
- | <a id="nest-validation-without-whitelist"></a>[`nest-validation-without-whitelist`](docs/rules/security/nest-validation-without-whitelist.md) | medium | A NestJS ValidationPipe permits properties outside the validated DTO. |
931
- | <a id="next-image-any-remote-host"></a>[`next-image-any-remote-host`](docs/rules/security/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). |
932
- | <a id="nosql-operator-injection"></a>[`nosql-operator-injection`](docs/rules/security/nosql-operator-injection.md) | high | Request data can introduce query operators into a NoSQL filter. |
933
- | <a id="open-redirect"></a>[`open-redirect`](docs/rules/security/open-redirect.md) | medium | An HTTP redirect destination is controlled by request data. |
934
- | <a id="password-hash-in-response"></a>[`password-hash-in-response`](docs/rules/security/password-hash-in-response.md) | high | A response returns a user record that still holds its password hash. |
935
- | <a id="path-traversal"></a>[`path-traversal`](docs/rules/security/path-traversal.md) | high | Request data controls a filesystem path without a recognized containment check. |
936
- | <a id="pg-dynamic-query-text"></a>[`pg-dynamic-query-text`](docs/rules/security/pg-dynamic-query-text.md) | medium | Dynamic SQL text reaches the PostgreSQL client without parameter binding. |
937
- | <a id="plaintext-password-storage"></a>[`plaintext-password-storage`](docs/rules/security/plaintext-password-storage.md) | critical | A password is stored or written without being hashed. |
938
- | <a id="postmessage-missing-origin-check"></a>[`postmessage-missing-origin-check`](docs/rules/security/postmessage-missing-origin-check.md) | medium | postMessage targets '*', or a window message listener reads event.data without checking origin or source. |
939
- | <a id="prisma-raw-unsafe-dynamic"></a>[`prisma-raw-unsafe-dynamic`](docs/rules/security/prisma-raw-unsafe-dynamic.md) | critical | Dynamic SQL text reaches an unsafe Prisma raw-query method. |
940
- | <a id="prisma-scope-unverified"></a>[`prisma-scope-unverified`](docs/rules/security/prisma-scope-unverified.md) | high | A Prisma operation lacks the row scope required by the declared policy. |
941
- | <a id="prototype-pollution"></a>[`prototype-pollution`](docs/rules/security/prototype-pollution.md) | high | Request data can supply keys to a write or merge that can modify an object prototype. |
942
- | <a id="react-dangerously-set-inner-html"></a>[`react-dangerously-set-inner-html`](docs/rules/security/react-dangerously-set-inner-html.md) | high | dangerouslySetInnerHTML receives HTML that is not a constant or sanitized. |
943
- | <a id="reflected-xss-response"></a>[`reflected-xss-response`](docs/rules/security/reflected-xss-response.md) | low | An HTML response reflects request data without recognized escaping. |
944
- | <a id="regex-catastrophic-backtracking"></a>[`regex-catastrophic-backtracking`](docs/rules/security/regex-catastrophic-backtracking.md) | high | A regular expression that can backtrack exponentially or in polynomial time runs on request input. |
945
- | <a id="regex-from-input"></a>[`regex-from-input`](docs/rules/security/regex-from-input.md) | medium | Request input supplies a regular expression pattern without recognized escaping. |
946
- | <a id="secret-compared-non-constant-time"></a>[`secret-compared-non-constant-time`](docs/rules/security/secret-compared-non-constant-time.md) | medium | A secret is compared with an operation that can vary in timing with its contents. |
947
- | <a id="secret-in-log"></a>[`secret-in-log`](docs/rules/security/secret-in-log.md) | high | A log statement can expose a credential, token, or other secret. |
948
- | <a id="secret-in-url-query"></a>[`secret-in-url-query`](docs/rules/security/secret-in-url-query.md) | medium | A password, token or API key is passed in a URL query string. |
949
- | <a id="sequelize-dynamic-query-text"></a>[`sequelize-dynamic-query-text`](docs/rules/security/sequelize-dynamic-query-text.md) | critical | Dynamic SQL text reaches Sequelize without parameter binding. |
950
- | <a id="server-action-missing-auth"></a>[`server-action-missing-auth`](docs/rules/security/server-action-missing-auth.md) | high | An exported Next.js Server Action performs work without verifying authentication or session state. |
951
- | <a id="ssrf-redirect-bypass"></a>[`ssrf-redirect-bypass`](docs/rules/security/ssrf-redirect-bypass.md) | high | An outbound HTTP request with a dynamic URL does not disable redirects, allowing SSRF allowlist bypasses. |
952
- | <a id="ssrf-request-url"></a>[`ssrf-request-url`](docs/rules/security/ssrf-request-url.md) | high | Request data controls the destination of a server-side network request. |
953
- | <a id="storage-object-public-acl"></a>[`storage-object-public-acl`](docs/rules/security/storage-object-public-acl.md) | high | A storage upload makes the object publicly readable. |
954
- | <a id="template-autoescape-disabled"></a>[`template-autoescape-disabled`](docs/rules/security/template-autoescape-disabled.md) | medium | A template engine is configured to render values without HTML escaping. |
955
- | <a id="template-injection"></a>[`template-injection`](docs/rules/security/template-injection.md) | critical | Request data is interpreted as template source rather than a template value. |
956
- | <a id="tls-verification-disabled"></a>[`tls-verification-disabled`](docs/rules/security/tls-verification-disabled.md) | high | A TLS client skips certificate or server hostname verification. |
957
- | <a id="typeorm-dynamic-query-text"></a>[`typeorm-dynamic-query-text`](docs/rules/security/typeorm-dynamic-query-text.md) | critical | A dynamic SQL fragment reaches TypeORM without parameter binding. |
958
- | <a id="upload-client-filename"></a>[`upload-client-filename`](docs/rules/security/upload-client-filename.md) | medium | A file upload is stored under the original name supplied by the client. |
959
- | <a id="vm-sandbox-escape"></a>[`vm-sandbox-escape`](docs/rules/security/vm-sandbox-escape.md) | critical | Node `vm` or `vm2` executes dynamic code or an untrusted context, risking sandbox escape and host RCE. |
960
- | <a id="vue-v-html-unsanitized"></a>[`vue-v-html-unsanitized`](docs/rules/security/vue-v-html-unsanitized.md) | high | A Vue render function binds unsanitized dynamic HTML to innerHTML. |
961
- | <a id="weak-password-hash"></a>[`weak-password-hash`](docs/rules/security/weak-password-hash.md) | high | A password is hashed with an algorithm unsuitable for password storage. |
962
- | <a id="xml-external-entities"></a>[`xml-external-entities`](docs/rules/security/xml-external-entities.md) | medium | An XML parser allows processing of external entities. |
963
- | <a id="zip-slip-extraction"></a>[`zip-slip-extraction`](docs/rules/security/zip-slip-extraction.md) | high | An archive entry controls an extraction path without a recognized containment check. |
491
+ <a id="angular-bypass-security-trust"></a>[`angular-bypass-security-trust`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/angular-bypass-security-trust.md) · <a id="auth-route-without-rate-limit"></a>[`auth-route-without-rate-limit`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/auth-route-without-rate-limit.md) ·
492
+ <a id="bcrypt-low-cost"></a>[`bcrypt-low-cost`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/bcrypt-low-cost.md) ·
493
+ <a id="client-env-secret-exposed"></a>[`client-env-secret-exposed`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/client-env-secret-exposed.md) · <a id="code-injection"></a>[`code-injection`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/code-injection.md) · <a id="command-injection"></a>[`command-injection`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/command-injection.md) · <a id="committed-secret"></a>[`committed-secret`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/committed-secret.md) · <a id="compose-hardcoded-secret"></a>[`compose-hardcoded-secret`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/compose-hardcoded-secret.md) · <a id="cookie-missing-security-flags"></a>[`cookie-missing-security-flags`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/cookie-missing-security-flags.md) · <a id="cors-credentials-any-origin"></a>[`cors-credentials-any-origin`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/cors-credentials-any-origin.md) · <a id="cors-origin-regex-unanchored"></a>[`cors-origin-regex-unanchored`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/cors-origin-regex-unanchored.md) ·
494
+ <a id="database-error-in-response"></a>[`database-error-in-response`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/database-error-in-response.md) · <a id="discarded-signature-verification-result"></a>[`discarded-signature-verification-result`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/discarded-signature-verification-result.md) · <a id="dockerfile-add-remote-url"></a>[`dockerfile-add-remote-url`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/dockerfile-add-remote-url.md) · <a id="dockerfile-runs-as-root"></a>[`dockerfile-runs-as-root`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/dockerfile-runs-as-root.md) · <a id="dockerfile-secret-in-build"></a>[`dockerfile-secret-in-build`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/dockerfile-secret-in-build.md) · <a id="dockerfile-unpinned-base-image"></a>[`dockerfile-unpinned-base-image`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/dockerfile-unpinned-base-image.md) · <a id="dom-xss-sink"></a>[`dom-xss-sink`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/dom-xss-sink.md) · <a id="drizzle-scope-unverified"></a>[`drizzle-scope-unverified`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/drizzle-scope-unverified.md) · <a id="drizzle-sql-raw-dynamic"></a>[`drizzle-sql-raw-dynamic`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/drizzle-sql-raw-dynamic.md) ·
495
+ <a id="error-stack-in-response"></a>[`error-stack-in-response`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/error-stack-in-response.md) · <a id="escape-replace-incomplete"></a>[`escape-replace-incomplete`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/escape-replace-incomplete.md) · <a id="express-cookie-auth-missing-csrf"></a>[`express-cookie-auth-missing-csrf`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/express-cookie-auth-missing-csrf.md) · <a id="express-missing-helmet"></a>[`express-missing-helmet`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/express-missing-helmet.md) ·
496
+ <a id="frontend-storage-secret-token"></a>[`frontend-storage-secret-token`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/frontend-storage-secret-token.md) ·
497
+ <a id="graphql-batching-unbounded"></a>[`graphql-batching-unbounded`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/graphql-batching-unbounded.md) · <a id="graphql-introspection-enabled"></a>[`graphql-introspection-enabled`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/graphql-introspection-enabled.md) · <a id="graphql-query-depth-unbounded"></a>[`graphql-query-depth-unbounded`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/graphql-query-depth-unbounded.md) ·
498
+ <a id="hardcoded-secret"></a>[`hardcoded-secret`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/hardcoded-secret.md) ·
499
+ <a id="insecure-cipher"></a>[`insecure-cipher`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/insecure-cipher.md) · <a id="insecure-deserialization"></a>[`insecure-deserialization`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/insecure-deserialization.md) · <a id="insecure-random-for-secret"></a>[`insecure-random-for-secret`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/insecure-random-for-secret.md) ·
500
+ <a id="js-yaml-unsafe-schema"></a>[`js-yaml-unsafe-schema`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/js-yaml-unsafe-schema.md) · <a id="jsx-javascript-url"></a>[`jsx-javascript-url`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/jsx-javascript-url.md) · <a id="jwt-decode-for-auth"></a>[`jwt-decode-for-auth`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/jwt-decode-for-auth.md) · <a id="jwt-none-algorithm"></a>[`jwt-none-algorithm`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/jwt-none-algorithm.md) · <a id="jwt-sign-without-expiry"></a>[`jwt-sign-without-expiry`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/jwt-sign-without-expiry.md) · <a id="jwt-verify-without-algorithms"></a>[`jwt-verify-without-algorithms`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/jwt-verify-without-algorithms.md) · <a id="jwt-weak-secret-literal"></a>[`jwt-weak-secret-literal`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/jwt-weak-secret-literal.md) ·
501
+ <a id="knex-raw-dynamic-text"></a>[`knex-raw-dynamic-text`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/knex-raw-dynamic-text.md) · <a id="kubernetes-privileged-container"></a>[`kubernetes-privileged-container`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/kubernetes-privileged-container.md) · <a id="kysely-scope-unverified"></a>[`kysely-scope-unverified`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/kysely-scope-unverified.md) ·
502
+ <a id="ldap-filter-injection"></a>[`ldap-filter-injection`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/ldap-filter-injection.md) ·
503
+ <a id="mass-assignment"></a>[`mass-assignment`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/mass-assignment.md) · <a id="mysql-dynamic-query-text"></a>[`mysql-dynamic-query-text`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/mysql-dynamic-query-text.md) ·
504
+ <a id="nest-validation-without-whitelist"></a>[`nest-validation-without-whitelist`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/nest-validation-without-whitelist.md) · <a id="next-image-any-remote-host"></a>[`next-image-any-remote-host`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/next-image-any-remote-host.md) · <a id="nosql-operator-injection"></a>[`nosql-operator-injection`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/nosql-operator-injection.md) ·
505
+ <a id="open-redirect"></a>[`open-redirect`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/open-redirect.md) ·
506
+ <a id="password-hash-in-response"></a>[`password-hash-in-response`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/password-hash-in-response.md) · <a id="path-traversal"></a>[`path-traversal`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/path-traversal.md) · <a id="pg-dynamic-query-text"></a>[`pg-dynamic-query-text`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/pg-dynamic-query-text.md) · <a id="plaintext-password-storage"></a>[`plaintext-password-storage`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/plaintext-password-storage.md) · <a id="postmessage-missing-origin-check"></a>[`postmessage-missing-origin-check`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/postmessage-missing-origin-check.md) · <a id="prisma-raw-unsafe-dynamic"></a>[`prisma-raw-unsafe-dynamic`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/prisma-raw-unsafe-dynamic.md) · <a id="prisma-scope-unverified"></a>[`prisma-scope-unverified`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/prisma-scope-unverified.md) · <a id="prototype-pollution"></a>[`prototype-pollution`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/prototype-pollution.md) ·
507
+ <a id="raw-content-disposition-filename"></a>[`raw-content-disposition-filename`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/raw-content-disposition-filename.md) · <a id="react-dangerously-set-inner-html"></a>[`react-dangerously-set-inner-html`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/react-dangerously-set-inner-html.md) · <a id="reflected-xss-response"></a>[`reflected-xss-response`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/reflected-xss-response.md) · <a id="regex-catastrophic-backtracking"></a>[`regex-catastrophic-backtracking`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/regex-catastrophic-backtracking.md) · <a id="regex-from-input"></a>[`regex-from-input`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/regex-from-input.md) · <a id="request-selected-executable"></a>[`request-selected-executable`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/request-selected-executable.md) ·
508
+ <a id="secret-compared-non-constant-time"></a>[`secret-compared-non-constant-time`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/secret-compared-non-constant-time.md) · <a id="secret-in-log"></a>[`secret-in-log`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/secret-in-log.md) · <a id="secret-in-url-query"></a>[`secret-in-url-query`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/secret-in-url-query.md) · <a id="sequelize-dynamic-query-text"></a>[`sequelize-dynamic-query-text`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/sequelize-dynamic-query-text.md) · <a id="server-action-missing-auth"></a>[`server-action-missing-auth`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/server-action-missing-auth.md) · <a id="ssrf-redirect-bypass"></a>[`ssrf-redirect-bypass`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/ssrf-redirect-bypass.md) · <a id="ssrf-request-url"></a>[`ssrf-request-url`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/ssrf-request-url.md) · <a id="storage-object-public-acl"></a>[`storage-object-public-acl`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/storage-object-public-acl.md) ·
509
+ <a id="template-autoescape-disabled"></a>[`template-autoescape-disabled`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/template-autoescape-disabled.md) · <a id="template-injection"></a>[`template-injection`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/template-injection.md) · <a id="template-raw-html-binding"></a>[`template-raw-html-binding`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/template-raw-html-binding.md) · <a id="tls-verification-disabled"></a>[`tls-verification-disabled`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/tls-verification-disabled.md) · <a id="trust-boundary-violation"></a>[`trust-boundary-violation`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/trust-boundary-violation.md) · <a id="typeorm-dynamic-query-text"></a>[`typeorm-dynamic-query-text`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/typeorm-dynamic-query-text.md) ·
510
+ <a id="upload-client-filename"></a>[`upload-client-filename`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/upload-client-filename.md) ·
511
+ <a id="vm-sandbox-escape"></a>[`vm-sandbox-escape`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/vm-sandbox-escape.md) · <a id="vue-v-html-unsanitized"></a>[`vue-v-html-unsanitized`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/vue-v-html-unsanitized.md) ·
512
+ <a id="weak-hash"></a>[`weak-hash`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/weak-hash.md) · <a id="weak-password-hash"></a>[`weak-password-hash`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/weak-password-hash.md) · <a id="webhook-body-without-verification"></a>[`webhook-body-without-verification`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/webhook-body-without-verification.md) ·
513
+ <a id="xml-external-entities"></a>[`xml-external-entities`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/xml-external-entities.md) · <a id="xpath-injection"></a>[`xpath-injection`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/xpath-injection.md) ·
514
+ <a id="zip-slip-extraction"></a>[`zip-slip-extraction`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/zip-slip-extraction.md)
964
515
 
965
516
  <!-- loadwise:rules:end -->
966
517
 
967
- `committed-secret`, `compose-hardcoded-secret` and the `dockerfile-` rules read project files rather than TypeScript: `loadwise sec -p <tsconfig>` scans the project folder (not explicit source files) with `git ls-files`, so ignored files are skipped; outside a git repository it walks the folder and never opens `.env*` files. `.env.example`, `.env.sample` and `.env.template` are checked for token formats only, and placeholder values (`changeme`, `example`, `your-...`, `${...}`, test or dummy values) and default credentials for a local service are not reported or are contextual. Rules that moved from the performance checker kept their ids, and `loadwise perf --ignore` still accepts them.
518
+ Secret, Compose and Dockerfile rules read project files rather than TypeScript; [Rules](https://loadwise.mintlify.app/checkers/security#rules) explains which files they read and which placeholder values they accept.
968
519
 
969
520
  ## Polyglot source checks
970
521
 
971
- `npx loadwise sec polyglot src/` accepts directories or individual `.py`, `.go`, `.java`, `.cs` and `.rs` files and needs the optional ast-grep binary. These are syntactic patterns without taint tracking: confirm that untrusted input can reach the call. They are not `--ignore` rule ids of the TypeScript source checks.
522
+ `npx loadwise sec polyglot src/` checks Python, Go, Java, C# and Rust files with the optional ast-grep binary. These are syntactic patterns without taint tracking: confirm that untrusted input can reach the call. See [Polyglot source checks](https://loadwise.mintlify.app/checkers/security#polyglot-source-checks).
972
523
 
973
524
  <!-- loadwise:rules:start checker=security group=polyglot-source-checks -->
974
525
 
975
- | Rule | Impact | What it flags |
976
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------ | ---------------------------------------------------------------------------------------------------- |
977
- | <a id="csharp-ef-from-sql-raw"></a>[`csharp-ef-from-sql-raw`](docs/rules/security/csharp-ef-from-sql-raw.md) | high | FromSqlRaw or ExecuteSqlRaw receives a concatenated or interpolated string, risking SQL injection. |
978
- | <a id="csharp-process-start"></a>[`csharp-process-start`](docs/rules/security/csharp-process-start.md) | medium | Process.Start launches an external process and risks command injection with untrusted arguments. |
979
- | <a id="go-exec-command-shell"></a>[`go-exec-command-shell`](docs/rules/security/go-exec-command-shell.md) | high | exec.Command invokes a shell, which risks command injection. |
980
- | <a id="go-sql-sprintf-injection"></a>[`go-sql-sprintf-injection`](docs/rules/security/go-sql-sprintf-injection.md) | high | SQL text formatted with fmt.Sprintf risks SQL injection. |
981
- | <a id="go-tls-insecure-skip-verify"></a>[`go-tls-insecure-skip-verify`](docs/rules/security/go-tls-insecure-skip-verify.md) | high | Setting InsecureSkipVerify: true on tls.Config disables TLS certificate verification. |
982
- | <a id="java-runtime-exec"></a>[`java-runtime-exec`](docs/rules/security/java-runtime-exec.md) | medium | Runtime.getRuntime().exec runs an OS command and risks command injection with untrusted arguments. |
983
- | <a id="java-sql-string-concat"></a>[`java-sql-string-concat`](docs/rules/security/java-sql-string-concat.md) | high | A SQL query built by string concatenation risks SQL injection. |
984
- | <a id="python-insecure-deserialization"></a>[`python-insecure-deserialization`](docs/rules/security/python-insecure-deserialization.md) | high | pickle or marshal deserialization of untrusted data can execute arbitrary code. |
985
- | <a id="python-requests-tls-verify-disabled"></a>[`python-requests-tls-verify-disabled`](docs/rules/security/python-requests-tls-verify-disabled.md) | high | Calling Python requests with verify=False disables TLS certificate verification. |
986
- | <a id="python-subprocess-shell-true"></a>[`python-subprocess-shell-true`](docs/rules/security/python-subprocess-shell-true.md) | high | subprocess with shell=True or os.system passes input through a shell, risking command injection. |
987
- | <a id="python-unsafe-yaml-load"></a>[`python-unsafe-yaml-load`](docs/rules/security/python-unsafe-yaml-load.md) | high | yaml.load or yaml.load_all without SafeLoader can construct arbitrary Python objects. |
988
- | <a id="rust-command-shell"></a>[`rust-command-shell`](docs/rules/security/rust-command-shell.md) | high | Command::new("sh") or Command::new("bash") spawns a shell and risks command injection. |
989
- | <a id="rust-reqwest-danger-accept-invalid-certs"></a>[`rust-reqwest-danger-accept-invalid-certs`](docs/rules/security/rust-reqwest-danger-accept-invalid-certs.md) | high | Calling danger_accept_invalid_certs(true) on a reqwest client disables TLS certificate verification. |
990
- | <a id="rust-unsafe-raw-pointer-deref"></a>[`rust-unsafe-raw-pointer-deref`](docs/rules/security/rust-unsafe-raw-pointer-deref.md) | medium | A raw pointer dereference in an unsafe block bypasses Rust memory safety guarantees. |
526
+ <a id="csharp-binaryformatter-request-deserialization"></a>[`csharp-binaryformatter-request-deserialization`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/csharp-binaryformatter-request-deserialization.md) · <a id="csharp-ef-from-sql-raw"></a>[`csharp-ef-from-sql-raw`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/csharp-ef-from-sql-raw.md) · <a id="csharp-process-start"></a>[`csharp-process-start`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/csharp-process-start.md) ·
527
+ <a id="go-exec-command-shell"></a>[`go-exec-command-shell`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/go-exec-command-shell.md) · <a id="go-sql-sprintf-injection"></a>[`go-sql-sprintf-injection`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/go-sql-sprintf-injection.md) · <a id="go-tls-insecure-skip-verify"></a>[`go-tls-insecure-skip-verify`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/go-tls-insecure-skip-verify.md) ·
528
+ <a id="java-des-cipher"></a>[`java-des-cipher`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/java-des-cipher.md) · <a id="java-objectinputstream-request-deserialization"></a>[`java-objectinputstream-request-deserialization`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/java-objectinputstream-request-deserialization.md) · <a id="java-runtime-exec"></a>[`java-runtime-exec`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/java-runtime-exec.md) · <a id="java-sql-string-concat"></a>[`java-sql-string-concat`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/java-sql-string-concat.md) ·
529
+ <a id="python-insecure-deserialization"></a>[`python-insecure-deserialization`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/python-insecure-deserialization.md) · <a id="python-requests-tls-verify-disabled"></a>[`python-requests-tls-verify-disabled`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/python-requests-tls-verify-disabled.md) · <a id="python-sqlite-unbound-value"></a>[`python-sqlite-unbound-value`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/python-sqlite-unbound-value.md) · <a id="python-subprocess-shell-true"></a>[`python-subprocess-shell-true`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/python-subprocess-shell-true.md) · <a id="python-unsafe-yaml-load"></a>[`python-unsafe-yaml-load`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/python-unsafe-yaml-load.md) ·
530
+ <a id="rust-command-shell"></a>[`rust-command-shell`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/rust-command-shell.md) · <a id="rust-reqwest-danger-accept-invalid-certs"></a>[`rust-reqwest-danger-accept-invalid-certs`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/rust-reqwest-danger-accept-invalid-certs.md) · <a id="rust-unsafe-raw-pointer-deref"></a>[`rust-unsafe-raw-pointer-deref`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/rust-unsafe-raw-pointer-deref.md)
991
531
 
992
532
  <!-- loadwise:rules:end -->
993
533
 
994
534
  ## Dependency checks
995
535
 
996
- `loadwise sec deps --online [directory]` reads `npm-shrinkwrap.json` in preference to `package-lock.json` (npm lockfile version 2 or 3), `pnpm-lock.yaml` or `yarn.lock` (version 1 or Berry) from the directory or the nearest parent that has one, and asks the [OSV database](https://osv.dev) (which includes the GitHub Advisory Database) about every pinned package version. It sends package names and versions and nothing else. Answers are cached for 24 hours in the `loadwise` folder of the OS cache directory. It takes `--format text|json` (or `--json`), `--include-contextual`, `--ignore` and `--fail-on`. A network failure exits 2 rather than passing. 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.
536
+ `loadwise sec deps --online [directory]` reads the npm, pnpm, Yarn, Cargo, Deno or Bun lockfile and asks the [OSV database](https://osv.dev) about every pinned package version. It sends package names, ecosystems and versions, and caches answers for 24 hours. The network is opt-in: `loadwise sec --online` and `loadwise check --online` add these findings to their security report. Supported lockfiles, `LOADWISE_OSV_URL` mirrors and cache settings are in [Dependency checks](https://loadwise.mintlify.app/checkers/security#dependency-checks).
997
537
 
998
538
  <!-- loadwise:rules:start checker=security group=dependency-checks -->
999
539
 
1000
- | Rule | Impact | What it flags |
1001
- | ------------------------------------------------------------------------------------------------------------------------------------ | ------ | ------------------------------------------------------------------------------ |
1002
- | <a id="dependency-known-vulnerability"></a>[`dependency-known-vulnerability`](docs/rules/security/dependency-known-vulnerability.md) | medium | A resolved dependency version is listed in a published vulnerability advisory. |
540
+ <a id="dependency-known-vulnerability"></a>[`dependency-known-vulnerability`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/security/dependency-known-vulnerability.md)
1003
541
 
1004
542
  <!-- loadwise:rules:end -->
1005
543
 
1006
544
  ## Project-defined row scopes
1007
545
 
1008
- Row-scope checks read `prismaScopes` and `drizzleScopes` from the `performance` section of `loadwise.config.json` (see [Project-defined access policy](#project-defined-access-policy)) and start only when the project names the model or table, its scoped property and the trusted helper that supplies an authorized scalar; column names such as `tenantId` mean nothing on their own. `prismaScopes` maps each generated model to its protected field and a named export of the project's authorization module, so `db.invoice.findMany({ where: { organizationId: requireOrganization() } })` is scoped; proof requires strict null checks, which the CLI enables for explicit source files with a policy. `drizzleScopes` names an exported table, its schema module, its scoped property (the ORM property, not the column name) and the trusted helper. A later `.where()` replaces the earlier condition, and every OR alternative must keep the scope. If a physical column is named `AND`, `OR` or `NOT`, configure the Prisma property that maps to it; quoted Drizzle properties such as `"org-id"` work with bracket access. Shapes the scanner cannot establish are reported as `prisma-scope-unverified` or `drizzle-scope-unverified`. These checks assume the helper authenticates the caller; middleware, injected clients, raw SQL and database row-level policies need separate verification. The import boundary for database modules is the maintainability `dataAccess` setting.
546
+ Row-scope checks read `prismaScopes`, `drizzleScopes` and `kyselyScopes` from the `performance` section of `loadwise.config.json` (see [Project-defined access policy](#project-defined-access-policy)) and start only when the project names the model or table, its scoped property and the trusted helper that supplies an authorized scalar. The [row scopes guide](https://loadwise.mintlify.app/checkers/security#project-defined-row-scopes) shows each setting and what the checks assume.
1009
547
 
1010
548
  # Accessibility checker
1011
549
 
1012
- `loadwise a11y` finds markup that people using screen readers, keyboards or zoom cannot use. It reads JSX and inline Angular templates from the TypeScript program, and `.html`, `.htm`, `.vue` and `.svelte` files from the project folders, leaving out ignored folders, build output, minified and vendored files and the config's `ignore` paths. It shares the source check of `loadwise perf`. A project with no frontend sources (no JSX, HTML, Vue or Svelte files and no frontend package in any `package.json`) is skipped by `loadwise check` with a note; `loadwise a11y` on it reports 0 findings.
550
+ `loadwise a11y` finds markup that people using screen readers, keyboards or zoom cannot use. It reads JSX and inline Angular templates from the TypeScript program and markup files such as `.html`, `.vue` and `.svelte` from the project folders, and shares the source check of `loadwise perf`. `loadwise check` skips it with a note on a project with no frontend sources. Details are in the [accessibility guide](https://loadwise.mintlify.app/checkers/accessibility).
1013
551
 
1014
552
  ```sh
1015
553
  npx loadwise a11y -p tsconfig.json # JSX, Angular templates and the project's markup files
@@ -1021,22 +559,7 @@ npx loadwise a11y --fix --only <id> # apply one generated fix
1021
559
 
1022
560
  <!-- loadwise:rules:start checker=accessibility group=rules -->
1023
561
 
1024
- | Rule | Impact | What it flags |
1025
- | -------------------------------------------------------------------------------------------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------- |
1026
- | <a id="a11y-aria-hidden-focus"></a>[`a11y-aria-hidden-focus`](docs/rules/accessibility/a11y-aria-hidden-focus.md) | high | A control in the Tab order is hidden from assistive technology by aria-hidden. |
1027
- | <a id="a11y-button-missing-type"></a>[`a11y-button-missing-type`](docs/rules/accessibility/a11y-button-missing-type.md) | medium | A button associated with a form has a click handler but no explicit type, so clicking it can also submit the form. |
1028
- | <a id="a11y-clickable-non-interactive"></a>[`a11y-clickable-non-interactive`](docs/rules/accessibility/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. |
1029
- | <a id="a11y-heading-level-skipped"></a>[`a11y-heading-level-skipped`](docs/rules/accessibility/a11y-heading-level-skipped.md) | low | A heading jumps more than one level down, which leaves a gap in the page outline. |
1030
- | <a id="a11y-html-missing-lang"></a>[`a11y-html-missing-lang`](docs/rules/accessibility/a11y-html-missing-lang.md) | medium | The html element has no lang attribute, so screen readers guess the pronunciation. |
1031
- | <a id="a11y-iframe-missing-title"></a>[`a11y-iframe-missing-title`](docs/rules/accessibility/a11y-iframe-missing-title.md) | medium | An iframe has no title, so screen readers cannot say what it contains. |
1032
- | <a id="a11y-img-missing-alt"></a>[`a11y-img-missing-alt`](docs/rules/accessibility/a11y-img-missing-alt.md) | high | An image has no alt text, so screen readers announce its file name or nothing. |
1033
- | <a id="a11y-input-missing-autocomplete"></a>[`a11y-input-missing-autocomplete`](docs/rules/accessibility/a11y-input-missing-autocomplete.md) | low | An input for personal data has no autocomplete, so browsers cannot fill it in for people who find typing hard. |
1034
- | <a id="a11y-invalid-aria"></a>[`a11y-invalid-aria`](docs/rules/accessibility/a11y-invalid-aria.md) | high | An ARIA attribute or role is misspelled or invalid, so assistive technology ignores it. |
1035
- | <a id="a11y-link-text-not-descriptive"></a>[`a11y-link-text-not-descriptive`](docs/rules/accessibility/a11y-link-text-not-descriptive.md) | medium | A link says only "click here" or "read more", so it means nothing out of context. |
1036
- | <a id="a11y-media-autoplay"></a>[`a11y-media-autoplay`](docs/rules/accessibility/a11y-media-autoplay.md) | medium | A video or audio element plays on its own with sound, so it talks over screen readers. |
1037
- | <a id="a11y-missing-form-label"></a>[`a11y-missing-form-label`](docs/rules/accessibility/a11y-missing-form-label.md) | high | A form control has no label, so screen readers announce it without its purpose. |
1038
- | <a id="a11y-positive-tabindex"></a>[`a11y-positive-tabindex`](docs/rules/accessibility/a11y-positive-tabindex.md) | medium | A positive tabindex reorders keyboard focus away from the visual order. |
1039
- | <a id="a11y-viewport-zoom-disabled"></a>[`a11y-viewport-zoom-disabled`](docs/rules/accessibility/a11y-viewport-zoom-disabled.md) | high | The viewport meta tag disables zoom, so people with low vision cannot enlarge the page. |
562
+ <a id="a11y-aria-hidden-focus"></a>[`a11y-aria-hidden-focus`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-aria-hidden-focus.md) · <a id="a11y-aria-role-missing-checked"></a>[`a11y-aria-role-missing-checked`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-aria-role-missing-checked.md) · <a id="a11y-button-missing-name"></a>[`a11y-button-missing-name`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-button-missing-name.md) · <a id="a11y-button-missing-type"></a>[`a11y-button-missing-type`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-button-missing-type.md) · <a id="a11y-clickable-non-interactive"></a>[`a11y-clickable-non-interactive`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-clickable-non-interactive.md) · <a id="a11y-competing-autofocus"></a>[`a11y-competing-autofocus`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-competing-autofocus.md) · <a id="a11y-data-table-missing-headers"></a>[`a11y-data-table-missing-headers`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-data-table-missing-headers.md) · <a id="a11y-heading-level-skipped"></a>[`a11y-heading-level-skipped`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-heading-level-skipped.md) · <a id="a11y-html-invalid-lang"></a>[`a11y-html-invalid-lang`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-html-invalid-lang.md) · <a id="a11y-html-missing-lang"></a>[`a11y-html-missing-lang`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-html-missing-lang.md) · <a id="a11y-iframe-missing-title"></a>[`a11y-iframe-missing-title`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-iframe-missing-title.md) · <a id="a11y-img-missing-alt"></a>[`a11y-img-missing-alt`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-img-missing-alt.md) · <a id="a11y-input-missing-autocomplete"></a>[`a11y-input-missing-autocomplete`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-input-missing-autocomplete.md) · <a id="a11y-invalid-aria"></a>[`a11y-invalid-aria`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-invalid-aria.md) · <a id="a11y-invalid-id-reference"></a>[`a11y-invalid-id-reference`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-invalid-id-reference.md) · <a id="a11y-link-text-not-descriptive"></a>[`a11y-link-text-not-descriptive`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-link-text-not-descriptive.md) · <a id="a11y-media-autoplay"></a>[`a11y-media-autoplay`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-media-autoplay.md) · <a id="a11y-missing-form-label"></a>[`a11y-missing-form-label`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-missing-form-label.md) · <a id="a11y-nested-interactive"></a>[`a11y-nested-interactive`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-nested-interactive.md) · <a id="a11y-placeholder-link-action"></a>[`a11y-placeholder-link-action`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-placeholder-link-action.md) · <a id="a11y-positive-tabindex"></a>[`a11y-positive-tabindex`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-positive-tabindex.md) · <a id="a11y-svg-image-missing-name"></a>[`a11y-svg-image-missing-name`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-svg-image-missing-name.md) · <a id="a11y-video-captions-review"></a>[`a11y-video-captions-review`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-video-captions-review.md) · <a id="a11y-viewport-zoom-disabled"></a>[`a11y-viewport-zoom-disabled`](https://github.com/IbrahimHafez1/loadwise/blob/main/docs/rules/accessibility/a11y-viewport-zoom-disabled.md)
1040
563
 
1041
564
  <!-- loadwise:rules:end -->
1042
565
 
@@ -1050,6 +573,8 @@ npx loadwise a11y --fix --only <id> # apply one generated fix
1050
573
 
1051
574
  Error monitoring, uptime checks, and scheduled-job monitoring for Loadwise are sponsored by **[Sentry](https://sentry.io)** through the Sentry Open Source Program.
1052
575
 
576
+ Pull requests get free AI code review from **[CodeRabbit](https://coderabbit.ai)**, **[cubic](https://cubic.dev)**, **[Qodo](https://www.qodo.ai)**, and **[Sourcery](https://www.sourcery.ai/)** through their open-source programs.
577
+
1053
578
  # License
1054
579
 
1055
- Licensed under the [Apache License 2.0](LICENSE). Copyright © 2026 Ibrahim Hafez.
580
+ Licensed under the [Apache License 2.0](https://github.com/IbrahimHafez1/loadwise/blob/main/LICENSE). Copyright © 2026 Ibrahim Hafez.