Add global ruff linter; unify python/ onto repo-wide ruff#5726
Merged
Conversation
Collaborator
Integration test reportCommit: d558ecf
23 interesting tests: 13 SKIP, 7 KNOWN, 2 flaky, 1 RECOVERED
Top 1 slowest tests (at least 2 minutes):
|
c84f8a4 to
9c46636
Compare
Adds `ruff check` (lint) alongside the existing `ruff format`, scoped to first-party Python scripts via the `lint-python` task and wired into `task lint`/`lint-q` and CI. The lint config lives in ruff.toml. The python/databricks-bundles package drops its own ruff config, dev dependency, and CI step and relies on the global ruff. As a result python/ is now formatted at the repo-wide line-length 120 (was the implicit 88). Co-authored-by: Isaac
Co-authored-by: Isaac
Add python/ruff.toml that extends the root config but overrides line-length back to 88, so the databricks-bundles package keeps its own formatting while inheriting the global lint rules. Regenerate the package so the committed generated code matches codegen output under ruff 0.15.17. Co-authored-by: Isaac
Co-authored-by: Isaac
Adds python/docs, the acceptance infra scripts (install_terraform.py, dbr_runner.py), and the permissions/user_agent test helper scripts to the ruff lint scope, and fixes their findings (import sorting, exception chaining, `is` type comparisons). dbr_runner.py ignores F821 (it is a DBR notebook using the injected `spark`/`dbutils` globals). Co-authored-by: Isaac
Co-authored-by: Isaac
Switches `ruff check` from an explicit allowlist to whole-repo (`ruff check .`), so first-party Python everywhere (cmd/, bundle/, internal/, libs/, integration/, acceptance/bin, ...) is linted, not just a hand-maintained list. Excludes are split by intent in ruff.toml: - lint.exclude (lint-only; still formatted): acceptance fixtures, .py.tmpl template sources, the .vscode Pylance stub. - extend-exclude (lint and format): generated `bundle init` outputs, testdata, and tagging.py. These must be pruned during traversal because they carry their own nested ruff config a lint-only exclude can't reach; formatting generated outputs is unnecessary anyway. ruff check runs with --no-cache because some excluded fixtures carry their own pyproject.toml/ruff.toml, and ruff would otherwise write a .ruff_cache into those checked-in dirs and break the acceptance tests. Co-authored-by: Isaac
7d0387e to
d558ecf
Compare
pietern
approved these changes
Jun 29, 2026
| - name: Run Go lint checks (does not include formatting checks) | ||
| - name: Run Go and Python lint checks (does not include formatting checks) | ||
| # `task lint` runs golangci-lint and `ruff check` (lint-python). ruff is | ||
| # provided by uvx, installed above; formatting is checked by `task fmt` below. |
Contributor
There was a problem hiding this comment.
Strictly speaking is not provided by uvx but installed on demand, right?
Contributor
Author
There was a problem hiding this comment.
Yes, uvx downloads it when ran if not in its cache already.
| # acceptance fixtures carry their own pyproject.toml/ruff.toml (config | ||
| # roots), so without it ruff writes a .ruff_cache into those checked-in | ||
| # dirs, polluting the goldens and breaking the acceptance tests. | ||
| - "{{.RUFF}} check --no-cache ." |
Contributor
There was a problem hiding this comment.
Is it possible to do this selectively?
Contributor
Author
There was a problem hiding this comment.
do what selectively? apply ruff to specific folder? or disable cache for specific folders?
Collaborator
Integration test reportCommit: 7669453
24 interesting tests: 13 SKIP, 8 KNOWN, 2 flaky, 1 FAIL
Top 4 slowest tests (at least 2 minutes):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
ruff check(linter) alongside the existing globalruff format. The enabled rule set (seeruff.toml) is intentionally conservative; opinionated/large-migration groups (pep8-naming, pyupgrade, simplify, pathlib, ...) are deferred to a follow-up.What changed
task lintnow runsruff check .. Excludes are split inruff.toml: acceptance fixtures and template sources are lint-only excludes (still formatted); generatedbundle initoutputs,testdata, andtagging.pyare excluded from both (they carry their own nested ruff config and don't need formatting). Run with--no-cacheso ruff doesn't write.ruff_cacheinto checked-in fixture dirs.python/unification: thedatabricks-bundlespackage drops its own ruff lint config, dev dependency, and CI ruff step, relying on the global ruff. It keeps a minimalpython/ruff.tomlthat extends the root but pinsline-length = 88, so its formatting is unchanged.task lintnow covers Python; the redundant standaloneruff-actionformat step is removed (formatting is still gated bytask fmt+git diff).This pull request and its description were written by Isaac.