diff --git a/.gitattributes b/.gitattributes index 5b052986..2fa63f2f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -16,6 +16,6 @@ script/nglfar2ccov export-ignore script/commit-msg export-ignore script/pre-commit export-ignore .codespellrc export-ignore -.aspell.en.pws export-ignore +.hunspell.en.dic export-ignore # no export of website-specific content doc/talk export-ignore diff --git a/.gitignore b/.gitignore index 4a57b396..c7653457 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,6 @@ /lint.sum /icdiff /.noicdiff -/.aspell.en.prepl /miniconda3 /nagelfar* /OpenFOAM-dev diff --git a/.aspell.en.pws b/.hunspell.en.dic similarity index 99% rename from .aspell.en.pws rename to .hunspell.en.dic index 31dc7bf8..709c44ff 100644 --- a/.aspell.en.pws +++ b/.hunspell.en.dic @@ -1,4 +1,3 @@ -personal_ws-1.1 en 907 ABBRVLIST ActiveTcl Adrien diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index e457202d..df3bc640 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -223,7 +223,7 @@ Commit hooks A :command:`pre-commit` hook script is provided in the :file:`script` directory of the project to help you check that the contribution made is free of misspellings and trailing spaces. It requires the `codespell`_ utility that -checks for typos in any kind of files and the `Aspell`_ utility that spell +checks for typos in any kind of files and the `Hunspell`_ utility that spell checks documentation files. The :command:`pre-commit` could be enabled in your local repository with following command:: @@ -231,13 +231,13 @@ local repository with following command:: A :command:`commit-msg` hook script is also provided in the :file:`script` directory of the project to help you check that your commit messages are free -of misspellings. It requires the `Aspell`_ utility and could be enabled in +of misspellings. It requires the `Hunspell`_ utility and could be enabled in your local repository with following command:: ln -s ../../script/commit-msg .git/hooks/commit-msg .. _codespell: https://github.com/codespell-project/codespell -.. _Aspell: http://aspell.net/ +.. _Hunspell: https://hunspell.github.io/ Emacs settings for coding conventions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/NEWS.rst b/NEWS.rst index 3e5f541f..0642c751 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -21,6 +21,10 @@ Modules 5.3.1 (not yet released) (fix issue #494) * Fix extra specifier requirement search when module searched is also defining a requirement and is the sole module to define it. (fix issue #495) +* Script: update :command:`pre-commit` and :command:`commit-msg` git hook + scripts to use `Hunspell`_ as spell checker instead of Aspell. + +.. _Hunspell: https://hunspell.github.io/ Modules 5.3.0 (2023-05-14) diff --git a/script/commit-msg b/script/commit-msg index 30a995cf..dc341a1a 100755 --- a/script/commit-msg +++ b/script/commit-msg @@ -1,7 +1,7 @@ #!/bin/bash # # COMMIT-MSG, hook script to verify commit message -# Copyright (C) 2022 Xavier Delaruelle +# Copyright (C) 2022-2023 Xavier Delaruelle # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -45,11 +45,11 @@ echo_hint() { } # check misspellings in commit message -command -v aspell >/dev/null +command -v hunspell >/dev/null if [ $? -eq 0 ]; then - ASPELL_OPTS=(-l en -x --home-dir=. --personal=.aspell.en.pws) + HUNSPELL_OPTS=(-d en_US -p .hunspell.en.dic) # use sed to extract commit message from full commit details - words=$(sed '/^# /Q' "$1" | aspell "${ASPELL_OPTS[@]}" list) + words=$(sed '/^# /Q' "$1" | hunspell "${HUNSPELL_OPTS[@]}" -l) # abort if misspelled words found if [ -n "$words" ]; then befmsg='# commit message was ---------------- >8 -------------' @@ -60,7 +60,7 @@ if [ $? -eq 0 ]; then exit 1 fi else - echo_warning "aspell command not found" + echo_warning "hunspell command not found" fi exit 0 diff --git a/script/pre-commit b/script/pre-commit index 0abbe03e..59c6bc73 100755 --- a/script/pre-commit +++ b/script/pre-commit @@ -1,7 +1,7 @@ #!/bin/bash # # PRE-COMMIT, hook script to verify what is about to be committed -# Copyright (C) 2022 Xavier Delaruelle +# Copyright (C) 2022-2023 Xavier Delaruelle # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -52,17 +52,17 @@ else fi # interactively check misspellings in doc files -command -v aspell >/dev/null +command -v hunspell >/dev/null if [ $? -eq 0 ]; then misspell=0 - ASPELL_OPTS=(-l en -x --home-dir=. --personal=.aspell.en.pws) + HUNSPELL_OPTS=(-d en_US -p .hunspell.en.dic) for docfile in $(git diff --cached --name-only --diff-filter=d | grep -E\ '(.rst|.md)$'); do - words=$(git diff --cached "$docfile" | grep '^[+][^+]' | aspell\ - "${ASPELL_OPTS[@]}" list) + words=$(git diff --cached "$docfile" | grep '^[+][^+]' | hunspell\ + "${HUNSPELL_OPTS[@]}" -l) if [ -n "$words" ]; then # interactively edit file to fix misspellings - aspell "${ASPELL_OPTS[@]}" check "$docfile" /dev/tty; + hunspell "${HUNSPELL_OPTS[@]}" "$docfile" /dev/tty; misspell=1 fi done @@ -72,7 +72,7 @@ if [ $? -eq 0 ]; then exit 1 fi else - echo_warning "aspell command not found" + echo_warning "hunspell command not found" fi # fail if there are whitespace errors