Skip to content

Commit

Permalink
Update shell lint config and fix the lint
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Jul 30, 2024
1 parent 3e4fca4 commit ea83405
Show file tree
Hide file tree
Showing 105 changed files with 423 additions and 472 deletions.
5 changes: 5 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
enable=avoid-nullary-conditions
enable=deprecate-which
enable=quote-safe-variables
enable=require-double-brackets
shell=bash
6 changes: 3 additions & 3 deletions scripts/check-tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ set -euo pipefail
FOLDERS=$(find . -name 'problem.md' | sed 's/problem.md//g' | sort)
EXIT_STATUS=0

for folder_tag in $FOLDERS; do
[ -s "${folder_tag}tags.txt" ] && continue
for folder_tag in ${FOLDERS}; do
[[ -s "${folder_tag}tags.txt" ]] && continue

EXIT_STATUS=1
echo "Missing content for ${folder_tag}tags.txt"
done

exit $EXIT_STATUS
exit "${EXIT_STATUS}"
50 changes: 0 additions & 50 deletions scripts/docker-cmd.sh

This file was deleted.

10 changes: 5 additions & 5 deletions scripts/docker/run-c.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ echo
FOLDERS=$(find . -name 'problem.md' | sed 's/problem.md//g' | sort)

for folder in ${FOLDERS}; do
[ -f "${folder}WRONG" ] && continue
[[ -f "${folder}WRONG" ]] && continue

if [[ "$(find "$folder" -name '*.c' | wc -l)" -eq 1 ]]; then
echo "$folder"
cd "$folder" || exit 1
if [[ "$(find "${folder}" -name '*.c' | wc -l)" -eq 1 ]]; then
echo "${folder}"
cd "${folder}" || exit 1

