Skip to content

Commit afcbf37

Browse files
committed
[gobby-cli-#126] chore(ghook): format release candidate
1 parent d86a254 commit afcbf37

1 file changed

Lines changed: 40 additions & 12 deletions

File tree

crates/ghook/src/main.rs

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,25 @@ fn run_gobby_owned(args: &Args) -> ExitCode {
188188
// Enqueue first (atomic write to ~/.gobby/hooks/inbox/).
189189
let inbox = match transport::inbox_dir() {
190190
Ok(d) => d,
191-
Err(e) => return emit_action(action_from_failure(hook_type, &cfg, transport::DeliveryFailureKind::Other, &e.to_string())),
191+
Err(e) => {
192+
return emit_action(action_from_failure(
193+
hook_type,
194+
&cfg,
195+
transport::DeliveryFailureKind::Other,
196+
&e.to_string(),
197+
));
198+
}
192199
};
193200
let enqueued_path = match transport::enqueue_to(&env, &inbox) {
194201
Ok(p) => p,
195-
Err(e) => return emit_action(action_from_failure(hook_type, &cfg, transport::DeliveryFailureKind::Other, &e.to_string())),
202+
Err(e) => {
203+
return emit_action(action_from_failure(
204+
hook_type,
205+
&cfg,
206+
transport::DeliveryFailureKind::Other,
207+
&e.to_string(),
208+
));
209+
}
196210
};
197211

198212
// Detach *after* project walk-up and enqueue — the file on disk is
@@ -209,7 +223,12 @@ fn run_gobby_owned(args: &Args) -> ExitCode {
209223
let body = report.response_body.as_deref().unwrap_or_default();
210224
match action_from_success_response(cfg.source, hook_type, body) {
211225
Ok(action) => action,
212-
Err(error) => action_from_failure(hook_type, &cfg, transport::DeliveryFailureKind::Other, &error),
226+
Err(error) => action_from_failure(
227+
hook_type,
228+
&cfg,
229+
transport::DeliveryFailureKind::Other,
230+
&error,
231+
),
213232
}
214233
}
215234
transport::DeliveryOutcome::Enqueued => {
@@ -220,7 +239,9 @@ fn run_gobby_owned(args: &Args) -> ExitCode {
220239
action_from_failure(
221240
hook_type,
222241
&cfg,
223-
report.failure_kind.unwrap_or(transport::DeliveryFailureKind::Other),
242+
report
243+
.failure_kind
244+
.unwrap_or(transport::DeliveryFailureKind::Other),
224245
&detail,
225246
)
226247
}
@@ -308,9 +329,9 @@ fn action_from_failure(
308329
transport::DeliveryFailureKind::Connect => format!(
309330
"Daemon connection failed on critical hook '{hook_type}' — blocking to fail safe."
310331
),
311-
transport::DeliveryFailureKind::Timeout => format!(
312-
"Hook timeout on critical hook '{hook_type}' — blocking to fail safe."
313-
),
332+
transport::DeliveryFailureKind::Timeout => {
333+
format!("Hook timeout on critical hook '{hook_type}' — blocking to fail safe.")
334+
}
314335
transport::DeliveryFailureKind::Other => format!(
315336
"Hook failure on critical hook '{hook_type}' — blocking to fail safe. Error: {detail}"
316337
),
@@ -454,7 +475,12 @@ mod tests {
454475
.unwrap();
455476

456477
assert_eq!(action.exit_code, 0);
457-
assert!(action.stdout_json.unwrap().contains(r#""permissionDecision":"deny""#));
478+
assert!(
479+
action
480+
.stdout_json
481+
.unwrap()
482+
.contains(r#""permissionDecision":"deny""#)
483+
);
458484
assert_eq!(action.stderr_message, None);
459485
}
460486

@@ -487,10 +513,12 @@ mod tests {
487513
);
488514
assert_eq!(action.exit_code, 2);
489515
assert!(action.stdout_json.is_none());
490-
assert!(action
491-
.stderr_message
492-
.unwrap()
493-
.contains("Hook error on critical hook 'SessionStart'"));
516+
assert!(
517+
action
518+
.stderr_message
519+
.unwrap()
520+
.contains("Hook error on critical hook 'SessionStart'")
521+
);
494522
}
495523

496524
#[test]

0 commit comments

Comments
 (0)