-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
# Shell script to check if all .dic and .aff files are encoded in ISO-8859-1 | ||
|
||
get_encoding() { | ||
for ext in dic aff; do | ||
find ./data/spelling-dict/hunspell -type f -name "pt*.${ext}" -exec file {} \; | ||
done | ||
} | ||
|
||
FILE_ENCODINGS=$(get_encoding) | ||
|
||
check_encoding() { | ||
echo "${FILE_ENCODINGS}" | grep -v "ISO-8859 text" | ||
} | ||
|
||
|
||
if [[ -z $(check_encoding) ]]; then | ||
echo "All .dic and .aff files are encoded in ISO-8859-1, we're good!" | ||
exit 0 | ||
else | ||
echo "Some .dic and .aff files are not encoded in ISO-8859-1, please fix this." | ||
echo "${FILE_ENCODINGS}" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Check for files that do not end with a newline | ||
|
||
check_newlines() { | ||
find ./data/src-dict -name "*.txt" -type f -print0 | xargs -0 -n1 bash -c 'tail -c1 "$1" | read -r _ || echo "$1"' bash | ||
} | ||
|
||
NO_NEWLINE_FILES=$(check_newlines) | ||
|
||
if [[ -z "${NO_NEWLINE_FILES}" ]]; then | ||
echo "All files end with a blank line, which is good." | ||
exit 0 | ||
else | ||
echo "Some files do not end with a newline:" | ||
echo "${NO_NEWLINE_FILES}" | ||
exit 1 | ||
fi |