codespell-project / actions-codespell

MIT License
74 stars 19 forks source link

Make misspells with a single correction inline `suggestion` blocks #40

Open robin-wayve opened 2 years ago

robin-wayve commented 2 years ago

Github has a neat feature to suggest code changes on PR lines: https://docs.github.com/en/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request

For simple misspells where there is only 1 correction option, it'd be convenient to have them as a suggestion which the reviewer can simply click "Commit suggestion" on.

peternewman commented 2 years ago

Yes, I agree 100% . If there were two or three suggestions you could always list them all too, as alternatives. The issue is I don't believe it's possible currently :disappointed: .

The available options currently seem to just be: https://github.com/getsentry/action-git-diff-suggestions https://github.com/reviewdog/action-suggester

But please link to anything relevant within GitHub actions if you've found them? I think there was an issue, but given suggestion is used in it's common sense too I'm struggling to find it currently.

robin-wayve commented 2 years ago

I had previously implemented this through a Probot with a bit of JavaScript to parse codespell's output and then substitute the suggestions on the line. It worked quite well, but I have not dug into what is possible with Actions.

robin-wayve commented 2 years ago

It seems like this might be a good way to achieve the same thing: https://github.com/marketplace/actions/action-git-diff-suggestions

peternewman commented 2 years ago

https://github.com/getsentry/action-git-diff-suggestions

It seems like this might be a good way to achieve the same thing: https://github.com/marketplace/actions/action-git-diff-suggestions

Is there an echo (echo, echo, echo...) in here? :laughing:

robin-wayve commented 2 years ago

My bad -- I saw this today and wanted to make a note of it without re-reading the comments 🙃

peternewman commented 2 years ago

In your defence at least they're different URLs!

I keep meaning to try this on the main Codespell repo against the dictionary sort stuff, given I do such a bad job of guessing sorting when submitting entries.

peternewman commented 2 years ago

I've re-opened this as while I was joking around, it's still a good idea and something we should try and do (or hopefully GitHub will see sense and finally enable it in due course).

My brief tests on the sorting didn't look too promising unfortunately: https://github.com/codespell-project/codespell/pull/2253