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

@@ -133,7 +133,9 @@ export async function handleDirectiveOnly(params: {
allowedModelCatalog,
resetModelOverride,
});
if (modelInfo) return modelInfo;
if (modelInfo) {
return modelInfo;
}
const modelResolution = resolveModelSelectionFromDirective({
directives,
@@ -146,7 +148,9 @@ export async function handleDirectiveOnly(params: {
allowedModelCatalog,
provider,
});
if (modelResolution.errorText) return { text: modelResolution.errorText };
if (modelResolution.errorText) {
return { text: modelResolution.errorText };
}
const modelSelection = modelResolution.modelSelection;
const profileOverride = modelResolution.profileOverride;
@@ -267,7 +271,9 @@ export async function handleDirectiveOnly(params: {
channel: provider,
sessionEntry,
});
if (queueAck) return queueAck;
if (queueAck) {
return queueAck;
}
if (
directives.hasThinkDirective &&
@@ -301,8 +307,11 @@ export async function handleDirectiveOnly(params: {
let reasoningChanged =
directives.hasReasoningDirective && directives.reasoningLevel !== undefined;
if (directives.hasThinkDirective && directives.thinkLevel) {
if (directives.thinkLevel === "off") delete sessionEntry.thinkingLevel;
else sessionEntry.thinkingLevel = directives.thinkLevel;
if (directives.thinkLevel === "off") {
delete sessionEntry.thinkingLevel;
} else {
sessionEntry.thinkingLevel = directives.thinkLevel;
}
}
if (shouldDowngradeXHigh) {
sessionEntry.thinkingLevel = "high";
@@ -311,8 +320,11 @@ export async function handleDirectiveOnly(params: {
applyVerboseOverride(sessionEntry, directives.verboseLevel);
}
if (directives.hasReasoningDirective && directives.reasoningLevel) {
if (directives.reasoningLevel === "off") delete sessionEntry.reasoningLevel;
else sessionEntry.reasoningLevel = directives.reasoningLevel;
if (directives.reasoningLevel === "off") {
delete sessionEntry.reasoningLevel;
} else {
sessionEntry.reasoningLevel = directives.reasoningLevel;
}
reasoningChanged =
directives.reasoningLevel !== prevReasoningLevel && directives.reasoningLevel !== undefined;
}
@@ -351,7 +363,9 @@ export async function handleDirectiveOnly(params: {
delete sessionEntry.queueCap;
delete sessionEntry.queueDrop;
} else if (directives.hasQueueDirective) {
if (directives.queueMode) sessionEntry.queueMode = directives.queueMode;
if (directives.queueMode) {
sessionEntry.queueMode = directives.queueMode;
}
if (typeof directives.debounceMs === "number") {
sessionEntry.queueDebounceMs = directives.debounceMs;
}
@@ -427,14 +441,24 @@ export async function handleDirectiveOnly(params: {
? formatDirectiveAck("Elevated mode set to full (auto-approve).")
: formatDirectiveAck("Elevated mode set to ask (approvals may still apply)."),
);
if (shouldHintDirectRuntime) parts.push(formatElevatedRuntimeHint());
if (shouldHintDirectRuntime) {
parts.push(formatElevatedRuntimeHint());
}
}
if (directives.hasExecDirective && directives.hasExecOptions) {
const execParts: string[] = [];
if (directives.execHost) execParts.push(`host=${directives.execHost}`);
if (directives.execSecurity) execParts.push(`security=${directives.execSecurity}`);
if (directives.execAsk) execParts.push(`ask=${directives.execAsk}`);
if (directives.execNode) execParts.push(`node=${directives.execNode}`);
if (directives.execHost) {
execParts.push(`host=${directives.execHost}`);
}
if (directives.execSecurity) {
execParts.push(`security=${directives.execSecurity}`);
}
if (directives.execAsk) {
execParts.push(`ask=${directives.execAsk}`);
}
if (directives.execNode) {
execParts.push(`node=${directives.execNode}`);
}
if (execParts.length > 0) {
parts.push(formatDirectiveAck(`Exec defaults set (${execParts.join(", ")}).`));
}
@@ -471,6 +495,8 @@ export async function handleDirectiveOnly(params: {
parts.push(formatDirectiveAck(`Queue drop set to ${directives.dropPolicy}.`));
}
const ack = parts.join(" ").trim();
if (!ack && directives.hasStatusDirective) return undefined;
if (!ack && directives.hasStatusDirective) {
return undefined;
}
return { text: ack || "OK." };
}