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.
Documentation for @aspect_rules_lint@v2.3.0 — View source
binary, library, test rules.
Typical usage:
Ruff is provided as a built-in tool by rules_lint. To use the built-in version,
create the linter aspect, typically in tools/lint/linters.bzl:
Using a specific ruff version
InMODULE.bazel, fetch the desired version from https://github.com/astral-sh/ruff/releases.
In tools/lint/BUILD.bazel, select the tool for the host platform:
@multitool:
Function: ruff_action
Run ruff as an action under Bazel.
Ruff will select the configuration file to use for each source file, as documented here:
https://docs.astral.sh/ruff/configuration/#config-file-discovery
Note: all config files are passed to the action.
This means that a change to any config file invalidates the action cache entries for ALL
ruff actions.
However, this is important because:
- ruff has an
extendfield, so it may need to read more than one config file - ruff’s logic for selecting the appropriate config needs to read the file content to detect a
[tool.ruff]section.
Parameters
Bazel Rule or Aspect evaluation context
label of the the ruff program
python files to be linted
labels of ruff config files (pyproject.toml, ruff.toml, or .ruff.toml)
output file of linter results to generate
output file to write the exit code.
If None, then fail the build when ruff exits non-zero.
See https://github.com/astral-sh/ruff/blob/dfe4291c0b7249ae892f5f1d513e6f1404436c13/docs/linter.md#exit-codes
environment variaables for ruff
output file for patch (optional). If provided, uses run_patcher instead of run_shell.
Function: lint_ruff_aspect
A factory function to create a linter aspect.
Attrs:
binary: a ruff executable
configs: ruff config file(s) (pyproject.toml, ruff.toml, or .ruff.toml)
rule_kinds: which kinds of rules should be visited by the aspect
filegroup_tags: filegroups tagged with these tags will be visited by the aspect in addition to Python rule kinds
Parameters
Repository rule: ruff_workaround_20269
Workaround for https://github.com/bazelbuild/bazel/issues/20269
Attributes
A unique name for this repository.
In
WORKSPACE context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).This attribute is not supported in MODULE.bazel context (when invoking a repository rule inside a module extension’s implementation function).unlike http_archive, any value causes us to pass —strip-components=1 to tar

