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

@@ -22,14 +22,18 @@ async function resolveApiKeyFromProfiles(params: {
});
for (const profileId of order) {
const cred = store.profiles[profileId];
if (cred?.type !== "api_key") continue;
if (cred?.type !== "api_key") {
continue;
}
const resolved = await resolveApiKeyForProfile({
cfg: params.cfg,
store,
profileId,
agentDir: params.agentDir,
});
if (resolved?.apiKey) return resolved.apiKey;
if (resolved?.apiKey) {
return resolved.apiKey;
}
}
return null;
}
@@ -45,10 +49,14 @@ export async function resolveNonInteractiveApiKey(params: {
allowProfile?: boolean;
}): Promise<{ key: string; source: NonInteractiveApiKeySource } | null> {
const flagKey = params.flagValue?.trim();
if (flagKey) return { key: flagKey, source: "flag" };
if (flagKey) {
return { key: flagKey, source: "flag" };
}
const envResolved = resolveEnvApiKey(params.provider);
if (envResolved?.apiKey) return { key: envResolved.apiKey, source: "env" };
if (envResolved?.apiKey) {
return { key: envResolved.apiKey, source: "env" };
}
if (params.allowProfile ?? true) {
const profileKey = await resolveApiKeyFromProfiles({
@@ -56,7 +64,9 @@ export async function resolveNonInteractiveApiKey(params: {
cfg: params.cfg,
agentDir: params.agentDir,
});
if (profileKey) return { key: profileKey, source: "profile" };
if (profileKey) {
return { key: profileKey, source: "profile" };
}
}
const profileHint =