Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jeremystretch opened this issue Nov 15, 2024 · 1 comment
Closed

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

jeremystretch opened this issue Nov 15, 2024 · 1 comment
Assignees
Labels
netbox status: accepted This issue has been accepted for implementation type: housekeeping Changes to the application which do not directly impact the end user

Comments

@jeremystretch
Copy link
Member

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.

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation type: housekeeping Changes to the application which do not directly impact the end user labels Nov 15, 2024
@jeremystretch jeremystretch self-assigned this Nov 15, 2024
@jeremystretch jeremystretch changed the title Ruff should enforce maximum line melgtnh (120 chars) Ruff should enforce maximum line length (120 chars) Nov 15, 2024
@jeremystretch jeremystretch added the netbox label Nov 15, 2024 — with Linear
@jeremystretch
Copy link
Member Author

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 added a commit that referenced this issue Nov 21, 2024
… chars) (#18067)

* Enable E501 rule
* Configure ruff formatter
* Reformat migration files to fix line length violations
* Fix various E501 errors
* Move table template code to template_code.py & ignore E501 errors
* Reformat raw SQL
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
netbox status: accepted This issue has been accepted for implementation type: housekeeping Changes to the application which do not directly impact the end user
Projects
None yet
Development

No branches or pull requests

1 participant