Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a robust, Bazel-managed framework for TCL linting and formatting, which is a great improvement for developer experience and CI consistency. The use of py_console_script_binary to manage tool dependencies is excellent. The new umbrella targets //:lint_test and //:lint are well-designed for future extension. My feedback includes a couple of minor suggestions to improve maintainability and robustness.
|
clang-tidy review says "All clean, LGTM! 👍" |
|
@hzeller Thoughs? |
|
I'll wait for @hzeller 's thoughts |
|
This is now starting to use pip with OpenROAD, which is kindof side-stepping what bazel is doing (managing dependencies itself). It makes it harder to use, as this won't run on a hardened system anymore that prevents side-loading. So, I am not a fan. So like |
- Rename //:lint to //:fix_lint to clarify it modifies files (gadfort) - Replace duplicated sh_binary with alias(actual = ":tcl_tidy") (gemini) - Add BUILD_WORKSPACE_DIRECTORY fallback in tcl_tidy.sh (gemini) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
I find dependencies for all the CI rules to be a pain to manage, I much rather that the OpenROAD project takes responsibility for this and provides bazelisk run XXX to do whatever needs doing and bazel tests that I can run locally to check whatever needs checking without me having to worry about tools: fast local workflows for AI and hoomans. |
|
clang-tidy review says "All clean, LGTM! 👍" |
Add tclint==0.7.0 to pip requirements for Bazel-managed TCL linting and formatting. This is the same version used by the GitHub Actions workflow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Expose tclint and tclfmt as py_console_script_binary targets from the pip-managed tclint package. Add wrapper shell scripts that invoke these tools against the workspace root. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Add Bazel targets for TCL linting and formatting: - //:tcl_lint_test — runs tclint (lint rules) - //:tcl_fmt_test — runs tclfmt --check (formatting) - //:tcl_tidy — runs tclfmt --in-place (auto-format) - //:lint_test — umbrella test_suite for all lint checks - //:lint — umbrella auto-fix target Designed for extension with additional linters (C++ tidy, etc). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Document the new Bazel lint targets, usage, configuration, how to add new linters, and planned additions (clang-tidy, clang-format, ruff, buildifier, shellcheck, doc checks, duplicate ID checks). Explain why Bazel is the right tool for managing linter dependencies: hermetic, version-pinned, reproducible across dev machines and CI. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
- Rename //:lint to //:fix_lint to clarify it modifies files (gadfort) - Replace duplicated sh_binary with alias(actual = ":tcl_tidy") (gemini) - Add BUILD_WORKSPACE_DIRECTORY fallback in tcl_tidy.sh (gemini) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Rename tcl_lint_test → lint_tcl_test, tcl_fmt_test → fmt_tcl_test, tcl_tidy → tidy_tcl for consistent verb-first naming with _test suffix per Bazel convention. Update docs to match. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
|
clang-tidy review says "All clean, LGTM! 👍" |
Bazel lint and tidy targets for TCL
Summary
tclintandtclfmtviapy_console_script_binary— no manual pip installsbazelisk test //:lint_test(all checks) andbazelisk run //:lint(auto-fix)Motivation
The GitHub Actions workflow
.github/workflows/github-actions-lint-tcl.ymlrunstclintandtclfmtchecks by creating a virtualenv andpip install tclint==0.7.0on every CI run. Thisis brittle: the version is pinned in a YAML file that can drift, developers can't easily run
the same checks locally without replicating the CI environment, and there's no way to test the
linting setup itself.
By moving to Bazel, tool versions are pinned in
bazel/requirements.inwith a lock file forreproducibility, Bazel manages the Python toolchain and all transitive dependencies hermetically,
and developers get a single command that works identically on every machine.
What changed
pip: add tclint dependencytclint==0.7.0inbazel/requirements.in, regenerated lock filebazel: add tclint/tclfmt console script binariespy_console_script_binarytargets inbazel/BUILD, wrapper shell scriptsbazel: add lint_test and lint umbrella targetssh_test,sh_binary,test_suitein rootBUILD.bazeldocs: add lint targets documentationdocs/contrib/LintTargets.mdUsage
Design decisions
py_console_script_binary: Idiomatic rules_python way to expose pip console scripts asBazel targets — Bazel manages the full dependency tree hermetically
tags = ["local"]: Lint checks need access to the full source tree spanning Bazelsubpackages —
localtag bypasses sandbox//:lint_testis atest_suite,//:lintis ansh_binary— bothdesigned to grow as more linters are added (C++, Python, Bazel files, shell scripts)
$1: The$(rootpath //bazel:tclint)arg lets Bazelresolve the tool binary; scripts resolve it before
cdto workspace rootBackwards compatibility
Planned additions to
//:lint_testand//:lintTest plan
bazelisk test //:lint_test— 2/2 pass (tcl_lint_test, tcl_fmt_test)bazelisk run //:lint— auto-formats successfullybazelisk run //:tcl_tidy— auto-formats successfully