Skip to content

Commit 8bf39a5

Browse files
committed
move and update ruff config
1 parent f9a5c9f commit 8bf39a5

File tree

5 files changed

+37
-17
lines changed

5 files changed

+37
-17
lines changed

pyproject.toml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,34 @@ ignore_missing_imports = true
4444
[[tool.mypy.overrides]]
4545
module = "tests.*"
4646
disallow_untyped_defs = false
47+
48+
[tool.ruff]
49+
select = [
50+
"E",
51+
"F",
52+
"W",
53+
"I",
54+
"UP",
55+
"N",
56+
"ANN",
57+
"B",
58+
"A",
59+
"C4",
60+
"PT",
61+
"SIM",
62+
"ARG",
63+
"PTH",
64+
"PL",
65+
"RUF",
66+
]
67+
target-version = "py39"
68+
ignore = [
69+
"E501", # line too long
70+
"ANN101", # annotate self
71+
"ANN102", # annotate cls
72+
"ANN401", # ban Any
73+
]
74+
75+
[tool.ruff.per-file-ignores]
76+
"tests/test_main.py" = [ "S101", "ANN201"]
77+
"tests/test_profiles.py" = [ "S101", "ANN201"]

qbpm/main.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
from pathlib import Path
23
from typing import Any, Callable, NoReturn, Optional
34

@@ -139,7 +140,7 @@ def edit(profile_dir: Path, profile_name: str) -> None:
139140
profile = Profile(profile_name, profile_dir)
140141
if not profile.exists():
141142
error(f"profile {profile.name} not found at {profile.root}")
142-
exit(1)
143+
sys.exit(1)
143144
click.edit(filename=str(profile.root / "config" / "config.py"))
144145

145146

@@ -178,10 +179,10 @@ def session_info(
178179
if not session_path:
179180
tried = ", ".join([str(p.resolve()) for p in session_paths])
180181
error(f"could not find session at the following paths: {tried}")
181-
exit(1)
182+
sys.exit(1)
182183

183184
return (Profile(profile_name or session_path.stem, profile_dir), session_path)
184185

185186

186187
def exit_with(result: bool) -> NoReturn:
187-
exit(0 if result else 1)
188+
sys.exit(0 if result else 1)

qbpm/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
WAYLAND_MENUS = ["fuzzel", "wofi", "dmenu-wl"]
1111
X11_MENUS = ["rofi", "dmenu"]
1212
AUTO_MENUS = WAYLAND_MENUS + X11_MENUS
13-
SUPPORTED_MENUS = AUTO_MENUS + ["fzf", "applescript"]
13+
SUPPORTED_MENUS = [*AUTO_MENUS, "fzf", "applescript"]
1414

1515

1616
def error(msg: str) -> None:

ruff.toml

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/test_profiles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def test_overwrite_config(tmp_path: Path):
6767
profiles.create_config(profile)
6868
profiles.create_config(profile, url, True)
6969
assert list(config_dir.iterdir()) == [config_dir / "config.py"]
70-
with open(config_dir / "config.py") as conf:
70+
with (config_dir / "config.py").open() as conf:
7171
for line in conf:
7272
if url in line:
7373
return

0 commit comments

Comments
 (0)