gcc -Werror -std=c99 -O2 -lm ./*.c

if [ -f in.txt ]; then
if [[ -f in.txt ]]; then
./a.out < in.txt > result-c.txt
else
./a.out > result-c.txt
Expand Down
12 changes: 6 additions & 6 deletions scripts/docker/run-clj.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ echo
echo "CLOJURE"
echo

for folder in $FOLDERS; do
[ -f "${folder}WRONG" ] && continue
for folder in ${FOLDERS}; do
[[ -f "${folder}WRONG" ]] && continue

if [ "$(find "$folder" -name '*.clj' | wc -l)" -eq 1 ]; then
echo "$folder"
cd "$folder" || exit 1
if [[ "$(find "${folder}" -name '*.clj' | wc -l)" -eq 1 ]]; then
echo "${folder}"
cd "${folder}" || exit 1

if [ -f in.txt ]; then
if [[ -f in.txt ]]; then
clojure -M ./*.clj < in.txt > result-clj.txt
else
clojure -M ./*.clj > result-clj.txt
Expand Down
6 changes: 3 additions & 3 deletions scripts/docker/run-cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ echo
echo "C++"
echo

for folder in $FOLDERS; do
for folder in ${FOLDERS}; do
[[ -f "${folder}WRONG" ]] && continue
if [[ "$(find "$folder" -name '*.cpp' | wc -l)" -eq 1 ]]; then
echo "$folder"
if [[ "$(find "${folder}" -name '*.cpp' | wc -l)" -eq 1 ]]; then
echo "${folder}"
cd "${folder}" || exit 1

g++ -Werror -std=c++20 -O2 -lm ./*.cpp
Expand Down
12 changes: 6 additions & 6 deletions scripts/docker/run-cs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ echo
echo "C#"
echo

for folder in $FOLDERS; do
[ -f "${folder}WRONG" ] && continue
for folder in ${FOLDERS}; do
[[ -f "${folder}WRONG" ]] && continue

if [ "$(find "$folder" -name '*.cs' | wc -l)" -eq 1 ]; then
echo "$folder"
cd "$folder" || exit 1
if [[ "$(find "${folder}" -name '*.cs' | wc -l)" -eq 1 ]]; then
echo "${folder}"
cd "${folder}" || exit 1

mcs -out:a.exe ./*.cs

if [ -f in.txt ]; then
if [[ -f in.txt ]]; then
mono a.exe < in.txt > result-cs.txt
else
mono a.exe > result-cs.txt
Expand Down
12 changes: 6 additions & 6 deletions scripts/docker/run-dart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ echo
echo "DART"
echo

for folder in $FOLDERS; do
[ -f "${folder}WRONG" ] && continue
for folder in ${FOLDERS}; do
[[ -f "${folder}WRONG" ]] && continue

if [ "$(find "$folder" -name '*.dart' | wc -l)" -eq 1 ]; then
echo "$folder"
cd "$folder" || exit 1
if [[ "$(find "${folder}" -name '*.dart' | wc -l)" -eq 1 ]]; then
echo "${folder}"
cd "${folder}" || exit 1

if [ -f in.txt ]; then
if [[ -f in.txt ]]; then
dart ./*.dart < in.txt > result-dart.txt
else
dart ./*.dart > result-dart.txt
Expand Down
12 changes: 6 additions & 6 deletions scripts/docker/run-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ echo
echo "GO"
echo

for folder in $FOLDERS; do
[ -f "${folder}WRONG" ] && continue
for folder in ${FOLDERS}; do
[[ -f "${folder}WRONG" ]] && continue

if [ "$(find "$folder" -name '*.go' | wc -l)" -eq 1 ]; then
echo "$folder"
cd "$folder" || exit 1
if [[ "$(find "${folder}" -name '*.go' | wc -l)" -eq 1 ]]; then
echo "${folder}"
cd "${folder}" || exit 1

if [ -f in.txt ]; then
if [[ -f in.txt ]]; then
go run ./*.go < in.txt > result-go.txt
else
go run ./*.go > result-go.txt
Expand Down
12 changes: 6 additions & 6 deletions scripts/docker/run-hs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ echo
echo "HASKELL"
echo

for folder in $FOLDERS; do
[ -f "${folder}WRONG" ] && continue
for folder in ${FOLDERS}; do
[[ -f "${folder}WRONG" ]] && continue

if [ "$(find "$folder" -name '*.hs' | wc -l)" -eq 1 ]; then
echo "$folder"
cd "$folder" || exit 1
if [[ "$(find "${folder}" -name '*.hs' | wc -l)" -eq 1 ]]; then
echo "${folder}"
cd "${folder}" || exit 1

ghc -o hs.out ./*.hs > /dev/null

if [ -f in.txt ]; then
if [[ -f in.txt ]]; then
./hs.out < in.txt > result-hs.txt
else
./hs.out > result-hs.txt
Expand Down
12 changes: 6 additions & 6 deletions scripts/docker/run-java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ echo
echo "JAVA"
echo

for folder in $FOLDERS; do
[ -f "${folder}WRONG" ] && continue
for folder in ${FOLDERS}; do
[[ -f "${folder}WRONG" ]] && continue

if [ "$(find "$folder" -name '*.java' | wc -l)" -eq 1 ]; then
echo "$folder"
cd "$folder" || exit 1
if [[ "$(find "${folder}" -name '*.java' | wc -l)" -eq 1 ]]; then
echo "${folder}"
cd "${folder}" || exit 1

cp ./*.java Main.java
javac Main.java

if [ -f in.txt ]; then
if [[ -f in.txt ]]; then
java Main < in.txt > result-java.txt
else
java Main > result-java.txt
Expand Down
12 changes: 6 additions & 6 deletions scripts/docker/run-js.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ echo
echo "JAVASCRIPT"
echo

for folder in $FOLDERS; do
[ -f "${folder}WRONG" ] && continue
for folder in ${FOLDERS}; do
[[ -f "${folder}WRONG" ]] && continue

if [ "$(find "$folder" -name '*.js' | wc -l)" -eq 1 ]; then
echo "$folder"
cd "$folder" || exit 1
if [[ "$(find "${folder}" -name '*.js' | wc -l)" -eq 1 ]]; then
echo "${folder}"
cd "${folder}" || exit 1

if [ -f in.txt ]; then
if [[ -f in.txt ]]; then
node ./*.js < in.txt > result-js.txt
else
node ./*.js > result-js.txt
Expand Down
12 changes: 6 additions & 6 deletions scripts/docker/run-kt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ echo
echo "KOTLIN"
echo

for folder in $FOLDERS; do
[ -f "${folder}WRONG" ] && continue
for folder in ${FOLDERS}; do
[[ -f "${folder}WRONG" ]] && continue

if [ "$(find "$folder" -name '*.kt' | wc -l)" -eq 1 ]; then
echo "$folder"
cd "$folder" || exit 1
if [[ "$(find "${folder}" -name '*.kt' | wc -l)" -eq 1 ]]; then
echo "${folder}"
cd "${folder}" || exit 1

cp ./*.kt main.kt
/kotlinc/bin/kotlinc main.kt

if [ -f in.txt ]; then
if [[ -f in.txt ]]; then
/kotlinc/bin/kotlin MainKt < in.txt > result-kt.txt
else
/kotlinc/bin/kotlin MainKt > result-kt.txt
Expand Down
12 changes: 6 additions & 6 deletions scripts/docker/run-lua.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ echo
echo "LUA"
echo

for folder in $FOLDERS; do
[ -f "${folder}WRONG" ] && continue
for folder in ${FOLDERS}; do
[[ -f "${folder}WRONG" ]] && continue

if [ "$(find "$folder" -name '*.lua' | wc -l)" -eq 1 ]; then
echo "$folder"
cd "$folder" || exit 1
if [[ "$(find "${folder}" -name '*.lua' | wc -l)" -eq 1 ]]; then
echo "${folder}"
cd "${folder}" || exit 1

if [ -f in.txt ]; then
if [[ -f in.txt ]]; then
lua ./*.lua < in.txt > result-lua.txt
else
lua ./*.lua > result-lua.txt
Expand Down
12 changes: 6 additions & 6 deletions scripts/docker/run-ml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ echo
echo "OCAML"
echo

for folder in $FOLDERS; do
[ -f "${folder}WRONG" ] && continue
for folder in ${FOLDERS}; do
[[ -f "${folder}WRONG" ]] && continue

if [ "$(find "$folder" -name '*.ml' | wc -l)" -eq 1 ]; then
echo "$folder"
cd "$folder" || exit 1
if [[ "$(find "${folder}" -name '*.ml' | wc -l)" -eq 1 ]]; then
echo "${folder}"
cd "${folder}" || exit 1

cp ./*.ml main.ml
ocamlc -o ml.out main.ml

if [ -f in.txt ]; then
if [[ -f in.txt ]]; then
./ml.out < in.txt > result-ml.txt
else
./ml.out > result-ml.txt
Expand Down
12 changes: 6 additions & 6 deletions scripts/docker/run-pas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ echo
echo "PASCAL"
echo

for folder in $FOLDERS; do
[ -f "${folder}WRONG" ] && continue
for folder in ${FOLDERS}; do
[[ -f "${folder}WRONG" ]] && continue

if [ "$(find "$folder" -name '*.pas' | wc -l)" -eq 1 ]; then
echo "$folder"
cd "$folder" || exit 1
if [[ "$(find "${folder}" -name '*.pas' | wc -l)" -eq 1 ]]; then
echo "${folder}"
cd "${folder}" || exit 1

fpc -opas.out ./*.pas

if [ -f in.txt ]; then
if [[ -f in.txt ]]; then
./pas.out < in.txt > result-pas.txt
else
./pas.out > result-pas.txt
Expand Down
12 changes: 6 additions & 6 deletions scripts/docker/run-php.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ echo
echo "PHP"
echo

for folder in $FOLDERS; do
[ -f "${folder}WRONG" ] && continue
for folder in ${FOLDERS}; do
[[ -f "${folder}WRONG" ]] && continue

if [ "$(find "$folder" -name '*.php' | wc -l)" -eq 1 ]; then
echo "$folder"
cd "$folder" || exit 1
if [[ "$(find "${folder}" -name '*.php' | wc -l)" -eq 1 ]]; then
echo "${folder}"
cd "${folder}" || exit 1

if [ -f in.txt ]; then
if [[ -f in.txt ]]; then
php ./*.php < in.txt > result-php.txt
else
php ./*.php > result-php.txt
Expand Down
Loading

0 comments on commit ea83405

Please sign in to comment.