Skip to content

Conversation

jerensl
Copy link
Contributor

@jerensl jerensl commented Aug 22, 2025

I tested here but this also won't fix this path issue in windows CI

Tested here: https://github.com/jerensl/ipc-channel/actions/runs/17154187746/job/48667048523?pr=2#step:5:22

Copy link
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. I have a few minor comments:

Comment on lines +81 to +82
result = emit_annotation_for_clippy(clippy_results, with_annotation)
sys.exit(result)
Copy link
Member

@mrobinson mrobinson Aug 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can simplify this a bit, by only parsing annotations when with_annotation is true and then returning the original return code:

Suggested change
result = emit_annotation_for_clippy(clippy_results, with_annotation)
sys.exit(result)
if with_annotation:
emit_annotation_for_clippy(clippy_results)
sys.exit(proc.returncode)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this as @mukilan said here. So unless we agreed on using explictly -D warnings internally here, I can go with this solution, what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, clippy will not return a failure code unless -D warning is passed, but then that will cause clippy to error just after the first warning. It is more useful in the with_annotation=true case to not rely on the exit code (we can show up to 10 warnings), so to me it makes sense to use that same logic even when GH annotation is turned off.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Thank you!

@mrobinson mrobinson merged commit 786937b into servo:main Aug 22, 2025
from typing import Any


def emit_annotation_for_clippy(results: list[dict[str, Any]], with_annotation: bool):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def emit_annotation_for_clippy(results: list[dict[str, Any]], with_annotation: bool):
def parse_cargo_output(results: list[dict[str, Any]], emit_annotation: bool) -> bool:

)
total_count += 1

return 1 if total_count > 0 else 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return 1 if total_count > 0 else 0
return total_count > 0

if "--message-format=json" not in cmd:
cmd.append("--message-format=json")

proc = subprocess.run(cmd, capture_output=with_annotation)
Copy link
Member

@mukilan mukilan Aug 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the idea is to parse the output of cargo to determine the exit status, then shouldn't we always capture the output, regardless of with_annotation? With the current logic, when with_annotation=False, we will not fail the build even when clippy has some output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants