style(cli): satisfy pinned clippy for the GitHub host lookups

This commit is contained in:
Dávid Balatoni 2026-10-25 10:05:15 +01:00
parent 4caf79abd6
commit 2bf8f6fb84
No known key found for this signature in database
8 changed files with 20 additions and 11 deletions

View file

@ -22,6 +22,7 @@ use crate::args::{GraphArgs, GraphDirection, GraphOutputFormat};
use crate::command_context::CommandContext;
use crate::commands::run::output::api_diagnostics_to_local;
use crate::shared::{absolute_or_current, print_diagnostics, print_json_pretty, relative_path};
use crate::user_config;
pub(crate) async fn run(
args: &GraphArgs,
@ -39,7 +40,7 @@ pub(crate) async fn run(
cwd: ctx.cwd().to_path_buf(),
environment_defaults: fabro_environment::seeded_catalog_layer(),
user_settings_path: Some(active_settings_path(None)),
github_host: crate::user_config::github_host()?,
github_host: user_config::github_host()?,
..Default::default()
})?;
let client = ctx.server().await?;

View file

@ -12,6 +12,7 @@ use crate::commands::run::output::{
use crate::commands::run::overrides::preflight_args_overrides;
use crate::manifest_args::preflight_manifest_args;
use crate::shared::{cyan_spinner, print_json_pretty};
use crate::user_config;
pub(crate) async fn execute(
mut args: PreflightArgs,
@ -32,7 +33,7 @@ pub(crate) async fn execute(
args: preflight_manifest_args(&args),
environment_defaults: fabro_environment::seeded_catalog_layer(),
user_settings_path: Some(active_settings_path(None)),
github_host: crate::user_config::github_host()?,
github_host: user_config::github_host()?,
})?;
let spinner = (!ctx.json_output()).then(|| cyan_spinner("Running checks..."));

View file

@ -11,6 +11,7 @@ use tokio::task::spawn_blocking;
use crate::args::{RepoInitArgs, ServerTargetArgs};
use crate::command_context::CommandContext;
use crate::user_config;
#[expect(
clippy::disallowed_methods,
@ -193,7 +194,7 @@ async fn check_github_app_installation(target: &ServerTargetArgs, base_ctx: &Com
};
// Convert SSH URL to HTTPS and parse owner/repo
let Ok(host) = crate::user_config::github_host() else {
let Ok(host) = user_config::github_host() else {
return; // Unreadable server settings — skip silently
};
let https_url = fabro_github::ssh_url_to_https(&remote_url);

View file

@ -14,7 +14,7 @@ use super::{resolution, selection};
use crate::args::RunArgs;
use crate::command_context::CommandContext;
use crate::commands::resolve_run_id;
use crate::user_config::{RunSettingsKeyPresence, read_project_run_settings_key_presence};
use crate::user_config::{self, RunSettingsKeyPresence, read_project_run_settings_key_presence};
pub(crate) struct CreatedRun {
pub(crate) run_id: RunId,
@ -105,7 +105,7 @@ pub(crate) async fn create_run(
&& args.target_repo_selector.is_none() =>
{
fabro_manifest::configured_repo_origin_url_for_location(
&crate::user_config::github_host()?,
&user_config::github_host()?,
package.workflow_location(),
)?
}

View file

@ -109,7 +109,7 @@ use tracing::{info, warn};
use super::publish;
use super::runner::{self, WorkerTitlePhase};
use crate::args::RunWorkerMode;
use crate::command_context;
use crate::{command_context, user_config};
/// What the worker holds when it hands a run to Petri.
pub(super) struct PetriWorker<'a> {
@ -221,7 +221,7 @@ pub(super) async fn execute(worker: PetriWorker<'_>) -> Result<()> {
None
}
};
let github_host = crate::user_config::github_host()?;
let github_host = user_config::github_host()?;
let read_tokens =
publish::read_token_source(&worker.run_state.spec, github.as_ref(), &github_host);
runtime.stage_credentials = StageCredentials::for_run(

View file

@ -7,6 +7,7 @@ use tokio::task;
use super::remote_workflow::{Interruption, NativeGit};
use super::selection::{TargetSelection, WorkflowSelection};
use crate::user_config;
/// Owns the canonical collector result without copying its contents. Local
/// location metadata remains available for settings warnings and target
@ -55,7 +56,7 @@ pub(super) async fn workflow(
selector,
revision,
} => {
let git = NativeGit::new(crate::user_config::github_host()?);
let git = NativeGit::new(user_config::github_host()?);
let (repository, selector, revision) =
(repository.clone(), selector.clone(), revision.clone());
let closure = interruption
@ -84,7 +85,7 @@ pub(super) async fn target(
if !provider.clones_workspace() {
bail!("Git targets require a clone-enabled environment");
}
let git = NativeGit::new(crate::user_config::github_host()?);
let git = NativeGit::new(user_config::github_host()?);
let (repository, branch) = (repository.clone(), branch.clone());
let target = interruption
.owned(move |cancel| async move {
@ -101,7 +102,7 @@ pub(super) async fn target(
// The existing observer can push/query Git synchronously. Preserve its
// behavior without blocking a Tokio worker or promising a new timeout.
let provider = provider.clone();
let host = crate::user_config::github_host()?;
let host = user_config::github_host()?;
let configured_repo_origin_url = configured_repo_origin_url.map(str::to_owned);
let derived = task::spawn_blocking(move || {
fabro_manifest::derive_run_target_for_provider(

View file

@ -10,6 +10,7 @@ use crate::args::ValidateArgs;
use crate::command_context::CommandContext;
use crate::commands::run::output::api_diagnostics_to_local;
use crate::shared::{print_diagnostics, print_json_pretty, relative_path};
use crate::user_config;
pub(crate) fn run(
args: &ValidateArgs,
@ -22,7 +23,7 @@ pub(crate) fn run(
cwd: base_ctx.cwd().to_path_buf(),
environment_defaults: fabro_environment::seeded_catalog_layer(),
user_settings_path: Some(active_settings_path(None)),
github_host: crate::user_config::github_host()?,
github_host: user_config::github_host()?,
..Default::default()
})?;
let response = manifest_validation::validate_manifest(&RunLayer::default(), &built.manifest)?;

View file

@ -123,6 +123,10 @@ mod tests {
#[cfg(unix)]
#[tokio::test]
#[expect(
clippy::disallowed_methods,
reason = "unit test stages a fake gh script and reads its argument log with sync std::fs"
)]
async fn gh_invocations_target_the_configured_host() {
use std::os::unix::fs::PermissionsExt;