New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Workflow] Expand code-format-helper.py error reporting #69686
Conversation
I'm trying to fix a couple of issue I recently ran into:
I'm not sure how to test this change, but it does pass I was a bit confused by the |
Hi, thanks for the updates, they seem sane to me. It's a little tough to review since it has a lot of stylistic changes mixed in with the functional ones. I would like to know if we could split the PR up so it's easier to review. |
I'll try splitting out an earlier CL that just does black/mypy. That should help. |
acb8511
to
ac2b8dc
Compare
The "[Workflow] make code-format-helper.py mypy-safe (NFC)" commit in this PR is actually part of #69691 instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I assume this has been tested somehow right?
Unfortunately, it still needs to be tested somehow. I did notice that you had some way to demo it on tru#8. |
Yes, the way I tested it was that I pushed my changes to a branch in my fork (i.e. |
I noticed that Edit: I got |
One of my test PRs was supposed to fail C++ and Python formatting, but instead it only failed on C++, and it reproduced the failure mode where https://github.com/rprichard/llvm-project/actions/runs/6592874295/job/17914345865?pr=4 Apparently darker is succeeding with no stdout/stderr output? The darker command fails for me when I run it locally:
I still think this CL is an improvement on the error reporting, though. (I assume the latest fixup commit is OK.) I used these PRs to test this PR so far: rprichard#1 rprichard#2 rprichard#3 rprichard#4 rprichard#5 |
* Consider the darker/clang-format command to have failed if the exit code is non-zero, regardless of the stdout/stderr output. * Allow stderr from the formatter command to propagate to the script's caller (and into the GitHub log). * On success, dump stdout to the caller, so it ends up in GitHub's log. I'm not sure what this would ever be, but if it exists, it should be preserved. * Just before the script exits, if any formatter failed, print a line showing which formatters failed. Replace [str] with list[str] to satisfy mypy/pytype.
* Prefix "clang-format" to the Excluding lines rather than print "Formatter darker (Python code formatter):" and "Formatter clang-format (C/C++ code formatter):" Those formatter lines were being printed even when there were no C++/Python files to format. * Capture stderr and then print it out, rather than let the subprocess directly write it out. This ensures that output appears in the right order when the script's output is buffered.
cbfc351
to
6612b01
Compare
Hmm that doesn't seem right. I am pretty sure I had it failing with the right code before. Are you sure this isn't related to your changes? |
I don't think so? |
It appears that darker/black process their file list using the currently-checked out files, not by querying git for the contents of the two git revisions. A newly-added file isn't checked out, because the current GitHub workflow checks something else out instead (the target branch of the PR maybe?) https://github.com/rprichard/llvm-project/actions/runs/6622055992/job/17986970016?pr=10 I think the fix is to specify a different commit to checkout in pr-code-format.yml. |
These changes are pretty well-tested via https://github.com/rprichard/llvm-project/pulls. |
Replace [str] with list[str] to satisfy mypy/pytype.