fix: resolve shellcheck warnings

- lint_python.sh: remove unused VERBOSE variable, use OVERALL_STATUS for exit
- run_game.sh: add || exit after cd
- install_arch.sh/uninstall_arch.sh: separate local declaration and assignment
- lint.sh: use variable for pkg-config output to avoid word splitting
This commit is contained in:
Krzysztof kuhy Rudnicki 2025-11-30 13:48:17 +01:00
parent 5ed6fe2bc9
commit f8823a7de1
5 changed files with 11 additions and 13 deletions

View File

@ -254,7 +254,8 @@ test_installation() {
# Test default application association # Test default application association
if command -v xdg-mime &> /dev/null; then if command -v xdg-mime &> /dev/null; then
local default_app=$(xdg-mime query default image/jpeg 2>/dev/null) local default_app
default_app=$(xdg-mime query default image/jpeg 2>/dev/null)
if [[ "$default_app" == "imageviewer.desktop" ]]; then if [[ "$default_app" == "imageviewer.desktop" ]]; then
print_success "imageviewer is set as default image viewer" print_success "imageviewer is set as default image viewer"
else else

View File

@ -115,8 +115,10 @@ compile_check() {
print_step "Running compile check..." print_step "Running compile check..."
# Try to compile with extra warnings # Try to compile with extra warnings
local sdl_cflags
sdl_cflags=$(pkg-config --cflags sdl2 2>/dev/null || echo "-I/usr/include/SDL2")
if gcc -Wall -Wextra -Wpedantic -std=c99 -O2 \ if gcc -Wall -Wextra -Wpedantic -std=c99 -O2 \
$(pkg-config --cflags sdl2 2>/dev/null || echo "-I/usr/include/SDL2") \ ${sdl_cflags} \
-c main.c -o /tmp/main.o 2>/dev/null; then -c main.c -o /tmp/main.o 2>/dev/null; then
print_success "Compile check passed" print_success "Compile check passed"
rm -f /tmp/main.o rm -f /tmp/main.o
@ -124,7 +126,7 @@ compile_check() {
print_error "Compile check failed" print_error "Compile check failed"
print_step "Trying compile with detailed errors..." print_step "Trying compile with detailed errors..."
gcc -Wall -Wextra -Wpedantic -std=c99 -O2 \ gcc -Wall -Wextra -Wpedantic -std=c99 -O2 \
$(pkg-config --cflags sdl2 2>/dev/null || echo "-I/usr/include/SDL2") \ ${sdl_cflags} \
-c main.c -o /tmp/main.o -c main.c -o /tmp/main.o
fi fi
} }

View File

@ -79,7 +79,8 @@ reset_default_associations() {
for mime_type in "${mime_types[@]}"; do for mime_type in "${mime_types[@]}"; do
if command -v xdg-mime &> /dev/null; then if command -v xdg-mime &> /dev/null; then
# Check if imageviewer was the default # Check if imageviewer was the default
local current_default=$(xdg-mime query default "$mime_type" 2>/dev/null) local current_default
current_default=$(xdg-mime query default "$mime_type" 2>/dev/null)
if [[ "$current_default" == "imageviewer.desktop" ]]; then if [[ "$current_default" == "imageviewer.desktop" ]]; then
# Remove the association (this will fall back to system defaults) # Remove the association (this will fall back to system defaults)
local mimeapps_file="$HOME/.config/mimeapps.list" local mimeapps_file="$HOME/.config/mimeapps.list"

View File

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
cd "$(dirname "$0")" cd "$(dirname "$0")" || exit 1
python main.py python main.py

View File

@ -52,7 +52,6 @@ FIX_MODE=false
QUICK_MODE=false QUICK_MODE=false
REPORT_MODE=false REPORT_MODE=false
TARGET_FILES="" TARGET_FILES=""
VERBOSE=false
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case $1 in case $1 in
@ -68,10 +67,6 @@ while [[ $# -gt 0 ]]; do
REPORT_MODE=true REPORT_MODE=true
shift shift
;; ;;
--verbose|-v)
VERBOSE=true
shift
;;
--help|-h) --help|-h)
echo "Usage: $0 [OPTIONS] [FILES...]" echo "Usage: $0 [OPTIONS] [FILES...]"
echo "" echo ""
@ -79,7 +74,6 @@ while [[ $# -gt 0 ]]; do
echo " --fix, -f Auto-fix issues where possible" echo " --fix, -f Auto-fix issues where possible"
echo " --quick, -q Quick mode (ruff + mypy only)" echo " --quick, -q Quick mode (ruff + mypy only)"
echo " --report, -r Generate detailed reports to ./lint-reports/" echo " --report, -r Generate detailed reports to ./lint-reports/"
echo " --verbose, -v Show verbose output"
echo " --help, -h Show this help message" echo " --help, -h Show this help message"
echo "" echo ""
echo "Examples:" echo "Examples:"
@ -335,7 +329,7 @@ fi
print_header "Linting Summary" print_header "Linting Summary"
echo "" echo ""
if [[ ${#FAILED_TOOLS[@]} -gt 0 ]]; then if [[ ${OVERALL_STATUS} -ne 0 ]]; then
print_error "The following tools reported issues:" print_error "The following tools reported issues:"
for tool in "${FAILED_TOOLS[@]}"; do for tool in "${FAILED_TOOLS[@]}"; do
echo " - ${tool}" echo " - ${tool}"
@ -345,7 +339,7 @@ if [[ ${#FAILED_TOOLS[@]} -gt 0 ]]; then
print_info "Detailed reports saved to: ${PROJECT_ROOT}/lint-reports/" print_info "Detailed reports saved to: ${PROJECT_ROOT}/lint-reports/"
fi fi
print_info "Run with --fix to auto-fix issues where possible" print_info "Run with --fix to auto-fix issues where possible"
exit 1 exit ${OVERALL_STATUS}
else else
print_success "All linting checks passed!" print_success "All linting checks passed!"
exit 0 exit 0