chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -89,21 +89,27 @@ export function registerSecurityCli(program: Command) {
|
||||
for (const action of fixResult.actions) {
|
||||
if (action.kind === "chmod") {
|
||||
const mode = action.mode.toString(8).padStart(3, "0");
|
||||
if (action.ok) lines.push(muted(` chmod ${mode} ${shortenHomePath(action.path)}`));
|
||||
else if (action.skipped)
|
||||
if (action.ok) {
|
||||
lines.push(muted(` chmod ${mode} ${shortenHomePath(action.path)}`));
|
||||
} else if (action.skipped) {
|
||||
lines.push(
|
||||
muted(` skip chmod ${mode} ${shortenHomePath(action.path)} (${action.skipped})`),
|
||||
);
|
||||
else if (action.error)
|
||||
} else if (action.error) {
|
||||
lines.push(
|
||||
muted(` chmod ${mode} ${shortenHomePath(action.path)} failed: ${action.error}`),
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
const command = shortenHomeInString(action.command);
|
||||
if (action.ok) lines.push(muted(` ${command}`));
|
||||
else if (action.skipped) lines.push(muted(` skip ${command} (${action.skipped})`));
|
||||
else if (action.error) lines.push(muted(` ${command} failed: ${action.error}`));
|
||||
if (action.ok) {
|
||||
lines.push(muted(` ${command}`));
|
||||
} else if (action.skipped) {
|
||||
lines.push(muted(` skip ${command} (${action.skipped})`));
|
||||
} else if (action.error) {
|
||||
lines.push(muted(` ${command} failed: ${action.error}`));
|
||||
}
|
||||
}
|
||||
if (fixResult.errors.length > 0) {
|
||||
for (const err of fixResult.errors) {
|
||||
@@ -118,7 +124,9 @@ export function registerSecurityCli(program: Command) {
|
||||
|
||||
const render = (sev: "critical" | "warn" | "info") => {
|
||||
const list = bySeverity(sev);
|
||||
if (list.length === 0) return;
|
||||
if (list.length === 0) {
|
||||
return;
|
||||
}
|
||||
const label =
|
||||
sev === "critical"
|
||||
? rich
|
||||
@@ -136,7 +144,9 @@ export function registerSecurityCli(program: Command) {
|
||||
for (const f of list) {
|
||||
lines.push(`${theme.muted(f.checkId)} ${f.title}`);
|
||||
lines.push(` ${f.detail}`);
|
||||
if (f.remediation?.trim()) lines.push(` ${muted(`Fix: ${f.remediation.trim()}`)}`);
|
||||
if (f.remediation?.trim()) {
|
||||
lines.push(` ${muted(`Fix: ${f.remediation.trim()}`)}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user