forked from BoboTiG/luma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
checks.sh
executable file
·66 lines (54 loc) · 1.42 KB
/
checks.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
set -eu
FOLDER='sources'
check_python_files() {
python -m ruff format "${FOLDER}" ./*.py
python -m ruff --fix "${FOLDER}" ./*.py
python -m mypy "${FOLDER}" ./*.py
}
check_shell_file() {
shellcheck -e SC1091,SC2164 "${1}"
}
check_shell_files() {
for file in $(/bin/find "${FOLDER}" -type f -name '*.sh'); do
check_shell_file "${file}"
done
check_shell_file 'checks.sh'
}
check_markdown_file() {
python -m pymarkdown --disable-rules line-length fix -r "${1}"
python -m pymarkdown --disable-rules line-length scan -r "${1}"
}
check_markdown_files() {
check_markdown_file "${FOLDER}"
check_markdown_file 'README.md'
}
check_spelling_file() {
# Requires the `aspell-fr` package to be installed
if [ "${CI:-false}" = "true" ]; then
aspell --home-dir='.' --mode='markdown' --lang='fr' --dont-backup list < "${1}"
else
aspell --home-dir='.' --mode='markdown' --lang='fr' --dont-backup check "${1}"
fi
}
check_spelling_files() {
for file in $(/bin/find "${FOLDER}" -type f -name '*.md'); do
check_spelling_file "${file}"
done
check_spelling_file 'README.md'
}
check_yaml_file() {
yamllint -d relaxed "${1}"
}
check_yaml_files() {
check_yaml_file "${FOLDER}"
check_yaml_file '.github'
}
main() {
check_python_files
check_shell_files
check_markdown_files
check_yaml_files
check_spelling_files
}
main