More tweaks

This commit is contained in:
Reid 'arrdem' McKenzie 2021-08-30 00:40:02 -06:00
parent 1684195192
commit 1d113f6007
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,4 @@
test --test_output=errors test --test_output=errors
# To enable flake8 on all build steps, uncomment this - # To enable flake8 on all build steps, uncomment this -
# build --aspects="//tools/flake8:flake8.bzl%flake8_aspect" --output_groups=flake8_checks # build --aspects="//tools/flake8:flake8.bzl%flake8_aspect" --output_groups=flake8_checks

View file

@ -1,5 +1,11 @@
"""Linting for Python using Aspects.""" """Linting for Python using Aspects."""
# Hacked up from https://github.com/bazelbuild/rules_rust/blob/main/rust/private/clippy.bzl
#
# Usage:
# bazel build --aspects="//tools/flake8:flake8.bzl%flake8_aspect" --output_groups=flake8_checks <target|pattern>
#
# Note that the build directive can be inserted to .bazelrc to make it part of the default behavior
def _flake8_aspect_impl(target, ctx): def _flake8_aspect_impl(target, ctx):
if hasattr(ctx.rule.attr, 'srcs'): if hasattr(ctx.rule.attr, 'srcs'):
@ -41,7 +47,7 @@ flake8_aspect = aspect(
implementation = _flake8_aspect_impl, implementation = _flake8_aspect_impl,
attr_aspects = ['deps'], attr_aspects = ['deps'],
attrs = { attrs = {
'_flake8': attr.label(default="//tools/flake8"), '_flake8': attr.label(default=":flake8"),
'_config': attr.label( '_config': attr.label(
default="//:setup.cfg", default="//:setup.cfg",
executable=False, executable=False,