Skip to content

Commit 37fb4fc

Browse files
Unbound Ruff (#1342)
By switching to `--fix-only` in our default Ruff hook, I think the breaking change chance lowers enough that it's safe to remove the upper bound in dependencies. Before this tweak, Ruff 0.14 for example would break the generator, as it enforced new lints which the generated code didn't pass. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
1 parent ff34530 commit 37fb4fc

File tree

5 files changed

+36
-25
lines changed

5 files changed

+36
-25
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
default: patch
3+
---
4+
5+
# Change default Ruff hook to `--fix-only`
6+
7+
This should enable `openapi-python-client` to keep auto-fixing lints (like removing unused imports) but _not_ fail to
8+
generate when unfixable lints are violated.
9+
10+
Since it's now unlikely for breaking changes to affect our usage (and by popular request), the upper bound of `ruff`
11+
has been lifted. Newer versions of `openapi-python-client` should no longer be required to support newer versions of `ruff`.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ In the config file, there's an easy way to tell `openapi-python-client` to run a
166166

167167
```yaml
168168
post_hooks:
169-
- "ruff check . --fix"
169+
- "ruff check . --fix-only"
170170
- "ruff format ."
171171
```
172172

openapi_python_client/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ def from_sources(
9595
post_hooks = config_file.post_hooks
9696
elif meta_type == MetaType.NONE:
9797
post_hooks = [
98-
"ruff check . --fix --extend-select=I",
98+
"ruff check . --fix-only --extend-select=I",
9999
"ruff format .",
100100
]
101101
else:
102102
post_hooks = [
103-
"ruff check --fix .",
103+
"ruff check --fix-only .",
104104
"ruff format .",
105105
]
106106

pdm.lock

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies = [
1414
"python-dateutil>=2.8.1,<3.0.0",
1515
"httpx>=0.23.0,<0.29.0",
1616
"ruamel.yaml>=0.18.6,<0.19.0",
17-
"ruff>=0.2,<0.14",
17+
"ruff>=0.2",
1818
]
1919
name = "openapi-python-client"
2020
version = "0.26.2"

0 commit comments

Comments
 (0)