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

Check for misspellings in CI #1825

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

szepeviktor
Copy link
Contributor

@szepeviktor szepeviktor commented Sep 23, 2024

This PR is explosive 💥

and includes file renaming

@github-actions github-actions bot added the tools and infrastructure Project internal tooling, such as linters, GitHub Actions, or repo settings label Sep 23, 2024
@github-actions github-actions bot added documentation Improvements or additions to documentation feature definition Creating or defining new features or groups of features. labels Sep 23, 2024
@szepeviktor szepeviktor marked this pull request as ready for review September 23, 2024 17:22
@jamesnw
Copy link
Collaborator

jamesnw commented Sep 24, 2024

I'm impressed by how few typos our process has let through so far!

My thought is that spelling checks are really helpful, but I'd prefer them as a comment in a PR, and not as a blocker that requires overrides in order to pass. That provides authors the info they need when they need it, but is a much lower long term cost.

@szepeviktor
Copy link
Contributor Author

szepeviktor commented Sep 24, 2024

I see.
You may want to see #1149 too.

|| true added in the latest commit.

@ddbeck
Copy link
Collaborator

ddbeck commented Oct 7, 2024

Hi @szepeviktor, thanks for opening this PR. I'm still giving some thought about how to fit in spell checks like this, with some other linting on the table. I'm not exactly sure if/when I'll be able to land this, but I do want to get your feature identifier fix into the release this week. I've opened #1918 and credited you with the Co-authored-by: trailer.

@szepeviktor
Copy link
Contributor Author

szepeviktor commented Oct 8, 2024

@ddbeck Hello 👋🏻

I could rebase this PR every week and report typos to you.
Recent findings include

"clonable" should be "cloneable".

@szepeviktor
Copy link
Contributor Author

@ddbeck new findings:

# 2024-10-15 — low → false — Chrome, Edge, and Safari do not implement font synthesis for missing superscript or subscript glpyhs.

"glpyhs"

@szepeviktor
Copy link
Contributor Author

szepeviktor commented Nov 13, 2024

new findings: "signficantly"

@szepeviktor szepeviktor mentioned this pull request Nov 20, 2024
@szepeviktor szepeviktor force-pushed the patch-1 branch 2 times, most recently from 918e7d0 to 5939764 Compare November 25, 2024 15:37
@szepeviktor
Copy link
Contributor Author

@ddbeck Typos live with us.

description: The `<input type="button">` HTML element represents a button that triggers some action, such as submitting a form or opening a dialog, styled as a labeled rectangular box by default. Not to be confused with the `<button>` elment, which contains HTML content.

Copy link
Collaborator

@ddbeck ddbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @szepeviktor, thanks again for opening this PR.

This PR came up at the WebDX CG meeting today. I'm reviewing this now, but I've also asked that others have a look too. I'm not familiar with this tool, so I don't have a ton of confidence in my review of it—you'll find that I'm mostly asking questions at this point.

Comment on lines +39 to +42
RELEASE_ASSET_URL="$(
gh api /repos/crate-ci/typos/releases/latest \
--jq '."assets"[] | select(."name" | test("^typos-.+-x86_64-unknown-linux-musl\\.tar\\.gz$")) | ."browser_download_url"'
)"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a question here: ci/typos seems to be available as a GitHub Action (which I imagine we could pin and upgrade with Dependabot). How does this approach compare to using the Action?

Also, have you seen this used in other open projects with a lot of churn on files? I'd be curious to know what a real-world PR looks like following a workflow like this (I'm curious how contributors respond to the feedback given).

Copy link
Contributor Author

@szepeviktor szepeviktor Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not recommend running typos in "passive" mode as a typo in code could be detrimental.

E.g. Go language encourages programmers to use 2 and 3 letter variable names. They usually look like English misspellings. That is all I know.

Copy link
Contributor Author

@szepeviktor szepeviktor Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typos is just a super useful software - I need an LLM to argue.
Please love typos.

Comment on lines +45 to +48
git grep --files-with-matches --null -I -e '.' \
| xargs --null --verbose -- "${{ runner.temp }}/typos/typos" --format json \
| jq --raw-output '"::warning file=\(.path),line=\(.line_num),col=\(.byte_offset)::\"\(.typo)\" should be \"" + (.corrections // [] | join("\" or \"") + "\".")' \
|| true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is rather complicated! Is there any way this can be broken up or commented to make each step better explained? Or maybe an example showing the transformation going on here? I'm just not sure what this is doing.

Copy link
Contributor Author

@szepeviktor szepeviktor Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it is enumerate files -> run typos -> convert output to GitHub check annotations.
All this code is hiding inside the GitHub Action of typos.
We talked about that typos should not stop a PR that is why I've copied the code from the Action and modified errors to warnings.

I've sent around ~500 PR-s advertising typos: https://github.com/pulls?q=is%3Apr+author%3Aszepeviktor+archived%3Afalse+Fix+typos
~5% of the people hate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature definition Creating or defining new features or groups of features. tools and infrastructure Project internal tooling, such as linters, GitHub Actions, or repo settings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants