Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Adding shellcheck to openverse-api #922

Merged
merged 17 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@ repos:
hooks:
- id: prettier
types: [yaml]
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.8.0
hooks:
- id: shellcheck
10 changes: 5 additions & 5 deletions api/test/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ endcol="\e[0m"
# $ ./test/run_test.sh test/audio_integration_test.py
# ```
if [ $# -ge 1 ]; then
TEST_ARG="$@"
TEST_ARG=( "$@" )
else
TEST_ARG="test/"
TEST_ARG=( "test/" )
fi

PYTHONWARNINGS="ignore:Unverified HTTPS request" \
PYTHONPATH=. \
pytest -s --disable-pytest-warnings $TEST_ARG
pytest -s --disable-pytest-warnings "${TEST_ARG[@]}"

succeeded=$?
if [[ $succeeded -eq 0 ]]; then
printf "${green}:-) All tests passed${endcol}\n"
printf "%b:-) All tests passed${endcol}\n" "${green}"
else
printf "\n\n${red}:'( Some tests did not pass${endcol}\n"
printf "\n\n%b:'( Some tests did not pass${endcol}\n" "${red}"
printf "Hint: \`just logs [service]\` will print the Docker logs and may be helpful for debugging.\n\n"
fi
exit $succeeded
10 changes: 5 additions & 5 deletions ingestion_server/test/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ endcol="\e[0m"
# $ ./test/run_test.sh test/unit_test.py
# ```
if [ $# -ge 1 ]; then
TEST_ARG="$@"
TEST_ARG=( "$@" )
else
TEST_ARG="test/"
TEST_ARG=( "test/" )
fi

PYTHONWARNINGS="ignore:Unverified HTTPS request" \
PYTHONPATH=. \
pytest -sx -vv --disable-pytest-warnings $TEST_ARG
pytest -sx -vv --disable-pytest-warnings "${TEST_ARG[@]}"

succeeded=$?
if [[ $succeeded -eq 0 ]]; then
printf "${green}:-) All tests passed${endcol}\n"
printf "%b:-) All tests passed${endcol}\n" "${green}"
else
printf "${red}:'( Some tests did not pass${endcol}\n"
printf "\n\n%b:'( Some tests did not pass${endcol}\n" "${red}"
fi
exit $succeeded
2 changes: 1 addition & 1 deletion ingestion_server/test/update_mocks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ docker run \

green="\e[32m"
endcol="\e[0m"
printf "${green}:-) Exported new mock data${endcol}\n"
printf "%b:-) Exported new mock data${endcol}\n" "${green}"
4 changes: 2 additions & 2 deletions load_sample_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ just wait-for-index "audio"
set +e
while true; do
just ingest-upstream "image" "init"
just wait-for-index "image-init"
if [ $? -eq 0 ]; then
if just wait-for-index "image-init"
then
break
fi
((c++)) && ((c==3)) && break
Expand Down