refactor: clean up dead code and redundant checks
This commit is contained in:
parent
177c724fdf
commit
8a716964bb
3 changed files with 12 additions and 10 deletions
|
|
@ -191,7 +191,6 @@ export async function runCli(
|
|||
|
||||
// If help is requested for a specific command, show command-specific help
|
||||
if (wantsCommandHelp) {
|
||||
const isHelpFlag = (arg: string) => arg === "--help" || arg === "-h";
|
||||
const actualSubcommand = isHelpFlag(subcommand) ? undefined : subcommand;
|
||||
showCommandHelp(command, cmdConf, actualSubcommand);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -86,17 +86,13 @@ function collectResults(
|
|||
addResult("Database URL format", isDbValid, isDbValid ? "valid" : "invalid");
|
||||
}
|
||||
|
||||
const isConfigured =
|
||||
const isForgejoConfigured =
|
||||
config.forgejoBaseUrl && config.forgejoPat && config.forgejoBotUsername;
|
||||
|
||||
if (!isConfigured) {
|
||||
return results;
|
||||
if (isForgejoConfigured) {
|
||||
addResult("Forgejo configured", true);
|
||||
}
|
||||
|
||||
const { forgejoBaseUrl, forgejoPat, forgejoBotUsername } = config;
|
||||
|
||||
addResult("Forgejo configured", true);
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
|
|
@ -186,13 +182,20 @@ async function verifyResults(
|
|||
return;
|
||||
}
|
||||
|
||||
if (forgejoResults.length < 3) {
|
||||
if (forgejoResults.length === 0) {
|
||||
s.stop("No Forgejo configuration");
|
||||
p.cancel(`${c.red("Error:")} Forgejo not configured`);
|
||||
process.exitCode = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (forgejoResults.length < 3) {
|
||||
s.stop("Incomplete Forgejo checks");
|
||||
p.cancel(`${c.red("Error:")} Could not complete all Forgejo checks`);
|
||||
process.exitCode = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
s.stop("Verification complete");
|
||||
|
||||
const reachability = forgejoResults[0]!;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export async function checkForgejoReachability(
|
|||
): Promise<CheckResult> {
|
||||
try {
|
||||
const response = await fetchWithTimeout(baseUrl, { method: "GET" });
|
||||
if (response.ok || response.status === 200) {
|
||||
if (response.ok) {
|
||||
return createCheckResult("Forgejo reachability", true);
|
||||
}
|
||||
return createCheckResult(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue