Skip to content

Commit

Permalink
Fix source_location access in subgraph check; minor updates to task…
Browse files Browse the repository at this point in the history
… styling
  • Loading branch information
david-castaneda committed Jun 15, 2023
1 parent 4b3bccf commit b6ec015
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ fn get_lint_response_from_result(
Some(result) => {
let mut diagnostics = Vec::with_capacity(result.diagnostics.len());
for diagnostic in result.diagnostics {
let mut start_line = 0;
// loc 0 is supergraph and 1 is subgraph
if let Some(start) = &diagnostic.source_locations[1].start {
start_line = start.line;
}
let start_line = match diagnostic.source_locations.len() {
2 => diagnostic.source_locations[1].start.clone().unwrap().line,
_ => diagnostic.source_locations[0].start.clone().unwrap().line,
};
diagnostics.push(Diagnostic {
level: diagnostic.level.to_string(),
message: diagnostic.message,
Expand Down
7 changes: 3 additions & 4 deletions crates/rover-client/src/shared/check_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,39 +36,38 @@ impl CheckWorkflowResponse {
} else {
msg.push_str("There were no changes detected in the composed schema.")
}
msg.push('\n');
}

if let Some(operations_response) = &self.maybe_operations_response {
if !operations_response.changes.is_empty() {
msg.push('\n');
msg.push_str(&Self::task_title(
"Operation Check",
operations_response.task_status.clone(),
));
msg.push_str(operations_response.get_output().as_str());
msg.push('\n');
}
}

if let Some(lint_response) = &self.maybe_lint_response {
if !lint_response.diagnostics.is_empty() {
msg.push('\n');
msg.push_str(&Self::task_title(
"Lint Check",
lint_response.task_status.clone(),
));
msg.push_str(lint_response.get_output().as_str());
msg.push('\n');
}
}

if let Some(downstream_response) = &self.maybe_downstream_response {
if !downstream_response.blocking_variants.is_empty() {
msg.push('\n');
msg.push_str(&Self::task_title(
"Downstream Check",
downstream_response.task_status.clone(),
));
msg.push_str(downstream_response.get_output().as_str());
msg.push('\n');
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl RoverError {
check_response,
}) = self.error.downcast_ref::<RoverClientError>()
{
stdoutln!("{}", check_response.to_output())?;
stdoutln!("{}\n", check_response.to_output())?;
}

stderr!("{}", self)?;
Expand Down

0 comments on commit b6ec015

Please sign in to comment.