-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Run crate-ci/typos
in CI
#51704
Run crate-ci/typos
in CI
#51704
Conversation
I've added |
I was wondering what was going on :) I noticed you asked for a short timeout in #48359, do you want that here too? |
Yeah, that would be good. Looks like this action runs pretty quickly, so a few minutes should be sufficient for a timeout. |
crate-ci/typos
GitHub Action in CI
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.
Overall, this seems like a good plan.
I'll do another thorough line-by-line review later.
We likely want to wait to merge this until the actual typos (the true positives) have been fixed. Lilith has a PR open for that.
crate-ci/typos
GitHub Action in CIcrate-ci/typos
GitHub Action in CI
crate-ci/typos
GitHub Action in CIcrate-ci/typos
GitHub Action on pull requests
If any of the false positives from abbreviations are from the standard library, I'd be interested in getting those baked into a julia-specific dictionary. Similar for highly common package names (e.g. |
Here's a list of false positives that seem worth including in a Julia-specific dictionary:
Almost all of the remaining are abbreviations that happen to look like typos or deliberate typos used in testing. |
Rust also has // Here are several Somes In Rust, I'd expect to see that written as // Here are several `Some`s which negates the problem.
For Python, we specifically approved
I'm assuming this is the same problem as Rust when we need to refer to a |
# Test completion for a case when type inference returned `Union` of the same types
union_somes(a, b) = rand() < 0.5 ? Some(a) : Some(b)
let s = "union_somes(1, 1.0)."
c, r, res = test_complete_context(s)
@test res
@test "value" in c
end
function _reverse(A::BitArray, d::Int)
nd = ndims(A)
1 ≤ d ≤ nd || throw(ArgumentError("dimension $d is not 1 ≤ $d ≤ $nd")) I wouldn't call |
The design now (which I think may be the final design) is... Look at each file that was edited and neither created nor deleted. Scan these all for typos longer than 4 characters and compute the union. This is our baseline of "false positives". Compile this list into a Python set. Look at each file that was edited and not deleted. Scan these all for typos longer than 4 characters, skipping any typos that are in the set of false positives. For each remaining typo, provide a github annotation and, if the typo is longer than 6 characters (at least 94% true positivity rate for typos that long), mark the CI job as a failure but continue to report all remaining novel typos. This achieves:
Runtime: 6s total, 1s doing the actual checks, |
Looking at the suggestions in #51707, spell-checking actual running code seems like a bad idea. Running it on comments and other types of text seems useful. |
If it were trivial to exclude running code, I would have done so. However, I do still think it is acceptable to spell check running code. Specifically, "overlayed" "compileable" and "supress" have all made it into running code. Usage of "overlayed" "compileable" and "supress"
It's hard to know how much false positives will be an issue without trying and finding out, but I suspect that the false positivity rate will be very low in practice. It can be bounded above by the reported false positivity rates in #51704 (comment), assuming PR text is more typo-ey than text already merged into master. |
See #51739 for an example of this action applied to the most recent PR with significant code additions. Feel free to recommend any other open PR for me to test this out on. I'm optimistic it will perform well. |
I'm going to remove the test typos and get this ready for merge. We can always revert if there are too many false positives. |
That are indeed good examples why running it on code is in fact useful. |
Here's an example of catching a code typo pre-merge |
https://github.com/crate-ci/typos
TODO:
actions/checkout
action, setpersist-credentials: false
.- [ ] Create an ignore list with the false positives?List of false positives that could be stored in typos.toml, if folks decide to go that route down the line