From d78dec7201d7c1bd4d844e5651cfab861f0a7837 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Mon, 15 Nov 2021 14:52:16 +0100 Subject: [PATCH 1/2] Add codespell infastructure Add codespell configuration files: * `.codespellrc` is the root configuration file * `.codespell/ignore-words.txt` list of words that are false positives * `.codespell/exclude-file.txt` list of lines that contain false positives Add a pre-commit hook, confined to the manual stage. Also add a Makefile target that will call the pre-commit hook. --- .codespell/exclude-file.txt | 9 +++++++++ .codespell/ignore-words.txt | 17 +++++++++++++++++ .codespellrc | 5 +++++ .pre-commit-config.yaml | 13 ++++++++++--- Makefile | 4 ++++ requirements.txt | 3 +++ 6 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 .codespell/exclude-file.txt create mode 100644 .codespell/ignore-words.txt create mode 100644 .codespellrc diff --git a/.codespell/exclude-file.txt b/.codespell/exclude-file.txt new file mode 100644 index 00000000000..364eb2e2840 --- /dev/null +++ b/.codespell/exclude-file.txt @@ -0,0 +1,9 @@ + of scoped seem allright. I still think there is not enough need + + da de dum, hmm, hmm, dum de dum. + + output=`dmesg | grep hda` + p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE) + + Error-de_DE=Wenn ist das Nunstück git und Slotermeyer? + Ja! Beiherhund das Oder die Virtualenvironment gersput! diff --git a/.codespell/ignore-words.txt b/.codespell/ignore-words.txt new file mode 100644 index 00000000000..bb47e30bfd8 --- /dev/null +++ b/.codespell/ignore-words.txt @@ -0,0 +1,17 @@ +adaptee +ans +arithmetics +asend +ba +clos +complies +crate +extraversion +fo +iif +nd +ned +recuse +reenable +therefor +warmup diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000000..c3cd40b9401 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,5 @@ +[codespell] +skip = ./.git +ignore-words = .codespell/ignore-words.txt +exclude-file = .codespell/exclude-file.txt +uri-ignore-words-list = daa,ist,searchin,theses diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d339a4fd449..4094e99679a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,9 +2,9 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v3.4.0 hooks: - - id: mixed-line-ending - name: Normalize mixed line endings - args: [--fix=lf] + - id: mixed-line-ending + name: Normalize mixed line endings + args: [--fix=lf] - repo: https://github.com/pre-commit/pygrep-hooks rev: v1.8.0 @@ -17,6 +17,13 @@ repos: files: '^pep-\d+\.txt|\.rst$' types: [text] + - repo: https://github.com/codespell-project/codespell + rev: v2.1.0 + hooks: + - id: codespell + name: Check for common misspellings in text files + stages: [manual] + - repo: local hooks: - id: check-required-fields diff --git a/Makefile b/Makefile index 0f201b0c04a..083901a02dd 100644 --- a/Makefile +++ b/Makefile @@ -55,6 +55,10 @@ lint: pre-commit --version > /dev/null || python3 -m pip install pre-commit pre-commit run --all-files +spellcheck: + pre-commit --version > /dev/null || python3 -m pip install pre-commit + pre-commit run --all-files --hook-stage manual codespell + # New Sphinx targets: SPHINX_JOBS=8 diff --git a/requirements.txt b/requirements.txt index 837f41b3ef7..d00e9a5c51d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,6 @@ docutils >= 0.16 # For RSS feedgen >= 0.9.0 # For RSS feed + +# For catching typos +codespell From 114e8aedaed954db3f74009f307da90471764c31 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos Orfanos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Thu, 18 Nov 2021 04:39:05 +0100 Subject: [PATCH 2/2] Update requirements.txt Co-authored-by: CAM Gerlach --- requirements.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index d00e9a5c51d..837f41b3ef7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,3 @@ docutils >= 0.16 # For RSS feedgen >= 0.9.0 # For RSS feed - -# For catching typos -codespell