mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-14 04:48:35 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -67,21 +67,35 @@ function parseSystemdUnit(content: string): {
|
||||
|
||||
for (const rawLine of content.split(/\r?\n/)) {
|
||||
const line = rawLine.trim();
|
||||
if (!line) continue;
|
||||
if (line.startsWith("#") || line.startsWith(";")) continue;
|
||||
if (line.startsWith("[")) continue;
|
||||
if (!line) {
|
||||
continue;
|
||||
}
|
||||
if (line.startsWith("#") || line.startsWith(";")) {
|
||||
continue;
|
||||
}
|
||||
if (line.startsWith("[")) {
|
||||
continue;
|
||||
}
|
||||
const idx = line.indexOf("=");
|
||||
if (idx <= 0) continue;
|
||||
if (idx <= 0) {
|
||||
continue;
|
||||
}
|
||||
const key = line.slice(0, idx).trim();
|
||||
const value = line.slice(idx + 1).trim();
|
||||
if (!value) continue;
|
||||
if (!value) {
|
||||
continue;
|
||||
}
|
||||
if (key === "After") {
|
||||
for (const entry of value.split(/\s+/)) {
|
||||
if (entry) after.add(entry);
|
||||
if (entry) {
|
||||
after.add(entry);
|
||||
}
|
||||
}
|
||||
} else if (key === "Wants") {
|
||||
for (const entry of value.split(/\s+/)) {
|
||||
if (entry) wants.add(entry);
|
||||
if (entry) {
|
||||
wants.add(entry);
|
||||
}
|
||||
}
|
||||
} else if (key === "RestartSec") {
|
||||
restartSec = value;
|
||||
@@ -92,9 +106,13 @@ function parseSystemdUnit(content: string): {
|
||||
}
|
||||
|
||||
function isRestartSecPreferred(value: string | undefined): boolean {
|
||||
if (!value) return false;
|
||||
if (!value) {
|
||||
return false;
|
||||
}
|
||||
const parsed = Number.parseFloat(value);
|
||||
if (!Number.isFinite(parsed)) return false;
|
||||
if (!Number.isFinite(parsed)) {
|
||||
return false;
|
||||
}
|
||||
return Math.abs(parsed - 5) < 0.01;
|
||||
}
|
||||
|
||||
@@ -170,7 +188,9 @@ async function auditLaunchdPlist(
|
||||
}
|
||||
|
||||
function auditGatewayCommand(programArguments: string[] | undefined, issues: ServiceConfigIssue[]) {
|
||||
if (!programArguments || programArguments.length === 0) return;
|
||||
if (!programArguments || programArguments.length === 0) {
|
||||
return;
|
||||
}
|
||||
if (!hasGatewaySubcommand(programArguments)) {
|
||||
issues.push({
|
||||
code: SERVICE_AUDIT_CODES.gatewayCommandMissing,
|
||||
@@ -209,7 +229,9 @@ function auditGatewayServicePath(
|
||||
env: Record<string, string | undefined>,
|
||||
platform: NodeJS.Platform,
|
||||
) {
|
||||
if (platform === "win32") return;
|
||||
if (platform === "win32") {
|
||||
return;
|
||||
}
|
||||
const servicePath = command?.environment?.PATH;
|
||||
if (!servicePath) {
|
||||
issues.push({
|
||||
@@ -276,7 +298,9 @@ async function auditGatewayRuntime(
|
||||
platform: NodeJS.Platform,
|
||||
) {
|
||||
const execPath = command?.programArguments?.[0];
|
||||
if (!execPath) return;
|
||||
if (!execPath) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isBunRuntime(execPath)) {
|
||||
issues.push({
|
||||
@@ -288,7 +312,9 @@ async function auditGatewayRuntime(
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isNodeRuntime(execPath)) return;
|
||||
if (!isNodeRuntime(execPath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isVersionManagedNodePath(execPath, platform)) {
|
||||
issues.push({
|
||||
|
||||
Reference in New Issue
Block a user