chore: Enable "curly" rule to avoid single-statement if confusion/errors.

This commit is contained in:
cpojer
2026-01-31 16:19:20 +09:00
parent 009b16fab8
commit 5ceff756e1
1266 changed files with 27871 additions and 9393 deletions

View File

@@ -21,14 +21,20 @@ type RuntimeHintOptions = {
export function formatGatewayRuntimeSummary(
runtime: GatewayServiceRuntime | undefined,
): string | null {
if (!runtime) return null;
if (!runtime) {
return null;
}
const status = runtime.status ?? "unknown";
const details: string[] = [];
if (runtime.pid) details.push(`pid ${runtime.pid}`);
if (runtime.pid) {
details.push(`pid ${runtime.pid}`);
}
if (runtime.state && runtime.state.toLowerCase() !== status) {
details.push(`state ${runtime.state}`);
}
if (runtime.subState) details.push(`sub ${runtime.subState}`);
if (runtime.subState) {
details.push(`sub ${runtime.subState}`);
}
if (runtime.lastExitStatus !== undefined) {
details.push(`last exit ${runtime.lastExitStatus}`);
}
@@ -41,7 +47,9 @@ export function formatGatewayRuntimeSummary(
if (runtime.lastRunTime) {
details.push(`last run time ${runtime.lastRunTime}`);
}
if (runtime.detail) details.push(runtime.detail);
if (runtime.detail) {
details.push(runtime.detail);
}
return details.length > 0 ? `${status} (${details.join(", ")})` : status;
}
@@ -50,7 +58,9 @@ export function buildGatewayRuntimeHints(
options: RuntimeHintOptions = {},
): string[] {
const hints: string[] = [];
if (!runtime) return hints;
if (!runtime) {
return hints;
}
const platform = options.platform ?? process.platform;
const env = options.env ?? process.env;
const fileLog = (() => {
@@ -62,7 +72,9 @@ export function buildGatewayRuntimeHints(
})();
if (platform === "linux" && isSystemdUnavailableDetail(runtime.detail)) {
hints.push(...renderSystemdUnavailableHints({ wsl: isWSLEnv() }));
if (fileLog) hints.push(`File logs: ${fileLog}`);
if (fileLog) {
hints.push(`File logs: ${fileLog}`);
}
return hints;
}
if (runtime.cachedLabel && platform === "darwin") {
@@ -74,12 +86,16 @@ export function buildGatewayRuntimeHints(
}
if (runtime.missingUnit) {
hints.push(`Service not installed. Run: ${formatCliCommand("openclaw gateway install", env)}`);
if (fileLog) hints.push(`File logs: ${fileLog}`);
if (fileLog) {
hints.push(`File logs: ${fileLog}`);
}
return hints;
}
if (runtime.status === "stopped") {
hints.push("Service is loaded but not running (likely exited immediately).");
if (fileLog) hints.push(`File logs: ${fileLog}`);
if (fileLog) {
hints.push(`File logs: ${fileLog}`);
}
if (platform === "darwin") {
const logs = resolveGatewayLogPaths(env);
hints.push(`Launchd stdout (if installed): ${logs.stdoutPath}`);