comprehensive-rust
comprehensive-rust copied to clipboard
Make it easy to react to `dprint fmt` errors
We should fix https://github.com/dprint/check/issues/11, which is about making it easy to react to dprint fmt
errors.
In short, we should ensure that the errors show up in GitHub on the relevant line in code reviews. Ideally, this should be in the form of a GitHub suggestion.
Hey there, I want to work on this. Can you please guide me currently I am not getting how to proceed with this ?
Hi @OmAximani0, nice to meet you!
Do you already have experience with GitHub actions? Did the description in https://github.com/dprint/check/issues/11 make sense to you?
The dprint
action is currently a "composite action", it simply runs dprint check
in a shell script. See action.yml
for details. You would have to read up on how GitHub actions work and figure out how to emit the annotations I mention in the issue.
Nice to meet you too @mgeisler :smile: Talking about GitHub actions I never worked with it but I would like to know more about it. What I understood is we have to annotate where errors are happening through the workflow right ?
Nice to meet you too @mgeisler 😄
:wave: :smile:
Talking about GitHub actions I never worked with it but I would like to know more about it. What I understood is we have to annotate where errors are happening through the workflow right ?
Yeah, try forking this repository and then make a PR against your fork. Add a long line of text to the README.md
file at the root and you will see the format
check fail. You can run all of this in your own fork and I suggest doing that to become familiar with how the errors look.
Thank you for the clear instructions @mgeisler . I'm on it :rocket:
Hello @mgeisler , I just looked over the errors I think we can create a shell script for echoing the annotation. But there is no option to store the dprint check
output in a file on which we can run the script
Hello @mgeisler , I just looked over the errors I think we can create a shell script for echoing the annotation. But there is no option to store the
dprint check
output in a file on which we can run the script
Using a shell script sounds good, it will be easy to integrate with the existing GitHub action. I think you will be able to do
dprint check > dprint.log
and then inspect dprint.log
afterwards.
An alternative, which might be more generic: you could run dprint fmt
to get all files updated. Then run git status
and git diff
to see what has changed. That might be easier for you since the commands have more well-defined output (especially if you use the lower-level git ls-files --modified
and git diff-files
"plumbing" commands).