Skip to content

About

A fast, deterministic scanner that flags the weird code and text LLMs produce.

Topics

Resources

Contributing

Stars

4 stars

Watchers

0 watching

Forks

Repository files navigation

straitjacket

Engraving of a patient restrained in a strait-waistcoat

straitjacket on crates.io MIT licensed Documentation at straitjacket.dev

Straitjacket is a fast, deterministic scanner that flags the weird code and text LLMs produce. It sweeps your files against a set of configurable rules and flags anything it finds. One static binary, no project setup, any language.

# Linux x86_64/aarch64, macOS arm64/x86_64
curl -fsSL https://straitjacket.dev/install | sh
straitjacket
src/theme/button.css:12:14  [color]  #ff6600
  hardcoded color literal
  help: use a theme token or CSS variable
straitjacket: 1 error(s), 0 warning(s) across 84 file(s); 0 suppressed

Eleven rules ship; nine run at the first invocation. The other two you opt into: no-comments, and test-quality, which reads your tests the way the language writes them — #[test], @Test, it(...), TEST(...), test "..." — and flags the ones that weaken what they prove, such as a loop or a conditional in a test body. It parses with a treebank grammar rather than matching text, and downloads that grammar the first time it meets a test file in a language, which is why it asks rather than assumes.

Or build from source with cargo install straitjacket. Re-run the installer to update; it installs over the copy that is there. In CI, the bundled Action installs the binary and scans the checked-out repository:

- uses: PowderworksCode/straitjacket@v0.2.0

The tag pins the scanner, not just the Action wrapper, so a release published later cannot apply new rules to a branch that changed nothing. Updating is a bump of that tag — see Updating.

Documentation

Everything lives at straitjacket.dev:

Contributing

The most useful thing you can send is a concrete example — a pattern Straitjacket should catch, or a false positive it shouldn't. scripts/dev.sh stands up everything you need: the Rust workspace, and the site dependencies the documentation tests run against. See CONTRIBUTING.md for what makes a good rule and how to run the tests. Release-to-release changes are in CHANGELOG.md.

License

Code is MIT.

The banner image (assets/strait-waistcoat.jpg) — Insane patient in a strait-waistcoat, Wellcome Collection (L0011301) — is licensed CC BY 4.0 and is not covered by the MIT license; reuse it under its own terms.

About

A fast, deterministic scanner that flags the weird code and text LLMs produce.

Topics

Resources

Contributing

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages