From ae16691738ae18cfbcd881f2273f9d7e304e80b4 Mon Sep 17 00:00:00 2001 From: Reid 'arrdem' McKenzie Date: Mon, 30 Aug 2021 00:40:02 -0600 Subject: [PATCH] More tweaks --- .bazelrc | 1 + tools/flake8/flake8.bzl | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.bazelrc b/.bazelrc index cbe8863..42d53ff 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,3 +1,4 @@ test --test_output=errors + # To enable flake8 on all build steps, uncomment this - # build --aspects="//tools/flake8:flake8.bzl%flake8_aspect" --output_groups=flake8_checks diff --git a/tools/flake8/flake8.bzl b/tools/flake8/flake8.bzl index b9990af..2e97623 100644 --- a/tools/flake8/flake8.bzl +++ b/tools/flake8/flake8.bzl @@ -1,5 +1,11 @@ """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 +# +# Note that the build directive can be inserted to .bazelrc to make it part of the default behavior def _flake8_aspect_impl(target, ctx): if hasattr(ctx.rule.attr, 'srcs'): @@ -41,7 +47,7 @@ flake8_aspect = aspect( implementation = _flake8_aspect_impl, attr_aspects = ['deps'], attrs = { - '_flake8': attr.label(default="//tools/flake8"), + '_flake8': attr.label(default=":flake8"), '_config': attr.label( default="//:setup.cfg", executable=False,