Skip to content
baskingspotPublic

About

Opinionated linting to keep your agent in check.

Topics

Resources

Stars

68 stars

Watchers

2 watching

Forks

Repository files navigation

ziglint

Opinionated linting to keep your agent in check.

A compiler does not care that a function is named MyBadName, that an import is unused, or that a materialized type hides a private one. An agent learns the same way, from the error it gets, and there is no error to get. ziglint reads the AST that std.zig.Ast gives it and reports the 36 things the house style says are wrong, each with a note that says why.

It has no dependencies, runs on the Zig tree you point it at, and prints one line per finding: Z024: src/Linter.zig:31: line exceeds 120 bytes (252 bytes).

What is in it

  • Rules: what the 36 checks cover, and how --only and --ignore pick one. The rule reference has the note for each.
  • Inline ignores: // ziglint-ignore: Z001 silences one rule on one line, so a deliberate exception costs one line of prose.
  • Reading a rule: ziglint --explain Z024 prints the note in the terminal, and --list-rules prints every code and title.

Not implemented:

  • An autofix. A finding names the line and the rule, and the edit is yours.
  • Formatting. zig fmt owns layout, and ziglint never runs it.
  • A rule over what a parse cannot see: a name built at comptime, a type that exists only after instantiation, or a generated file.

Install

ziglint runs zig to find the standard library it lints against, so zig must be on PATH. --zig-lib-path points it at another lib directory.

With Homebrew, on macOS or Linux:

brew install --cask baskingspot/tap/ziglint

With mise:

mise use -g github:baskingspot/ziglint

With Nix:

nix run github:baskingspot/ziglint -- src

Each release has a tarball for linux-x64, linux-arm64, and macos-arm64, a zip for windows-x64, and a SHA256SUMS file. The archives are attested, so check a download with gh attestation verify FILE -R baskingspot/ziglint --signer-repo baskingspot/gh-actions.

From source:

zig build install -Doptimize=ReleaseFast --prefix $HOME/.local

Documentation

  • The guide: install, run, configure, and what the rules cover.
  • The rule reference: every rule with its note and its examples, generated from src/docs/rules/.
  • The changelog: the notes from each release.

Work on it

nix develop
just ci

nix develop provides the toolchain and the site tools. just lists the recipes, just ci runs what CI runs, just guide serves the guide with live reload, and just doc builds the whole site into zig-out/site/ziglint/. The rule and changelog pages are generated by zig build site.

License

MIT. See LICENSE. The logo files in docs/static/ are baskingspot marks and are not covered by it. See docs/static/LICENSE.

How it's made

Built with LLM assistance. How, in detail.

baskingspot

About

Opinionated linting to keep your agent in check.

Topics

Resources

Stars

68 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages