Skip to content

[TODO]: Ensure ruff & pylint run properly - reinstate automatic running #171

Open

Description

@CoMPaTech

Todo

Both scripts/tests_and_coverage.sh as well as .github/workflows/verify.yaml now have ruff commented out, mostly since it's a chore for correcting (or even adding) docstrings. See #170 where CodeRabbit also wants this fixed (and no I did not and do not intend to disable ruff for that one also).

Updated: added pylint as well ... mypy is tracked in #265 and should not be considered part of this todo/effort.

Activity

  1. CoMPaTech commented on Jun 18, 2025

    @CoMPaTech
    MemberAuthor

    As requested; @dirixmjm ruff is still commented out - I'll branch and start the engines :)

  2. CoMPaTech commented on Jun 18, 2025

    @CoMPaTech
    MemberAuthor

    Added the following ignores to pyproject.toml to ensure 'proper working' - but this is a considerable todo list. Tagged the appropriate things to remove from the toml with FIXFOR171 as a search-string

    • mypy:

    This is still a 'bridge too far' and needs a separate effort to clean up (so it's there in tests_and_coverage but disabled

    • ruff:
    plugwise_usb/connection/manager.py:40:9: D102 Missing docstring in public method
       |
    39 |     @property
    40 |     def queue_depth(self) -> int:
       |         ^^^^^^^^^^^ D102
    41 |         return self._sender.processed_messages - self._receiver.processed_messages
       |
    
    plugwise_usb/connection/manager.py:43:9: D102 Missing docstring in public method
       |
    41 |         return self._sender.processed_messages - self._receiver.processed_messages
    42 |
    43 |     def correct_received_messages(self, correction: int) -> None:
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^ D102
    44 |         self._receiver.correct_processed_messages(correction)
       |
    
    plugwise_usb/helpers/cache.py:83:9: D210 No whitespaces allowed surrounding docstring text
       |
    82 |     async def write_cache(self, data: dict[str, str], rewrite: bool = False) -> None:
    83 |         """ "Save information to cache file."""
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D210
    84 |         if not self._initialized:
    85 |             raise CacheError(
       |
       = help: Trim surrounding whitespace
    
    plugwise_usb/messages/properties.py:114:15: UP031 Use format specifiers instead of percent format
        |
    112 |     def serialize(self) -> bytes:
    113 |         """Return current string formatted value into an iterable list of bytes."""
    114 |         fmt = "%%0%dX" % self.length
        |               ^^^^^^^^ UP031
    115 |         return bytes(fmt % self._raw_value, UTF8)
        |
        = help: Replace with format specifiers
    
    plugwise_usb/messages/properties.py:150:15: UP031 Use format specifiers instead of percent format
        |
    148 |     def serialize(self) -> bytes:
    149 |         """Return current string formatted integer value into an iterable list of bytes."""
    150 |         fmt = "%%0%dX" % self.length
        |               ^^^^^^^^ UP031
    151 |         return bytes(fmt % int_to_uint(self._raw_value, self.length), UTF8)
        |
        = help: Replace with format specifiers
    
    plugwise_usb/messages/properties.py:178:15: UP031 Use format specifiers instead of percent format
        |
    176 |         if not isinstance(self._raw_value, datetime):
    177 |             raise MessageError("Unable to serialize. Value is not a datetime object")
    178 |         fmt = "%%0%dX" % self.length
        |               ^^^^^^^^ UP031
    179 |         date_in_float = self._raw_value.timestamp()
    180 |         return bytes(fmt % int(date_in_float), UTF8)
        |
        = help: Replace with format specifiers
    
    plugwise_usb/messages/properties.py:293:15: UP031 Use format specifiers instead of percent format
        |
    291 |     def serialize(self) -> bytes:
    292 |         """Return current string formatted integer value into an iterable list of bytes."""
    293 |         fmt = "%%0%dd" % self.length
        |               ^^^^^^^^ UP031
    294 |         return bytes(fmt % self._raw_value, UTF8)
        |
        = help: Replace with format specifiers
    
    plugwise_usb/network/__init__.py:21:5: F401 `..messages.requests.CirclePlusAllowJoiningRequest` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
       |
    19 |     CircleClockSetRequest,
    20 |     CircleMeasureIntervalRequest,
    21 |     CirclePlusAllowJoiningRequest,
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F401
    22 |     NodePingRequest,
    23 | )
       |
       = help: Use an explicit re-export: `CirclePlusAllowJoiningRequest as CirclePlusAllowJoiningRequest`
    
    plugwise_usb/nodes/helpers/subscription.py:24:9: D107 Missing docstring in `__init__`
       |
    22 |     """Base Class to call awaitable of subscription when event happens."""
    23 |
    24 |     def __init__(self) -> None:
       |         ^^^^^^^^ D107
    25 |         self._feature_update_subscribers: dict[
    26 |             Callable[[], None],
       |
    
    tests/stick_test_data.py:1:1: D100 Missing docstring in public module
    tests/stick_test_data.py:18:16: UP031 Use format specifiers instead of percent format
       |
    16 |     delta_month = hour_timestamp - hour_timestamp.replace(day=1, hour=0)
    17 |     LOG_TIMESTAMPS[x] = (
    18 |         bytes(("%%0%dX" % 2) % (hour_timestamp.year - 2000), pw_constants.UTF8)
       |                ^^^^^^^^ UP031
    19 |         + bytes(("%%0%dX" % 2) % hour_timestamp.month, pw_constants.UTF8)
    20 |         + bytes(
       |
       = help: Replace with format specifiers
    
    tests/stick_test_data.py:19:18: UP031 Use format specifiers instead of percent format
       |
    17 |     LOG_TIMESTAMPS[x] = (
    18 |         bytes(("%%0%dX" % 2) % (hour_timestamp.year - 2000), pw_constants.UTF8)
    19 |         + bytes(("%%0%dX" % 2) % hour_timestamp.month, pw_constants.UTF8)
       |                  ^^^^^^^^ UP031
    20 |         + bytes(
    21 |             ("%%0%dX" % 4)
       |
       = help: Replace with format specifiers
    
    tests/stick_test_data.py:21:14: UP031 Use format specifiers instead of percent format
       |
    19 |         + bytes(("%%0%dX" % 2) % hour_timestamp.month, pw_constants.UTF8)
    20 |         + bytes(
    21 |             ("%%0%dX" % 4)
       |              ^^^^^^^^ UP031
    22 |             % int((delta_month.days * 1440) + (delta_month.seconds / 60)),
    23 |             pw_constants.UTF8,
       |
       = help: Replace with format specifiers
    
    tests/stick_test_data.py:597:18: UP031 Use format specifiers instead of percent format
        |
    595 |         b"003A"  # msg_id
    596 |         + b"0098765432101234"  # mac
    597 |         + bytes(("%%0%dd" % 2) % utc_now.second, pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    598 |         + bytes(("%%0%dd" % 2) % utc_now.minute, pw_constants.UTF8)
    599 |         + bytes(("%%0%dd" % 2) % utc_now.hour, pw_constants.UTF8)
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:598:18: UP031 Use format specifiers instead of percent format
        |
    596 |         + b"0098765432101234"  # mac
    597 |         + bytes(("%%0%dd" % 2) % utc_now.second, pw_constants.UTF8)
    598 |         + bytes(("%%0%dd" % 2) % utc_now.minute, pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    599 |         + bytes(("%%0%dd" % 2) % utc_now.hour, pw_constants.UTF8)
    600 |         + bytes(("%%0%dd" % 2) % utc_now.weekday(), pw_constants.UTF8)
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:599:18: UP031 Use format specifiers instead of percent format
        |
    597 |         + bytes(("%%0%dd" % 2) % utc_now.second, pw_constants.UTF8)
    598 |         + bytes(("%%0%dd" % 2) % utc_now.minute, pw_constants.UTF8)
    599 |         + bytes(("%%0%dd" % 2) % utc_now.hour, pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    600 |         + bytes(("%%0%dd" % 2) % utc_now.weekday(), pw_constants.UTF8)
    601 |         + bytes(("%%0%dd" % 2) % utc_now.day, pw_constants.UTF8)
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:600:18: UP031 Use format specifiers instead of percent format
        |
    598 |         + bytes(("%%0%dd" % 2) % utc_now.minute, pw_constants.UTF8)
    599 |         + bytes(("%%0%dd" % 2) % utc_now.hour, pw_constants.UTF8)
    600 |         + bytes(("%%0%dd" % 2) % utc_now.weekday(), pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    601 |         + bytes(("%%0%dd" % 2) % utc_now.day, pw_constants.UTF8)
    602 |         + bytes(("%%0%dd" % 2) % utc_now.month, pw_constants.UTF8)
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:601:18: UP031 Use format specifiers instead of percent format
        |
    599 |         + bytes(("%%0%dd" % 2) % utc_now.hour, pw_constants.UTF8)
    600 |         + bytes(("%%0%dd" % 2) % utc_now.weekday(), pw_constants.UTF8)
    601 |         + bytes(("%%0%dd" % 2) % utc_now.day, pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    602 |         + bytes(("%%0%dd" % 2) % utc_now.month, pw_constants.UTF8)
    603 |         + bytes(("%%0%dd" % 2) % (utc_now.year - 2000), pw_constants.UTF8),
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:602:18: UP031 Use format specifiers instead of percent format
        |
    600 |         + bytes(("%%0%dd" % 2) % utc_now.weekday(), pw_constants.UTF8)
    601 |         + bytes(("%%0%dd" % 2) % utc_now.day, pw_constants.UTF8)
    602 |         + bytes(("%%0%dd" % 2) % utc_now.month, pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    603 |         + bytes(("%%0%dd" % 2) % (utc_now.year - 2000), pw_constants.UTF8),
    604 |     ),
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:603:18: UP031 Use format specifiers instead of percent format
        |
    601 |         + bytes(("%%0%dd" % 2) % utc_now.day, pw_constants.UTF8)
    602 |         + bytes(("%%0%dd" % 2) % utc_now.month, pw_constants.UTF8)
    603 |         + bytes(("%%0%dd" % 2) % (utc_now.year - 2000), pw_constants.UTF8),
        |                  ^^^^^^^^ UP031
    604 |     ),
    605 |     b"\x05\x05\x03\x03003E11111111111111111B8A\r\n": (
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:610:18: UP031 Use format specifiers instead of percent format
        |
    608 |         b"003F"  # msg_id
    609 |         + b"1111111111111111"  # mac
    610 |         + bytes(("%%0%dX" % 2) % utc_now.hour, pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    611 |         + bytes(("%%0%dX" % 2) % utc_now.minute, pw_constants.UTF8)
    612 |         + bytes(("%%0%dX" % 2) % utc_now.second, pw_constants.UTF8)
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:611:18: UP031 Use format specifiers instead of percent format
        |
    609 |         + b"1111111111111111"  # mac
    610 |         + bytes(("%%0%dX" % 2) % utc_now.hour, pw_constants.UTF8)
    611 |         + bytes(("%%0%dX" % 2) % utc_now.minute, pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    612 |         + bytes(("%%0%dX" % 2) % utc_now.second, pw_constants.UTF8)
    613 |         + bytes(("%%0%dX" % 2) % utc_now.weekday(), pw_constants.UTF8)
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:612:18: UP031 Use format specifiers instead of percent format
        |
    610 |         + bytes(("%%0%dX" % 2) % utc_now.hour, pw_constants.UTF8)
    611 |         + bytes(("%%0%dX" % 2) % utc_now.minute, pw_constants.UTF8)
    612 |         + bytes(("%%0%dX" % 2) % utc_now.second, pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    613 |         + bytes(("%%0%dX" % 2) % utc_now.weekday(), pw_constants.UTF8)
    614 |         + b"00"  # unknown
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:613:18: UP031 Use format specifiers instead of percent format
        |
    611 |         + bytes(("%%0%dX" % 2) % utc_now.minute, pw_constants.UTF8)
    612 |         + bytes(("%%0%dX" % 2) % utc_now.second, pw_constants.UTF8)
    613 |         + bytes(("%%0%dX" % 2) % utc_now.weekday(), pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    614 |         + b"00"  # unknown
    615 |         + b"0000",  # unknown2
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:622:18: UP031 Use format specifiers instead of percent format
        |
    620 |         b"003F"  # msg_id
    621 |         + b"2222222222222222"  # mac
    622 |         + bytes(("%%0%dX" % 2) % utc_now.hour, pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    623 |         + bytes(("%%0%dX" % 2) % utc_now.minute, pw_constants.UTF8)
    624 |         + bytes(("%%0%dX" % 2) % utc_now.second, pw_constants.UTF8)
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:623:18: UP031 Use format specifiers instead of percent format
        |
    621 |         + b"2222222222222222"  # mac
    622 |         + bytes(("%%0%dX" % 2) % utc_now.hour, pw_constants.UTF8)
    623 |         + bytes(("%%0%dX" % 2) % utc_now.minute, pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    624 |         + bytes(("%%0%dX" % 2) % utc_now.second, pw_constants.UTF8)
    625 |         + bytes(("%%0%dX" % 2) % utc_now.weekday(), pw_constants.UTF8)
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:624:18: UP031 Use format specifiers instead of percent format
        |
    622 |         + bytes(("%%0%dX" % 2) % utc_now.hour, pw_constants.UTF8)
    623 |         + bytes(("%%0%dX" % 2) % utc_now.minute, pw_constants.UTF8)
    624 |         + bytes(("%%0%dX" % 2) % utc_now.second, pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    625 |         + bytes(("%%0%dX" % 2) % utc_now.weekday(), pw_constants.UTF8)
    626 |         + b"00"  # unknown
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:625:18: UP031 Use format specifiers instead of percent format
        |
    623 |         + bytes(("%%0%dX" % 2) % utc_now.minute, pw_constants.UTF8)
    624 |         + bytes(("%%0%dX" % 2) % utc_now.second, pw_constants.UTF8)
    625 |         + bytes(("%%0%dX" % 2) % utc_now.weekday(), pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    626 |         + b"00"  # unknown
    627 |         + b"0000",  # unknown2
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:634:18: UP031 Use format specifiers instead of percent format
        |
    632 |         b"003F"  # msg_id
    633 |         + b"3333333333333333"  # mac
    634 |         + bytes(("%%0%dX" % 2) % utc_now.hour, pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    635 |         + bytes(("%%0%dX" % 2) % utc_now.minute, pw_constants.UTF8)
    636 |         + bytes(("%%0%dX" % 2) % utc_now.second, pw_constants.UTF8)
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:635:18: UP031 Use format specifiers instead of percent format
        |
    633 |         + b"3333333333333333"  # mac
    634 |         + bytes(("%%0%dX" % 2) % utc_now.hour, pw_constants.UTF8)
    635 |         + bytes(("%%0%dX" % 2) % utc_now.minute, pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    636 |         + bytes(("%%0%dX" % 2) % utc_now.second, pw_constants.UTF8)
    637 |         + bytes(("%%0%dX" % 2) % utc_now.weekday(), pw_constants.UTF8)
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:636:18: UP031 Use format specifiers instead of percent format
        |
    634 |         + bytes(("%%0%dX" % 2) % utc_now.hour, pw_constants.UTF8)
    635 |         + bytes(("%%0%dX" % 2) % utc_now.minute, pw_constants.UTF8)
    636 |         + bytes(("%%0%dX" % 2) % utc_now.second, pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    637 |         + bytes(("%%0%dX" % 2) % utc_now.weekday(), pw_constants.UTF8)
    638 |         + b"00"  # unknown
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:637:18: UP031 Use format specifiers instead of percent format
        |
    635 |         + bytes(("%%0%dX" % 2) % utc_now.minute, pw_constants.UTF8)
    636 |         + bytes(("%%0%dX" % 2) % utc_now.second, pw_constants.UTF8)
    637 |         + bytes(("%%0%dX" % 2) % utc_now.weekday(), pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    638 |         + b"00"  # unknown
    639 |         + b"0000",  # unknown2
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:646:18: UP031 Use format specifiers instead of percent format
        |
    644 |         b"003F"  # msg_id
    645 |         + b"4444444444444444"  # mac
    646 |         + bytes(("%%0%dX" % 2) % utc_now.hour, pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    647 |         + bytes(("%%0%dX" % 2) % utc_now.minute, pw_constants.UTF8)
    648 |         + bytes(("%%0%dX" % 2) % utc_now.second, pw_constants.UTF8)
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:647:18: UP031 Use format specifiers instead of percent format
        |
    645 |         + b"4444444444444444"  # mac
    646 |         + bytes(("%%0%dX" % 2) % utc_now.hour, pw_constants.UTF8)
    647 |         + bytes(("%%0%dX" % 2) % utc_now.minute, pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    648 |         + bytes(("%%0%dX" % 2) % utc_now.second, pw_constants.UTF8)
    649 |         + bytes(("%%0%dX" % 2) % utc_now.weekday(), pw_constants.UTF8)
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:648:18: UP031 Use format specifiers instead of percent format
        |
    646 |         + bytes(("%%0%dX" % 2) % utc_now.hour, pw_constants.UTF8)
    647 |         + bytes(("%%0%dX" % 2) % utc_now.minute, pw_constants.UTF8)
    648 |         + bytes(("%%0%dX" % 2) % utc_now.second, pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    649 |         + bytes(("%%0%dX" % 2) % utc_now.weekday(), pw_constants.UTF8)
    650 |         + b"00"  # unknown
        |
        = help: Replace with format specifiers
    
    tests/stick_test_data.py:649:18: UP031 Use format specifiers instead of percent format
        |
    647 |         + bytes(("%%0%dX" % 2) % utc_now.minute, pw_constants.UTF8)
    648 |         + bytes(("%%0%dX" % 2) % utc_now.second, pw_constants.UTF8)
    649 |         + bytes(("%%0%dX" % 2) % utc_now.weekday(), pw_constants.UTF8)
        |                  ^^^^^^^^ UP031
    650 |         + b"00"  # unknown
    651 |         + b"0000",  # unknown2
        |
        = help: Replace with format specifiers
    
    tests/test_usb.py:588:72: E711 Comparison to `None` should be `cond is None`
        |
    586 |         assert stick.nodes["5555555555555555"].node_info.version == "080007"
    587 |         assert stick.nodes["5555555555555555"].node_info.model == "Scan"
    588 |         assert stick.nodes["5555555555555555"].node_info.model_type == None
        |                                                                        ^^^^ E711
    589 |         assert stick.nodes["5555555555555555"].available
    590 |         assert stick.nodes["5555555555555555"].node_info.is_battery_powered
        |
        = help: Replace with `cond is None`
    
    • pylint:
    ************* Module plugwise_usb.messages.requests
    plugwise_usb/messages/requests.py:756:13: W0511: FIXME: Define "absoluteHour" variable (fixme)
    plugwise_usb/messages/requests.py:1004:1: W0511: TODO : Insert (fixme)
    ************* Module plugwise_usb.api
    plugwise_usb/api.py:306:5: W0511: TODO: Move to node with subscription to stick event (fixme)
    plugwise_usb/api.py:310:5: W0511: TODO: Move to node with subscription to stick event (fixme)
    ************* Module plugwise_usb.messages.responses
    plugwise_usb/messages/responses.py:70:5: W0511: TODO: Validate these response types (fixme)
    plugwise_usb/messages/responses.py:596:13: W0511: FIXME 1.0: Define "absoluteHour" variable (fixme)
    plugwise_usb/messages/responses.py:604:13: W0511: FIXME: Define "State_mask" variable (fixme)
    plugwise_usb/messages/responses.py:710:1: W0511: TODO : Insert (fixme)
    ************* Module plugwise_usb.messages.properties
    plugwise_usb/messages/properties.py:155:9: W0511: TODO: negative is not initialized! 20220405 (fixme)
    
  3. changed the title [-][TODO]: Ensure ruff runs properly - reinstate automatic running[/-] [+][TODO]: Ensure ruff & pylint run properly - reinstate automatic running[/+] on Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions