[PR #18067] [MERGED] Closes #18022: Extend linter (ruff) to enforce line length limit (120 chars) #15262

Closed
opened 2025-12-30 00:20:57 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/18067
Author: @jeremystretch
Created: 11/21/2024
Status: Merged
Merged: 11/21/2024
Merged by: @jeremystretch

Base: featureHead: 18022-ruff-line-length


📝 Commits (10+)

📊 Changes

200 files changed (+5942 additions, -1684 deletions)

View changed files

📝 netbox/circuits/api/serializers_/circuits.py (+6 -5)
📝 netbox/circuits/filtersets.py (+5 -3)
📝 netbox/circuits/forms/filtersets.py (+4 -1)
📝 netbox/circuits/migrations/0001_squashed.py (+7 -4)
📝 netbox/circuits/migrations/0002_squashed_0029.py (+59 -12)
📝 netbox/circuits/migrations/0003_squashed_0037.py (+1 -2)
📝 netbox/circuits/migrations/0038_squashed_0042.py (+35 -10)
📝 netbox/circuits/migrations/0044_circuit_groups.py (+0 -1)
📝 netbox/circuits/migrations/0045_circuit_distance.py (+0 -1)
📝 netbox/circuits/migrations/0046_charfield_null_choices.py (+1 -5)
📝 netbox/circuits/migrations/0047_circuittermination__termination.py (+6 -10)
📝 netbox/circuits/migrations/0048_circuitterminations_cached_relations.py (+1 -7)
📝 netbox/circuits/migrations/0049_natural_ordering.py (+0 -1)
📝 netbox/circuits/migrations/0050_virtual_circuits.py (+58 -10)
📝 netbox/circuits/models/circuits.py (+3 -1)
📝 netbox/circuits/tables/circuits.py (+2 -1)
📝 netbox/circuits/tests/test_api.py (+9 -3)
📝 netbox/circuits/tests/test_filtersets.py (+129 -15)
📝 netbox/circuits/tests/test_views.py (+9 -3)
📝 netbox/circuits/urls.py (+25 -5)

...and 80 more files

📄 Description

Fixes: #18022

  • Configure ruff to enforce E501 rule w/a limit of 120 characters
  • Exclude netbox/project-static/ and table template code
  • Clean up violating lines

Most of the cleanup was accomplished by running ruff's built-in formatter (similar to Black) against specific sections of files failing the E501 rule. For example

ruff format netbox/extras/tests/test_customfields.py --range 639:1-677:1

will automatically reformat lines 639 through 677 in test_customfields.py.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/18067 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 11/21/2024 **Status:** ✅ Merged **Merged:** 11/21/2024 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `18022-ruff-line-length` --- ### 📝 Commits (10+) - [`189aee6`](https://github.com/netbox-community/netbox/commit/189aee602bfcdf089e6ff6af0b211f8e770cf66f) Enable E501 rule - [`003855f`](https://github.com/netbox-community/netbox/commit/003855ff8b77d76e7a8f2266bcb4608d383ba6ff) Configure ruff formatter - [`b25c744`](https://github.com/netbox-community/netbox/commit/b25c7445012afbfca6109bc0617b0c3954d6aa06) Reformat migration files to fix line length violations - [`7edd1a5`](https://github.com/netbox-community/netbox/commit/7edd1a58c81e3c2e9bdff7aaf782ac9b20489c5e) Fix E501 errors - [`e5001aa`](https://github.com/netbox-community/netbox/commit/e5001aac95f79236ba7827b000eb50dfb42adc2c) Fix E501 errors - [`4bc2bf6`](https://github.com/netbox-community/netbox/commit/4bc2bf6f2e03e3024698e722b5a65588ef431e4f) Fix E501 errors - [`d39dc6d`](https://github.com/netbox-community/netbox/commit/d39dc6d45c4bdbc37af541bc68abf51b01d257fd) Fix E501 errors - [`3b7d8dd`](https://github.com/netbox-community/netbox/commit/3b7d8dd5dbae582420bbca5711c91b5f6d6dd0d8) Fix E501 errors - [`e6698a5`](https://github.com/netbox-community/netbox/commit/e6698a5514f34074fb6ade8c42b62d0fd2e1734f) Move table template code to template_code.py & ignore E501 errors - [`d73ed54`](https://github.com/netbox-community/netbox/commit/d73ed5442bc8efc1354d4ff897cc60d0299c6665) Reformat raw SQL ### 📊 Changes **200 files changed** (+5942 additions, -1684 deletions) <details> <summary>View changed files</summary> 📝 `netbox/circuits/api/serializers_/circuits.py` (+6 -5) 📝 `netbox/circuits/filtersets.py` (+5 -3) 📝 `netbox/circuits/forms/filtersets.py` (+4 -1) 📝 `netbox/circuits/migrations/0001_squashed.py` (+7 -4) 📝 `netbox/circuits/migrations/0002_squashed_0029.py` (+59 -12) 📝 `netbox/circuits/migrations/0003_squashed_0037.py` (+1 -2) 📝 `netbox/circuits/migrations/0038_squashed_0042.py` (+35 -10) 📝 `netbox/circuits/migrations/0044_circuit_groups.py` (+0 -1) 📝 `netbox/circuits/migrations/0045_circuit_distance.py` (+0 -1) 📝 `netbox/circuits/migrations/0046_charfield_null_choices.py` (+1 -5) 📝 `netbox/circuits/migrations/0047_circuittermination__termination.py` (+6 -10) 📝 `netbox/circuits/migrations/0048_circuitterminations_cached_relations.py` (+1 -7) 📝 `netbox/circuits/migrations/0049_natural_ordering.py` (+0 -1) 📝 `netbox/circuits/migrations/0050_virtual_circuits.py` (+58 -10) 📝 `netbox/circuits/models/circuits.py` (+3 -1) 📝 `netbox/circuits/tables/circuits.py` (+2 -1) 📝 `netbox/circuits/tests/test_api.py` (+9 -3) 📝 `netbox/circuits/tests/test_filtersets.py` (+129 -15) 📝 `netbox/circuits/tests/test_views.py` (+9 -3) 📝 `netbox/circuits/urls.py` (+25 -5) _...and 80 more files_ </details> ### 📄 Description ### Fixes: #18022 - Configure ruff to enforce E501 rule w/a limit of 120 characters - Exclude `netbox/project-static/` and table template code - Clean up violating lines Most of the cleanup was accomplished by running ruff's built-in formatter (similar to Black) against specific sections of files failing the E501 rule. For example ``` ruff format netbox/extras/tests/test_customfields.py --range 639:1-677:1 ``` will automatically reformat lines 639 through 677 in `test_customfields.py`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:20:57 +01:00
adam closed this issue 2025-12-30 00:20:57 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15262