danielgtaylor / danielgtaylor/python-betterproto
Use Ruff on generated code (can replace isort)
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 234
- PR merge metrics
- No merged PRs in 30d
Description
https://beta.ruff.rs
Config example:
```toml
# pyproject.toml
[tool.ruff]
# https://beta.ruff.rs/docs/rules
line-length = 88 # Default
select = ["ALL"]
ignore = [
# "D203",
# "D213",
"D",
"RUF009", # See `extend-immutable-calls`
"ERA001", # Detects comments as code
# "A003", # See `builtins-ignorelist`
"UP006", # https://github.com/danielgtaylor/python-betterproto/issues/485
]
[tool.ruff.flake8-builtins]
builtins-ignorelist = ["id", "type"]
[tool.ruff.flake8-bugbear]
# https://github.com/charliermarsh/ruff/issues/4355
extend-immutable-calls = ["betterproto.*"]
```
It's possible to have it only emulate isort, but I've tried to enable as much as possible from it, which is still incredibly fast.
Can be run as `ruff check --fix`.
Contributor guide
Research direction
Start by locating the generated-code formatting configuration and any existing isort setup, then review the Ruff documentation linked in the issue. Run `ruff check --fix` against the generated code and verify that Ruff provides the intended checks while replacing the current isort use; the issue's configuration example shows the expected direction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100