Skip to content

Commit

Permalink
Add various lints
Browse files Browse the repository at this point in the history
  • Loading branch information
lbonn committed Feb 20, 2024
1 parent 2301a27 commit e43a196
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions i3_quickterm/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ def read_conf(fn) -> Conf:

try:
with open(fn, "r") as f:
c = json.load(f)
return c
return json.load(f)
except Exception as e:
print(f"invalid config file: {e}", file=sys.stderr)
return {}
Expand Down Expand Up @@ -157,7 +156,8 @@ def select_terminal(term_fmt: str) -> str:
f"Could not find a suitable terminal "
f"in the predefined list: {sorted(TERMS.keys())}"
)
elif term_fmt in TERMS:

if term_fmt in TERMS:
# one of the pre-configured terminals
return cast(str, TERMS.get(term_fmt))

Expand Down Expand Up @@ -433,5 +433,5 @@ def main(argv=None):
try:
sys.exit(main(sys.argv[1:]))
except Exception:
print(traceback.format_exc())
print(traceback.format_exc(), file=sys.stderr)
sys.exit(1)
2 changes: 2 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[lint]
select = ["E4", "E7", "E9", "F", "A", "B", "PIE", "RET", "RUF"]
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def conf(tmp_path):
"menu": "/bin/true",
"term": "xterm",
"shells": {"shell": "bash"},
"history": f"{str(tmp_path / 'shells.order')}",
"history": str(tmp_path / "shells.order"),
}
)
return c
Expand Down

0 comments on commit e43a196

Please sign in to comment.