Skip to content

Commit a1b82e7

Browse files
committed
Use Hunspell spell checker instead of Aspell
Following upcoming recommendation of Fedora to depreciate Aspell and migrate to Hunspell [1]. Update documentation and scripts to use Hunspell. [1] https://fedoraproject.org/wiki/Changes/AspellDeprecation
1 parent 5079663 commit a1b82e7

File tree

7 files changed

+20
-18
lines changed

7 files changed

+20
-18
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ script/nglfar2ccov export-ignore
1616
script/commit-msg export-ignore
1717
script/pre-commit export-ignore
1818
.codespellrc export-ignore
19-
.aspell.en.pws export-ignore
19+
.hunspell.en.dic export-ignore
2020
# no export of website-specific content
2121
doc/talk export-ignore

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
/lint.sum
1212
/icdiff
1313
/.noicdiff
14-
/.aspell.en.prepl
1514
/miniconda3
1615
/nagelfar*
1716
/OpenFOAM-dev

.aspell.en.pws renamed to .hunspell.en.dic

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
personal_ws-1.1 en 907
21
ABBRVLIST
32
ActiveTcl
43
Adrien

CONTRIBUTING.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,21 +223,21 @@ Commit hooks
223223
A :command:`pre-commit` hook script is provided in the :file:`script`
224224
directory of the project to help you check that the contribution made is free
225225
of misspellings and trailing spaces. It requires the `codespell`_ utility that
226-
checks for typos in any kind of files and the `Aspell`_ utility that spell
226+
checks for typos in any kind of files and the `Hunspell`_ utility that spell
227227
checks documentation files. The :command:`pre-commit` could be enabled in your
228228
local repository with following command::
229229

230230
ln -s ../../script/pre-commit .git/hooks/pre-commit
231231

232232
A :command:`commit-msg` hook script is also provided in the :file:`script`
233233
directory of the project to help you check that your commit messages are free
234-
of misspellings. It requires the `Aspell`_ utility and could be enabled in
234+
of misspellings. It requires the `Hunspell`_ utility and could be enabled in
235235
your local repository with following command::
236236

237237
ln -s ../../script/commit-msg .git/hooks/commit-msg
238238

239239
.. _codespell: https://github.com/codespell-project/codespell
240-
.. _Aspell: http://aspell.net/
240+
.. _Hunspell: https://hunspell.github.io/
241241

242242
Emacs settings for coding conventions
243243
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

NEWS.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ Modules 5.3.1 (not yet released)
2121
(fix issue #494)
2222
* Fix extra specifier requirement search when module searched is also defining
2323
a requirement and is the sole module to define it. (fix issue #495)
24+
* Script: update :command:`pre-commit` and :command:`commit-msg` git hook
25+
scripts to use `Hunspell`_ as spell checker instead of Aspell.
26+
27+
.. _Hunspell: https://hunspell.github.io/
2428

2529

2630
Modules 5.3.0 (2023-05-14)

script/commit-msg

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
#
33
# COMMIT-MSG, hook script to verify commit message
4-
# Copyright (C) 2022 Xavier Delaruelle
4+
# Copyright (C) 2022-2023 Xavier Delaruelle
55
#
66
# This program is free software: you can redistribute it and/or modify
77
# it under the terms of the GNU General Public License as published by
@@ -45,11 +45,11 @@ echo_hint() {
4545
}
4646

4747
# check misspellings in commit message
48-
command -v aspell >/dev/null
48+
command -v hunspell >/dev/null
4949
if [ $? -eq 0 ]; then
50-
ASPELL_OPTS=(-l en -x --home-dir=. --personal=.aspell.en.pws)
50+
HUNSPELL_OPTS=(-d en_US -p .hunspell.en.dic)
5151
# use sed to extract commit message from full commit details
52-
words=$(sed '/^# /Q' "$1" | aspell "${ASPELL_OPTS[@]}" list)
52+
words=$(sed '/^# /Q' "$1" | hunspell "${HUNSPELL_OPTS[@]}" -l)
5353
# abort if misspelled words found
5454
if [ -n "$words" ]; then
5555
befmsg='# commit message was ---------------- >8 -------------'
@@ -60,7 +60,7 @@ if [ $? -eq 0 ]; then
6060
exit 1
6161
fi
6262
else
63-
echo_warning "aspell command not found"
63+
echo_warning "hunspell command not found"
6464
fi
6565

6666
exit 0

script/pre-commit

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
#
33
# PRE-COMMIT, hook script to verify what is about to be committed
4-
# Copyright (C) 2022 Xavier Delaruelle
4+
# Copyright (C) 2022-2023 Xavier Delaruelle
55
#
66
# This program is free software: you can redistribute it and/or modify
77
# it under the terms of the GNU General Public License as published by
@@ -52,17 +52,17 @@ else
5252
fi
5353

5454
# interactively check misspellings in doc files
55-
command -v aspell >/dev/null
55+
command -v hunspell >/dev/null
5656
if [ $? -eq 0 ]; then
5757
misspell=0
58-
ASPELL_OPTS=(-l en -x --home-dir=. --personal=.aspell.en.pws)
58+
HUNSPELL_OPTS=(-d en_US -p .hunspell.en.dic)
5959
for docfile in $(git diff --cached --name-only --diff-filter=d | grep -E\
6060
'(.rst|.md)$'); do
61-
words=$(git diff --cached "$docfile" | grep '^[+][^+]' | aspell\
62-
"${ASPELL_OPTS[@]}" list)
61+
words=$(git diff --cached "$docfile" | grep '^[+][^+]' | hunspell\
62+
"${HUNSPELL_OPTS[@]}" -l)
6363
if [ -n "$words" ]; then
6464
# interactively edit file to fix misspellings
65-
aspell "${ASPELL_OPTS[@]}" check "$docfile" </dev/tty >/dev/tty;
65+
hunspell "${HUNSPELL_OPTS[@]}" "$docfile" </dev/tty >/dev/tty;
6666
misspell=1
6767
fi
6868
done
@@ -72,7 +72,7 @@ if [ $? -eq 0 ]; then
7272
exit 1
7373
fi
7474
else
75-
echo_warning "aspell command not found"
75+
echo_warning "hunspell command not found"
7676
fi
7777

7878
# fail if there are whitespace errors

0 commit comments

Comments
 (0)