Skip to content

Commit

Permalink
Move quality checks to private package
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jwnrt committed Dec 13, 2024
1 parent c1b420e commit e106b4b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/licence-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 0 additions & 28 deletions BUILD
Original file line number Diff line number Diff line change
@@ -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",
)
33 changes: 33 additions & 0 deletions quality/BUILD
Original file line number Diff line number Diff line change
@@ -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",
)

0 comments on commit e106b4b

Please sign in to comment.