mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 23:03:45 +01:00
Merge bitcoin/bitcoin#34053: lint: Remove confusing, redundant, and brittle lint-spelling
fa904fc683lint: Remove confusing, redundant, and brittle lint-spelling (MarcoFalke) Pull request description: `codespell` was a fun experiment. However, it has many issues, when used in this project: * The number of false-positives and true-positives are in the same ballpark. There are also many false-negatives, so the overall net-benefit is questionable. * There is often confusion around spelling errors leading to a failing CI (they do not, which was intended). * LLMs released this year are capable to detect typos with less false-positives and less false-negatives, so the `codespell` integration is a bit redundant in that sense. Fix all issues by removing it. Going forward, anyone is free to continue to use `codespell`, or any LLM, or any other tool, locally. Also, DrahtBot has the LLM typo linter integrated in the summary comment. I think the options are plenty, and are more than sufficient for now. ACKs for top commit: l0rinc: ACKfa904fc683rkrux: ACKfa904fc683pablomartin4btc: ACKfa904fc683Tree-SHA512: 5e2008a77c2c313605f30d73286111eba034a2a6bb2a0a48e2f77ec6ccc7afaa274e00bbfcb727be0ac5e547b8ae9c801d30c43589b0cad2099565e6716b9ec7
This commit is contained in:
@@ -40,7 +40,6 @@ command -v python3
|
||||
python3 --version
|
||||
|
||||
${CI_RETRY_EXE} pip3 install \
|
||||
codespell==2.4.1 \
|
||||
lief==0.16.6 \
|
||||
mypy==1.18.2 \
|
||||
pyzmq==27.1.0 \
|
||||
|
||||
@@ -50,7 +50,6 @@ or `--help`:
|
||||
| [`lint-python.py`](/test/lint/lint-python.py) | [pyzmq](https://github.com/zeromq/pyzmq)
|
||||
| [`lint-python-dead-code.py`](/test/lint/lint-python-dead-code.py) | [vulture](https://github.com/jendrikseipp/vulture)
|
||||
| [`lint-shell.py`](/test/lint/lint-shell.py) | [ShellCheck](https://github.com/koalaman/shellcheck)
|
||||
| [`lint-spelling.py`](/test/lint/lint-spelling.py) | [codespell](https://github.com/codespell-project/codespell)
|
||||
| `py_lint` | [ruff](https://github.com/astral-sh/ruff)
|
||||
| markdown link check | [mlc](https://github.com/becheran/mlc)
|
||||
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (c) 2022-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
"""
|
||||
Warn in case of spelling errors.
|
||||
Note: Will exit successfully regardless of spelling errors.
|
||||
"""
|
||||
|
||||
from subprocess import check_output, STDOUT, CalledProcessError
|
||||
|
||||
from lint_ignore_dirs import SHARED_EXCLUDED_SUBTREES
|
||||
|
||||
IGNORE_WORDS_FILE = 'test/lint/spelling.ignore-words.txt'
|
||||
FILES_ARGS = ['git', 'ls-files', '--', ":(exclude)contrib/seeds/*.txt", ":(exclude)depends/", ":(exclude)doc/release-notes/", ":(exclude)src/qt/locale/", ":(exclude)src/qt/*.qrc", ":(exclude)contrib/guix/patches"]
|
||||
FILES_ARGS += [f":(exclude){dir}" for dir in SHARED_EXCLUDED_SUBTREES]
|
||||
|
||||
|
||||
def check_codespell_install():
|
||||
try:
|
||||
check_output(["codespell", "--version"])
|
||||
except FileNotFoundError:
|
||||
print("Skipping spell check linting since codespell is not installed.")
|
||||
exit(0)
|
||||
|
||||
|
||||
def main():
|
||||
check_codespell_install()
|
||||
|
||||
files = check_output(FILES_ARGS, text=True).splitlines()
|
||||
codespell_args = ['codespell', '--check-filenames', '--disable-colors', '--quiet-level=7', '--ignore-words={}'.format(IGNORE_WORDS_FILE)] + files
|
||||
|
||||
try:
|
||||
check_output(codespell_args, stderr=STDOUT, text=True)
|
||||
except CalledProcessError as e:
|
||||
print(e.output, end="")
|
||||
print('^ Warning: codespell identified likely spelling errors. Any false positives? Add them to the list of ignored words in {}'.format(IGNORE_WORDS_FILE))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,29 +0,0 @@
|
||||
afile
|
||||
amountIn
|
||||
anc
|
||||
blockin
|
||||
bu
|
||||
cachable
|
||||
clen
|
||||
debbugs
|
||||
deques
|
||||
fo
|
||||
hashIn
|
||||
hights
|
||||
incomin
|
||||
invokable
|
||||
lief
|
||||
mor
|
||||
nd
|
||||
nin
|
||||
ot
|
||||
outIn
|
||||
requestor
|
||||
ser
|
||||
siz
|
||||
stap
|
||||
unparseable
|
||||
unser
|
||||
useable
|
||||
viewIn
|
||||
wit
|
||||
Reference in New Issue
Block a user