From 12c8acb9f270914ef783f76c56ef73c5fee5a315 Mon Sep 17 00:00:00 2001 From: James Wainwright Date: Fri, 13 Dec 2024 16:53:45 +0000 Subject: [PATCH] Move quality checks to private package The targets in this package are only for local testing and do not need to be exposed to depending Bazel modules. This prevents errors when querying the whole module when the `aspect_rules_lint` dependency won't be available. Signed-off-by: James Wainwright --- .github/workflows/licence-checker.yml | 4 ++-- BUILD | 28 ----------------------- quality/BUILD | 33 +++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 30 deletions(-) create mode 100644 quality/BUILD diff --git a/.github/workflows/licence-checker.yml b/.github/workflows/licence-checker.yml index f9a9f6f..a32433d 100644 --- a/.github/workflows/licence-checker.yml +++ b/.github/workflows/licence-checker.yml @@ -22,9 +22,9 @@ jobs: with: python-version: 3.9 - name: Check formatting with Ruff - run: bazel run :format.check + run: bazel run //quality:format.check - name: Run Licence Checker - run: bazel run //:licence-check + run: bazel run //quality:licence-check - name: Test Licence Checker run: | cd tests diff --git a/BUILD b/BUILD index 865bf5d..9f9e5f5 100644 --- a/BUILD +++ b/BUILD @@ -1,31 +1,3 @@ # Copyright lowRISC contributors. # Licensed under the Apache License, Version 2.0, see LICENSE for details. # SPDX-License-Identifier: Apache-2.0 - -load("//rules:rules.bzl", "licence_check") -load("@aspect_rules_lint//format:defs.bzl", "format_multirun") - -licence_check( - name = "licence-check", - exclude_patterns = [".style.yapf"], - licence = """ - Copyright lowRISC contributors. - Licensed under the Apache License, Version 2.0, see LICENSE for details. - SPDX-License-Identifier: Apache-2.0 - """, -) - -alias( - name = "ruff", - actual = select({ - "@bazel_tools//src/conditions:linux_x86_64": "@ruff_x86_64-unknown-linux-gnu//:ruff", - "@bazel_tools//src/conditions:linux_aarch64": "@ruff_aarch64-unknown-linux-gnu//:ruff", - "@bazel_tools//src/conditions:darwin_arm64": "@ruff_aarch64-apple-darwin//:ruff", - "@bazel_tools//src/conditions:darwin_x86_64": "@ruff_x86_64-apple-darwin//:ruff", - }), -) - -format_multirun( - name = "format", - python = ":ruff", -) diff --git a/quality/BUILD b/quality/BUILD new file mode 100644 index 0000000..0509fcd --- /dev/null +++ b/quality/BUILD @@ -0,0 +1,33 @@ +# Copyright lowRISC contributors. +# Licensed under the Apache License, Version 2.0, see LICENSE for details. +# SPDX-License-Identifier: Apache-2.0 + +load("//rules:rules.bzl", "licence_check") +load("@aspect_rules_lint//format:defs.bzl", "format_multirun") + +package(default_visibility = ["//visibility:private"]) + +licence_check( + name = "licence-check", + exclude_patterns = [".style.yapf"], + licence = """ + Copyright lowRISC contributors. + Licensed under the Apache License, Version 2.0, see LICENSE for details. + SPDX-License-Identifier: Apache-2.0 + """, +) + +alias( + name = "ruff", + actual = select({ + "@bazel_tools//src/conditions:linux_x86_64": "@ruff_x86_64-unknown-linux-gnu//:ruff", + "@bazel_tools//src/conditions:linux_aarch64": "@ruff_aarch64-unknown-linux-gnu//:ruff", + "@bazel_tools//src/conditions:darwin_arm64": "@ruff_aarch64-apple-darwin//:ruff", + "@bazel_tools//src/conditions:darwin_x86_64": "@ruff_x86_64-apple-darwin//:ruff", + }), +) + +format_multirun( + name = "format", + python = ":ruff", +)