Ruff should enforce maximum line length (120 chars) #10482

Closed
opened 2025-12-29 21:32:05 +01:00 by adam · 1 comment
Owner

Originally created by @jeremystretch on GitHub (Nov 15, 2024).

Originally assigned to: @jeremystretch on GitHub.

Proposed Changes

Configure Ruff to enforce a maximum line length of 120 characters for Python files. This includes:

  • Reformatting existing files as needed (mostly migrations and urls.py)
  • Adding line-length = 120 to ruff.toml
  • Removing the E501 rule from ignore

Justification

NetBox adopted a maximum line length of 120 characters years ago, however it has never been enforced. This will improve linter coverage.

Originally created by @jeremystretch on GitHub (Nov 15, 2024). Originally assigned to: @jeremystretch on GitHub. ### Proposed Changes Configure Ruff to enforce a maximum line length of 120 characters for Python files. This includes: - Reformatting existing files as needed (mostly migrations and `urls.py`) - Adding [`line-length = 120`](https://docs.astral.sh/ruff/settings/#line-length) to `ruff.toml` - Removing the E501 rule from `ignore` ### Justification NetBox adopted a [maximum line length of 120 characters](https://netboxlabs.com/docs/netbox/en/stable/development/style-guide/#e501-line-too-long) years ago, however it has never been enforced. This will improve linter coverage.
adam added the status: acceptedtype: housekeepingnetbox labels 2025-12-29 21:32:05 +01:00
adam closed this issue 2025-12-29 21:32:05 +01:00
Author
Owner

@jeremystretch commented on GitHub (Nov 19, 2024):

Ruff currently shows ~1098 E501 errors in the feature branch. The biggest offenders currently are the migrations, tests, and urls.py files within each app. The migrations can easily be reformatted with Ruff, and #18023 should address the line length violations from URL paths. We might be able to reformat the tests automatically but these ~273 errors might need to be cleaned up manually.

@jeremystretch commented on GitHub (Nov 19, 2024): Ruff currently shows ~1098 E501 errors in the `feature` branch. The biggest offenders currently are the migrations, tests, and `urls.py` files within each app. The migrations can easily be reformatted with Ruff, and #18023 should address the line length violations from URL paths. We might be able to reformat the tests automatically but these ~273 errors might need to be cleaned up manually.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10482