astral-sh / astral-sh/ruff

Providing the line length, max-complexity, etc in --statistics

Open
#3,755 1 comment 0 reactions 0 assignees View on GitHub
wish
Dominant language
Rust
Stars
49.7k
Forks
2.4k
Avg merge
2d 1h
Merged PRs (30d)
458

Description

@JonathanPlasse

Similar to #3748 but for providing the value for `line-length`, `max-complexity`, `max-args`… when running `ruff --select=ALL --statistics .`

When linting a new repo, I might need to set all seven of the following numbers.
```toml
[tool.ruff]
line-length = 100 # Recommended: 88

[tool.ruff.mccabe]
max-complexity = 15 # Recommended: 10

[tool.ruff.pylint]
max-args = 8 # Recommended: 5
max-branches = 17 # Recommended: 12
max-returns = 12 # Recommended: 6
max-statements = 52 # Recommended: 50
```
It takes a bit of trial and error to find the length of longest line or the most complex function. It would save a lot of time and aggravation if `--statistics` did not just show a random `E501` error but instead showed me the error message from the longest line. I could the copy that `line-length` value and paste it into `pyproject.toml`

Contributor guide

Open the contributing guide

Research direction

Run `ruff --select=ALL --statistics .` on a representative repository and inspect how the current statistics output reports E501 and complexity-related violations. Done means the output exposes the observed values needed to configure `line-length`, `max-complexity`, `max-args`, `max-branches`, `max-returns`, and `max-statements`.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
cli, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.