Browse Source

disable pylint's similarity checks locally

Fabian Peter Hammerle 1 year ago
parent
commit
f0f5e96b77

+ 0 - 7
.pylintrc

@@ -3,13 +3,6 @@
 disable=missing-function-docstring,
         missing-module-docstring
 
-[SIMILARITIES]
-
-# avoid marking param list of implementation as duplicate of abstract declaration
-# https://github.com/PyCQA/pylint/issues/3239
-# https://github.com/PyCQA/pylint/issues/214
-min-similarity-lines=7
-
 [DESIGN]
 
 max-args=8

+ 2 - 1
switchbot_mqtt/_actors/__init__.py

@@ -157,7 +157,7 @@ class _CurtainMotor(_MQTTControlledActor):
 
     def _report_position(
         self,
-        mqtt_client: paho.mqtt.client.Client,
+        mqtt_client: paho.mqtt.client.Client,  # pylint: disable=duplicate-code; similar param list
         mqtt_topic_prefix: str,
     ) -> None:
         # > position_closed integer (Optional, default: 0)
@@ -287,6 +287,7 @@ class _CurtainMotor(_MQTTControlledActor):
 
     @classmethod
     def _get_mqtt_message_callbacks(
+        # pylint: disable=duplicate-code; param list in parent class
         cls,
         *,
         enable_device_info_update_topic: bool,

+ 3 - 1
switchbot_mqtt/_actors/base.py

@@ -178,6 +178,7 @@ class _MQTTControlledActor(abc.ABC):
 
     @classmethod
     def _mqtt_update_device_info_callback(
+        # pylint: disable=duplicate-code; other callbacks with same params
         cls,
         mqtt_client: paho.mqtt.client.Client,
         userdata: _MQTTCallbackUserdata,
@@ -201,7 +202,7 @@ class _MQTTControlledActor(abc.ABC):
             )
 
     @abc.abstractmethod
-    def execute_command(
+    def execute_command(  # pylint: disable=duplicate-code; implementations
         self,
         *,
         mqtt_message_payload: bytes,
@@ -213,6 +214,7 @@ class _MQTTControlledActor(abc.ABC):
 
     @classmethod
     def _mqtt_command_callback(
+        # pylint: disable=duplicate-code; other callbacks with same params
         cls,
         mqtt_client: paho.mqtt.client.Client,
         userdata: _MQTTCallbackUserdata,

+ 1 - 0
tests/test_actor_base.py

@@ -37,6 +37,7 @@ def test_abstract() -> None:
 
 def test_execute_command_abstract() -> None:
     class _ActorMock(switchbot_mqtt._actors.base._MQTTControlledActor):
+        # pylint: disable=duplicate-code
         def __init__(
             self, mac_address: str, retry_count: int, password: typing.Optional[str]
         ) -> None:

+ 4 - 3
tests/test_switchbot_button_automator.py

@@ -16,6 +16,10 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
+# pylint: disable=protected-access
+# pylint: disable=too-many-arguments; these are tests, no API
+# pylint: disable=duplicate-code; similarities with tests for curtain motor
+
 import logging
 import typing
 import unittest.mock
@@ -26,9 +30,6 @@ import pytest
 
 from switchbot_mqtt._actors import _ButtonAutomator
 
-# pylint: disable=protected-access
-# pylint: disable=too-many-arguments; these are tests, no API
-
 
 @pytest.mark.parametrize("prefix", ["homeassistant/", "prefix-", ""])
 @pytest.mark.parametrize("mac_address", ["{MAC_ADDRESS}", "aa:bb:cc:dd:ee:ff"])