style: Format code and logging calls for readability#5
Conversation
Signed-off-by: wallentx <william.allentx@gmail.com>
| mt = _api_retry(nb.dcim.module_types.create, create_params) | ||
| logger.info("Auto-created module type '%s / %s' (profile=%s)", vendor, product, profile_name) | ||
| logger.info( | ||
| "Auto-created module type '%s / %s' (profile=%s)", vendor, product, profile_name |
| mt = _api_retry(nb.dcim.module_types.create, create_params) | ||
| logger.info("Auto-created module type '%s / %s' (profile=%s)", vendor, product, profile_name) | ||
| logger.info( | ||
| "Auto-created module type '%s / %s' (profile=%s)", vendor, product, profile_name |
| logger.warning("Duplicate serial '%s' found on %d modules — using first match", serial, len(results)) | ||
| logger.warning( | ||
| "Duplicate serial '%s' found on %d modules — using first match", | ||
| serial, |
| logger.info( | ||
| "Created module %s serial=%s on %s bay=%s", | ||
| item["product"], serial, self.device.name, bay.name, | ||
| item["product"], |
| "Created module %s serial=%s on %s bay=%s", | ||
| item["product"], serial, self.device.name, bay.name, | ||
| item["product"], | ||
| serial, |
| logger.info( | ||
| "Created module %s (no serial) on %s bay=%s", | ||
| item["product"], self.device.name, bay.name, | ||
| item["product"], |
| "Skipping non-Ethernet MAC on %s: %s (%d chars)", | ||
| interface, mac, len(mac), | ||
| interface, | ||
| mac, |
There was a problem hiding this comment.
Pull request overview
This PR applies ruff format (and related auto-fixes) across the codebase to align with the repository’s Ruff configuration and resolve CI/style failures reported in PR #4.
Changes:
- Reformats Python sources (tests, scripts, and
netbox_agent/) for consistent line wrapping, indentation, and call formatting. - Adjusts multi-argument logging and long literals for readability without changing behavior.
- Adds
# noqa: E402in a few tests to accommodate intentional import ordering aftersys.modulespatching.
Reviewed changes
Copilot reviewed 38 out of 40 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_state.py | Removes stray whitespace-only line; formatting only. |
| tests/test_network_ip.py | Wraps config/lists and logging call arguments for readability; formatting only. |
| tests/test_modules.py | Wraps long literals/patch contexts; adds # noqa: E402 for intentional import placement. |
| tests/test_ipmi.py | Wraps patch contexts and spacing; formatting only. |
| tests/test_fixture_integration.py | Wraps long literals, patch contexts, and asserts; adds # noqa: E402 where needed. |
| tests/test_dependencies.py | Removes whitespace-only line and adds blank lines between sections; formatting only. |
| scripts/validation/validate_record_completeness.py | Wraps dict literals and long print line; formatting only. |
| scripts/schema/08_run_all_schema_setup.py | Wraps long tuple entry; formatting only. |
| scripts/schema/07_create_spare_inventory_device.py | Wraps logger calls and request payload dicts; formatting only. |
| scripts/schema/06_update_device_types_module_bay_templates.py | Wraps logger args and create payloads; formatting only. |
| scripts/schema/05_create_module_types.py | Expands large literals and wraps _ensure_module_type calls; formatting only. |
| scripts/schema/04_create_module_type_profiles.py | Wraps schema dict formatting and logger/create payloads; formatting only. |
| scripts/schema/03_create_custom_fields.py | Wraps logger calls and create payload dict; formatting only. |
| scripts/schema/02_create_custom_field_choice_sets.py | Wraps logger call; formatting only. |
| scripts/rollback/delete_all_modules.py | Wraps long getattr expression; formatting only. |
| scripts/migration/verify_modules_vs_inventory.py | Wraps long getattr expression; formatting only. |
| scripts/migration/migrate_ipam.py | Adds section-spacing blank lines and wraps long calls/argparse; formatting only. |
| scripts/migration/cleanup_legacy_bays.py | Wraps argparse construction; formatting only. |
| scripts/migration/cleanup_bad_modules.py | Wraps long print lines; formatting only. |
| scripts/migration/assign_asset_tags.py | Wraps argparse argument definition; formatting only. |
| scripts/infra/pdus/sync_asset_tags.py | Wraps dict literals, prints, headers, argparse; formatting only. |
| scripts/infra/pdus/delete_garbage_entries.py | Wraps multiline f-strings/prints; formatting only. |
| scripts/infra/credentials/validate_machines_csv.py | Wraps dict literals, subprocess args, CSV headers/rows; formatting only. |
| scripts/infra/credentials/sync_to_1password.py | Wraps dict and argparse construction, subprocess invocation formatting; formatting only. |
| scripts/infra/credentials/push_to_vaults.py | Wraps subprocess/run args and prints; formatting only. |
| scripts/infra/compute/sync_asset_tags.py | Wraps dict literals, prints, argparse, list comprehension formatting; formatting only. |
| scripts/fixtures/collect_hardware_fixture.py | Wraps subprocess argument lists and summary prints; formatting only. |
| scripts/arp_discover.py | Wraps constants, argparse, prints, and long ssh command string; formatting only. |
| netbox_agent/vendors/supermicro.py | Wraps debug logging calls and generator expression; formatting only. |
| netbox_agent/state.py | Collapses mkstemp call into a single line; formatting only. |
| netbox_agent/server.py | Wraps long constants, subprocess calls, list comprehensions, and logging args; formatting only. |
| netbox_agent/network.py | Wraps long expressions, list/filter calls, and logging; formatting only. |
| netbox_agent/modules.py | Wraps literals and logging; keeps logic intact while improving readability. |
| netbox_agent/misc.py | Wraps logging and exception formatting; formatting only. |
| netbox_agent/lshw.py | Wraps large constant set and dict append literal; formatting only. |
| netbox_agent/ipmi.py | Wraps debug/info logging and subprocess invocation; formatting only. |
| netbox_agent/ethtool.py | Applies Ruff slice spacing format; formatting only. |
| netbox_agent/dependencies.py | Aligns TOOLS dict formatting; formatting only. |
| netbox_agent/cli.py | Wraps netbox_create_or_update call and ARP reporter import block; formatting only. |
| netbox_agent/arp_reporter.py | Wraps subprocess.run calls, tuple constants, and conditional expression formatting; formatting only. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Great catch. Btw, we only touch 'fgpu' branch and I have some code still on 'ethan' that I have been waiting to merge. Not sure if that is still relevant but we have been intending to leave 'master' untouched to handle upstream merges as needed. |
|
Oh glad you already saw these @ereinha3! It'd probably be good to change everything back to using the If we can make ruff fully pass without too much effort, that'd be excellent. Similar for the token issue I mentioned in #4, but none of this is so urgent it should distract from already-promised deliverables. |
I saw that all tests were failing in #4 due to it needing
ruff format, and possiblyruff check --fix, so I've applied those.