Skip to content

Commit 6f4f7f5

Browse files
committed
Update Ruff configuration
This resolves two warnings about Ruff configuration, by: - No longer setting `ignore-init-module-imports = true` explicitly, which was deprecated since `ruff` 0.4.4. We primarily use `ruff` via `pre-commit`, for which this deprecation has applied since we upgraded the version in `.pre-commit-config.yaml` from 0.4.3 to 0.6.0 in d1582d1 (gitpython-developers#1953). We continue to list `F401` ("Module imported but unused") as not automatically fixable, to avoid inadvertently removing imports that may be needed. See also: https://docs.astral.sh/ruff/settings/#lint_ignore-init-module-imports - Rename the rule `TCH004` to `TC004`, since `TCH004` is the old name that may eventually be removed and that is deprecated since 0.8.0. We upgraded `ruff` in `.pre-commit-config.yml` again in b7ce712 (gitpython-developers#2031), from 0.6.0 to 0.11.12, at which point this deprecation applied. See also https://astral.sh/blog/ruff-v0.8.0. These changes make those configuration-related warnings go away, and no new diagnostics (errors/warnings) are produced when running `ruff check` or `pre-commit run --all-files`. No F401-related diagnostics are triggered when testing with explicit `ignore-init-module-imports = false`, in preview mode or otherwise. In addition, this commit makes two changes that are not needed to resolve warnings: - Stop excluding `E203` ("Whitespace before ':'"). That diagnostic is no longer failing with the current code here in the current version of `ruff`, and code changes that would cause it to fail would likely be accidentally mis-st - Add the version lower bound `>=0.8` for `ruff` in `requirements-dev.txt`. That file is rarely used, as noted in a8a73ff (gitpython-developers#1871), but as long as we have it, there may be a benefit to excluding dependency versions for which our configuration is no longer compatible. This is the only change in this commit outside of `pyproject.toml`.
1 parent 1b79d44 commit 6f4f7f5

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

pyproject.toml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,14 @@ lint.select = [
6060
# "UP", # See: https://docs.astral.sh/ruff/rules/#pyupgrade-up
6161
]
6262
lint.extend-select = [
63-
# "A", # See: https://pypi.org/project/flake8-builtins
64-
"B", # See: https://pypi.org/project/flake8-bugbear
65-
"C4", # See: https://pypi.org/project/flake8-comprehensions
66-
"TCH004", # See: https://docs.astral.sh/ruff/rules/runtime-import-in-type-checking-block/
63+
# "A", # See: https://pypi.org/project/flake8-builtins
64+
"B", # See: https://pypi.org/project/flake8-bugbear
65+
"C4", # See: https://pypi.org/project/flake8-comprehensions
66+
"TC004", # See: https://docs.astral.sh/ruff/rules/runtime-import-in-type-checking-block/
6767
]
6868
lint.ignore = [
69-
"E203", # Whitespace before ':'
7069
"E731", # Do not assign a `lambda` expression, use a `def`
7170
]
72-
lint.ignore-init-module-imports = true
7371
lint.unfixable = [
7472
"F401", # Module imported but unused
7573
]

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
-r test-requirements.txt
33

44
# For additional local testing/linting - to be added elsewhere eventually.
5-
ruff
5+
ruff >=0.8
66
shellcheck
77
pytest-icdiff
88
# pytest-profiling

0 commit comments

Comments
 (0)