Skip to content

Commit cda1f2f

Browse files
committed
chore(ruff): Manual fixes for cli/load.py
rc/tmuxp/cli/load.py:122:13: PERF203 `try`-`except` within a loop incurs performance overhead src/tmuxp/cli/load.py:124:89: E501 Line too long (93 > 88 characters)
1 parent ba9caf1 commit cda1f2f

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/tmuxp/cli/load.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ def set_layout_hook(session: Session, hook_name: str) -> None:
9191
hook_cmd.append("selectw -p")
9292

9393
# unset the hook immediately after executing
94-
hook_cmd.append(
95-
f"set-hook -u -t {session.id} {hook_name}"
96-
)
94+
hook_cmd.append(f"set-hook -u -t {session.id} {hook_name}")
9795
hook_cmd.append(f"selectw -t {attached_window.id}")
9896

9997
# join the hook's commands with semicolons
@@ -117,11 +115,26 @@ def load_plugins(session_config: t.Dict[str, t.Any]) -> t.List[t.Any]:
117115
module_name = plugin.split(".")
118116
module_name = ".".join(module_name[:-1])
119117
plugin_name = plugin.split(".")[-1]
118+
except Exception as error:
119+
tmuxp_echo(
120+
style("[Plugin Error] ", fg="red")
121+
+ f"Couldn't load {plugin}\n"
122+
+ style(f"{error}", fg="yellow")
123+
)
124+
sys.exit(1)
125+
126+
try:
120127
plugin = getattr(importlib.import_module(module_name), plugin_name)
121128
plugins.append(plugin())
122129
except exc.TmuxpPluginException as error:
123130
if not prompt_yes_no(
124-
"{}Skip loading {}?".format(style(str(error), fg="yellow"), plugin_name),
131+
"{}Skip loading {}?".format(
132+
style(
133+
str(error),
134+
fg="yellow",
135+
),
136+
plugin_name,
137+
),
125138
default=True,
126139
):
127140
tmuxp_echo(

0 commit comments

Comments
 (0)