-
Notifications
You must be signed in to change notification settings - Fork 110
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
base: main
Are you sure you want to change the base?
Changes from all commits
d0ec19f
adf3f06
46a333a
afe3e0c
9998f6c
6c6db6d
92655d4
beb9c60
4edcd6b
c611fd2
cad692d
034db56
590b850
d975580
8d2f0cc
02b1e01
f3fd2b3
236b8f6
473f167
f1129b3
51ca473
cfd3915
5b478bd
1cab68f
9d30e60
a4c04e2
e285c61
6c5b683
bd716c3
b79480b
084acb9
7b61209
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,25 @@ jobs: | |
cache: npm | ||
- run: npm ci | ||
- run: npm test | ||
spelling: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: | | ||
set -o pipefail | ||
mkdir -p "${{ runner.temp }}/typos" | ||
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"' | ||
)" | ||
wget --quiet --output-document=- "${RELEASE_ASSET_URL}" \ | ||
| tar -xz -C "${{ runner.temp }}/typos" ./typos | ||
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 | ||
Comment on lines
+45
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. I've sent around ~500 PR-s advertising typos: https://github.com/pulls?q=is%3Apr+author%3Aszepeviktor+archived%3Afalse+Fix+typos |
||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
|
||
env: | ||
FORCE_COLOR: 3 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[files] | ||
extend-exclude = [ | ||
".git/", | ||
] | ||
ignore-hidden = false | ||
|
||
[default] | ||
extend-ignore-re = [ | ||
"\\bext-shader-texture-lod\\b", | ||
"\\bhttp\\.headers\\.ECT\\b", | ||
"detail \\(LOD\\)", | ||
] | ||
|
||
[default.extend-words] | ||
"clonable" = "clonable" | ||
"seeked" = "seeked" | ||
# https://github.com/web-platform-dx/web-features/pull/2484 | ||
"seperators" = "seperators" | ||
|
||
[default.extend-identifiers] | ||
"EXT_shader_texture_lod" = "EXT_shader_texture_lod" | ||
"gatherND" = "gatherND" | ||
"is_transitionable" = "is_transitionable" | ||
"scatterND" = "scatterND" | ||
"scheme_parameter_openpgp4fpr" = "scheme_parameter_openpgp4fpr" | ||
|
||
# Typos | ||
"Github" = "GitHub" |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.