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.1.0 — View source
rb_binary, rb_library, and rb_test
rules.
Typical usage:
Installing RuboCop
The recommended approach is to use Bundler with rules_ruby to manage RuboCop as a gem dependency:- Add RuboCop to your
Gemfile:
-
Run
bundle lockto generateGemfile.lock -
Configure the bundle in your
MODULE.bazel:
- Create an alias to the gem-provided binary in
tools/lint/BUILD.bazel:
- Create the linter aspect, typically in
tools/lint/linters.bzl:
- Hermetic builds with pinned gem versions
- Consistent RuboCop versions across all developers
- Integration with Bazel’s dependency management
Configuration
RuboCop will automatically discover.rubocop.yml files according to its
standard configuration hierarchy.
See https://docs.rubocop.org/rubocop/configuration.html for details.
Note: all config files are passed to the action as inputs.
This means that a change to any config file invalidates the action cache
entries for ALL RuboCop actions.
Function: rubocop_action
Run RuboCop as an action under Bazel.
RuboCop will select the configuration file to use for each source file,
as documented here:
https://docs.rubocop.org/rubocop/configuration.html
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 RuboCop actions.
However this is needed because RuboCop’s logic for selecting the
appropriate config needs to traverse the directory hierarchy.
Parameters
Bazel Rule or Aspect evaluation context
File object for the RuboCop executable
list of File objects for Ruby source files to be linted
list of File objects for RuboCop config files (.rubocop.yml)
File object where linter output will be written
File object where exit code will be written, or None.
If None, the build will fail when RuboCop exits non-zero.
See https://docs.rubocop.org/rubocop/usage/basic_usage.html
boolean, whether to enable color output
output file for patch (optional). If provided, uses run_patcher instead of run_shell.
Function: lint_rubocop_aspect
A factory function to create a linter aspect.
Parameters
Label of the RuboCop executable.
Example: “//tools/lint:rubocop” or “@bundle//bin:rubocop”
Label or list of Labels of RuboCop config file(s).
Example: [”//:rubocop.yml”] or ”//:rubocop.yml”
list of rule kinds to visit.
See https://bazel.build/query/language#kind
list of filegroup tags. Filegroups with these tags
will be visited by the aspect in addition to Ruby rule kinds.

