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

@@ -26,16 +26,24 @@ function detectGatewayRuntime(programArguments: string[] | undefined): GatewayDa
const first = programArguments?.[0];
if (first) {
const base = path.basename(first).toLowerCase();
if (base === "bun" || base === "bun.exe") return "bun";
if (base === "node" || base === "node.exe") return "node";
if (base === "bun" || base === "bun.exe") {
return "bun";
}
if (base === "node" || base === "node.exe") {
return "node";
}
}
return DEFAULT_GATEWAY_DAEMON_RUNTIME;
}
function findGatewayEntrypoint(programArguments?: string[]): string | null {
if (!programArguments || programArguments.length === 0) return null;
if (!programArguments || programArguments.length === 0) {
return null;
}
const gatewayIndex = programArguments.indexOf("gateway");
if (gatewayIndex <= 0) return null;
if (gatewayIndex <= 0) {
return null;
}
return programArguments[gatewayIndex - 1] ?? null;
}
@@ -44,7 +52,9 @@ function normalizeExecutablePath(value: string): string {
}
function extractDetailPath(detail: string, prefix: string): string | null {
if (!detail.startsWith(prefix)) return null;
if (!detail.startsWith(prefix)) {
return null;
}
const value = detail.slice(prefix.length).trim();
return value.length > 0 ? value : null;
}
@@ -102,7 +112,9 @@ export async function maybeRepairGatewayServiceConfig(
} catch {
command = null;
}
if (!command) return;
if (!command) {
return;
}
const audit = await auditGatewayServiceConfig({
env: process.env,
@@ -115,7 +127,9 @@ export async function maybeRepairGatewayServiceConfig(
const systemNodePath = systemNodeInfo?.supported ? systemNodeInfo.path : null;
if (needsNodeRuntime && !systemNodePath) {
const warning = renderSystemNodeWarning(systemNodeInfo);
if (warning) note(warning, "Gateway runtime");
if (warning) {
note(warning, "Gateway runtime");
}
note(
"System Node 22+ not found. Install via Homebrew/apt/choco and rerun doctor to migrate off Bun/version managers.",
"Gateway runtime",
@@ -148,7 +162,9 @@ export async function maybeRepairGatewayServiceConfig(
});
}
if (audit.issues.length === 0) return;
if (audit.issues.length === 0) {
return;
}
note(
audit.issues
@@ -178,7 +194,9 @@ export async function maybeRepairGatewayServiceConfig(
message: "Update gateway service config to the recommended defaults now?",
initialValue: true,
});
if (!repair) return;
if (!repair) {
return;
}
try {
await service.install({
env: process.env,
@@ -200,7 +218,9 @@ export async function maybeScanExtraGatewayServices(
const extraServices = await findExtraGatewayServices(process.env, {
deep: options.deep,
});
if (extraServices.length === 0) return;
if (extraServices.length === 0) {
return;
}
note(
extraServices.map((svc) => `- ${svc.label} (${svc.scope}, ${svc.detail})`).join("\n"),