mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 15:54:58 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -20,17 +20,27 @@ export function isMessagingToolDuplicateNormalized(
|
||||
normalized: string,
|
||||
normalizedSentTexts: string[],
|
||||
): boolean {
|
||||
if (normalizedSentTexts.length === 0) return false;
|
||||
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
||||
if (normalizedSentTexts.length === 0) {
|
||||
return false;
|
||||
}
|
||||
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) {
|
||||
return false;
|
||||
}
|
||||
return normalizedSentTexts.some((normalizedSent) => {
|
||||
if (!normalizedSent || normalizedSent.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
||||
if (!normalizedSent || normalizedSent.length < MIN_DUPLICATE_TEXT_LENGTH) {
|
||||
return false;
|
||||
}
|
||||
return normalized.includes(normalizedSent) || normalizedSent.includes(normalized);
|
||||
});
|
||||
}
|
||||
|
||||
export function isMessagingToolDuplicate(text: string, sentTexts: string[]): boolean {
|
||||
if (sentTexts.length === 0) return false;
|
||||
if (sentTexts.length === 0) {
|
||||
return false;
|
||||
}
|
||||
const normalized = normalizeTextForComparison(text);
|
||||
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
||||
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) {
|
||||
return false;
|
||||
}
|
||||
return isMessagingToolDuplicateNormalized(normalized, sentTexts.map(normalizeTextForComparison));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user