mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 14:44:32 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -47,8 +47,12 @@ export function formatGatewayChannelsStatusLines(payload: Record<string, unknown
|
||||
typeof account.lastOutboundAt === "number" && Number.isFinite(account.lastOutboundAt)
|
||||
? account.lastOutboundAt
|
||||
: null;
|
||||
if (inboundAt) bits.push(`in:${formatAge(Date.now() - inboundAt)}`);
|
||||
if (outboundAt) bits.push(`out:${formatAge(Date.now() - outboundAt)}`);
|
||||
if (inboundAt) {
|
||||
bits.push(`in:${formatAge(Date.now() - inboundAt)}`);
|
||||
}
|
||||
if (outboundAt) {
|
||||
bits.push(`out:${formatAge(Date.now() - outboundAt)}`);
|
||||
}
|
||||
if (typeof account.mode === "string" && account.mode.length > 0) {
|
||||
bits.push(`mode:${account.mode}`);
|
||||
}
|
||||
@@ -56,9 +60,13 @@ export function formatGatewayChannelsStatusLines(payload: Record<string, unknown
|
||||
const bot = account.bot as { username?: string | null } | undefined;
|
||||
const probeBot = (account.probe as { bot?: { username?: string | null } } | undefined)?.bot;
|
||||
const raw = bot?.username ?? probeBot?.username ?? "";
|
||||
if (typeof raw !== "string") return "";
|
||||
if (typeof raw !== "string") {
|
||||
return "";
|
||||
}
|
||||
const trimmed = raw.trim();
|
||||
if (!trimmed) return "";
|
||||
if (!trimmed) {
|
||||
return "";
|
||||
}
|
||||
return trimmed.startsWith("@") ? trimmed : `@${trimmed}`;
|
||||
})();
|
||||
if (botUsername) {
|
||||
@@ -164,7 +172,9 @@ async function formatConfigChannelsStatusLines(
|
||||
if (meta.mode) {
|
||||
lines.push(`Mode: ${meta.mode}`);
|
||||
}
|
||||
if (meta.path || meta.mode) lines.push("");
|
||||
if (meta.path || meta.mode) {
|
||||
lines.push("");
|
||||
}
|
||||
|
||||
const accountLines = (provider: ChatChannel, accounts: Array<Record<string, unknown>>) =>
|
||||
accounts.map((account) => {
|
||||
@@ -206,7 +216,9 @@ async function formatConfigChannelsStatusLines(
|
||||
const plugins = listChannelPlugins();
|
||||
for (const plugin of plugins) {
|
||||
const accountIds = plugin.config.listAccountIds(cfg);
|
||||
if (!accountIds.length) continue;
|
||||
if (!accountIds.length) {
|
||||
continue;
|
||||
}
|
||||
const snapshots: ChannelAccountSnapshot[] = [];
|
||||
for (const accountId of accountIds) {
|
||||
const snapshot = await buildChannelAccountSnapshot({
|
||||
@@ -235,7 +247,9 @@ export async function channelsStatusCommand(
|
||||
const timeoutMs = Number(opts.timeout ?? 10_000);
|
||||
const statusLabel = opts.probe ? "Checking channel status (probe)…" : "Checking channel status…";
|
||||
const shouldLogStatus = opts.json !== true && !process.stderr.isTTY;
|
||||
if (shouldLogStatus) runtime.log(statusLabel);
|
||||
if (shouldLogStatus) {
|
||||
runtime.log(statusLabel);
|
||||
}
|
||||
try {
|
||||
const payload = await withProgress(
|
||||
{
|
||||
@@ -258,7 +272,9 @@ export async function channelsStatusCommand(
|
||||
} catch (err) {
|
||||
runtime.error(`Gateway not reachable: ${String(err)}`);
|
||||
const cfg = await requireValidConfig(runtime);
|
||||
if (!cfg) return;
|
||||
if (!cfg) {
|
||||
return;
|
||||
}
|
||||
const snapshot = await readConfigFileSnapshot();
|
||||
const mode = cfg.gateway?.mode === "remote" ? "remote" : "local";
|
||||
runtime.log(
|
||||
|
||||
Reference in New Issue
Block a user