Skip to content

Commit 6120389

Browse files
committed
Update helpers.sh
Uses case statement instead of if statement.
1 parent 9e71424 commit 6120389

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

helpers.sh

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ set -euo pipefail
44

55
clean() {
66
# Remove build artifacts and temporary files
7-
rm -rf build dist __pycache__ *.egg-info **/*.egg-info *.pyc **/*.pyc reports 2>/dev/null || true
7+
rm -rf {build,dist,__pycache__,*.egg-info,**/*.egg-info,*.pyc,**/*.pyc,reports} 2>/dev/null || true
88
}
99

1010
qa() {
1111
# Run static analysis tools
1212
if command -v flake8 >/dev/null 2>&1; then
1313
flake8 .
1414
fi
15+
1516
python run_pylint.py
1617
}
1718

@@ -21,19 +22,24 @@ style() {
2122
black --exclude=".*/*(dist|venv|.venv|test-results)/*.*" .
2223
}
2324

24-
if [[ "$@" == *"clean"* ]]; then
25-
printf 'Removing build artifacts and temporary files...\n'
26-
clean
27-
elif [[ "$@" == *"qa"* ]]; then
28-
printf 'Running static analysis tools...\n'
29-
qa
30-
elif [[ "$@" == *"style"* ]]; then
31-
printf 'Running code formatters...\n'
32-
style
33-
else
34-
printf 'Usage: %s [clean|qa|style]\n' "$0"
35-
exit 1
36-
fi
25+
case "$1" in
26+
clean)
27+
echo Removing build artifacts and temporary files...
28+
clean
29+
;;
30+
qa)
31+
echo Running static analysis tools...
32+
qa
33+
;;
34+
style)
35+
echo Running code formatters...
36+
style
37+
;;
38+
*)
39+
echo "Usage: $0 [clean|qa|style]"
40+
exit 1
41+
;;
42+
esac
3743

3844
printf 'Done!\n\n'
3945
exit 0

0 commit comments

Comments
 (0)