Commit 7cae06e
chore: Adopt ruff for unused-import enforcement
Merge #6097
## Summary
Adopts **ruff** to enforce unused-import (F401) hygiene going forward, so dead imports are caught automatically instead of relying on IDE highlights. (The bulk one-time cleanup already landed in #6095; this is just the tooling.)
- `[tool.ruff]` in `pyproject.toml`: select `F401`, exempt `__init__.py` (intentional public re-exports), and exclude four files that hardcode `googleapis.com` URLs so cleanup doesn't trip the `check-file-contents` mTLS policy.
- ruff pre-commit hook scoped to `src/`.
- `scripts/run_precommit_checks.py` (the no-git standalone runner) learns the ruff hook, passing `--force-exclude` so excludes are honored on explicit file args.
- Pin `ruff` in the dev extra to match the hook version.
## Test plan
- [x] `ruff check src/` passes (excludes honored)
- [x] pre-commit ruff hook runs green
- [x] standalone runner check/fix modes verified
Co-authored-by: Wei Sun (Jack) <weisun@google.com>
COPYBARA_INTEGRATE_REVIEW=#6097 from google:chore/adopt-ruff-f401 b063652
PiperOrigin-RevId: 9313040521 parent b79096a commit 7cae06e
3 files changed
Lines changed: 36 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
14 | 20 | | |
15 | 21 | | |
16 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
| |||
260 | 261 | | |
261 | 262 | | |
262 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
263 | 283 | | |
264 | 284 | | |
265 | 285 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
98 | 103 | | |
99 | 104 | | |
100 | 105 | | |
| |||
317 | 322 | | |
318 | 323 | | |
319 | 324 | | |
320 | | - | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
321 | 330 | | |
322 | 331 | | |
323 | 332 | | |
| |||
0 commit comments