File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
+ check_aspell_dict_header () {
4
+ local dict_file=" $1 "
5
+ local expected_lang=" $2 "
6
+
7
+ if [[ ! -f " $dict_file " ]]; then
8
+ echo " Error: Dictionary file '$dict_file ' does not exist"
9
+ return 1
10
+ fi
11
+
12
+ local first_line=$( head -n 1 " $dict_file " )
13
+
14
+ # Check if first line matches the expected format: personal_ws-1.1 LANG NUMBER
15
+ if [[ ! " $first_line " =~ ^personal_ws-1\. 1[[:space:]]+${expected_lang} [[:space:]]+[0-9]+$ ]]; then
16
+ echo " Error: Dictionary file '$dict_file ' missing or invalid header"
17
+ echo " Expected format: personal_ws-1.1 ${expected_lang} <word_count>"
18
+ echo " Found: $first_line "
19
+ return 1
20
+ fi
21
+
22
+ return 0
23
+ }
24
+
3
25
echo " Checking spelling using aspell"
4
26
5
27
# Only support OSX and Linux for now
@@ -33,6 +55,12 @@ CHECK_LANG=en
33
55
ASPELL_DICT_FILE=" ${ROOT_PATH} /scripts/aspell-dict-file.txt"
34
56
ASPELL_IGNORE_PATH=" ${ROOT_PATH} /scripts/aspell-ignore/${CHECK_LANG} "
35
57
58
+ # Check if main aspell dictionary has proper header
59
+ if ! check_aspell_dict_header " ${ASPELL_IGNORE_PATH} /aspell-dict.txt" " $CHECK_LANG " ; then
60
+ echo " Please ensure aspell-dict.txt has the proper header format"
61
+ exit 1
62
+ fi
63
+
36
64
# Function to get a list of files
37
65
get_files_to_check () {
38
66
if [[ ! -z ${1:- } ]]; then
You can’t perform that action at this time.
0 commit comments