Skip to main content

Command Palette

Search for a command to run...

Aspect's rules_lint Reaches 2.0

We are excited to announce today the second major release of our formatting and linting support for Bazel.

Updated
3 min read
Aspect's rules_lint Reaches 2.0
A

Fixing Bazel!

You’ll find the project and examples at https://github.com/aspect-build/rules_lint.

We’ve been incredibly gratified by the more than 60 open-source contributors who have improved the ruleset, and everyone who has filed or answered issues. Thank you! We support 30 languages now and continue to grow.

Highlights of Aspect rules_lint release version 2.0

  • The Aspect Extension Language (AXL) is now used to provide the lint and format tasks on your command-line. Just install the Aspect CLI and run aspect lint. This is wired in the MODULE.aspect file that sits next to MODULE.bazel.

  • Most of the bazel-starters demonstrate rules_lint 2.0, and give an easy playground to try it out.

  • The rules_lint examples folder is now broken out into standalone Bazel modules per-language, making it much easier to find the bits you need for your own repo.

  • Pythonistas will love the new ty linter support. Ty is a fast Python type-checker written in Rust from Astral - and we’re working with them to add incremental type-check support to avoid quadratic runtime. Thank you to https://github.com/whoahbot for the contribution!

  • We’ve added Rust’s clippy tool so you can get auto-fixes like unused imports applied automatically during code review. We expect rules_rust to decrease scope, possibly removing their Clippy support. Thank you to https://github.com/blorente for adding this support!

  • Full Bazel 9 support, including Bzlmod module_extension support for fetching all tools, obviating the need for any WORKSPACE file or http_archive rules.

About rules_lint

aspect-build/rules_lint is a Bazel ruleset that makes linting and formatting “first-class” in Bazel — so you can run common static analysis tools via Bazel without wrapping your existing BUILD targets or changing the rulesets you already use.

As before, rules_lint v2 is really two rulesets in one:

Formatting

  • Typically one formatter per language; deterministic output; “just apply the changes.”

  • Formatting tools are run as side-effects outside of Bazel actions and wired with a git pre-commit hook.

  • That means it can run on files not modeled in Bazel’s dependency graph: formatting runs on the file tree (helpful for scripts, docs, etc.).

Get started at https://github.com/aspect-build/rules_lint/blob/main/docs/formatting.md

Linting

  • Can run multiple linters per language; may propose fixes; results can be shown as terminal output, failing tests, or code-review feedback.

  • No BUILD-file clutter: you lint existing *_library targets rather than adding special wrapper macros.

  • Incremental & cache-friendly: lint runs as Bazel actions (works with remote execution/cache).

  • Practical for legacy repos: supports “lint only what changed” workflows so you can start without fixing all historic issues. We refer to the “Water Leak Principle” which says to stop the leak before mopping the spill.

Get started at https://github.com/aspect-build/rules_lint/blob/main/docs/linting.md

Wiring into code review

Aspect’s platform includes Marvin, our mascot and helpful Bazel bot. Marvin comments on your pull requests, and includes lint results displayed as GitHub Checks. Even better, when the linter tool has a —-fix mode, Marvin will provide the Suggested Fixes in the GitHub code review so you can just accept the improvements to your code.

Next steps

To learn more about our Aspect Workflows developer productivity platform and expert Bazel support services, talk to us on Bazel Slack or email us at hello@aspect.build.