Skip to content
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

Make it easy to react to dprint fmt errors #1163

Open
mgeisler opened this issue Sep 4, 2023 · 7 comments
Open

Make it easy to react to dprint fmt errors #1163

mgeisler opened this issue Sep 4, 2023 · 7 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mgeisler
Copy link
Collaborator

mgeisler commented Sep 4, 2023

We should fix dprint/check#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 mgeisler added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Sep 4, 2023
@OmAximani0
Copy link

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

@mgeisler
Copy link
Collaborator Author

mgeisler commented Sep 4, 2023

Hi @OmAximani0, nice to meet you!

Do you already have experience with GitHub actions? Did the description in dprint/check#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.

@OmAximani0
Copy link

Nice to meet you too @mgeisler 😄
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 ?

@mgeisler
Copy link
Collaborator Author

mgeisler commented Sep 4, 2023

Nice to meet you too @mgeisler 😄

👋 😄

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.

@OmAximani0
Copy link

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

@OmAximani0
Copy link

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

@mgeisler
Copy link
Collaborator Author

mgeisler commented Sep 9, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants