-
Notifications
You must be signed in to change notification settings - Fork 698
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
Add typo checking for *.rst and *.md files #10603
Conversation
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.
If we only use it for text files (e.g. RST) there's not much profit we get over conventional spell checkers like aspell? I think the killer feature of typos
is that it tries to analyze source code and find typos in things like program_idenfitiars
? If we don't use this feature, I'd rather we use something like aspell
. But I won't block it on these grounds.
Besides RST, could we include MD and, most importantly, the contents of the changelog-d directory? That looks critical to me.
Some of the clean-ups suggested it was finding typos in comments in source code, at least. Identifiers might be a harder problem if they affect API. |
@ulysses4ever, I'm starting cautiously, doing only |
I didn't say a word about I also suggest to add a constant in Makefile for the wildcards like |
I found typos in |
FWIW we usually catch them while compiling them into actual release notes. Ideally we identify them within PRs before they're merged. |
This. |
96f532d
to
3d3a06b
Compare
I've managed to get this working but want to propose it on a separate PR. |
5f4ca6c
to
794284f
Compare
This needs another review now that I've changed the way I'm passing files to the |
I also disagree with separate targets for .md and .rst. I think one target for spell checking is enough. |
@ulysses4ever, there's one more pair I'd like to add in a separate PR, the
|
I wouldn't be able to use the Combining the scans into one larger scan will noticeably slow things down;
|
I think one rule for all file types should be enough. Please, name the reasons you think it's not. If it's |
I don't see a slowdown from combining. I see run times for three different queries. None of these numbers are sensible in CI (or, indeed, locally). |
The slowness of the larger scans is quite noticable (sensible), locally. Also I don't trust the configuration of |
Can you show the numbers?
That's great, so lets use some more bash magic to exclude what we need to exclude, if necessary. Again, please, name reasons to not spell-check all desired files in one go? |
You may not have seen those. I edited one of my previous posts in this thread, #10603 (comment), adding the run times. |
I'm already doing exclusion using a simple inverted grep pattern. Which files are being scanned can be seen by adding the
$ git diff
diff --git a/Makefile b/Makefile
index e4749580a..257bd8070 100644
--- a/Makefile
+++ b/Makefile
@@ -278,7 +278,7 @@ FIND_NAMED := find . -type f -name
.PHONY: users-guide-typos
users-guide-typos: ## Find typos in users guide
- cd doc && $(FIND_NAMED) '*.rst' | xargs typos
+ cd doc && $(FIND_NAMED) '*.rst' | xargs typos --files
.PHONY: users-guide-fix-typos
users-guide-fix-typos: ## Fix typos in users guide
|
No, I did see those because I put the summary into my quote in #10603 (comment) These numbers are negligible. So far, I don't see a single reason for having separate make-rules for every file type. |
I disagree. Right now |
I understand your wish to keep the makefile small. I would like to wait on trying to have one |
1d47063
to
cab2f42
Compare
- Add a typos action - Fix typos in *.rst - Split version and platform env variables - Add comments to typo makefile targets - Add a section on typos to README - Layout block quotation - Add typos to checks - Fix typos in release-notes/*.md - Fix typos in **/*.md - Extract typos to its own folder - Rename to .typos.toml - Use find, grep and xargs with typos - We have users-guide-typos and markdown-typos - Fix markdown typos - Typo in help comment for markdown-fix-typos - Trigger action pushing to master only - Add FIND_NAMED variable - Update target in doc/README for finding typos - Update prerequisite targets of checks PHONY target
cab2f42
to
6d8f0f3
Compare
Label merge+no rebase is necessary when the pull request is from an organisation. |
Also fixes #10604. |
Fix #10601. Adds spell checking (finding typos) and fixing makefile targets with recipes using typos and an GitHub action that uses the makefile target (even though there is a canned action available for this).
Limited at the moment to checking and fixing spelling in
*.rst
files (and*.md
files - requested at review). No configuration is required as yet. The default configuration can be viewed withtypos --dump-config -
.Fixes the typos that
make typos
found withmake fix-typos
except for the one with an ambiguous fix that I fixed by hand.Template B: This PR does not modify behaviour or interface
E.g. the PR only touches documentation or tests, does refactorings, etc.
Include the following checklist in your PR: