Skip to main content

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.

Factory function to make lint test rules. When the linter exits non-zero, the test will print the output of the linter and then fail. To use this, in your linters.bzl where you define the aspect, just create a test that references it. For example, with flake8:
load("@aspect_rules_lint//lint:lint_test.bzl", "lint_test")
load("@aspect_rules_lint//lint:flake8.bzl", "lint_flake8_aspect")

flake8 = lint_flake8_aspect(
    binary = Label("//:flake8"),
    config = Label("//:.flake8"),
)

flake8_test = lint_test(aspect = flake8)
Now in your BUILD files you can add a test:
load("//tools/lint:linters.bzl", "flake8_test")

py_library(
    name = "unused_import",
    srcs = ["unused_import.py"],
)

flake8_test(
    name = "flake8",
    srcs = [":unused_import"],
)

Function: lint_test

Parameters

aspect
unknown
required