Skip to main content
Version: 1.0.x

lint_test

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", "flake8_aspect")

flake8 = flake8_aspect(
binary = "@@//:flake8",
config = "@@//:.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"],
)

Macros and Functions

lint_test

Example usage (generated):

load("@aspect_rules_lint//lint:lint_test.bzl", "lint_test")

lint_test(
aspect = None,
)

aspect

Required.