From 7cf4340bdf485e6b058c6f61483d825ea66d5824 Mon Sep 17 00:00:00 2001 From: Jochen Hoenle Date: Wed, 15 Jul 2026 11:48:39 +0200 Subject: [PATCH] [tooling repo] remove multitool - remove multitool - update docs-as-code to 4.6.1, 3.x still required multitool - update rules score to handle new doc-as-code --- MODULE.bazel | 38 --------------- README.md | 1 - bazel/rules/rules_score/test/BUILD | 6 ++- bazel/rules/rules_score/test/MODULE.bazel | 2 +- .../test/template/conf.template.py | 1 - format_checker/README.md | 8 ++-- format_checker/macros.bzl | 4 +- python_basics/multitool.lock.json | 15 ------ python_basics/private/BUILD | 27 ----------- tools/BUILD | 47 ------------------- tools/README.md | 46 ------------------ tools/actionlint.lock.json | 25 ---------- tools/ruff.lock.json | 25 ---------- tools/sample.sh | 36 -------------- tools/shellcheck.lock.json | 25 ---------- tools/yamlfmt.lock.json | 25 ---------- 16 files changed, 9 insertions(+), 322 deletions(-) delete mode 100644 python_basics/multitool.lock.json delete mode 100644 tools/BUILD delete mode 100644 tools/README.md delete mode 100644 tools/actionlint.lock.json delete mode 100644 tools/ruff.lock.json delete mode 100755 tools/sample.sh delete mode 100644 tools/shellcheck.lock.json delete mode 100644 tools/yamlfmt.lock.json diff --git a/MODULE.bazel b/MODULE.bazel index ee1b738e..0fd002cd 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -28,7 +28,6 @@ bazel_dep(name = "aspect_rules_lint", version = "1.5.3") bazel_dep(name = "rules_shell", version = "0.5.0") bazel_dep(name = "rules_java", version = "8.15.1") bazel_dep(name = "rules_rust", version = "0.68.1-score") -bazel_dep(name = "rules_multitool", version = "1.9.0") bazel_dep(name = "score_rust_policies", version = "0.0.2") bazel_dep(name = "bazel_skylib", version = "1.7.1") bazel_dep(name = "buildifier_prebuilt", version = "8.2.0.2") @@ -234,43 +233,6 @@ use_repo(pip, "pip_lobster_bazel") use_repo(pip, "pip_rules_score") -############################################################################### -# Multitool Hub (for ruff, pyright, actionlint, etc.) -############################################################################### -multitool = use_extension("@rules_multitool//multitool:extension.bzl", "multitool") - -#python_basics -multitool.hub(lockfile = "python_basics/multitool.lock.json") -use_repo(multitool, "multitool") - -# Ruff Hub -multitool.hub( - hub_name = "ruff_hub", - lockfile = "tools/ruff.lock.json", -) -use_repo(multitool, "ruff_hub") - -# Actionlint Hub -multitool.hub( - hub_name = "actionlint_hub", - lockfile = "tools/actionlint.lock.json", -) -use_repo(multitool, "actionlint_hub") - -# Shellcheck Hub -multitool.hub( - hub_name = "shellcheck_hub", - lockfile = "tools/shellcheck.lock.json", -) -use_repo(multitool, "shellcheck_hub") - -# YAMLfmt Hub -multitool.hub( - hub_name = "yamlfmt_hub", - lockfile = "tools/yamlfmt.lock.json", -) -use_repo(multitool, "yamlfmt_hub") - ############################################################################### # lcov deb package (provides genhtml + lcov for combined coverage reports) ############################################################################### diff --git a/README.md b/README.md index b7762941..631e021e 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,6 @@ See the individual README files for detailed usage instructions and configuratio | **format_checker** | Code formatting validation | [README](format_checker/README.md) | | **python_basics** | Python development utilities and testing | [README](python_basics/README.md) | | **starpls** | Starlark language server support | [README](starpls/README.md) | -| **tools** | Formatters & Linters | [README](tools/README.md) | | **coverage** | Rust + Python coverage reports | [README](coverage/README.md) | ## Coverage diff --git a/bazel/rules/rules_score/test/BUILD b/bazel/rules/rules_score/test/BUILD index 506f7c28..e7b7d955 100644 --- a/bazel/rules/rules_score/test/BUILD +++ b/bazel/rules/rules_score/test/BUILD @@ -1,5 +1,3 @@ -load("@aspect_rules_py//py:defs.bzl", "py_binary") - # ******************************************************************************* # Copyright (c) 2025 Contributors to the Eclipse Foundation # @@ -12,6 +10,9 @@ load("@aspect_rules_py//py:defs.bzl", "py_binary") # # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* + +load("@aspect_rules_py//py:defs.bzl", "py_binary") +load("@pip_tooling_test//:requirements.bzl", "requirement") load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test") load( "@score_tooling//bazel/rules/rules_score:rules_score.bzl", @@ -115,6 +116,7 @@ py_binary( "@score_docs_as_code//src/extensions/score_sphinx_bundle", "@score_tooling//bazel/rules/rules_score:bazel_sphinx_needs", "@score_tooling//bazel/rules/rules_score:sphinx_module_ext", + requirement("sphinx-rtd-theme"), ], ) diff --git a/bazel/rules/rules_score/test/MODULE.bazel b/bazel/rules/rules_score/test/MODULE.bazel index 6424372d..64e6652b 100644 --- a/bazel/rules/rules_score/test/MODULE.bazel +++ b/bazel/rules/rules_score/test/MODULE.bazel @@ -61,7 +61,7 @@ pip.parse( ) use_repo(pip, "pip_tooling_test") -bazel_dep(name = "score_docs_as_code", version = "3.0.1", dev_dependency = True) +bazel_dep(name = "score_docs_as_code", version = "4.6.1", dev_dependency = True) bazel_dep(name = "googletest", version = "1.17.0.bcr.2") # bazel_dep(name = "score_platform", version = "0.5.0") diff --git a/bazel/rules/rules_score/test/template/conf.template.py b/bazel/rules/rules_score/test/template/conf.template.py index b8670fa6..16470d6a 100644 --- a/bazel/rules/rules_score/test/template/conf.template.py +++ b/bazel/rules/rules_score/test/template/conf.template.py @@ -38,7 +38,6 @@ "score_plantuml", "score_metamodel", "score_draw_uml_funcs", - "score_source_code_linker", "score_layout", ] diff --git a/format_checker/README.md b/format_checker/README.md index 6286150a..fa66f01c 100644 --- a/format_checker/README.md +++ b/format_checker/README.md @@ -45,10 +45,8 @@ The `languages` parameter selects which formatters are wired up. Supported value | Language | Formatter | | ---------- | ------------------------------------------------------ | -| `python` | `@aspect_rules_lint//format:ruff` | | `rust` | `@score_tooling//format_checker:rustfmt_with_policies` | | `starlark` | `@buildifier_prebuilt//:buildifier` | -| `yaml` | `@aspect_rules_lint//format:yamlfmt` | | `cpp` | `@llvm_toolchain//:clang-format` | When `languages` is omitted, every language except `cpp` is enabled. C++ is @@ -103,8 +101,8 @@ This will register two Bazel targets: To control which formatters run, pass an explicit `languages` list: ```python -# Only check Python and Starlark. -use_format_targets(languages = ["python", "starlark"]) +# Only check Starlark. +use_format_targets(languages = ["starlark"]) ``` ### 3️⃣ In VS Code settings: @@ -141,7 +139,7 @@ bazel run @score_tooling//format_checker:rustfmt_with_policies C++ formatting is opt-in. Enable it by adding `cpp` to the `languages` list: ```python -use_format_targets(languages = ["python", "rust", "starlark", "yaml", "cpp"]) +use_format_targets(languages = ["rust", "starlark", "cpp"]) ``` - Formatter label: `@llvm_toolchain//:clang-format`, which requires the LLVM diff --git a/format_checker/macros.bzl b/format_checker/macros.bzl index 5c04eda2..3b092605 100644 --- a/format_checker/macros.bzl +++ b/format_checker/macros.bzl @@ -15,16 +15,14 @@ load("@aspect_rules_lint//format:defs.bzl", "format_multirun", "format_test") # Maps a user-facing language name to the (attribute, formatter label) pair that # is forwarded to aspect_rules_lint's format_multirun / format_test rules. _FORMATTERS = { - "python": ("python", "@aspect_rules_lint//format:ruff"), "rust": ("rust", "@score_tooling//format_checker:rustfmt_with_policies"), "starlark": ("starlark", "@buildifier_prebuilt//:buildifier"), - "yaml": ("yaml", "@aspect_rules_lint//format:yamlfmt"), "cpp": ("cc", "@llvm_toolchain//:clang-format"), } # Languages enabled when the caller does not specify a selection. C++ is left # out so that projects without C++ code do not depend on the LLVM toolchain. -_DEFAULT_LANGUAGES = ["python", "rust", "starlark", "yaml"] +_DEFAULT_LANGUAGES = ["rust", "starlark"] def use_format_targets(fix_name = "format.fix", check_name = "format.check", languages = None): """Registers format.fix and format.check targets for the selected languages. diff --git a/python_basics/multitool.lock.json b/python_basics/multitool.lock.json deleted file mode 100644 index b38b1015..00000000 --- a/python_basics/multitool.lock.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/theoremlp/rules_multitool/main/lockfile.schema.json", - "ruff": { - "binaries": [ - { - "kind": "archive", - "file": "ruff-x86_64-unknown-linux-gnu/ruff", - "url": "https://github.com/astral-sh/ruff/releases/download/0.11.4/ruff-x86_64-unknown-linux-gnu.tar.gz", - "sha256": "69b9d9228ecadcffec970976e7d5c989064c2129ab03e606b3f96e588bcc1ffc", - "os": "linux", - "cpu": "x86_64" - } - ] - } -} diff --git a/python_basics/private/BUILD b/python_basics/private/BUILD index 7bd96105..b8be63a1 100644 --- a/python_basics/private/BUILD +++ b/python_basics/private/BUILD @@ -10,7 +10,6 @@ # # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -load("@aspect_rules_lint//format:defs.bzl", "format_multirun", "format_test") load("@bazel_skylib//rules:build_test.bzl", "build_test") load("@pip_tooling//:requirements.bzl", "all_requirements", "requirement") load("@rules_python//python:pip.bzl", "compile_pip_requirements") @@ -22,31 +21,6 @@ load("@score_tooling//python_basics:defs.bzl", "score_virtualenv") # Generate the virtualenv score_virtualenv() -python_tool = "@aspect_rules_lint//format:ruff" - -format_multirun( - name = "format.fix", - print_command = True, - python = python_tool, - visibility = [ - "//visibility:private", - ], -) - -# Ensure all files are formatted correctly -format_test( - name = "format.check", - - # Scan the entire workspace. - # This mode causes the test to be non-hermetic and it cannot be cached. - no_sandbox = True, - python = python_tool, - visibility = [ - "//visibility:private", - ], - workspace = "//:MODULE.bazel", -) - # In order to update the requirements, change the `requirements.txt` file and run: # `bazel run //:requirements_3_XX.update --@@rules_python+//python/config_settings:python_version=3.XX`. # This will update the `requirements_lock.txt` file. @@ -71,7 +45,6 @@ format_test( build_test( name = "ensure_all_private_targets_work", targets = [ - ":format.fix", # Ensure format.fix is executable ":requirements.update", ], ) diff --git a/tools/BUILD b/tools/BUILD deleted file mode 100644 index ec8f248b..00000000 --- a/tools/BUILD +++ /dev/null @@ -1,47 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -load("@rules_shell//shell:sh_binary.bzl", "sh_binary") - -package(default_visibility = ["//visibility:public"]) - -exports_files([ - "ruff.lock.json", - "actionlint.lock.json", - "shellcheck.lock.json", - "yamlfmt.lock.json", -]) - -sh_binary( - name = "ruff", - srcs = ["@ruff_hub//tools/ruff:cwd"], - visibility = ["//visibility:public"], -) - -sh_binary( - name = "actionlint", - srcs = ["@actionlint_hub//tools/actionlint:cwd"], - visibility = ["//visibility:public"], -) - -sh_binary( - name = "shellcheck", - srcs = ["@shellcheck_hub//tools/shellcheck:cwd"], - visibility = ["//visibility:public"], -) - -sh_binary( - name = "yamlfmt", - srcs = ["@yamlfmt_hub//tools/yamlfmt:cwd"], - visibility = ["//visibility:public"], -) diff --git a/tools/README.md b/tools/README.md deleted file mode 100644 index d4c374a3..00000000 --- a/tools/README.md +++ /dev/null @@ -1,46 +0,0 @@ - - -- **Ruff**: A super-fast Python linter. -- **basedpyright**: A type checker for Python. -- **Actionlint**: A linter for your GitHub Actions workflows. -- **Shellcheck**: A static analysis tool for shell scripts. -- **Yamlfmt**: A handy formatter for YAML files. - -## How to use the Module -Add the import of `multitool` as well as `score_linter` to your `MODULE.bazel` file. -Adapt the `use_repo` and `register_toolchains` calls to only import/use the tools you need. -``` -bazel_dep(name = "score_tooling", version = "1.0.0") -bazel_dep(name = "rules_multitool", version = "1.8.0") - -multitool_root = use_extension("@rules_multitool//multitool:extension.bzl", "multitool") -use_repo(multitool_root, "actionlint_hub", "multitool", "ruff_hub", "shellcheck_hub", "yamlfmt_hub") - -register_toolchains( - "@ruff_hub//toolchains:all", - "@actionlint_hub//toolchains:all", - "@shellcheck_hub//toolchains:all", - "@yamlfmt_hub//toolchains:all", -) -``` - -### Run the Lint Script (sample.sh) - -Copy the [sample.sh script](https://github.com/eclipse-score/tooling/tools/sample.sh). - -Adapt it to only run the tools you need, by deleting or commenting out the lines not necessary. The script will run all the configured linters and report any issues it finds. - -Ensure the script is executable `chmod u+x