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

@@ -3,7 +3,9 @@ import { normalizeThinkLevel, type ThinkLevel } from "../../auto-reply/thinking.
function extractSupportedValues(raw: string): string[] {
const match =
raw.match(/supported values are:\s*([^\n.]+)/i) ?? raw.match(/supported values:\s*([^\n.]+)/i);
if (!match?.[1]) return [];
if (!match?.[1]) {
return [];
}
const fragment = match[1];
const quoted = Array.from(fragment.matchAll(/['"]([^'"]+)['"]/g)).map((entry) =>
entry[1]?.trim(),
@@ -22,13 +24,21 @@ export function pickFallbackThinkingLevel(params: {
attempted: Set<ThinkLevel>;
}): ThinkLevel | undefined {
const raw = params.message?.trim();
if (!raw) return undefined;
if (!raw) {
return undefined;
}
const supported = extractSupportedValues(raw);
if (supported.length === 0) return undefined;
if (supported.length === 0) {
return undefined;
}
for (const entry of supported) {
const normalized = normalizeThinkLevel(entry);
if (!normalized) continue;
if (params.attempted.has(normalized)) continue;
if (!normalized) {
continue;
}
if (params.attempted.has(normalized)) {
continue;
}
return normalized;
}
return undefined;