Skip to content

Commit 36fe6b4

Browse files
chore: drop multitool & cleanup (#474)
* drop multitool and some cleanup * drop aspect_rules_lint * fix README
1 parent c6ca64b commit 36fe6b4

17 files changed

Lines changed: 99 additions & 142 deletions

.pre-commit-config.yaml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,27 @@ repos:
1515
- id: check-added-large-files
1616
args: ["--maxkb=150"]
1717

18-
# use LOCAL hooks for python tooling so versions come from the virtualenv
18+
- repo: https://github.com/rhysd/actionlint
19+
rev: v1.7.11
20+
hooks:
21+
- id: actionlint
22+
args:
23+
# Disable shellcheck and pyflakes for now, to enforce consistent behavior.
24+
- -shellcheck=
25+
- -pyflakes=
26+
27+
- repo: https://github.com/astral-sh/ruff-pre-commit
28+
rev: v0.15.9
29+
hooks:
30+
- id: ruff-check
31+
args: [ --fix ]
32+
- id: ruff-format
33+
34+
# Note: this is super slow, therefore it is last
1935
- repo: local
2036
hooks:
21-
- id: Linter Scripts
22-
name: Run linter script
23-
entry: ./scripts/run-linters.sh
24-
language: unsupported_script
37+
- id: BasedPyright
38+
name: BasedPyright
39+
entry: bash -c 'bazel run //:ide_support && .venv_docs/bin/python3 -m basedpyright'
40+
language: system
2541
pass_filenames: false

MODULE.bazel

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@
1212
# *******************************************************************************
1313

1414
# Versioning is handled by GitHub Releases.
15-
# Here we always keep "0.0.0" to indicate that.
16-
module(
17-
name = "score_docs_as_code",
18-
version = "0.0.0",
19-
)
15+
module(name = "score_docs_as_code")
2016

2117
###############################################################################
2218
#
@@ -53,13 +49,6 @@ use_repo(pip, "docs_as_code_hub_env")
5349
bazel_dep(name = "aspect_rules_py", version = "1.4.0")
5450
bazel_dep(name = "buildifier_prebuilt", version = "8.2.0.2")
5551

56-
###############################################################################
57-
#
58-
# Generic linting and formatting rules
59-
#
60-
###############################################################################
61-
bazel_dep(name = "aspect_rules_lint", version = "1.5.3")
62-
6352
# PlantUML for docs
6453
bazel_dep(name = "rules_java", version = "8.15.1")
6554

@@ -86,17 +75,4 @@ http_file(
8675
# Note: requirements were last aligned with 1.2.0,
8776
# the switch to 1.3.1 is purely to drop the dependency on docs-as-code 1.x.
8877
bazel_dep(name = "score_process", version = "1.5.1")
89-
90-
# Add Linter
91-
bazel_dep(name = "rules_multitool", version = "1.9.0")
9278
bazel_dep(name = "score_tooling", version = "1.2.0")
93-
94-
multitool_root = use_extension("@rules_multitool//multitool:extension.bzl", "multitool")
95-
use_repo(multitool_root, "actionlint_hub", "multitool", "ruff_hub", "shellcheck_hub", "yamlfmt_hub")
96-
97-
register_toolchains(
98-
"@ruff_hub//toolchains:all",
99-
"@actionlint_hub//toolchains:all",
100-
"@shellcheck_hub//toolchains:all",
101-
"@yamlfmt_hub//toolchains:all",
102-
)

MODULE.bazel.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,7 @@ pre-commit install
3131
pre-commit install --hook-type pre-push
3232
```
3333

34-
Execute the pre-commit manually via `pre-commit`
35-
36-
### Format your documentation with:
37-
38-
```bash
39-
bazel test //src:format.check
40-
bazel run //src:format.fix
41-
```
34+
Execute the pre-commit manually via `pre-commit run` or `pre-commit run --all-files` to run it on all files.
4235

4336
### Find & fix missing copyright
4437

pyproject.toml

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,76 @@
11
# This file is at the root level, as it applies to all Python code,
22
# not only to docs or to tools.
33
[tool.pyright]
4-
extends = "bazel-bin/ide_support.runfiles/score_tooling+/python_basics/pyproject.toml"
4+
# Standard mode + some additional warnings as defined below
5+
typeCheckingMode = "standard"
6+
7+
# Warn if function parameters lack type annotations
8+
reportMissingParameterType = "warning"
9+
10+
# Warn if generic types (e.g. List) are missing type args
11+
reportMissingTypeArgument = "warning"
12+
13+
# Warn when using members marked as private (e.g. _log)
14+
reportPrivateUsage = "warning"
15+
16+
# Warn when variable type can't be inferred or is 'Any'
17+
reportUnknownVariableType = "warning"
18+
19+
# Warn about declared but unused variables
20+
reportUnusedVariable = "warning"
521

622
exclude = [
7-
"**/__pycache__",
8-
"**/.*",
9-
"**/bazel-*",
10-
".venv*/**",
23+
"**/__pycache__",
24+
"**/.*",
25+
"**/bazel-*",
26+
".venv*/**",
1127
]
1228

1329
venvPath = "."
1430
venv = ".venv_docs"
1531

1632
[tool.ruff]
17-
extend = "bazel-bin/ide_support.runfiles/score_tooling+/python_basics/pyproject.toml"
33+
target-version = "py312"
34+
35+
[tool.ruff.lint]
36+
select = [
37+
"E", # pycodestyle (PEP8)
38+
"F", # pyflakes (undefined vars, unused imports)
39+
"I", # isort (import sorting)
40+
"B", # flake8-bugbear (likely bugs)
41+
"C90", # mccabe (complexity checks)
42+
"UP", # pyupgrade (modern Python 3.12+ features)
43+
"SIM", # flake8-simplify (simplifies code patterns)
44+
"RET" # flake8-return (consistent return statements)
1845

19-
extend-exclude = [
20-
"**/__pycache__",
21-
"/.*",
22-
"bazel-*",
23-
".venv*/**",
46+
# FIXME:
47+
# "W", # pycodestyle warnings
48+
# "N", # pep8-naming
49+
# "C4", # flake8-comprehensions
50+
# "TCH", # flake8-type-checking
51+
# "TID", # flake8-tidy-imports
52+
# "RUF", # ruff-specific rules
53+
# "PT", # flake8-pytest-style
54+
# "PIE", # flake8-pie
55+
# "T20", # flake8-print
56+
# "RSE", # flake8-raise
57+
]
58+
ignore = [
59+
"E501", # line too long (handled by formatter)
60+
"T201", # allow print() globally for CLI friendliness
61+
"RET505", # opinionated decision: allow else after if-return for readability
2462
]
63+
64+
65+
[tool.ruff.lint.isort]
66+
combine-as-imports = true
67+
68+
[tool.ruff.lint.per-file-ignores]
69+
"tests/**" = [
70+
"S101", # assert used
71+
]
72+
73+
2574
[tool.pytest.ini_options]
2675
log_cli = true
2776
log_cli_level = "Debug"

scripts/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

scripts/run-linters.sh

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/BUILD

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
1313

14-
load("@aspect_rules_lint//format:defs.bzl", "format_multirun", "format_test")
1514
load("@aspect_rules_py//py:defs.bzl", "py_library")
1615
load("@rules_java//java:java_binary.bzl", "java_binary")
1716
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
@@ -104,26 +103,3 @@ dash_license_checker(
104103
file_type = "requirements",
105104
visibility = ["//visibility:public"],
106105
)
107-
108-
format_multirun(
109-
name = "format.fix",
110-
python = "@aspect_rules_lint//format:ruff",
111-
starlark = "@buildifier_prebuilt//:buildifier",
112-
visibility = [
113-
"//visibility:public",
114-
],
115-
yaml = "@aspect_rules_lint//format:yamlfmt",
116-
)
117-
118-
format_test(
119-
name = "format.check",
120-
no_sandbox = True,
121-
python = "@aspect_rules_lint//format:ruff",
122-
starlark = "@buildifier_prebuilt//:buildifier",
123-
tags = ["manual"],
124-
visibility = [
125-
"//visibility:public",
126-
],
127-
workspace = "//:MODULE.bazel",
128-
yaml = "@aspect_rules_lint//format:yamlfmt",
129-
)

src/extensions/score_metamodel/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,10 @@
2727
# Import and re-export some types and functions for easier access
2828
from src.extensions.score_metamodel.metamodel_types import (
2929
ProhibitedWordCheck as ProhibitedWordCheck,
30-
)
31-
from src.extensions.score_metamodel.metamodel_types import (
3230
ScoreNeedType as ScoreNeedType,
3331
)
3432
from src.extensions.score_metamodel.yaml_parser import (
3533
default_options as default_options,
36-
)
37-
from src.extensions.score_metamodel.yaml_parser import (
3834
load_metamodel_data as load_metamodel_data,
3935
)
4036
from src.helper_lib import config_setdefault

src/extensions/score_source_code_linker/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,7 @@ def build_and_save_repo_scl_file(outdir: Path):
253253

254254

255255
def setup_repo_linker(app: Sphinx, _: BuildEnvironment):
256-
grouped_cache = get_cache_filename(
257-
app.outdir, "score_repo_grouped_scl_cache.json"
258-
)
256+
grouped_cache = get_cache_filename(app.outdir, "score_repo_grouped_scl_cache.json")
259257
grouped_cache_exists = grouped_cache.exists()
260258
# TODO this cache should be done via Bazel
261259
if (
@@ -301,7 +299,7 @@ def setup_once(app: Sphinx):
301299
def setup(app: Sphinx) -> dict[str, str | bool]:
302300
# Esbonio will execute setup() on every iteration.
303301
# setup_once will only be called once.
304-
app.add_config_value("KNOWN_GOOD_JSON", default="",rebuild="env",types=str)
302+
app.add_config_value("KNOWN_GOOD_JSON", default="", rebuild="env", types=str)
305303
setup_once(app)
306304

307305
return {

0 commit comments

Comments
 (0)