Commit caecb8b
authored
ruff: move per-file-ignores into inline noqa headers (#1457)
## Why
Internal coding guidelines don't allow the centralized
`[tool.ruff.lint.per-file-ignores]` block in `pyproject.toml`.
Exceptions must be annotated inline on the files that need them. Most of
the affected files are generated, so the noqa headers have to come from
the codegen templates.
## What
Removes the `[tool.ruff.lint.per-file-ignores]` block from
`pyproject.toml` and replaces it with inline `# ruff: noqa: <codes>`
headers on the affected files.
## Where the noqas come from
| File set | Codes | Source |
|---|---|---|
| `databricks/sdk/__init__.py` | F401 F403 F405 F811 | codegen template
(`pysdkv0/templates/batch/init.py.tmpl`) |
| `databricks/sdk/service/*.py` + `tests/databricks/sdk/service/*.py` |
F811 F841 | codegen template
(`pysdkv0/templates/packages/service.py.tmpl`) |
| `databricks/sdk/errors/overrides.py` | F403 F405 | codegen template
(`pysdkv0/templates/batch/error_overrides.py.tmpl`) |
| `tests/generated/test_*.py` | F403 F405 | codegen template
(`pysdkv0/unittestgen/{http,lro,marshall,idempotency}`) |
| `databricks/sdk/core.py` | F403 F405 | hand-written (star-imports for
backwards compat) |
| `databricks/sdk/errors/__init__.py` | F401 F403 F405 F811 |
hand-written (public re-export surface) |
| `databricks/sdk/logger/__init__.py` | F401 | hand-written (re-exports
`RoundTrip`) |
| `databricks/sdk/runtime/__init__.py` line 127 | F401 | hand-written
(intentional optional import probe) |
**F401 stays uncovered on `service/*.py` on purpose**: `make fmt` runs
`ruff check --fix-only` to strip the fat-import header emitted by the
codegen template. Ignoring F401 there would defeat that (the
autoflake-equivalent behavior the SDK relies on).
## Paired PR
Template changes land in databricks-eng/universe#2008679. Regenerate via
`bazel build //openapi/genkit` then `genkit update-sdk --dir .` from
this checkout. Generation job runs once a day, so the two PRs are safe
to merge outside of that window.
## Verification
```
$ make lint
uv run ruff check databricks tests
All checks passed!
uv run ruff format --check databricks tests
152 files already formatted
```
This pull request and its description were written by Isaac.
NO_CHANGELOG=true1 parent bcb9b08 commit caecb8b
50 files changed
Lines changed: 134 additions & 25 deletions
File tree
- databricks/sdk
- errors
- logger
- runtime
- service
- tests
- databricks/sdk/service
- generated
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
1 | 6 | | |
2 | 7 | | |
3 | 8 | | |
4 | 9 | | |
5 | 10 | | |
6 | 11 | | |
7 | | - | |
8 | | - | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
1 | 4 | | |
2 | 5 | | |
3 | 6 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments