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,10 +21,18 @@ function bindingMatchKey(match: AgentBinding["match"]) {
export function describeBinding(binding: AgentBinding) {
const match = binding.match;
const parts = [match.channel];
if (match.accountId) parts.push(`accountId=${match.accountId}`);
if (match.peer) parts.push(`peer=${match.peer.kind}:${match.peer.id}`);
if (match.guildId) parts.push(`guild=${match.guildId}`);
if (match.teamId) parts.push(`team=${match.teamId}`);
if (match.accountId) {
parts.push(`accountId=${match.accountId}`);
}
if (match.peer) {
parts.push(`peer=${match.peer.kind}:${match.peer.id}`);
}
if (match.guildId) {
parts.push(`guild=${match.guildId}`);
}
if (match.teamId) {
parts.push(`team=${match.teamId}`);
}
return parts.join(" ");
}
@@ -83,7 +91,9 @@ export function applyAgentBindings(
function resolveDefaultAccountId(cfg: OpenClawConfig, provider: ChannelId): string {
const plugin = getChannelPlugin(provider);
if (!plugin) return DEFAULT_ACCOUNT_ID;
if (!plugin) {
return DEFAULT_ACCOUNT_ID;
}
return resolveChannelDefaultAccountId({ plugin, cfg });
}
@@ -122,7 +132,9 @@ export function parseBindingSpecs(params: {
const agentId = normalizeAgentId(params.agentId);
for (const raw of specs) {
const trimmed = raw?.trim();
if (!trimmed) continue;
if (!trimmed) {
continue;
}
const [channelRaw, accountRaw] = trimmed.split(":", 2);
const channel = normalizeChannelId(channelRaw);
if (!channel) {
@@ -141,7 +153,9 @@ export function parseBindingSpecs(params: {
}
}
const match: AgentBinding["match"] = { channel };
if (accountId) match.accountId = accountId;
if (accountId) {
match.accountId = accountId;
}
bindings.push({ agentId, match });
}
return { bindings, errors };