Documentation Index
Fetch the complete documentation index at: https://docs.aspect.build/llms.txt
Use this file to discover all available pages before exploring further.
aspect lint runs one or more aspect_rules_lint aspects as a standard Bazel build, reads SARIF diagnostic output, and decides whether to fail the CI step based on which findings are in scope. It posts inline PR annotations via the GithubLintComments feature.
The key design: aspect lint doesn’t re-implement linting. It drives Bazel, which caches lint results the same as any other action. If a file hasn’t changed, its lint results come from the remote cache rather than running the linter again. At scale, aspect lint //... on a large repo is fast because Bazel only re-lints what’s actually changed.
Hold-the-line strategy
The default failure strategy —hold-the-line — is what makes lint practical on large, pre-existing codebases with known violations.
Instead of failing on any finding anywhere, hold-the-line:
- Detects the PR’s changed lines (via GitHub PR Files API or
git diff) - Fails only on error-severity findings on lines you actually changed
| Strategy | When it fails |
|---|---|
hold-the-line (default) | Error-severity findings on changed lines |
hold-the-file | Error-severity findings anywhere in a changed file |
hard | Any error-severity finding in any linted target |
soft | Never (report only) |
Configuration
Lint aspects
aspect lint requires at least one --aspect pointing to an aspect_rules_lint aspect:
config.axl so developers running aspect lint //... locally use the same set as CI:
.aspect/config.axl
config.axl. A CI job that needs only fast linters can pass --aspect= directly without affecting the default config.
Apply auto-fix patches
Some rules_lint linters produce fix patches. Pass--fix to apply them to the working tree:
Changed-file scope
By default,aspect lint runs on all targets and strategy filtering determines which findings fail. To restrict the Bazel build to targets in changed packages:
--base-ref when your main branch isn’t origin/main.
GitHub PR annotations
GithubLintComments posts inline PR review comments for every error-severity finding that holds the line (i.e., would have caused a failure under hold-the-line). Reviewers see the issue directly on the diff line without switching to CI logs.
Enable by authenticating the Aspect Workflows GitHub App and setting ASPECT_API_TOKEN. The feature is always enabled — it just no-ops when not authenticated.
Suggestions from auto-fix linters become one-click “commit suggestion” buttons in the PR review.
How it works under the hood
aspect lint uses two Bazel output groups from aspect_rules_lint:
rules_lint_machine— SARIF JSON and per-target exit codes. Used for CI verdicts and annotation posting.rules_lint_human— Colored terminal output. Streamed to the developer’s terminal.
- Reads every diagnostic from every SARIF file
- Computes the changed-line set for the PR (GitHub PR Files API or
git diff) - Filters diagnostics according to the chosen strategy
- For
hold-the-line, uses±3 line contextaround each changed hunk to catch findings that are technically on adjacent-but-related lines - Posts inline annotations via
GithubLintCommentsfor each finding that passed the filter - Exits 0 or 1 based on whether any filtered findings have error severity
aspect lint after an unrelated change doesn’t re-execute any linter whose inputs haven’t changed. On Aspect Workflows with remote cache, lint is O(changed targets), not O(repo size).

