From b16f3d2a25645daf71f6cedbc22621565ea4b516 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Sat, 5 Dec 2026 05:43:21 +0000 Subject: [PATCH 1/2] CI: source files under 500 lines (1,000 for tests; older long files capped), and every lint suppression listed with its reason (sc-9611) --- .github/workflows/ci.yml | 4 + AGENTS.md | 8 +- lefthook.yml | 6 ++ .../check_file_length.cpython-313.pyc | Bin 0 -> 4107 bytes scripts/ci/check_file_length.py | 62 ++++++++++++++++ scripts/ci/check_suppressions.py | 70 ++++++++++++++++++ scripts/ci/file_lengths.txt | 45 +++++++++++ scripts/ci/suppressions.txt | 32 ++++++++ 8 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 scripts/ci/__pycache__/check_file_length.cpython-313.pyc create mode 100755 scripts/ci/check_file_length.py create mode 100755 scripts/ci/check_suppressions.py create mode 100644 scripts/ci/file_lengths.txt create mode 100644 scripts/ci/suppressions.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3912a456..0f95eebf0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -201,6 +201,10 @@ jobs: - run: typos - run: oxlint --deny-warnings . - run: scripts/ci/shellcheck.sh + # Source files' length (caps for the long ones in scripts/ci/file_lengths.txt), and every lint suppression + # listed with its reason (scripts/ci/suppressions.txt). + - run: scripts/ci/check_file_length.py + - run: scripts/ci/check_suppressions.py # The renderer's two warnings (a `cd` and a pipe in the PDFBox download step) wait for its next rebuild: any edit # to renderer.Dockerfile rebuilds the renderer image (its inputs hash), so it isn't touched for lint alone. - run: hadolint docker/app.Dockerfile && hadolint --ignore DL3003 --ignore DL4006 docker/renderer.Dockerfile diff --git a/AGENTS.md b/AGENTS.md index 5f794b30c..21aff261b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -20,7 +20,13 @@ design is in `docs/design.md`; read it before changing the architecture, and upd 2026, sc-9611), so a commit made without the hooks lands unformatted: never commit with `--no-verify`. - **Workflows, secrets, spelling, JS/TS and shell scripts are checked** by CI's `security` job and the pre-commit hook: actionlint, zizmor, Betterleaks, typos (`_typos.toml`), oxlint (`.oxlintrc.json`) and ShellCheck - (`scripts/ci/shellcheck.sh`); mise.toml pins them. Allow a word or turn a lint rule off for a file only in those + (`scripts/ci/shellcheck.sh`); mise.toml pins them. +- **Source files stay under 500 lines** (1,000 for tests and migrations; `scripts/ci/check_file_length.py`). The files + that were already longer have their own caps in `scripts/ci/file_lengths.txt`: split one rather than grow it past its + cap, never raise a cap, and delete its line once it's under the limit. **Every lint suppression** (`#[allow(...)]`, + `@ts-expect-error`, `# noqa`, a zizmor ignore and the rest) is listed in `scripts/ci/suppressions.txt` with its + reason, added in the change that adds it (`scripts/ci/check_suppressions.py`). Fix what a lint finds before you + reach for a suppression. Allow a word or turn a lint rule off for a file only in those files, with the reason beside it. Pin every action by commit SHA with its version in a comment (`pinact run` does it). Ignore a zizmor finding only inline (`# zizmor: ignore[audit]`) with the reason beside it; allow a made-up value in `.betterleaks.toml` only with a description of what it is. A real secret that reached a commit is revoked, diff --git a/lefthook.yml b/lefthook.yml index 10b7de2fc..de4bea90c 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -25,6 +25,12 @@ pre-commit: shellcheck: glob: "{*.sh,scripts/*,scripts/**/*,**/bin/*}" run: scripts/ci/shellcheck.sh {staged_files} + # Source files stay under 500 lines (1,000 for tests and migrations; scripts/ci/file_lengths.txt caps the older long + # ones), and every lint suppression is listed with its reason (scripts/ci/suppressions.txt). + file-length: + run: scripts/ci/check_file_length.py {staged_files} + suppressions: + run: scripts/ci/check_suppressions.py # The workflows and actions: actionlint (with shellcheck on their scripts) and zizmor (.github/zizmor.yml). actionlint: glob: ".github/workflows/*.{yml,yaml}" diff --git a/scripts/ci/__pycache__/check_file_length.cpython-313.pyc b/scripts/ci/__pycache__/check_file_length.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2c151868ee2265e0c6902c5c1dc570f0ab92ad42 GIT binary patch literal 4107 zcma(UOKc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 ze@HlGExc+4ni3A;JeDgO?;$wGmd=WPN@V@_r;*8nTY@Itj?Oh+B?wVR2_ECj2xpprc;P^$Z#r*OJ|6@1O+Zo5bB0KFVC9k4=$7d0jM2_3cCf$ zN!ZyOgS@O~2&IM{6p924QKnPO5W%w0^Ez#Xx*Y(9YqchV^E_D_PF|Ohj3G?&ObaEm zVFw>E1i;LLUh))S+#R60YB$Q$o+0LCMWsK7DUYbE6PyR~vgmy69UCg*GBAGS z+AGzkmqNH6!oRb9?E1*{aqy$yC;C$Oa6NqZD}T>&pmU+WD&7lhTkLH1YAM7ajM($_Kx4XEZ4>-Y7^;NZ)V9)9&A9J8~?Qt`8%5K zU@e(ybm@1KsoI5$wH&LbS)=>hjm*M@>i()+m1_7btn0~Cy-TmV^@{U;_vVUg*&V1% zeem3^=WjlL&;8T`JL>8E+7)PqI+jIGW%PrcRr3Cx>ekw>gP*4F^#5M@Bw0I}sCh5k z6E8M>{vZ0lAYTTy{rkHv)Lj%9Pr!fd$EUVBJ|FO$iaI|()B*jUwt7$P^%(9{iu+J1 zMLPg3(qXt#sf?C}HN5rVS zD(6WmWr$=J9vy!W(;va_SB_>nulsOb%M{_K13d~b9@bb1x^L}*AUqJ=g7~lp3Eun2 zb02lyN8Z1@{Wk50*E_ A$^ZZW literal 0 HcmV?d00001 diff --git a/scripts/ci/check_file_length.py b/scripts/ci/check_file_length.py new file mode 100755 index 000000000..f91056540 --- /dev/null +++ b/scripts/ci/check_file_length.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +"""Source files stay short enough to read whole (sc-9611): at most 500 lines, 1,000 for tests and migrations. + +Files that were already longer when this check arrived are listed in scripts/ci/file_lengths.txt, each with its own cap +(its length then, rounded up to the next hundred, so branches open at the time still fit). Such a file can't grow past +its cap: split it instead. When one is split below the limit, delete its line (a line for a file that no longer needs +it fails the check). Never raise a cap to make room. + + scripts/ci/check_file_length.py [...] (no files: every tracked one) +""" + +import os +import re +import subprocess +import sys + +CODE = re.compile(r"\.(rs|ts|tsx|js|mjs|cjs|jsx|py|rb|sh|astro|vue|svelte|css|scss)$") +LONGER = re.compile(r"(^|/)(tests?|spec|e2e)/|[._-](test|spec)\.[a-z]+$|_test\.[a-z]+$|^app/database/migrations/") +LIMIT, LONGER_LIMIT = 500, 1000 +CAPS = "scripts/ci/file_lengths.txt" + + +def limit(path): + return LONGER_LIMIT if LONGER.search(path) else LIMIT + + +def main(args): + os.chdir(subprocess.check_output(["git", "rev-parse", "--show-toplevel"], text=True).strip()) + caps = {} + for line in open(CAPS): + line = line.split("#", 1)[0].strip() + if line: + path, cap = line.rsplit(None, 1) + caps[path] = int(cap) + tracked = subprocess.check_output(["git", "ls-files", "-z"], text=True).split("\0") + paths = args or tracked + failed = [] + checked = 0 + for path in paths: + if not CODE.search(path) or not os.path.isfile(path): + continue + checked += 1 + with open(path, "rb") as f: + lines = f.read().count(b"\n") + cap = max(limit(path), caps.get(path, 0)) + if lines > cap: + how = f"its cap in {CAPS}" if path in caps else "the limit" + failed.append(f"{path}: {lines} lines, over {how} ({cap}). Split it (never raise the cap).") + elif path in caps and lines <= limit(path): + failed.append(f"{path}: {lines} lines, within the limit now: delete its line in {CAPS}.") + if not args: + failed += [f"{CAPS}: {p} isn't a tracked file any more: delete its line." for p in caps if p not in tracked] + for message in failed: + print(message, file=sys.stderr) + if failed: + return 1 + print(f"File length: {checked} files checked, {len(caps)} with their own caps.") + return 0 + + +if __name__ == "__main__": + sys.exit(main(sys.argv[1:])) diff --git a/scripts/ci/check_suppressions.py b/scripts/ci/check_suppressions.py new file mode 100755 index 000000000..3f054bac4 --- /dev/null +++ b/scripts/ci/check_suppressions.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python3 +"""Every lint suppression in the repository is one somebody agreed to (sc-9611). + +A suppression (Rust's #[allow(...)], `@ts-expect-error`, `# noqa`, `rubocop:disable`, `shellcheck disable=`, a zizmor +or hadolint ignore, and the like) silences a check for good, so each one is listed in scripts/ci/suppressions.txt with +the reason for it. A new one fails until it's added there (and the reason is in the diff a reviewer reads). One that's +gone must be deleted from the list, so it never quietly allows a later one. + + scripts/ci/check_suppressions.py +""" + +import collections +import os +import re +import subprocess +import sys + +LIST = "scripts/ci/suppressions.txt" +SKIP = re.compile(r"\.(md|txt|png|jpe?g|gif|webp|ico|pdf|woff2?|ttf|otf|svg|lock)$|^scripts/ci/(check_suppressions\.py|suppressions\.txt)$") +PATTERNS = [ + r"#!?\[(?:allow|expect)\([^)]*\)", + r"@ts-(?:ignore|expect-error|nocheck)", + r"(?:eslint|oxlint)-disable(?:-next-line|-line)?(?: [\w/@,-]+)?", + r"biome-ignore(?: [\w/]+)?", + r"# noqa(?:: ?[A-Z]+\d+(?:, ?[A-Z]+\d+)*)?", + r"# type: ignore(?:\[[\w-]+\])?", + r"# pragma: no cover", + r"rubocop:disable [\w/,]+", + r"shellcheck disable=[\w,]+", + r"zizmor: ignore\[[\w-]+\]", + r"hadolint ignore=[\w,]+", + r"nosemgrep", + r"(?:gitleaks|betterleaks):allow", +] +FOUND = re.compile("|".join(f"(?:{p})" for p in PATTERNS)) + + +def main(): + os.chdir(subprocess.check_output(["git", "rev-parse", "--show-toplevel"], text=True).strip()) + allowed = collections.Counter() + for line in open(LIST): + line = line.split(" -- ", 1)[0].strip() + if line and not line.startswith("#"): + path, found = line.split(" ", 1) + allowed[(path, found)] += 1 + present = collections.Counter() + for path in subprocess.check_output(["git", "ls-files", "-z"], text=True).split("\0"): + if not path or SKIP.search(path) or not os.path.isfile(path): + continue + try: + text = open(path, encoding="utf-8").read() + except UnicodeDecodeError: + continue + for m in FOUND.finditer(text): + present[(path, re.sub(r"\s+", " ", m.group(0)))] += 1 + failed = False + for key, n in sorted((present - allowed).items()): + failed = True + print(f"{key[0]}: a new `{key[1]}` ({n}). Fix what it silences, or add `{key[0]} {key[1]} -- ` to {LIST}.", file=sys.stderr) + for key, n in sorted((allowed - present).items()): + failed = True + print(f"{LIST}: `{key[0]} {key[1]}` is listed but gone ({n}): delete its line.", file=sys.stderr) + if failed: + return 1 + print(f"Suppressions: {sum(present.values())}, each listed with its reason in {LIST}.") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/ci/file_lengths.txt b/scripts/ci/file_lengths.txt new file mode 100644 index 000000000..4069f635b --- /dev/null +++ b/scripts/ci/file_lengths.txt @@ -0,0 +1,45 @@ +# Files already over the limit when scripts/ci/check_file_length.py arrived (5 Dec 2026), each with its cap: its +# length then, rounded up to the next hundred. Split a file rather than raise its cap; delete its line once it's under +# the limit. +app/database/migrations/0001_01_01_000000_initial_schema.rs 1400 +app/src/auth/invitations.rs 600 +app/src/auth/oauth.rs 700 +app/src/auth/sign_in.rs 600 +app/src/config.rs 900 +app/src/domain/baselines.rs 600 +app/src/domain/builds.rs 600 +app/src/domain/bundles.rs 700 +app/src/domain/credits.rs 600 +app/src/domain/demo.rs 800 +app/src/domain/downloads.rs 600 +app/src/domain/gallery.rs 600 +app/src/domain/processing.rs 1400 +app/src/forge/deliveries.rs 800 +app/src/forge/installations.rs 1100 +app/src/forge/pr_comment.rs 600 +app/src/forge/webhooks.rs 1200 +app/src/http/api/builds.rs 600 +app/src/mcp/admin.rs 1000 +app/src/mcp/args.rs 600 +app/src/mcp/mod.rs 2500 +app/src/notify/render.rs 600 +app/tests/abuse.rs 1400 +app/tests/mcp.rs 1400 +clients/gallery/js/src/hydrate.ts 600 +clients/gallery/rust/src/model.rs 700 +crates/envschema/src/lib.rs 900 +crates/snapshot-diff/src/lib.rs 1000 +crates/visualci-cli/src/ci.rs 600 +crates/visualci-cli/src/client.rs 1700 +crates/visualci-cli/src/main.rs 1500 +crates/visualci-core/src/config.rs 800 +crates/visualci-core/src/pdf.rs 900 +frontend/src/api/hooks.ts 700 +frontend/src/api/types.ts 700 +frontend/src/components/Comments.tsx 600 +frontend/src/pages/BillingPage.tsx 700 +frontend/src/pages/BuildPage.tsx 700 +frontend/src/pages/ProjectPage.tsx 1000 +frontend/src/pages/SnapshotPage.tsx 1200 +frontend/src/styles.css 5800 +scripts/screenshots/journeys.mjs 800 diff --git a/scripts/ci/suppressions.txt b/scripts/ci/suppressions.txt new file mode 100644 index 000000000..de9d0596e --- /dev/null +++ b/scripts/ci/suppressions.txt @@ -0,0 +1,32 @@ +# Every lint suppression in the repository, with the reason for it (scripts/ci/check_suppressions.py; sc-9611). +# One line per suppression: ` -- `. Add a line, with its reason, in the change that adds the +# suppression; delete it in the change that removes one. Fixing what a suppression silences beats adding one. + +# Workflows +.github/workflows/ci.yml shellcheck disable=SC2086 -- the renderer inputs hash splits $paths into one argument per crate path on purpose +.github/workflows/release-gallery-gem.yml zizmor: ignore[cache-poisoning] -- setup-node there sets no cache; zizmor flags the action itself +.github/workflows/release-gallery-npm.yml zizmor: ignore[cache-poisoning] -- setup-node there sets no cache; zizmor flags the action itself +.github/workflows/release-gallery-python.yml zizmor: ignore[cache-poisoning] -- setup-node there sets no cache; zizmor flags the action itself +.github/workflows/release.yml zizmor: ignore[dangerous-triggers] -- workflow_run is how the release waits for CI; every job checks for a successful CI run of a push to main +.github/zizmor.yml zizmor: ignore[audit] -- not a suppression: the file's comment showing the syntax +clients/github-action/action.yml zizmor: ignore[github-env] -- GITHUB_PATH gets a directory under RUNNER_TEMP named from the workflow author's own inputs + +# Rust +app/src/domain/compare.rs #[allow(clippy::too_many_arguments) -- page_state takes the snapshot, both pages and the diff settings; a struct would only be built to be taken apart +app/src/domain/detail.rs #[allow(clippy::cast_precision_loss) -- changed and total line counts as f64 for a fraction; counts never come near 2^52 +app/src/domain/processing.rs #[allow(clippy::too_many_lines) -- process() is the build pipeline, kept in one function so its steps (and what holds no transaction) read in order +app/src/domain/retention.rs #[allow(clippy::cast_precision_loss) -- a byte total shown in MB with one decimal; precision past 2^52 doesn't matter there +app/src/mcp/admin.rs #![allow(clippy::doc_markdown) -- doc comments here are the tools' descriptions agents read, as prose, not rustdoc +app/src/mcp/args.rs #![allow(clippy::doc_markdown) -- doc comments here become the JSON schemas' descriptions agents read, as prose +app/tests/oauth_client/mod.rs #![allow(dead_code) -- a helper module each test binary includes; each uses only part of it +clients/gallery/rust/tests/examples.rs #[allow(dead_code) -- the examples are compiled as modules to test them, so their main() is unused +clients/gallery/rust/tests/examples.rs #[allow(dead_code) -- the examples are compiled as modules to test them, so their main() is unused +clients/gallery/rust/tests/examples.rs #[allow(dead_code) -- the examples are compiled as modules to test them, so their main() is unused +crates/visualci-cli/src/client.rs #[allow(clippy::type_complexity) -- a test helper's return type, used in two tests +crates/visualci-wasm/src/lib.rs #![allow(unsafe_code) -- the wasm exports hand the page raw pointers into linear memory; there is no safe form +crates/visualci-wasm/src/lib.rs #[allow(clippy::too_many_arguments) -- a wasm export takes plain numbers and pointers, never a struct + +# Others +clients/gallery/js/test/hydrate.test.ts @ts-expect-error -- deletes a DOM method to test the fallback for Safari before 15.4 +clients/gallery/ruby/lib/visualci/gallery/engine.rb rubocop:disable Rails/OutputSafety -- the gallery renderer escapes everything it outputs +scripts/ci/test_migration_safety.py # noqa: E402 -- the import has to follow the sys.path change that finds the module From 7e50214bc9c043a5dc6763e52d50dfb3184fdecd Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Sat, 5 Dec 2026 05:51:16 +0000 Subject: [PATCH 2/2] Limits: more suppression forms (cfg_attr, NOQA, ruff, nosec, hadolint --ignore, eslint with a reason), test_*.py get 1,000 lines, rename hint, no __pycache__ in git (review) --- .gitignore | 3 +++ .../check_file_length.cpython-313.pyc | Bin 4107 -> 0 bytes .../migration_safety.cpython-313.pyc | Bin 7829 -> 0 bytes .../test_migration_safety.cpython-313.pyc | Bin 4177 -> 0 bytes scripts/ci/check_file_length.py | 5 ++-- scripts/ci/check_suppressions.py | 25 +++++++++++------- scripts/ci/suppressions.txt | 14 +++++++--- 7 files changed, 32 insertions(+), 15 deletions(-) delete mode 100644 scripts/ci/__pycache__/check_file_length.cpython-313.pyc delete mode 100644 scripts/ci/__pycache__/migration_safety.cpython-313.pyc delete mode 100644 scripts/ci/__pycache__/test_migration_safety.cpython-313.pyc diff --git a/.gitignore b/.gitignore index cdb784fde..e1ac68719 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ target/ frontend/dist frontend/dist-site .dev-host + +# Python bytecode (scripts/ci) +__pycache__/ diff --git a/scripts/ci/__pycache__/check_file_length.cpython-313.pyc b/scripts/ci/__pycache__/check_file_length.cpython-313.pyc deleted file mode 100644 index 2c151868ee2265e0c6902c5c1dc570f0ab92ad42..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4107 zcma(UOKcm*b(UQIfBM<6Wjh+%vP0SuY1wfLD|X`|@-L2Ln`_!eD4Si8BXMJLmzi1W z!|)*F5;`APL7aw00$4zEaL@t?&>Rf(l0$)@H_~(>W-XvaTLeu{aU3+49{OgbC1p8H zJJQbQ&71d|H}5?@3jRVz+qv94iCBLny&=j?sf{2be5#A zVwqB9nq*)kz=G*8RaDHfLI_h$I_KN0V^rF z99T?`M6px^hO%isV5L5#<0-1m;DXF_FXsyEhcPSU6dfc2@j(kY6U7&~s+vkLD7&&d zL2_`8^T;WA1ysq99MJ)Riw^e1VR>cb_FZLYT2j?4`>BLv7;wdtvXWyaEz^)7<`|g< z15;UHV0A7OS356XC143H4_AZN+SNRjT4UX4VGbt`bHFd6(dcE2aTwV0H5cy zoW2Sc1*Ib1Z@4Rtm5z=_!<3bE{y$rOiIwy4rQv%CmW8=8ohY+x8B9gB@^q1u*)+-N zq?~4~%%F?(mtG8CDaRsV)1RI#vjRz%$$k=vm6Orb;AInTLL=kRq&!%hjg z6}eD|Wn^8RkQs@!-7yxiDc{2*RsLZ|sI=uLyehr=l+EV_$cTRr$Dn%`B~2jj;vBlJ zC0b7}yt*Sh5lV^{T0cs{dZqQFh%gor4d)AI#!eiI8%{=Kn$8;jm38WcQ=_NO8xC`b z2!>dY!RfhV*fUX@wQ#Tv{2N(cz&Cnl8m+Yn1%4D>fV^9_1nJ z3HaC+=;qP#mhHEW+&pr-XK72cz9stR;hK2p(__#*gl+VQb$k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W*h8-ni86u>xOe$x&)hvz*n6LSeB^Vs=z4p>6)|`< z^aDX?78Drj`Y{HLSM!LHnY5KAXxo)qx@uKd+MTqWcAT&X76{ys&TS~Pv#VDRjmiA6 zcg8u$Cm5LxBXdDrN7;?*<$TR`WH+x{X$W9L{*M2x^GN{ z7hSart{p|!j>4^?i&6>d#S@A2Tu1z$fLcJj94=#eLIPnM!>TdbcGv>=RwUI~K5LtW z%BE9ioX~bSB5*p_Y%mKA~q~ch^KM$N~jIJh- zL~3HrYV5Gfh$&VmIr^#{@mO%_M>TNk)Rt2~=n`Z%uBQw-&@nBU!B{GB+fvjVviIm-*Z>cWuBx zw(6;Clof`Qv7VeYlcWf1q|+K9f@7``y17Nyxb83OhF7A{Uv$PbTUO%XBLm7{LZbAJtY3+oBx%+(C-_O} zH0mJG`kGA-J2VH}pzt{vrm!EYFkfTAR+zZ|ck1!JC+w5UDt%RbdqjPgd78+SyuyO_PSJbksrS7V z8{w(?FYkNPJ&UfI+0!$p3%&){t`!^R+%-+ik~8GokwRU`v7-=r>Uixd?|aKO%tkI_ zFlm_tzj3Pf>ssG5u~g@qV?S!1-*s9_w-m+?AX4O;MLY`|6?`gs9kb+ zrrBA3hA%iu)h)lZB5(Ce$6LYpm{TjQrNKe~MhR*G>`NI`&W5o>y6L z|8w#+yyp2^Fq+1nJB-?jw>)<@;hyE=7~!7Im#j@+*~#g{v&UzS|LkuHc*)+h=y1(C s?mFfgo;sQq3HvX4f7&|}o!c|tdat$6aqnQs^V)wByO!-3(X5mDe~yjZ`~Uy| diff --git a/scripts/ci/__pycache__/test_migration_safety.cpython-313.pyc b/scripts/ci/__pycache__/test_migration_safety.cpython-313.pyc deleted file mode 100644 index 856ad6bad4b0f25612d7d9c2193debe9ce8bc527..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4177 zcmbuC-*4N-9l(#2WK*(TyY{lV!I0h3{IFWvs*@P)oL`nDx>h1fo+xD*>W!r&O5!Y$ z&K=d%#kRm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z!sHM4h}WRzhZEf655=5jchfsH)#DXk??H4UFi7G#x5hQ#=4Jd`; z^G`tLVQ2M!9uq3C5O}1{DGF!=2Y49_6;xpl5d1=q5ct!hUD{EhfsNDo5(^$y3UVr= zWB>%8uwWRRT9Q*Y@q~@9UBxfpWG;`Y%JJU z6?+a-TeI~!3^5Fb$wNg|KTq+iy!cgYP;Yxr^MXmRg$=S$%uRNl#+(SRfn#J0bR#Sd zg|Pkvn=Xq}y%1``GloB|+B8gEZR%_X^9u+Zk;H1(8_w)utNy*s=Gb^Yh2$RkR2uZ6 zp`UF3{LaH?$aeep+x8!Jq(Aa?{TOaRF-KC}QB^0Vsx7P9ZtAM)45}&%2iXw^f5WO; zGYGYrs-~r?CCKwENkHP9P*t`FMg;;|n;7Lb%ogNlm;gJ$co<38t&=A# z%%|)&_!qP%_C+$n-pEiSws$HPiSLa^B2D4zr-aBGg4>j}V(PZQ3#w{-#OYVns#O8~ zM2o_`X@feFe-U)T>u^VM`dosY{;EOPTv+p(!Dl#f@M_2n#&2Of2zI0*Tp&|$Ou6c^ zi;WXzV;`7}BVBQq?HWme3^O&YL9!bX1mT}(^$QgJ48=Y}!~aI1`_h}z{oyx cap: how = f"its cap in {CAPS}" if path in caps else "the limit" - failed.append(f"{path}: {lines} lines, over {how} ({cap}). Split it (never raise the cap).") + hint = "" if path in caps else f" (A capped file you renamed: move its line in {CAPS} to the new path.)" + failed.append(f"{path}: {lines} lines, over {how} ({cap}). Split it (never raise the cap).{hint}") elif path in caps and lines <= limit(path): failed.append(f"{path}: {lines} lines, within the limit now: delete its line in {CAPS}.") if not args: diff --git a/scripts/ci/check_suppressions.py b/scripts/ci/check_suppressions.py index 3f054bac4..4aa8cc3a3 100755 --- a/scripts/ci/check_suppressions.py +++ b/scripts/ci/check_suppressions.py @@ -17,29 +17,36 @@ LIST = "scripts/ci/suppressions.txt" SKIP = re.compile(r"\.(md|txt|png|jpe?g|gif|webp|ico|pdf|woff2?|ttf|otf|svg|lock)$|^scripts/ci/(check_suppressions\.py|suppressions\.txt)$") +RULES = r"(?: (?!--)[\w/@-]+(?:, ?[\w/@-]+)*)?" PATTERNS = [ r"#!?\[(?:allow|expect)\([^)]*\)", + r"#!?\[cfg_attr\([^]]*?\b(?:allow|expect)\([^)]*\)", r"@ts-(?:ignore|expect-error|nocheck)", - r"(?:eslint|oxlint)-disable(?:-next-line|-line)?(?: [\w/@,-]+)?", - r"biome-ignore(?: [\w/]+)?", - r"# noqa(?:: ?[A-Z]+\d+(?:, ?[A-Z]+\d+)*)?", - r"# type: ignore(?:\[[\w-]+\])?", - r"# pragma: no cover", - r"rubocop:disable [\w/,]+", + r"(?:eslint|oxlint)-disable(?:-next-line|-line)?" + RULES, + r"biome-ignore" + RULES, + r"(?:ruff: )?noqa(?:: ?[A-Z]+\d+(?:, ?[A-Z]+\d+)*)?", + r"type: ignore(?:\[[\w-]+\])?", + r"pyright: ignore(?:\[[\w-]+\])?", + r"pylint: disable=[\w,-]+", + r"pragma: no cover", + r"\bnosec\b", + r"(?:rubocop|standard):(?:disable|todo) [\w/,]+", r"shellcheck disable=[\w,]+", - r"zizmor: ignore\[[\w-]+\]", + r"zizmor: ignore\[[\w, -]+\]", r"hadolint ignore=[\w,]+", + r"--ignore DL\d{4}", r"nosemgrep", r"(?:gitleaks|betterleaks):allow", ] -FOUND = re.compile("|".join(f"(?:{p})" for p in PATTERNS)) +# Case-insensitive: `# NOQA` silences as well as `# noqa`. +FOUND = re.compile("|".join(f"(?:{p})" for p in PATTERNS), re.I) def main(): os.chdir(subprocess.check_output(["git", "rev-parse", "--show-toplevel"], text=True).strip()) allowed = collections.Counter() for line in open(LIST): - line = line.split(" -- ", 1)[0].strip() + line = line.rsplit(" -- ", 1)[0].strip() if line and not line.startswith("#"): path, found = line.split(" ", 1) allowed[(path, found)] += 1 diff --git a/scripts/ci/suppressions.txt b/scripts/ci/suppressions.txt index de9d0596e..a7fede3e1 100644 --- a/scripts/ci/suppressions.txt +++ b/scripts/ci/suppressions.txt @@ -11,22 +11,28 @@ .github/zizmor.yml zizmor: ignore[audit] -- not a suppression: the file's comment showing the syntax clients/github-action/action.yml zizmor: ignore[github-env] -- GITHUB_PATH gets a directory under RUNNER_TEMP named from the workflow author's own inputs +# docker/renderer.Dockerfile's two hadolint warnings wait for the renderer's next rebuild (sc-9674): any edit to that file rebuilds the renderer image. +.github/workflows/ci.yml --ignore DL3003 -- the renderer's PDFBox step cds; fixed in its rebuild (sc-9674) +.github/workflows/ci.yml --ignore DL4006 -- the renderer's PDFBox step pipes without pipefail; fixed in its rebuild (sc-9674) +lefthook.yml --ignore DL3003 -- the same two renderer warnings in the hook (sc-9674) +lefthook.yml --ignore DL4006 -- the same two renderer warnings in the hook (sc-9674) + # Rust -app/src/domain/compare.rs #[allow(clippy::too_many_arguments) -- page_state takes the snapshot, both pages and the diff settings; a struct would only be built to be taken apart +app/src/domain/compare.rs #[allow(clippy::too_many_arguments) -- page_state takes the snapshot, store, project, both pages, the diff options and the mask; a struct would only be built to be taken apart app/src/domain/detail.rs #[allow(clippy::cast_precision_loss) -- changed and total line counts as f64 for a fraction; counts never come near 2^52 app/src/domain/processing.rs #[allow(clippy::too_many_lines) -- process() is the build pipeline, kept in one function so its steps (and what holds no transaction) read in order app/src/domain/retention.rs #[allow(clippy::cast_precision_loss) -- a byte total shown in MB with one decimal; precision past 2^52 doesn't matter there app/src/mcp/admin.rs #![allow(clippy::doc_markdown) -- doc comments here are the tools' descriptions agents read, as prose, not rustdoc app/src/mcp/args.rs #![allow(clippy::doc_markdown) -- doc comments here become the JSON schemas' descriptions agents read, as prose -app/tests/oauth_client/mod.rs #![allow(dead_code) -- a helper module each test binary includes; each uses only part of it +app/tests/oauth_client/mod.rs #![allow(dead_code) -- the OAuth test client's helpers; not every one has a test using it yet clients/gallery/rust/tests/examples.rs #[allow(dead_code) -- the examples are compiled as modules to test them, so their main() is unused clients/gallery/rust/tests/examples.rs #[allow(dead_code) -- the examples are compiled as modules to test them, so their main() is unused clients/gallery/rust/tests/examples.rs #[allow(dead_code) -- the examples are compiled as modules to test them, so their main() is unused -crates/visualci-cli/src/client.rs #[allow(clippy::type_complexity) -- a test helper's return type, used in two tests +crates/visualci-cli/src/client.rs #[allow(clippy::type_complexity) -- a test helper's return type (the server's URL and request count, and the last bundle); a type alias for it would be used twice crates/visualci-wasm/src/lib.rs #![allow(unsafe_code) -- the wasm exports hand the page raw pointers into linear memory; there is no safe form crates/visualci-wasm/src/lib.rs #[allow(clippy::too_many_arguments) -- a wasm export takes plain numbers and pointers, never a struct # Others clients/gallery/js/test/hydrate.test.ts @ts-expect-error -- deletes a DOM method to test the fallback for Safari before 15.4 clients/gallery/ruby/lib/visualci/gallery/engine.rb rubocop:disable Rails/OutputSafety -- the gallery renderer escapes everything it outputs -scripts/ci/test_migration_safety.py # noqa: E402 -- the import has to follow the sys.path change that finds the module +scripts/ci/test_migration_safety.py noqa: E402 -- the import has to follow the sys.path change that finds the module