Page MenuHomeSoftware Heritage

pre-commit: Bump codespell and add hook to check commit msg spelling
ClosedPublic

Authored by anlambert on Feb 9 2022, 4:51 PM.

Details

Summary

Add a new optional hook to check spelling of commit messages.
Below is an example of use:

(swh) ✔ ~/swh/swh-environment/swh-loader-svn [master ↑·1|⚑ 35] 
16:48 $ pre-commit install -t commit-msg
pre-commit installed at .git/hooks/commit-msg
(swh) ✔ ~/swh/swh-environment/swh-loader-svn [master ↑·1|⚑ 35] 
16:48 $ touch foo
(swh) ✔ ~/swh/swh-environment/swh-loader-svn [master ↑·1|…1⚑ 35] 
16:48 $ git add foo
(swh) ✔ ~/swh/swh-environment/swh-loader-svn [master ↑·1|●1⚑ 35] 
16:48 $ git commit -m "Thi is a mesage with speling issue"
Trim Trailing Whitespace.................................................Passed
Check JSON...........................................(no files to check)Skipped
Check Yaml...........................................(no files to check)Skipped
flake8...............................................(no files to check)Skipped
Check source code spelling...............................................Passed
mypy.................................................(no files to check)Skipped
isort................................................(no files to check)Skipped
black................................................(no files to check)Skipped
Check JSON...........................................(no files to check)Skipped
Check Yaml...........................................(no files to check)Skipped
flake8...............................................(no files to check)Skipped
Check commit message spelling............................................Failed
- hook id: codespell
- exit code: 65

.git/COMMIT_EDITMSG:1: Thi ==> The, this
.git/COMMIT_EDITMSG:1: mesage ==> message
.git/COMMIT_EDITMSG:1: speling ==> spelling

mypy.................................................(no files to check)Skipped
isort................................................(no files to check)Skipped
black................................................(no files to check)Skipped

Diff Detail

Repository
rDLDSVN Subversion (SVN) loader
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D7138 (id=25875)

Rebasing onto b5769ef7d6...

Current branch diff-target is up to date.
Changes applied before test
commit 727172d5f176004461f453eeffe9b29f4e604a88
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Feb 9 16:15:58 2022 +0100

    pre-commit: Bump codespell and add hook to check commit msg spelling
    
    To install the new hook:
    
     $ pre-commit install -t commit-msg

See https://jenkins.softwareheritage.org/job/DLDSVN/job/tests-on-diff/300/ for more details.

ardumont added a subscriber: ardumont.

fine with me!

"fini les typos!"

This revision is now accepted and ready to land.Feb 9 2022, 4:57 PM

I will submit similar diffs for other swh repositories.

I will submit similar diffs for other swh repositories.

great.

@vlorentz added swh-environment/bin/change-all-repos for that purpose.
That should help a bit.

And also for the other task about bumping black [1]

[1] T3922

Build is green

Patch application report for D7138 (id=25896)

Rebasing onto b5769ef7d6...

Current branch diff-target is up to date.
Changes applied before test
commit 8e5e5b94a5d79845e3f07138f38be5c77f701295
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Feb 9 16:15:58 2022 +0100

    pre-commit: Bump hooks and add new one to check commit message spelling
    
    To install the new hook:
    
     $ pre-commit install -t commit-msg

See https://jenkins.softwareheritage.org/job/DLDSVN/job/tests-on-diff/301/ for more details.