Fix ruff lint findings across client, protocol, and tests #27

Merged
kovagoadi merged 1 commits from claude/ruff-import-sorting-bb5651 into main 2026-08-26 21:05:47 +02:00
Owner

Resolve 51 findings from the I/RUF/BLE/TRY002/S110/PLR0402 rule set:

  • Sort imports and all (I001, RUF022, PLR0402). The sys.path.insert
    calls in check_public_calls.py and tests/test_e2e.py still precede the
    openttd imports that depend on them.
  • Replace unused unpacked values with _ (RUF059) and annotate the two
    timetable lookup tables as ClassVar (RUF012).
  • Narrow the best-effort excepts in OpenTTDClient.quit and
    OpenTTDAdminClient.quit to (OSError, SocketClosed) and log at debug
    rather than swallowing silently (BLE001, S110). The test doubles now
    raise an OSError subclass so they still exercise that branch.
  • Narrow the gamescript JSON fallback to json.JSONDecodeError. The broad
    catch in receive_packet keeps a noqa: it guards untrusted wire data and
    must degrade to a no-op packet instead of killing the connection.
  • Use contextlib.suppress instead of try/except/pass in tests.

ruff check . is clean, 102 tests pass, coverage stays at 100%.

Co-Authored-By: Claude [email protected]

Resolve 51 findings from the I/RUF/BLE/TRY002/S110/PLR0402 rule set: - Sort imports and __all__ (I001, RUF022, PLR0402). The sys.path.insert calls in check_public_calls.py and tests/test_e2e.py still precede the openttd imports that depend on them. - Replace unused unpacked values with _ (RUF059) and annotate the two timetable lookup tables as ClassVar (RUF012). - Narrow the best-effort excepts in OpenTTDClient.quit and OpenTTDAdminClient.quit to (OSError, SocketClosed) and log at debug rather than swallowing silently (BLE001, S110). The test doubles now raise an OSError subclass so they still exercise that branch. - Narrow the gamescript JSON fallback to json.JSONDecodeError. The broad catch in receive_packet keeps a noqa: it guards untrusted wire data and must degrade to a no-op packet instead of killing the connection. - Use contextlib.suppress instead of try/except/pass in tests. ruff check . is clean, 102 tests pass, coverage stays at 100%. Co-Authored-By: Claude <[email protected]>
kovagoadi added 1 commit 2026-08-26 21:04:39 +02:00
Fix ruff lint findings across client, protocol, and tests
Continuous Integration / lint-and-security (pull_request) Successful in 20s
Continuous Integration / tests-and-coverage (pull_request) Successful in 25s
25953bea06
Resolve 51 findings from the I/RUF/BLE/TRY002/S110/PLR0402 rule set:

- Sort imports and __all__ (I001, RUF022, PLR0402). The sys.path.insert
  calls in check_public_calls.py and tests/test_e2e.py still precede the
  openttd imports that depend on them.
- Replace unused unpacked values with _ (RUF059) and annotate the two
  timetable lookup tables as ClassVar (RUF012).
- Narrow the best-effort excepts in OpenTTDClient.quit and
  OpenTTDAdminClient.quit to (OSError, SocketClosed) and log at debug
  rather than swallowing silently (BLE001, S110). The test doubles now
  raise an OSError subclass so they still exercise that branch.
- Narrow the gamescript JSON fallback to json.JSONDecodeError. The broad
  catch in receive_packet keeps a noqa: it guards untrusted wire data and
  must degrade to a no-op packet instead of killing the connection.
- Use contextlib.suppress instead of try/except/pass in tests.

ruff check . is clean, 102 tests pass, coverage stays at 100%.

Co-Authored-By: Claude <[email protected]>
kovagoadi merged commit db7fb8e09a into main 2026-08-26 21:05:47 +02:00
kovagoadi deleted branch claude/ruff-import-sorting-bb5651 2026-08-26 21:05:47 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kovagoadi/openttd-client#27