From 3f73528cad041322fcf44a3f5c23c993011d46be Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Wed, 22 Apr 2026 18:04:11 -0400 Subject: [PATCH] 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. --- CMakeLists.txt | 4 +-- Documentation/CodingStyle.md | 2 +- .../check_debug_flags.sh} | 2 +- .../check_flatpak.py} | 0 .../check_html_doctype.py} | 2 +- .../check_idl_files.py} | 2 +- .../check_newlines_at_eof.py} | 2 +- .../check_png_sizes.sh} | 2 +- .../check_style.py} | 2 +- .../lint_clang_format.py} | 2 +- .../lint_executable_resources.sh} | 2 +- .../lint_prettier.sh} | 2 +- .../lint_python.sh} | 2 +- .../lint_shell_scripts.sh} | 2 +- Meta/lint-ci.sh | 28 +++++++++---------- 15 files changed, 28 insertions(+), 28 deletions(-) rename Meta/{check-debug-flags.sh => Linters/check_debug_flags.sh} (98%) rename Meta/{check-flatpak.py => Linters/check_flatpak.py} (100%) rename Meta/{check-html-doctype.py => Linters/check_html_doctype.py} (97%) rename Meta/{check-idl-files.py => Linters/check_idl_files.py} (98%) rename Meta/{check-newlines-at-eof.py => Linters/check_newlines_at_eof.py} (97%) rename Meta/{check-png-sizes.sh => Linters/check_png_sizes.sh} (98%) rename Meta/{check-style.py => Linters/check_style.py} (99%) rename Meta/{lint-clang-format.py => Linters/lint_clang_format.py} (98%) rename Meta/{lint-executable-resources.sh => Linters/lint_executable_resources.sh} (95%) rename Meta/{lint-prettier.sh => Linters/lint_prettier.sh} (96%) rename Meta/{lint-python.sh => Linters/lint_python.sh} (96%) rename Meta/{lint-shell-scripts.sh => Linters/lint_shell_scripts.sh} (97%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1aa0c9a0ac..4f9c59a3c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,11 +168,11 @@ if (ENABLE_GUI_TARGETS) endif() add_custom_target(lint-shell-scripts - COMMAND "${ladybird_SOURCE_DIR}/Meta/lint-shell-scripts.sh" + COMMAND "${ladybird_SOURCE_DIR}/Meta/Linters/lint_shell_scripts.sh" USES_TERMINAL ) add_custom_target(check-style - COMMAND ${Python3_EXECUTABLE} "${ladybird_SOURCE_DIR}/Meta/check-style.py" + COMMAND ${Python3_EXECUTABLE} "${ladybird_SOURCE_DIR}/Meta/Linters/check_style.py" USES_TERMINAL ) diff --git a/Documentation/CodingStyle.md b/Documentation/CodingStyle.md index 38ef280ccc..4e84b06b70 100644 --- a/Documentation/CodingStyle.md +++ b/Documentation/CodingStyle.md @@ -4,7 +4,7 @@ For low-level styling (spaces, parentheses, brace placement, etc), all code shou **Important: Make sure you use the correct version of `clang-format`!** -See [lint-clang-format.py](../Meta/lint-clang-format.py) for the version enforced in CI. +See [lint_clang_format.py](../Meta/Linters/lint_clang_format.py) for the version enforced in CI. See [AdvancedBuildInstructions.md](AdvancedBuildInstructions.md#clang-format-updates) for instructions on how to get an up-to-date version if your OS distribution does not ship the correct version. diff --git a/Meta/check-debug-flags.sh b/Meta/Linters/check_debug_flags.sh similarity index 98% rename from Meta/check-debug-flags.sh rename to Meta/Linters/check_debug_flags.sh index 9666867039..4d454b53a9 100755 --- a/Meta/check-debug-flags.sh +++ b/Meta/Linters/check_debug_flags.sh @@ -3,7 +3,7 @@ set -eo pipefail script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P) -cd "${script_path}/.." +cd "${script_path}/../.." || exit 1 MISSING_FLAGS=n diff --git a/Meta/check-flatpak.py b/Meta/Linters/check_flatpak.py similarity index 100% rename from Meta/check-flatpak.py rename to Meta/Linters/check_flatpak.py diff --git a/Meta/check-html-doctype.py b/Meta/Linters/check_html_doctype.py similarity index 97% rename from Meta/check-html-doctype.py rename to Meta/Linters/check_html_doctype.py index 440046aa6b..9a1507c04d 100755 --- a/Meta/check-html-doctype.py +++ b/Meta/Linters/check_html_doctype.py @@ -52,5 +52,5 @@ def run(): if __name__ == "__main__": - os.chdir(os.path.dirname(__file__) + "/..") + os.chdir(os.path.dirname(__file__) + "/../..") run() diff --git a/Meta/check-idl-files.py b/Meta/Linters/check_idl_files.py similarity index 98% rename from Meta/check-idl-files.py rename to Meta/Linters/check_idl_files.py index 058e945a2e..120053acae 100755 --- a/Meta/check-idl-files.py +++ b/Meta/Linters/check_idl_files.py @@ -99,5 +99,5 @@ def run(): if __name__ == "__main__": - os.chdir(os.path.dirname(__file__) + "/..") + os.chdir(os.path.dirname(__file__) + "/../..") run() diff --git a/Meta/check-newlines-at-eof.py b/Meta/Linters/check_newlines_at_eof.py similarity index 97% rename from Meta/check-newlines-at-eof.py rename to Meta/Linters/check_newlines_at_eof.py index 943e40afad..ff3815f527 100755 --- a/Meta/check-newlines-at-eof.py +++ b/Meta/Linters/check_newlines_at_eof.py @@ -68,5 +68,5 @@ def run(): if __name__ == "__main__": - os.chdir(os.path.dirname(__file__) + "/..") + os.chdir(os.path.dirname(__file__) + "/../..") run() diff --git a/Meta/check-png-sizes.sh b/Meta/Linters/check_png_sizes.sh similarity index 98% rename from Meta/check-png-sizes.sh rename to Meta/Linters/check_png_sizes.sh index a0286d2858..02e6c46c03 100755 --- a/Meta/check-png-sizes.sh +++ b/Meta/Linters/check_png_sizes.sh @@ -6,7 +6,7 @@ set -eo pipefail : "${MINIMUM_OPTIMIZATION_BYTES:=1024}" script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P) -cd "${script_path}/.." +cd "${script_path}/../.." || exit 1 if ! command -v optipng >/dev/null ; then if [[ "$GITHUB_ACTIONS" == "true" ]]; then diff --git a/Meta/check-style.py b/Meta/Linters/check_style.py similarity index 99% rename from Meta/check-style.py rename to Meta/Linters/check_style.py index b221d91b0a..e8f0048af3 100755 --- a/Meta/check-style.py +++ b/Meta/Linters/check_style.py @@ -203,5 +203,5 @@ def run(): if __name__ == "__main__": - os.chdir(os.path.dirname(__file__) + "/..") + os.chdir(os.path.dirname(__file__) + "/../..") run() diff --git a/Meta/lint-clang-format.py b/Meta/Linters/lint_clang_format.py similarity index 98% rename from Meta/lint-clang-format.py rename to Meta/Linters/lint_clang_format.py index fdefe375c3..3daabe6259 100755 --- a/Meta/lint-clang-format.py +++ b/Meta/Linters/lint_clang_format.py @@ -13,7 +13,7 @@ from pathlib import Path from typing import List from typing import Optional -sys.path.append(str(Path(__file__).resolve().parent.parent)) +sys.path.append(str(Path(__file__).resolve().parent.parent.parent)) from Meta.host_platform import HostSystem from Meta.host_platform import Platform diff --git a/Meta/lint-executable-resources.sh b/Meta/Linters/lint_executable_resources.sh similarity index 95% rename from Meta/lint-executable-resources.sh rename to Meta/Linters/lint_executable_resources.sh index b65884719e..bdbb6c006b 100755 --- a/Meta/lint-executable-resources.sh +++ b/Meta/Linters/lint_executable_resources.sh @@ -3,7 +3,7 @@ set -eo pipefail script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P) -cd "$script_path/.." +cd "${script_path}/../.." || exit 1 if [ "$(uname -s)" = "Darwin" ]; then # MacOS's find does not support '-executable' OR '-perm /mode'. diff --git a/Meta/lint-prettier.sh b/Meta/Linters/lint_prettier.sh similarity index 96% rename from Meta/lint-prettier.sh rename to Meta/Linters/lint_prettier.sh index 6fb6d06042..57b290d513 100755 --- a/Meta/lint-prettier.sh +++ b/Meta/Linters/lint_prettier.sh @@ -3,7 +3,7 @@ set -e script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P) -cd "${script_path}/.." || exit 1 +cd "${script_path}/../.." || exit 1 if [ "$#" -eq "0" ]; then files=() diff --git a/Meta/lint-python.sh b/Meta/Linters/lint_python.sh similarity index 96% rename from Meta/lint-python.sh rename to Meta/Linters/lint_python.sh index 7eda6d15da..6be2effe47 100755 --- a/Meta/lint-python.sh +++ b/Meta/Linters/lint_python.sh @@ -3,7 +3,7 @@ set -e script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P) -cd "${script_path}/.." || exit 1 +cd "${script_path}/../.." || exit 1 overwrite=0 diff --git a/Meta/lint-shell-scripts.sh b/Meta/Linters/lint_shell_scripts.sh similarity index 97% rename from Meta/lint-shell-scripts.sh rename to Meta/Linters/lint_shell_scripts.sh index 8587f0d89d..8a5108ad48 100755 --- a/Meta/lint-shell-scripts.sh +++ b/Meta/Linters/lint_shell_scripts.sh @@ -3,7 +3,7 @@ set -eo pipefail script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P) -cd "$script_path/.." +cd "${script_path}/../.." || exit 1 if [ "$#" -eq "0" ]; then files=() diff --git a/Meta/lint-ci.sh b/Meta/lint-ci.sh index cd60dedec3..57484ac0d4 100755 --- a/Meta/lint-ci.sh +++ b/Meta/lint-ci.sh @@ -14,17 +14,17 @@ FAILURES=0 set +e for cmd in \ - Meta/check-debug-flags.sh \ - Meta/check-flatpak.py \ - Meta/check-html-doctype.py \ - Meta/check-idl-files.py \ - Meta/check-newlines-at-eof.py \ - Meta/check-png-sizes.sh \ - Meta/check-style.py \ - Meta/lint-executable-resources.sh \ - Meta/lint-prettier.sh \ - Meta/lint-python.sh \ - Meta/lint-shell-scripts.sh; do + 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 @@ -44,10 +44,10 @@ else echo -e "[${GREEN}SKIP${NC}]: IPCMagicLinter (in Meta/lint-ci.sh)" fi -if Meta/lint-clang-format.py --overwrite-inplace "$@" && git diff --exit-code -- ':*.cpp' ':*.h' ':*.mm'; then - echo -e "[${GREEN}OK${NC}]: Meta/lint-clang-format.py" +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/lint-clang-format.py" + echo -e "[${BOLD_RED}FAIL${NC}]: Meta/Linters/lint_clang_format.py" ((FAILURES+=1)) fi