Files
ladybird/Meta/lint-ci.sh
Timothy Flynn 3f73528cad Meta: Move linter helpers to a subdirectory
Continuing some organization of the Meta directory. lint-ci.sh and
lint-commits.sh are left alone as "top-level" linters.
2026-04-23 07:31:19 -04:00

69 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
cd "${script_path}/.." || exit 1
BOLD_RED='\033[0;1;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
FAILURES=0
set +e
for cmd in \
Meta/Linters/check_debug_flags.sh \
Meta/Linters/check_flatpak.py \
Meta/Linters/check_html_doctype.py \
Meta/Linters/check_idl_files.py \
Meta/Linters/check_newlines_at_eof.py \
Meta/Linters/check_png_sizes.sh \
Meta/Linters/check_style.py \
Meta/Linters/lint_executable_resources.sh \
Meta/Linters/lint_prettier.sh \
Meta/Linters/lint_python.sh \
Meta/Linters/lint_shell_scripts.sh; do
if "${cmd}" "$@"; then
echo -e "[${GREEN}OK${NC}]: ${cmd}"
else
echo -e "[${BOLD_RED}FAIL${NC}]: ${cmd}"
((FAILURES+=1))
fi
done
if [ -x ./Build/lagom/bin/IPCMagicLinter ]; then
if { git ls-files '*.ipc' | xargs ./Build/lagom/bin/IPCMagicLinter; }; then
echo -e "[${GREEN}OK${NC}]: IPCMagicLinter (in Meta/lint-ci.sh)"
else
echo -e "[${BOLD_RED}FAIL${NC}]: IPCMagicLinter (in Meta/lint-ci.sh)"
((FAILURES+=1))
fi
else
echo -e "[${GREEN}SKIP${NC}]: IPCMagicLinter (in Meta/lint-ci.sh)"
fi
if Meta/Linters/lint_clang_format.py --overwrite-inplace "$@" && git diff --exit-code -- ':*.cpp' ':*.h' ':*.mm'; then
echo -e "[${GREEN}OK${NC}]: Meta/Linters/lint_clang_format.py"
else
echo -e "[${BOLD_RED}FAIL${NC}]: Meta/Linters/lint_clang_format.py"
((FAILURES+=1))
fi
if cargo fmt --check ; then
echo -e "[${GREEN}OK${NC}]: cargo fmt --check"
else
echo -e "[${BOLD_RED}FAIL${NC}]: cargo fmt --check"
((FAILURES+=1))
fi
if cargo clippy -- -D clippy::all ; then
echo -e "[${GREEN}OK${NC}]: cargo clippy -- -D clippy::all"
else
echo -e "[${BOLD_RED}FAIL${NC}]: cargo clippy -- -D clippy::all"
((FAILURES+=1))
fi
exit "${FAILURES}"