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

Commit

Permalink
Adding shellcheck to openverse-api (#922)
Browse files Browse the repository at this point in the history
* adding shellcheck to openverse-api

Signed-off-by: MustkimKhatik <[email protected]>

* Update .pre-commit-config.yaml

trailing newline

* Update run_test.sh

syntax correction in run_test.sh

* Update run_test.sh

Some corrections in run_test

* Update run_test.sh

some corrections in run_test

* Update run_test.sh

syntax correction in ingestion_sever/run_test.sh

* Update update_mocks.sh

syntax correction in update_mocks.sh

* Update run_test.sh

syntax correction in run_test.sh

* Update run_test.sh

* correction of SC2181 

syntax correction in load_sample.sh

* Fix EOL at EOF

* Remove stray spaces from end of line

* Remove extra fullstop

* Replace `%s` with `%b` for ANSI color codes

Signed-off-by: MustkimKhatik <[email protected]>
Co-authored-by: Dhruv Bhanushali <[email protected]>
  • Loading branch information
MustkimKhatik and dhruvkb authored Oct 4, 2022
1 parent 0746fdd commit 043b319
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
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

0 comments on commit 043b319

Please sign in to comment.