-
Notifications
You must be signed in to change notification settings - Fork 36.6k
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
Warn (don't fail!) on spelling errors. Fix typos reported by codespell. #13954
Conversation
ab46eb5
to
9d8dd3d
Compare
Travis failure:
|
ad8c1bb
to
c505b76
Compare
.travis.yml
Outdated
cache: false | ||
language: python | ||
python: '3.6' | ||
install: | ||
- travis_retry sudo apt-get install --no-install-recommends --no-upgrade -qq codespell |
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.
Can use
addons:
apt:
packages:
- codespell
to avoid sudo
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.
Oh that is much cleaner! Thanks!
b2bcf1b
to
ab54964
Compare
Note to reviewers: This pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Does this mean we need to manually add words that are not recognized to the spell checker? |
test/lint/lint-spelling.sh
Outdated
|
||
EXIT_CODE=0 | ||
EXCLUDE_REGEXP="(src/example.cpp:.*example-false-positive-word) " | ||
SPELLING_ERRORS=$(codespell -d -q 3 $(git ls-files -- ":(exclude)src/leveldb/" ":(exclude)src/secp256k1/" ":(exclude)src/univalue/" ":(exclude)depends/" ":(exclude)doc/release-notes/" ":(exclude)src/qt/locale/" ":(exclude)test/functional/test_framework/__init__.py" ":(exclude)test/lint/lint-spelling.sh") | grep -vE "${EXCLUDE_REGEXP}") |
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.
nit: using the long form options here would be more self-documenting: --disable-colors --quiet-level=
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.
Good point! Now fixed.
src/rpc/net.cpp
Outdated
"\n" "Immediately disconnects from the specified peer node.\n" | ||
"\n" "Strictly one out of 'address' and 'nodeid' can be provided to identify the node.\n" | ||
"\n" "To disconnect by nodeid, either set 'address' to the empty string, or call using the named 'nodeid' argument only.\n" | ||
"\n" "Arguments:\n" |
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.
Why are these changes necessary? There are plenty more leading \n
in this file.
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.
The old Ubuntu packaged version didn't understand \n
and thus flagged "nTo" as a typo. That seems to have been fixed in the more recent pip
installed version.
.travis.yml
Outdated
addons: | ||
apt: | ||
packages: | ||
- codespell |
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.
nit: codespell
recommends installation via pip
:
https://github.com/codespell-project/codespell
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.
Good point! Now fixed
Concept ACK |
10dd66a
to
d8725c0
Compare
@laanwj No not at all :-) False positives – words recognised as errors by To get rid of all false positives in the project only four entries are needed in the ignore file which is tiny considering that the Bitcoin project contains over 50 000 unique words :-)
|
src/qt/paymentserver.h
Outdated
@@ -77,7 +77,7 @@ class PaymentServer : public QObject | |||
// to read from the file specified in the -rootcertificates setting, | |||
// or, if that's not set, to use the system default root certificates. | |||
// If you pass in a store, you should not X509_STORE_free it: it will be | |||
// freed either at exit or when another set of CAs are loaded. | |||
// freed either at exit or when another set of CA:s are loaded. |
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.
why?
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.
Yeah I would add these to test/lint/lint-spelling.ignore-words.txt
rather than use :
to separate them.
src/qt/coincontroldialog.cpp
Outdated
@@ -185,7 +185,7 @@ void CoinControlDialog::buttonSelectAllClicked() | |||
ui->treeWidget->topLevelItem(i)->setCheckState(COLUMN_CHECKBOX, state); | |||
ui->treeWidget->setEnabled(true); | |||
if (state == Qt::Unchecked) | |||
coinControl()->UnSelectAll(); // just to be sure | |||
coinControl()->DeSelectAll(); // just to be sure |
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.
Should probably be a scripted diff
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.
Good point! Now fixed using a scripted-diff
:-)
I'm... not convinced about this. I think running this once in a while is good, just to see if there's any really awkward misspellings, but running this in travis and failing the tests just because of a misspelled word in a comment seems overkill. As I've said before, many times, linters should be added cautiously, there to prevent real problems resulting in bugs. |
…ed by codespell. f8a81f7 lint: Add spell check linter (codespell) (practicalswift) ada3562 Fix typos reported by codespell (practicalswift) Pull request description: * Check for common misspellings using `codespell`. * Fix recently introduced typos reported by `codespell`. Tree-SHA512: 9974c0e640b411c7d0ebc5b45de253c19bac7fe3002cd98601ff8da8db584224c2fd7d331aee3df612c9f2cfef540d647a9b4c5a1a73fd208dc93ce4bf9e5e3e
so in case anyone cares, i'm not happy about this "can we add this?"
"but… can we add it if it only warns?"
now, a few months later, it is causing Travis failures—apparently through #14179, without any discussion |
@laanwj Oh, I wasn't aware of the policy change introduced in #14179 so I don't have anything meaningful to add about that. Setting the discussion about that merge decision aside: Do you have a link to the Travis failure? It would be interesting to see if it was a true positive or a false positive that caused |
It came up when someone tried to name a mutex |
yes it came up on IRC @karel-3d
|
Oh, that sounds really strange. I'm unable to reproduce locally:
Anyone who has been able to reproduce? |
I was able to reproduce after upgrading |
@practicalswift Which versions of codespell? |
|
Fixed in #14495 :-) |
@scravy Seems like this was introduced somewhere between |
I cloned the repo, did some experimental changes, and used Travis-ci.org. The build is here https://travis-ci.org/karel-3d/bitcoin/builds/442019337 It's branched from this commit, 18 days old. (Maybe it will go away if I rebase on current master?) |
Oh yeah. It seems I have branched the master before this commit Which means that if I rebase to master, it would indeed go away. |
@karel-3d Thanks for the clarification! That explains the mystery :-) |
c32cf6a Add ignored word: mut (practicalswift) 4ae50da Revert "qa: Fix codespell error and have lint-spelling error instead of warn" (practicalswift) Pull request description: Revert `codespell` policy change introduced in #14179. Context: #13954 (comment) Tree-SHA512: 4606b19bb32cdd661f90b3778759818d3493e5ed1a4a2f95982f07eeb6b9c889bc8d53cde31706e0a3b9524c3d3a7378f1b769a60baeb0d00da4c68fd3068114
… reported by codespell. f8a81f7 lint: Add spell check linter (codespell) (practicalswift) ada3562 Fix typos reported by codespell (practicalswift) Pull request description: * Check for common misspellings using `codespell`. * Fix recently introduced typos reported by `codespell`. Tree-SHA512: 9974c0e640b411c7d0ebc5b45de253c19bac7fe3002cd98601ff8da8db584224c2fd7d331aee3df612c9f2cfef540d647a9b4c5a1a73fd208dc93ce4bf9e5e3e
c32cf6a Add ignored word: mut (practicalswift) 4ae50da Revert "qa: Fix codespell error and have lint-spelling error instead of warn" (practicalswift) Pull request description: Revert `codespell` policy change introduced in bitcoin#14179. Context: bitcoin#13954 (comment) Tree-SHA512: 4606b19bb32cdd661f90b3778759818d3493e5ed1a4a2f95982f07eeb6b9c889bc8d53cde31706e0a3b9524c3d3a7378f1b769a60baeb0d00da4c68fd3068114
… reported by codespell. f8a81f7 lint: Add spell check linter (codespell) (practicalswift) ada3562 Fix typos reported by codespell (practicalswift) Pull request description: * Check for common misspellings using `codespell`. * Fix recently introduced typos reported by `codespell`. Tree-SHA512: 9974c0e640b411c7d0ebc5b45de253c19bac7fe3002cd98601ff8da8db584224c2fd7d331aee3df612c9f2cfef540d647a9b4c5a1a73fd208dc93ce4bf9e5e3e
c32cf6a Add ignored word: mut (practicalswift) 4ae50da Revert "qa: Fix codespell error and have lint-spelling error instead of warn" (practicalswift) Pull request description: Revert `codespell` policy change introduced in bitcoin#14179. Context: bitcoin#13954 (comment) Tree-SHA512: 4606b19bb32cdd661f90b3778759818d3493e5ed1a4a2f95982f07eeb6b9c889bc8d53cde31706e0a3b9524c3d3a7378f1b769a60baeb0d00da4c68fd3068114
… reported by codespell. f8a81f7 lint: Add spell check linter (codespell) (practicalswift) ada3562 Fix typos reported by codespell (practicalswift) Pull request description: * Check for common misspellings using `codespell`. * Fix recently introduced typos reported by `codespell`. Tree-SHA512: 9974c0e640b411c7d0ebc5b45de253c19bac7fe3002cd98601ff8da8db584224c2fd7d331aee3df612c9f2cfef540d647a9b4c5a1a73fd208dc93ce4bf9e5e3e
c32cf6a Add ignored word: mut (practicalswift) 4ae50da Revert "qa: Fix codespell error and have lint-spelling error instead of warn" (practicalswift) Pull request description: Revert `codespell` policy change introduced in bitcoin#14179. Context: bitcoin#13954 (comment) Tree-SHA512: 4606b19bb32cdd661f90b3778759818d3493e5ed1a4a2f95982f07eeb6b9c889bc8d53cde31706e0a3b9524c3d3a7378f1b769a60baeb0d00da4c68fd3068114
… reported by codespell. f8a81f7 lint: Add spell check linter (codespell) (practicalswift) ada3562 Fix typos reported by codespell (practicalswift) Pull request description: * Check for common misspellings using `codespell`. * Fix recently introduced typos reported by `codespell`. Tree-SHA512: 9974c0e640b411c7d0ebc5b45de253c19bac7fe3002cd98601ff8da8db584224c2fd7d331aee3df612c9f2cfef540d647a9b4c5a1a73fd208dc93ce4bf9e5e3e
c32cf6a Add ignored word: mut (practicalswift) 4ae50da Revert "qa: Fix codespell error and have lint-spelling error instead of warn" (practicalswift) Pull request description: Revert `codespell` policy change introduced in bitcoin#14179. Context: bitcoin#13954 (comment) Tree-SHA512: 4606b19bb32cdd661f90b3778759818d3493e5ed1a4a2f95982f07eeb6b9c889bc8d53cde31706e0a3b9524c3d3a7378f1b769a60baeb0d00da4c68fd3068114
… reported by codespell. f8a81f7 lint: Add spell check linter (codespell) (practicalswift) ada3562 Fix typos reported by codespell (practicalswift) Pull request description: * Check for common misspellings using `codespell`. * Fix recently introduced typos reported by `codespell`. Tree-SHA512: 9974c0e640b411c7d0ebc5b45de253c19bac7fe3002cd98601ff8da8db584224c2fd7d331aee3df612c9f2cfef540d647a9b4c5a1a73fd208dc93ce4bf9e5e3e
codespell
.codespell
.