mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 17:01:53 +03:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -45,7 +45,9 @@ export const createIMessageTestPlugin = (params?: {
|
||||
collectStatusIssues: (accounts) =>
|
||||
accounts.flatMap((account) => {
|
||||
const lastError = typeof account.lastError === "string" ? account.lastError.trim() : "";
|
||||
if (!lastError) return [];
|
||||
if (!lastError) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
{
|
||||
channel: "imessage",
|
||||
@@ -61,11 +63,15 @@ export const createIMessageTestPlugin = (params?: {
|
||||
targetResolver: {
|
||||
looksLikeId: (raw) => {
|
||||
const trimmed = raw.trim();
|
||||
if (!trimmed) return false;
|
||||
if (!trimmed) {
|
||||
return false;
|
||||
}
|
||||
if (/^(imessage:|sms:|auto:|chat_id:|chat_guid:|chat_identifier:)/i.test(trimmed)) {
|
||||
return true;
|
||||
}
|
||||
if (trimmed.includes("@")) return true;
|
||||
if (trimmed.includes("@")) {
|
||||
return true;
|
||||
}
|
||||
return /^\+?\d{3,}$/.test(trimmed);
|
||||
},
|
||||
hint: "<handle|chat_id:ID>",
|
||||
|
||||
@@ -2,7 +2,9 @@ import { createServer } from "node:net";
|
||||
import { isMainThread, threadId } from "node:worker_threads";
|
||||
|
||||
async function isPortFree(port: number): Promise<boolean> {
|
||||
if (!Number.isFinite(port) || port <= 0 || port > 65535) return false;
|
||||
if (!Number.isFinite(port) || port <= 0 || port > 65535) {
|
||||
return false;
|
||||
}
|
||||
return await new Promise((resolve) => {
|
||||
const server = createServer();
|
||||
server.once("error", () => resolve(false));
|
||||
@@ -66,7 +68,9 @@ export async function getDeterministicFreePortBlock(params?: {
|
||||
const ok = (await Promise.all(offsets.map((offset) => isPortFree(start + offset)))).every(
|
||||
Boolean,
|
||||
);
|
||||
if (!ok) continue;
|
||||
if (!ok) {
|
||||
continue;
|
||||
}
|
||||
nextTestPortOffset = (nextTestPortOffset + attempt + blockSize) % usable;
|
||||
return start;
|
||||
}
|
||||
@@ -79,7 +83,9 @@ export async function getDeterministicFreePortBlock(params?: {
|
||||
const ok = (await Promise.all(offsets.map((offset) => isPortFree(port + offset)))).every(
|
||||
Boolean,
|
||||
);
|
||||
if (ok) return port;
|
||||
if (ok) {
|
||||
return port;
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error("failed to acquire a free port block");
|
||||
|
||||
Reference in New Issue
Block a user