comprehensive-rust icon indicating copy to clipboard operation
comprehensive-rust copied to clipboard

Make it easy to react to `dprint fmt` errors

Open mgeisler opened this issue 1 year ago • 7 comments

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.

mgeisler avatar Sep 04 '23 09:09 mgeisler

Hey there, I want to work on this. Can you please guide me currently I am not getting how to proceed with this ?

OmAximani0 avatar Sep 04 '23 10:09 OmAximani0

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.

mgeisler avatar Sep 04 '23 10:09 mgeisler

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 ?

OmAximani0 avatar Sep 04 '23 13:09 OmAximani0

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.

mgeisler avatar Sep 04 '23 13:09 mgeisler

Thank you for the clear instructions @mgeisler . I'm on it :rocket:

OmAximani0 avatar Sep 04 '23 13:09 OmAximani0

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

OmAximani0 avatar Sep 08 '23 17:09 OmAximani0

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).

mgeisler avatar Sep 09 '23 13:09 mgeisler