Skip to content

Commit

Permalink
chore: clean up errors and address lints
Browse files Browse the repository at this point in the history
  • Loading branch information
EverlastingBugstopper committed Jun 23, 2021
1 parent c13a824 commit a7d9ce3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
6 changes: 3 additions & 3 deletions crates/rover-client/src/utils/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -52,7 +52,7 @@ impl GitContext {
}

pub fn default() -> Self {
GitContext::new(GitContext {
GitContext::new_with_override(GitContext {
author: None,
branch: None,
commit: None,
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion src/command/subgraph/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
17 changes: 8 additions & 9 deletions src/error/metadata/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a7d9ce3

Please sign in to comment.