# redline > redline reviews a diff the way a careful reviewer would. It shows each changed file in full and writes 137 kinds of problems (AI-written code tells and classic smells) as comments that explain what is wrong, why it matters and the fix. Version 0.1.0, MIT. ## Use it - [Web app](https://redline.kevinliu.studio/): drop a .diff or .patch file, paste a diff, or paste a public GitHub pull request link. - [API](https://redline.kevinliu.studio/docs#api): POST {"changes": [{"diff": "..."}]} to https://redline.kevinliu.studio/api/analyze and get findings as JSON. Nothing is stored. - [CLI](https://redline.kevinliu.studio/docs#cli): pip install git+https://github.com/Kevin-Liu-01/redline; redline check prints path:line:col: severity rule: message and exits 1 at --fail-on. - [All rules as JSON](https://redline.kevinliu.studio/rules.json): id, title, severity, languages, why, fix, flagged and clean examples, research sources. - [Docs](https://redline.kevinliu.studio/docs) and [source](https://github.com/Kevin-Liu-01/redline). ## Rules: AI tells - [Placeholder instead of code](https://redline.kevinliu.studio/rules/placeholder-code) `placeholder-code` (high): Models elide code with `// ... existing code ...` or `# implementation here`. When that lands in a commit, the real code is gone or was never written. - [Stubbed implementation](https://redline.kevinliu.studio/rules/stub-body) `stub-body` (high): A function that only throws `not implemented` passes type checks and review, then fails in production on the first call. - [Change-log comment](https://redline.kevinliu.studio/rules/changelog-comment) `changelog-comment` (medium): Comments like `// Added retry` or `// now uses the new client` describe the diff, not the code. They are true for one commit and misleading forever after. - [Chat voice in a comment](https://redline.kevinliu.studio/rules/assistant-voice) `assistant-voice` (medium): Comments addressed to the person who asked for the change ('I've added', 'feel free to') are pasted from an assistant's answer. They say nothing about the code. - [Deprecated API](https://redline.kevinliu.studio/rules/stale-api) `stale-api` (medium): Deprecated APIs still work today and print warnings, change behavior or disappear in the next major version. - [Floating model alias](https://redline.kevinliu.studio/rules/floating-model) `floating-model` (medium): Aliases move to new snapshots without notice, so prompts, costs and outputs change with no code change. - [Placeholder value](https://redline.kevinliu.studio/rules/placeholder-value) `placeholder-value` (medium): Generated code ships with `YOUR_API_KEY` and `your-domain.com` in it. It runs, then fails at the first real request. - [Versioned or boastful name](https://redline.kevinliu.studio/rules/versioned-name) `versioned-name` (medium): `parseV2`, `fetchDataNew`, `enhancedSearch` mean a second copy was added beside the first instead of replacing it. Names should say what a thing does. - [Comment repeats the code](https://redline.kevinliu.studio/rules/restating-comment) `restating-comment` (low): `// increment counter` above `counter++` doubles the reading and goes stale when the code changes. It's the most common AI comment. - [Docstring restates the name](https://redline.kevinliu.studio/rules/obvious-docstring) `obvious-docstring` (low): 'Get the user.' on `get_user` tells nothing new. Docstrings earn their place with units, edge cases and failure modes. - [Em or en dash](https://redline.kevinliu.studio/rules/em-dash) `em-dash` (low): Readers now take the em dash as a sign nobody edited the text. In logs and UI strings it also breaks grep and plain-ASCII terminals. - [Emoji in code](https://redline.kevinliu.studio/rules/emoji) `emoji` (low): Emoji in logs, comments and error messages are a common AI tell. They don't grep, some terminals render them as boxes, and they add no meaning a word wouldn't. - [Filler comment](https://redline.kevinliu.studio/rules/filler-comment) `filler-comment` (low): 'This function is responsible for…' and section labels like `// Imports` restate the structure a reader can already see. Models add them by reflex. - [Generated summary file](https://redline.kevinliu.studio/rules/doc-sprawl) `doc-sprawl` (low): Agents leave `IMPLEMENTATION_SUMMARY.md` and `FIXES_REPORT.md` behind. They narrate one session and nobody updates them. - [Marketing words](https://redline.kevinliu.studio/rules/hype-words) `hype-words` (low): Words like robust, seamless and comprehensive are filler that models lean on. They make docs longer and say nothing checkable. - [Numbered placeholder name](https://redline.kevinliu.studio/rules/numbered-name) `numbered-name` (low): `data2`, `result3` mean the author ran out of names. The reader has to trace where each one came from. - [Numbered step comments](https://redline.kevinliu.studio/rules/step-comment) `step-comment` (low): `// Step 1:`, `// Step 2:` scaffolding is a tutorial habit. It goes stale when a step is added and hides the one comment that matters. - [Section banner comment](https://redline.kevinliu.studio/rules/section-banner) `section-banner` (low): `// ===== Helpers =====` banners split a file into chapters instead of splitting it into files. Models add them to look organised. - [TODO left in](https://redline.kevinliu.studio/rules/todo-marker) `todo-marker` (low): TODOs are where reviews hide unfinished work. They rarely get done and nobody owns them. ## Rules: Error handling - [Bare except](https://redline.kevinliu.studio/rules/bare-except) `bare-except` (high): `except:` catches everything, including Ctrl-C and `sys.exit`, so the program can't even be stopped cleanly. - [Empty catch](https://redline.kevinliu.studio/rules/empty-catch) `empty-catch` (high): An empty catch makes every failure look like success. The bug surfaces later and far away, with no trace of the cause. - [Mutable default argument](https://redline.kevinliu.studio/rules/mutable-default) `mutable-default` (high): Python evaluates defaults once. A list or dict default is shared by every call, so state leaks between calls. - [Rejection swallowed](https://redline.kevinliu.studio/rules/promise-catch-noop) `promise-catch-noop` (high): An empty `.catch` turns every failure into silent success. The bug shows up later, far from the cause, with no log. - [Branches on error text](https://redline.kevinliu.studio/rules/match-error-message) `match-error-message` (medium): Error messages are for people and change without notice. A reworded message silently changes control flow. - [Error turned into an empty value](https://redline.kevinliu.studio/rules/catch-returns-empty) `catch-returns-empty` (medium): Returning `null` or `[]` from a catch makes 'it failed' look like 'there was nothing'. The UI shows an empty list instead of an error. - [except Exception](https://redline.kevinliu.studio/rules/broad-except) `broad-except` (medium): Catching `Exception` treats a typo, a None and a network error the same way. Bugs get handled as if they were expected failures. - [Logs the error and carries on](https://redline.kevinliu.studio/rules/log-and-continue) `log-and-continue` (medium): Logging an error and continuing means the caller thinks it worked. The log line is the only witness, and nobody reads it in time. - [Network call without a timeout](https://redline.kevinliu.studio/rules/missing-timeout) `missing-timeout` (medium): Without a timeout one stuck upstream holds a worker until the process dies. At scale that becomes an outage. - [Throws a non-Error](https://redline.kevinliu.studio/rules/throw-literal) `throw-literal` (medium): Throwing a string or object loses the stack trace and breaks `instanceof Error` checks in handlers. - [assert used for validation](https://redline.kevinliu.studio/rules/assert-for-validation) `assert-for-validation` (low): Asserts are for invariants in tests and debugging. Under `python -O` they are removed, so input validation built on them disappears. - [Error caught and ignored](https://redline.kevinliu.studio/rules/error-discarded) `error-discarded` (low): A catch that never reads the error handles every failure the same way, including the ones you didn't expect. - [Exits the process](https://redline.kevinliu.studio/rules/exit-in-library) `exit-in-library` (low): Exiting deep in a call stack skips cleanup, loses buffered logs and makes the code impossible to reuse or test. - [Fallback hides missing data](https://redline.kevinliu.studio/rules/silent-default) `silent-default` (low): Defaulting to `[]`, `{}` or `''` makes a missing field look like an empty one. The bug surfaces later as wrong output, not as an error. - [fetch without a timeout](https://redline.kevinliu.studio/rules/fetch-without-timeout) `fetch-without-timeout` (low): `fetch` has no default timeout. A hung upstream holds the request, the connection and the user until something else gives up. - [Generic error message](https://redline.kevinliu.studio/rules/generic-error-message) `generic-error-message` (low): 'Something went wrong' tells the on-call engineer nothing. Good messages name the operation and the input that failed. - [Raises plain Exception](https://redline.kevinliu.studio/rules/raise-bare-exception) `raise-bare-exception` (low): A generic exception forces callers into `except Exception`, which also catches real bugs. - [Re-raise loses the cause](https://redline.kevinliu.studio/rules/raise-without-from) `raise-without-from` (low): Raising a new exception inside `except` without `from` buries the original error in 'During handling…' noise. - [Time without a time zone](https://redline.kevinliu.studio/rules/naive-datetime) `naive-datetime` (low): Naive datetimes compare wrongly with aware ones and shift when the server's zone or DST changes. ## Rules: Type safety - [`is` with a literal](https://redline.kevinliu.studio/rules/is-literal) `is-literal` (high): `x is 1` or `x is 'a'` depends on interpreter caching. It can be true in tests and false in production. - [Double cast](https://redline.kevinliu.studio/rules/double-cast) `double-cast` (high): A double cast is a lie to the type checker. It hides a real mismatch that will show up as a runtime bug. - [`any` type](https://redline.kevinliu.studio/rules/any-type) `any-type` (medium): `any` spreads: everything it touches stops being checked. A wrong field name or shape compiles fine and fails at runtime. - [Lint or type check switched off](https://redline.kevinliu.studio/rules/lint-suppress) `lint-suppress` (medium): Each suppression is a finding someone decided not to fix. They pile up, and the linter stops meaning anything. - [Shapeless object type](https://redline.kevinliu.studio/rules/loose-object-type) `loose-object-type` (medium): Bags of `Record` or `dict[str, Any]` move type errors from compile time to runtime and hide the real shape from readers. - [Type error suppressed](https://redline.kevinliu.studio/rules/ts-suppress) `ts-suppress` (medium): Suppressed type errors are bugs the compiler already found. `@ts-ignore` also keeps hiding new errors on that line after the original is fixed. - [`var`](https://redline.kevinliu.studio/rules/var-declaration) `var-declaration` (low): `var` leaks out of blocks and can be used before it's assigned, which causes subtle loop and closure bugs. - [Compares to None with ==](https://redline.kevinliu.studio/rules/none-compare) `none-compare` (low): `==` can be overridden by a class and gives surprising answers. `is None` is exact and idiomatic. - [Loose equality](https://redline.kevinliu.studio/rules/loose-equality) `loose-equality` (low): Loose equality follows coercion rules few people remember. It hides type bugs. - [Non-null assertion](https://redline.kevinliu.studio/rules/non-null-assertion) `non-null-assertion` (low): Non-null assertions skip the check the type system asked for. They are often added to quiet an error, not because the value is proven present. - [Optional chaining everywhere](https://redline.kevinliu.studio/rules/defensive-chaining) `defensive-chaining` (low): Chains like `a?.b?.c?.d` silence errors on data you should know the shape of. A missing field becomes `undefined` downstream instead of an error here. - [TypeScript enum](https://redline.kevinliu.studio/rules/ts-enum) `ts-enum` (low): Enums generate objects, number enums accept any number, and they don't work with type-stripping runtimes. ## Rules: Tests and CI - [Assertion that can't fail](https://redline.kevinliu.studio/rules/trivial-assertion) `trivial-assertion` (high): `expect(true).toBe(true)` makes a test look green and covered while checking nothing. Models write these to make a failing test pass. - [Check switched off in config](https://redline.kevinliu.studio/rules/gate-weakened) `gate-weakened` (high): Loosening `strict` or skipping a CI job makes every later change easier to break, and the PR looks like a config tweak. - [CI failure ignored](https://redline.kevinliu.studio/rules/ci-escape-hatch) `ci-escape-hatch` (high): CI is only worth having if red means red. `|| true`, `continue-on-error` and `--no-verify` make failures look like success. - [Exits from a test](https://redline.kevinliu.studio/rules/exit-in-test) `exit-in-test` (high): Exiting with 0 from inside a test makes the runner report success no matter what ran or failed. - [Focused test](https://redline.kevinliu.studio/rules/focused-test) `focused-test` (high): A committed `.only` turns a whole suite green by not running it. - [Mocks the code under test](https://redline.kevinliu.studio/rules/mock-of-subject) `mock-of-subject` (high): When a test mocks the module it's named after, it tests the mock. It will pass while the real code is broken. - [Test-only branch in shipped code](https://redline.kevinliu.studio/rules/test-branch-in-prod) `test-branch-in-prod` (high): Branches on 'am I in a test?' mean the tests exercise a path production never takes. - [Assertions removed](https://redline.kevinliu.studio/rules/assertions-removed) `assertions-removed` (medium): Deleting assertions is the quickest way to make a red test green. Sometimes right, often the bug fix that wasn't. - [Expects any error](https://redline.kevinliu.studio/rules/broad-raises) `broad-raises` (medium): `toThrow()` with no argument or `pytest.raises(Exception)` passes when the code fails for an unrelated reason, like a typo. - [Fixed sleep in a test](https://redline.kevinliu.studio/rules/sleep-in-test) `sleep-in-test` (medium): Sleeps make tests slow and flaky at once: they guess how long something takes instead of waiting for it. - [Retries a flaky test](https://redline.kevinliu.studio/rules/test-retry) `test-retry` (medium): Auto-retries turn real races and order bugs into green builds. The flake is still there, now invisible. - [Skipped test](https://redline.kevinliu.studio/rules/skipped-test) `skipped-test` (medium): Skipped tests are deleted tests that still look like coverage. They're how a red suite gets turned green without a fix. - [Test without an assertion](https://redline.kevinliu.studio/rules/no-assertion) `no-assertion` (medium): A test with no assertion only checks that nothing throws. It stays green when the code returns the wrong answer. - [Mock](https://redline.kevinliu.studio/rules/mock-heavy) `mock-heavy` (low): Every mock is a place where the test checks your assumption about the other code instead of the code itself. Heavy mocking is how suites pass while production breaks. - [Test named after a ticket](https://redline.kevinliu.studio/rules/test-named-for-history) `test-named-for-history` (low): 'fixes bug 1234' tells the next reader nothing when it fails. The name should say what must stay true. - [Weak assertion](https://redline.kevinliu.studio/rules/weak-assertion) `weak-assertion` (low): 'It returned something' passes for wrong answers too. These assertions inflate coverage without catching regressions. ## Rules: Performance - [Await inside a loop (N+1)](https://redline.kevinliu.studio/rules/await-in-loop) `await-in-loop` (medium): One round trip per item makes the loop as slow as the list is long. With a database call inside, it's the classic N+1 query. - [Awaits that could run together](https://redline.kevinliu.studio/rules/sequential-awaits) `sequential-awaits` (medium): Each await waits for the one before. When the second call doesn't need the first one's result, the latency adds up for nothing. - [Deep copy through JSON](https://redline.kevinliu.studio/rules/json-clone) `json-clone` (medium): The JSON round-trip is a slow, lossy deep copy that silently changes types. - [Quadratic reduce](https://redline.kevinliu.studio/rules/spread-accumulator) `spread-accumulator` (medium): `{...acc, [k]: v}` inside reduce rebuilds the whole object each iteration. Fine for 10 items, a stall for 10,000. - [Reads whole rows](https://redline.kevinliu.studio/rules/select-star) `select-star` (medium): Whole-row reads move columns nobody uses, defeat covering indexes, and pull large JSON or text columns off disk on every call. They get slower as the table grows. - [Array scan inside a loop](https://redline.kevinliu.studio/rules/lookup-in-loop) `lookup-in-loop` (low): `.find` or `.includes` inside a loop scans the array once per item: O(n²). Unnoticeable at 50 items, a freeze at 50,000. - [Blocking file or process call](https://redline.kevinliu.studio/rules/sync-io) `sync-io` (low): Sync I/O in a server stops all concurrent work until the disk or child process returns. - [f-string in a log call](https://redline.kevinliu.studio/rules/fstring-in-logger) `fstring-in-logger` (low): f-strings run even when the level is off, and they defeat log grouping because every message is unique. - [Parses a URL to read one part](https://redline.kevinliu.studio/rules/new-url-parse) `new-url-parse` (low): `new URL()` allocates, parses and validates the whole string. On a hot path, repeated parsing adds up, and often the framework already gives you the parsed piece. - [Reads one key out of a JSON column](https://redline.kevinliu.studio/rules/jsonb-hot-read) `jsonb-hot-read` (low): A large jsonb value is stored out of line. Reading one key decompresses all of it, so a query that returns a few KB can read gigabytes. - [Regex built on every call](https://redline.kevinliu.studio/rules/regex-in-function) `regex-in-function` (low): Compiling a regex costs far more than running it. Inside a function or loop, that cost repeats on every call. - [Unbounded parallel calls](https://redline.kevinliu.studio/rules/unbounded-fanout) `unbounded-fanout` (low): Unbounded fan-out exhausts connection pools, trips rate limits and can take down the service it calls. ## Rules: Security - [Download piped to a shell](https://redline.kevinliu.studio/rules/pipe-to-shell) `pipe-to-shell` (high): `curl | sh` executes remote code with no review and no integrity check; a compromised host owns the machine. - [eval](https://redline.kevinliu.studio/rules/eval-call) `eval-call` (high): If any part of the string comes from input, this is remote code execution. Even when it doesn't, it defeats static analysis and CSP. - [Invisible character](https://redline.kevinliu.studio/rules/invisible-char) `invisible-char` (high): Zero-width and bidi control characters can make code read differently from how it runs (the Trojan Source attack) and break string comparisons. - [Secret in a public env var](https://redline.kevinliu.studio/rules/client-exposed-secret) `client-exposed-secret` (high): Public env prefixes inline the value into client JavaScript. A secret there is published. - [Secret in source](https://redline.kevinliu.studio/rules/hardcoded-secret) `hardcoded-secret` (high): Anything committed is copied to every clone, fork and CI log, and stays in history after you delete it. - [Secret with a fallback value](https://redline.kevinliu.studio/rules/default-secret) `default-secret` (high): If the variable is unset in production, the app quietly runs with a secret that's in the repo. - [Secret written to a log](https://redline.kevinliu.studio/rules/secret-in-log) `secret-in-log` (high): Credentials in logs end up in log search, vendor dashboards and support tickets, with weaker access control than the secret store. - [Shell command from strings](https://redline.kevinliu.studio/rules/shell-injection) `shell-injection` (high): A filename with `;` or `$()` in it becomes a second command. Shell parsing is the bug. - [SQL built from strings](https://redline.kevinliu.studio/rules/sql-injection) `sql-injection` (high): String-built SQL is the textbook injection bug. Escaping by hand misses cases; parameters don't. - [TLS verification off](https://redline.kevinliu.studio/rules/tls-off) `tls-off` (high): Disabled TLS verification is usually added to get past a dev certificate error and then ships. - [Token decoded without verifying](https://redline.kevinliu.studio/rules/jwt-unverified) `jwt-unverified` (high): Anyone can write a JWT. Without signature verification, the claims (user id, role) are whatever the caller wants. - [Unsafe deserialization](https://redline.kevinliu.studio/rules/unsafe-deserialize) `unsafe-deserialize` (high): Pickle and full YAML loaders construct arbitrary objects. Loading untrusted bytes with them is code execution. - [Archive extracted unchecked](https://redline.kevinliu.studio/rules/tar-extractall) `tar-extractall` (medium): Archive entries like `../../etc/cron.d/x` escape the destination (path traversal, 'tar slip'). - [Auth token in localStorage](https://redline.kevinliu.studio/rules/token-in-localstorage) `token-in-localstorage` (medium): One XSS bug, or one bad npm package, can read localStorage and take the session. - [CORS open to every origin](https://redline.kevinliu.studio/rules/cors-wildcard) `cors-wildcard` (medium): A wildcard origin lets any page in a user's browser read these responses. With credentials it's an account takeover path. - [Math.random for a secret](https://redline.kevinliu.studio/rules/insecure-random) `insecure-random` (medium): `Math.random` and `random` are seeded PRNGs; an attacker who sees a few outputs can predict the next. - [Raw HTML](https://redline.kevinliu.studio/rules/html-injection) `html-injection` (medium): Raw HTML bypasses the framework's escaping. One unescaped field is enough to run script in your users' sessions. - [Request data in a file path or URL](https://redline.kevinliu.studio/rules/request-to-path) `request-to-path` (medium): `../` in a path reads files outside the folder; a user-chosen URL lets them make your server call internal services (SSRF). - [Secret in a URL](https://redline.kevinliu.studio/rules/secret-in-url) `secret-in-url` (medium): URLs are logged everywhere: load balancers, CDNs, analytics, referrer headers. - [CI action not pinned](https://redline.kevinliu.studio/rules/unpinned-action) `unpinned-action` (low): Tags can be moved to new code. A compromised action runs with your CI secrets. - [target=_blank without rel](https://redline.kevinliu.studio/rules/target-blank) `target-blank` (low): Older browsers give the opened page a handle to yours (`window.opener`) that can redirect it. - [Weak hash](https://redline.kevinliu.studio/rules/weak-hash) `weak-hash` (low): MD5 and SHA-1 have practical collisions. Fine for cache keys, wrong for passwords, signatures or integrity checks. ## Rules: Design - [Compatibility shim](https://redline.kevinliu.studio/rules/compat-shim) `compat-shim` (medium): Compatibility layers and legacy aliases mean every reader has to learn both paths, and the old one never gets deleted. - [Deep nesting](https://redline.kevinliu.studio/rules/deep-nesting) `deep-nesting` (medium): Every nested `if` or loop is another condition to keep in mind. Past three or four, readers lose track of which case they're in. - [Duplicated block](https://redline.kevinliu.studio/rules/duplicate-block) `duplicate-block` (medium): Copy-pasted code drifts: a fix lands in one copy and not the other. Models duplicate rather than find the existing helper. - [Long function](https://redline.kevinliu.studio/rules/long-function) `long-function` (medium): Long functions mix several jobs. They're hard to name, test and change without breaking a part you didn't read. - [Old/new switch](https://redline.kevinliu.studio/rules/feature-toggle) `feature-toggle` (medium): A toggle that keeps the old path alive doubles the states to test, and the old path rots because nobody runs it. - [Pass-through wrapper](https://redline.kevinliu.studio/rules/pass-through) `pass-through` (medium): A function that only forwards its arguments adds a name to learn and a hop to follow, and hides nothing. Ousterhout calls this a shallow module. - [Unreachable code](https://redline.kevinliu.studio/rules/unreachable-code) `unreachable-code` (medium): Code after a `return` never runs. It misleads readers and usually means a merge or edit went wrong. - [Boolean arguments](https://redline.kevinliu.studio/rules/boolean-args) `boolean-args` (low): `render(user, true, false)` hides intent and makes swapping two flags a silent bug. - [else after return](https://redline.kevinliu.studio/rules/else-after-return) `else-after-return` (low): When the `if` branch returns, the `else` only adds indentation. Early returns keep the main path flat. - [Environment read deep in code](https://redline.kevinliu.studio/rules/env-read) `env-read` (low): Scattered `process.env` reads make behavior depend on hidden globals, fail late on a typo, and can't be checked at startup. - [global](https://redline.kevinliu.studio/rules/global-statement) `global-statement` (low): Hidden global state makes functions order-dependent and tests interfere with each other. - [Long file grew](https://redline.kevinliu.studio/rules/long-file) `long-file` (low): Very long files usually hold several modules. Every addition makes the split harder. - [Long way round a builtin](https://redline.kevinliu.studio/rules/reinvented-builtin) `reinvented-builtin` (low): `.filter(...).length > 0` builds a whole array to answer yes/no; `range(len(x))` indexes by hand. The builtin is shorter and says what you mean. - [Nested ternary](https://redline.kevinliu.studio/rules/nested-ternary) `nested-ternary` (low): Nested conditionals in one expression hide the branches and are easy to get wrong when edited. - [New dependency](https://redline.kevinliu.studio/rules/new-dependency) `new-dependency` (low): Every dependency is code you ship, audit and upgrade forever. Models add packages for things the standard library already does. - [Probes for a shape](https://redline.kevinliu.studio/rules/hasattr-probe) `hasattr-probe` (low): Feature-probing your own objects means the types don't say what they hold. It usually covers two incompatible versions of a thing. - [Temporary code with no end](https://redline.kevinliu.studio/rules/temporary-code) `temporary-code` (low): Temporary code without an owner or an issue becomes permanent. Nobody remembers what it was waiting for. - [Too many parameters](https://redline.kevinliu.studio/rules/many-params) `many-params` (low): Long positional parameter lists are easy to call in the wrong order and hard to extend. - [utils / helpers module](https://redline.kevinliu.studio/rules/junk-drawer-module) `junk-drawer-module` (low): `utils.ts` grows forever because anything can go there. Names by topic (`dates.ts`, `money.py`) keep code findable and cohesive. ## Rules: Async - [async callback in forEach](https://redline.kevinliu.studio/rules/async-foreach) `async-foreach` (high): `arr.forEach(async ...)` fires every callback and returns immediately. Rejections become unhandled and ordering is lost. - [async Promise executor](https://redline.kevinliu.studio/rules/async-promise-executor) `async-promise-executor` (high): Errors thrown inside an async executor are lost; the outer promise hangs forever. - [Blocking call in async code](https://redline.kevinliu.studio/rules/blocking-in-async) `blocking-in-async` (medium): A blocking call inside `async def` freezes the event loop: every other request waits for this one. - [Fixed wait in shipped code](https://redline.kevinliu.studio/rules/sleep-in-prod) `sleep-in-prod` (medium): Sleeps guess at timing. They are too short under load and pure latency the rest of the time, and they hide races instead of fixing them. - [setTimeout(…, 0) timing hack](https://redline.kevinliu.studio/rules/timeout-zero) `timeout-zero` (low): Zero-delay timeouts paper over a race: they work until something else also defers. ## Rules: React - [Data fetching in useEffect](https://redline.kevinliu.studio/rules/effect-fetch) `effect-fetch` (medium): Fetching in an effect races when props change quickly, double-fetches in Strict Mode and has no cache. - [Index as React key](https://redline.kevinliu.studio/rules/index-as-key) `index-as-key` (medium): When items move or are removed, index keys make React reuse the wrong component state; random keys remount every render. - [useEffect without dependencies](https://redline.kevinliu.studio/rules/effect-no-deps) `effect-no-deps` (medium): An effect with no dependency array runs after every render. It's a common source of loops and wasted work. - [Effect that copies into state](https://redline.kevinliu.studio/rules/derived-state-effect) `derived-state-effect` (low): Setting state from an effect to mirror props or other state costs an extra render and drifts out of sync. - [New object as context value](https://redline.kevinliu.studio/rules/unstable-context-value) `unstable-context-value` (low): Inline `value={{...}}` creates a fresh object each render; React sees a change and re-renders the whole subtree. ## Rules: Hygiene - [Merge conflict marker](https://redline.kevinliu.studio/rules/merge-conflict) `merge-conflict` (high): Conflict markers break the build in code and silently corrupt config, docs and data files. - [Debug output left in](https://redline.kevinliu.studio/rules/debug-print) `debug-print` (medium): Debug prints leak data into logs, cost I/O on hot paths and bury real log lines. `debugger` and `breakpoint()` stop the process. - [Machine-specific path](https://redline.kevinliu.studio/rules/user-path) `user-path` (medium): Absolute home paths work on the author's laptop and nowhere else, and they leak usernames into the repo. - [Unpinned dependency](https://redline.kevinliu.studio/rules/unpinned-dependency) `unpinned-dependency` (medium): `latest`, `*` and bare package names pull whatever is newest at install time, so a build can break with no change in the repo. - [Wildcard import](https://redline.kevinliu.studio/rules/wildcard-import) `wildcard-import` (medium): Star imports hide where names come from, shadow builtins and break when the other module adds a name. - [Commented-out code](https://redline.kevinliu.studio/rules/commented-out-code) `commented-out-code` (low): Dead code in comments confuses readers about what runs and never gets updated with the code around it. - [Hard-coded localhost](https://redline.kevinliu.studio/rules/localhost-url) `localhost-url` (low): A localhost URL in production code works in development and fails everywhere else, usually silently. - [Unnamed number](https://redline.kevinliu.studio/rules/magic-number) `magic-number` (low): `86400000` or `3500` means nothing at the call site. When it changes, someone has to find every copy.