Skip to content

Commit cad785d

Browse files
committed
Fix ruff lint and formatting issues
1 parent adbde7a commit cad785d

3 files changed

Lines changed: 33 additions & 22 deletions

File tree

src/reviewd/daemon.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import contextlib
34
import functools
45
import logging
56
import os
@@ -336,10 +337,8 @@ def run_poll_loop(
336337

337338
# Save terminal settings so we can restore after subprocesses corrupt them
338339
_saved_termios = None
339-
try:
340+
with contextlib.suppress(termios.error, ValueError, OSError):
340341
_saved_termios = termios.tcgetattr(sys.stdin.fileno())
341-
except (termios.error, ValueError, OSError):
342-
pass
343342

344343
executor = ThreadPoolExecutor(max_workers=max_workers, thread_name_prefix='review')
345344
futures: dict[Future, PRInfo] = {}
@@ -348,10 +347,8 @@ def run_poll_loop(
348347

349348
def _restore_terminal():
350349
if _saved_termios is not None:
351-
try:
350+
with contextlib.suppress(termios.error, ValueError, OSError):
352351
termios.tcsetattr(sys.stdin.fileno(), termios.TCSADRAIN, _saved_termios)
353-
except (termios.error, ValueError, OSError):
354-
pass
355352

356353
def _handle_shutdown(_signum, _frame):
357354
nonlocal _force_quit

tests/test_config_env.py

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,44 +16,58 @@ def _write_config(tmp_path, data: dict) -> str:
1616

1717
def test_env_var_substitution(tmp_path, monkeypatch):
1818
monkeypatch.setenv('TEST_GH_TOKEN', 'ghp_secret123')
19-
path = _write_config(tmp_path, {
20-
'github': {'token': '${TEST_GH_TOKEN}'},
21-
'repos': [{'name': 'r', 'path': '/tmp/r', 'provider': 'github'}],
22-
})
19+
path = _write_config(
20+
tmp_path,
21+
{
22+
'github': {'token': '${TEST_GH_TOKEN}'},
23+
'repos': [{'name': 'r', 'path': '/tmp/r', 'provider': 'github'}],
24+
},
25+
)
2326
config = load_global_config(path)
2427
assert config.github.token == 'ghp_secret123'
2528

2629

2730
def test_missing_env_var_raises(tmp_path, monkeypatch):
2831
monkeypatch.delenv('NONEXISTENT_VAR_XYZ', raising=False)
29-
path = _write_config(tmp_path, {
30-
'github': {'token': '${NONEXISTENT_VAR_XYZ}'},
31-
'repos': [{'name': 'r', 'path': '/tmp/r', 'provider': 'github'}],
32-
})
32+
path = _write_config(
33+
tmp_path,
34+
{
35+
'github': {'token': '${NONEXISTENT_VAR_XYZ}'},
36+
'repos': [{'name': 'r', 'path': '/tmp/r', 'provider': 'github'}],
37+
},
38+
)
3339
with pytest.raises(ValueError, match='NONEXISTENT_VAR_XYZ is not set'):
3440
load_global_config(path)
3541

3642

3743
def test_max_concurrent_reviews_parsed(tmp_path):
38-
path = _write_config(tmp_path, {
39-
'max_concurrent_reviews': 8,
40-
'repos': [{'name': 'r', 'path': '/tmp/r', 'provider': 'github'}],
41-
})
44+
path = _write_config(
45+
tmp_path,
46+
{
47+
'max_concurrent_reviews': 8,
48+
'repos': [{'name': 'r', 'path': '/tmp/r', 'provider': 'github'}],
49+
},
50+
)
4251
config = load_global_config(path)
4352
assert config.max_concurrent_reviews == 8
4453

4554

4655
def test_max_concurrent_reviews_default(tmp_path):
47-
path = _write_config(tmp_path, {
48-
'repos': [{'name': 'r', 'path': '/tmp/r', 'provider': 'github'}],
49-
})
56+
path = _write_config(
57+
tmp_path,
58+
{
59+
'repos': [{'name': 'r', 'path': '/tmp/r', 'provider': 'github'}],
60+
},
61+
)
5062
config = load_global_config(path)
5163
assert config.max_concurrent_reviews == 4
5264

5365

5466
def test_git_env_has_terminal_prompt_disabled():
5567
from reviewd.reviewer import _GIT_ENV
68+
5669
assert _GIT_ENV['GIT_TERMINAL_PROMPT'] == '0'
5770

5871
from reviewd.config import _GIT_ENV as _CONFIG_GIT_ENV
72+
5973
assert _CONFIG_GIT_ENV['GIT_TERMINAL_PROMPT'] == '0'

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)