diff --git a/crates/rover-client/src/utils/git.rs b/crates/rover-client/src/utils/git.rs index d32e7ed1a..558be9d4a 100644 --- a/crates/rover-client/src/utils/git.rs +++ b/crates/rover-client/src/utils/git.rs @@ -14,7 +14,7 @@ pub struct GitContext { } impl GitContext { - pub fn new(override_git_context: GitContext) -> Self { + pub fn new_with_override(override_git_context: GitContext) -> Self { let repo = GitContext::get_repo(); let mut remote_url = override_git_context.remote_url; @@ -52,7 +52,7 @@ impl GitContext { } pub fn default() -> Self { - GitContext::new(GitContext { + GitContext::new_with_override(GitContext { author: None, branch: None, commit: None, @@ -331,7 +331,7 @@ mod tests { remote_url: Some(remote_url), }; - let actual_git_context = GitContext::new(override_git_context.clone()); + let actual_git_context = GitContext::new_with_override(override_git_context.clone()); assert_eq!(override_git_context, actual_git_context); } diff --git a/src/cli.rs b/src/cli.rs index 9c0373726..1820dbce3 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -94,7 +94,7 @@ impl Rover { remote_url: self.env_store.get(RoverEnvKey::VcsRemoteUrl).ok().flatten(), }; - let git_context = GitContext::new(override_git_context); + let git_context = GitContext::new_with_override(override_git_context); tracing::debug!(?git_context); Ok(git_context) } diff --git a/src/command/subgraph/check.rs b/src/command/subgraph/check.rs index 219df3dcd..f6c3bc3b1 100644 --- a/src/command/subgraph/check.rs +++ b/src/command/subgraph/check.rs @@ -74,7 +74,7 @@ impl Check { variant: self.graph.variant.clone(), proposed_schema, subgraph: self.subgraph.clone(), - git_context: git_context.into(), + git_context, config: SubgraphCheckConfig { query_count_threshold: self.query_count_threshold, query_count_threshold_percentage: self.query_percentage_threshold, diff --git a/src/error/metadata/mod.rs b/src/error/metadata/mod.rs index ffb793fa1..32649ab6c 100644 --- a/src/error/metadata/mod.rs +++ b/src/error/metadata/mod.rs @@ -63,15 +63,14 @@ impl From<&mut anyhow::Error> for Metadata { composition_errors, } => { for composition_error in composition_errors { - let code = format!( - "error[{}]: ", - composition_error - .code - .as_ref() - .unwrap_or(&"UNKNOWN".to_string()) - ); - let color_code = Red.bold().paint(&code); - eprintln!("{}{}", &color_code, &composition_error.message); + let mut error = format!("{} ", Red.bold().paint("error:")); + if let Some(code) = &composition_error.code { + error.push_str(&format!("{}: ", code)); + } else { + error.push_str("UNKNOWN: "); + } + error.push_str(&composition_error.message); + eprintln!("{}", &error); } ( Some(Suggestion::FixSubgraphSchema {