2
1
Fork 0
mirror of https://git.savannah.gnu.org/git/gnuboot.git synced 2025-01-06 16:27:40 +01:00
gnuboot/tests/lint
Denis 'GNUtoo' Carikli 491225f38a
website-build: build.sh: make it pass shellcheck.
Without that fix, shellcheck -x complains a lot:
    In build.sh line 53:
    mkdir -p "$(dirname ${dst_path})"
                        ^---------^
    SC2086 (info): Double quote to prevent globbing and word splitting.

    In build.sh line 82:
    git -C "${dst_path}" am $(realpath ${patch})
                            ^------------------^
    SC2046 (warning): Quote this to prevent word splitting.
    git -C "${dst_path}" am $(realpath ${patch})
                                       ^------^
    SC2086 (info): Double quote to prevent globbing and word splitting.

    In build.sh line 112:
    opt="$(eval echo \$$i)"
                       ^--
    SC2086 (info): Double quote to prevent globbing and word splitting.

    In build.sh line 127:
    untitled_path="$(eval echo \$$(expr $i + 1))"
                                 ^------------^
    SC2046 (warning): Quote this to prevent word splitting.
    untitled_path="$(eval echo \$$(expr $i + 1))"
                                   ^--^
    SC2003 (style): expr is antiquated.
    Consider rewriting this using $((..)), ${} or [[ ]].
    untitled_path="$(eval echo \$$(expr $i + 1))"
                                        ^--
    SC2086 (info): Double quote to prevent globbing and word splitting.

    In build.sh line 128:
    i="$(expr "$i" + 1)"
         ^--^
    SC2003 (style): expr is antiquated.
    Consider rewriting this using $((..)), ${} or [[ ]].

    In build.sh line 136:
    i="$(expr "$i" + 1)"
         ^--^
    SC2003 (style): expr is antiquated.
    Consider rewriting this using $((..)), ${} or [[ ]].

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Acked-by: Adrien 'neox' Bourmault <neox@gnu.org>
2024-05-27 23:58:49 +02:00

74 lines
2.3 KiB
Bash
Executable file

#!/usr/bin/env bash
#
# Various code quality tests to avoid regressions in code quality.
#
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
report()
{
ret=$?
message="$1"
if [ ${ret} -eq 0 ] ; then
echo "[ OK ] ${message}"
else
echo "[ !! ] ${message} failed"
exit ${ret}
fi
}
run_shellcheck()
{
for path in "$@" ; do
shellcheck -x "${path}" ; report "${path}"
done
}
printf "+---------------------+\n"
printf "| Running lint tests: |\n"
printf "+---------------------+\n"
run_shellcheck \
autogen.sh \
build \
download \
modify \
update \
resources/packages/coreboot/distclean \
resources/packages/descriptors/distclean \
resources/packages/i945-thinkpads-install-utilities/clean \
resources/packages/i945-thinkpads-install-utilities/distclean \
resources/packages/i945-thinkpads-install-utilities/download \
resources/packages/i945-thinkpads-install-utilities/module \
resources/packages/grub/distclean \
resources/packages/ich9utils/distclean \
resources/packages/memtest86plus/distclean \
resources/packages/payloads/distclean \
resources/packages/rom_images/distclean \
resources/packages/roms/distclean \
resources/packages/seabios/distclean \
resources/packages/src/distclean \
resources/packages/u-boot-libre/distclean \
resources/packages/website/distclean \
resources/scripts/misc/guix.sh \
resources/scripts/tasks/distclean.sh \
tests/distclean \
tests/lint \
website-build/build.sh \
website-build/check.sh
printf "+---------------------+\n"
printf "| Lint tests done |\n"
printf "+---------------------+\n"