Skip to content

Commit d777443

Browse files
authored
tooling: Enable ruff preview rules E231, E275, E301, E305, and W391. (#403)
Closes #402. Second round of explicit preview rules, following #400 (E203/E302/E303): E231 — missing whitespace after comma (prevents dense 0,15 in arrays) E275 — missing whitespace after keyword (catches if(...) without space) E301 — blank line between methods in a class E305 — 2 blank lines after function/class definition (symmetric with E302) W391 — too many newlines at end of file Auto-fixed the 5 existing E305 violations, all in example files.
1 parent 4aeb1dc commit d777443

6 files changed

Lines changed: 10 additions & 0 deletions

File tree

lib/wsen-hids/examples/comfort_monitor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def comfort_label(humidity):
1818
else:
1919
return "Humid"
2020

21+
2122
while True:
2223
humidity, temperature = sensor.read_one_shot()
2324
comfort = comfort_label(humidity)

lib/wsen-hids/examples/dew_point.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def dew_point_celsius(temperature_c, humidity):
2020
dp = (b * gamma) / (a - gamma)
2121
return dp
2222

23+
2324
humidity, temperature = sensor.read_one_shot()
2425
dew_point = dew_point_celsius(temperature, humidity)
2526

lib/wsen-pads/examples/altitude.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
def pressure_to_altitude(p):
1515
return 44330 * (1 - (p / SEA_LEVEL_PRESSURE) ** EXPONENT)
1616

17+
1718
for _ in range(10):
1819
pressure, temp = sensor.read()
1920

lib/wsen-pads/examples/pressure_trend.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def get_trend(values):
3333
else:
3434
return "falling"
3535

36+
3637
while True:
3738
pressure = sensor.pressure_hpa()
3839

lib/wsen-pads/examples/temp_pressure_display.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def bar_graph(value, vmin, vmax, width=20):
2828

2929
return "[" + "#" * filled + "-" * (width - filled) + "]"
3030

31+
3132
while True:
3233
pressure, temp = sensor.read()
3334
temp_bar = bar_graph(temp, TEMP_MIN, TEMP_MAX)

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,15 @@ select = [
5050
"E", # pycodestyle
5151
"E203", # (preview) whitespace before ':', ';', or ','
5252
"E225", # (preview) missing whitespace around operator
53+
"E231", # (preview) missing whitespace after ','
5354
"E261", # (preview) at least two spaces before inline comment
5455
"E262", # (preview) inline comment must start with '# '
5556
"E265", # (preview) block comment must start with '# '
57+
"E275", # (preview) missing whitespace after keyword
58+
"E301", # (preview) blank line between methods
5659
"E302", # (preview) expected 2 blank lines before function/class definition
5760
"E303", # (preview) too many blank lines
61+
"E305", # (preview) expected 2 blank lines after function/class definition
5862
"EXE", # flake8-executable
5963
"F", # Pyflakes
6064
"G", # flake8-logging-format
@@ -78,6 +82,7 @@ select = [
7882
"T20", # flake8-print: no print() in production code
7983
"TCH", # flake8-type-checking
8084
"W", # pycodestyle
85+
"W391", # (preview) too many newlines at end of file
8186
"YTT", # flake8-2020
8287
]
8388
ignore = [

0 commit comments

Comments
 (0)