mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 20:48:26 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -104,7 +104,9 @@ export function createHookRunner(registry: PluginRegistry, options: HookRunnerOp
|
||||
ctx: Parameters<NonNullable<PluginHookRegistration<K>["handler"]>>[1],
|
||||
): Promise<void> {
|
||||
const hooks = getHooksForName(registry, hookName);
|
||||
if (hooks.length === 0) return;
|
||||
if (hooks.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
logger?.debug?.(`[hooks] running ${hookName} (${hooks.length} handlers)`);
|
||||
|
||||
@@ -135,7 +137,9 @@ export function createHookRunner(registry: PluginRegistry, options: HookRunnerOp
|
||||
mergeResults?: (accumulated: TResult | undefined, next: TResult) => TResult,
|
||||
): Promise<TResult | undefined> {
|
||||
const hooks = getHooksForName(registry, hookName);
|
||||
if (hooks.length === 0) return undefined;
|
||||
if (hooks.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
logger?.debug?.(`[hooks] running ${hookName} (${hooks.length} handlers, sequential)`);
|
||||
|
||||
@@ -323,7 +327,9 @@ export function createHookRunner(registry: PluginRegistry, options: HookRunnerOp
|
||||
ctx: PluginHookToolResultPersistContext,
|
||||
): PluginHookToolResultPersistResult | undefined {
|
||||
const hooks = getHooksForName(registry, "tool_result_persist");
|
||||
if (hooks.length === 0) return undefined;
|
||||
if (hooks.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let current = event.message;
|
||||
|
||||
@@ -347,7 +353,9 @@ export function createHookRunner(registry: PluginRegistry, options: HookRunnerOp
|
||||
}
|
||||
|
||||
const next = (out as PluginHookToolResultPersistResult | undefined)?.message;
|
||||
if (next) current = next;
|
||||
if (next) {
|
||||
current = next;
|
||||
}
|
||||
} catch (err) {
|
||||
const msg = `[hooks] tool_result_persist handler from ${hook.pluginId} failed: ${String(err)}`;
|
||||
if (catchErrors) {
|
||||
|
||||
Reference in New Issue
Block a user