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

@@ -28,7 +28,9 @@ const BACKSPACE_CHAR = "\u0008";
export const CURRENT_MESSAGE_MARKER = "[Current message - respond to this]";
function normalizeMentionPattern(pattern: string): string {
if (!pattern.includes(BACKSPACE_CHAR)) return pattern;
if (!pattern.includes(BACKSPACE_CHAR)) {
return pattern;
}
return pattern.split(BACKSPACE_CHAR).join("\\b");
}
@@ -37,7 +39,9 @@ function normalizeMentionPatterns(patterns: string[]): string[] {
}
function resolveMentionPatterns(cfg: OpenClawConfig | undefined, agentId?: string): string[] {
if (!cfg) return [];
if (!cfg) {
return [];
}
const agentConfig = agentId ? resolveAgentConfig(cfg, agentId) : undefined;
const agentGroupChat = agentConfig?.groupChat;
if (agentGroupChat && Object.hasOwn(agentGroupChat, "mentionPatterns")) {
@@ -69,9 +73,13 @@ export function normalizeMentionText(text: string): string {
}
export function matchesMentionPatterns(text: string, mentionRegexes: RegExp[]): boolean {
if (mentionRegexes.length === 0) return false;
if (mentionRegexes.length === 0) {
return false;
}
const cleaned = normalizeMentionText(text ?? "");
if (!cleaned) return false;
if (!cleaned) {
return false;
}
return mentionRegexes.some((re) => re.test(cleaned));
}
@@ -93,7 +101,9 @@ export function matchesMentionWithExplicit(params: {
if (hasAnyMention && explicitAvailable) {
return explicit || params.mentionRegexes.some((re) => re.test(cleaned));
}
if (!cleaned) return explicit;
if (!cleaned) {
return explicit;
}
return explicit || params.mentionRegexes.some((re) => re.test(cleaned));
}