Skip to content

Commit c50087d

Browse files
committed
tooling: Enable ruff S110 to detect try-except-pass.
1 parent 1f060e6 commit c50087d

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

lib/lis2mdl/lis2mdl/device.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@ def __init__(
5454

5555
# Perform a soft reset to ensure the sensor starts in a known state.
5656
self._write_reg(LIS2MDL_CFG_REG_A, 0x20) # SOFT_RST=1 (not 0x10)
57-
try:
58-
sleep_ms(10) # Small delay for reset to complete
59-
except Exception:
60-
pass
57+
sleep_ms(10) # Small delay for reset to complete
6158

6259
# Configure the sensor's operating mode, output data rate, and other settings.
6360
odr_bits = {10: 0b00, 20: 0b01, 50: 0b10, 100: 0b11}.get(odr_hz, 0b00)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ select = [
6868
"PYI", # flake8-pyi
6969
"RSE", # flake8-raise
7070
"RUF", # Ruff-specific rules
71+
"S110", # flake8-bandit: try-except-pass (no silent exception suppression)
7172
"SIM", # flake8-simplify
7273
"T10", # flake8-debugger
7374
"PERF", # Perflint

tests/report_plugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ def _get_board_info(port):
4040
"platform": lines[4],
4141
}
4242
except Exception:
43-
pass
43+
# Best-effort: report metadata is optional, never fail the test session.
44+
return {}
4445
return {}
4546

4647

0 commit comments

Comments
 (0)