Przeglądaj źródła

ci: enable bandit ruff checks

- suppress S101 (no assert usage) in tests
- suppress S105 (hardcoded password string) false positives case-by-case
Jason Rumney 2 miesięcy temu
rodzic
commit
a9cb1fac55

+ 1 - 1
custom_components/tuya_local/const.py

@@ -14,7 +14,7 @@ API_PROTOCOL_VERSIONS = [3.3, 3.1, 3.2, 3.4, 3.5, 3.22]
 CONF_APP_TYPE = "tuya_app_type"
 CONF_ENDPOINT = "endpoint"
 CONF_TERMINAL_ID = "terminal_id"
-CONF_TOKEN_INFO = "token_info"
+CONF_TOKEN_INFO = "token_info"  # noqa: S105
 CONF_USER_CODE = "user_code"
 CONF_USERNAME = "username"
 

+ 3 - 5
pyproject.toml

@@ -51,16 +51,14 @@ select = [
   "F",     # pyflakes
   "E",     # pycodestyle
   "W",     # pycodestyle warnings
-#  "S",     # flake8-bandit
+  "S",     # flake8-bandit
   "B",     # flake8-bugbear
   "A",    # flake8-builtins
 ]
-ignore = [
-  "E501",  # Duplicate of format rule, hits on tests
-]
+ignore = ["E501"]  # long lines (checked by ruff format)
 
 [tool.ruff.lint.per-file-ignores]
-"tests/**.py" = ["B011", "B028"]
+"tests/**.py" = ["B011", "B028", "S101"]
 
 [tool.uv.build-backend]
 module-name = ["custom_components.tuya_local", "util"]

+ 1 - 1
tests/devices/test_ailrinni_fplock.py

@@ -6,7 +6,7 @@ from .base_device_tests import TuyaDeviceTestCase
 
 BATTERY_DP = "8"
 UNLOCK_FP_DP = "12"
-UNLOCK_PWD_DP = "13"
+UNLOCK_PWD_DP = "13"  # noqa: S105
 UNLOCK_DYN_DP = "14"
 UNLOCK_BLE_DP = "19"
 ALERT_DP = "21"

+ 1 - 1
tests/devices/test_moebot.py

@@ -19,7 +19,7 @@ ERROR_DP = "102"
 PROBLEM_DP = "103"
 RAINMODE_DP = "104"
 RUNTIME_DP = "105"
-PASSWD_DP = "106"
+PASSWD_DP = "106"  # noqa: S105
 CLEARSCHED_DP = "107"
 QUERYSCHED_DP = "108"
 QUERYZONE_DP = "109"