Meta: Ignore wpt-import folder from python, shell and executable linting

As these are third party.
This commit is contained in:
Shannon Booth 2026-03-24 22:08:36 +01:00 committed by Shannon Booth
parent ecded38b55
commit d4f8879e8b
4 changed files with 39 additions and 6 deletions

View file

@ -5,13 +5,21 @@ set -eo pipefail
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
cd "${script_path}/../.." || exit 1
tests_find_args=(
Tests/
\( -name WPT -o -path '*/wpt-import' \) -prune
-or
)
ignored_executable_paths='^(Meta/lint-executable-resources\.sh)$'
if [ "$(uname -s)" = "Darwin" ]; then
# MacOS's find does not support '-executable' OR '-perm /mode'.
BAD_FILES=$(find Base/res/ -type f -perm +111)
BAD_FILES+=$(find Tests/ -name WPT -prune -or -perm +111 \! -type d -print | grep -Ev '\.(sh|py)$' || true)
BAD_FILES+=$(find "${tests_find_args[@]}" -perm +111 \! -type d -print | grep -Ev "(${ignored_executable_paths}|\\.(sh|py)$)" || true)
else
BAD_FILES=$(find Base/res/ -type f -executable)
BAD_FILES+=$(find Tests/ -name WPT -prune -or -executable \! -type d -print | grep -Ev '\.(sh|py)$' || true)
BAD_FILES+=$(find "${tests_find_args[@]}" -executable \! -type d -print | grep -Ev "(${ignored_executable_paths}|\\.(sh|py)$)" || true)
fi
if [ -n "${BAD_FILES}" ]

View file

@ -7,6 +7,16 @@ cd "${script_path}/../.." || exit 1
overwrite=0
is_ignored_python_file() {
case "$1" in
Tests/LibWeb/Text/input/wpt-import/*)
return 0
;;
esac
return 1
}
if [ "$#" -gt "0" ]; then
if [ "--overwrite-inplace" = "$1" ] ; then
overwrite=1
@ -17,14 +27,16 @@ fi
if [ "$#" -eq "0" ]; then
files=()
while IFS= read -r file; do
files+=("$file")
if ! is_ignored_python_file "$file"; then
files+=("$file")
fi
done < <(
git ls-files '*.py'
)
else
files=()
for file in "$@"; do
if [[ "${file}" == *".py" ]]; then
if [[ "${file}" == *".py" ]] && ! is_ignored_python_file "$file"; then
files+=("${file}")
fi
done

View file

@ -5,10 +5,22 @@ set -eo pipefail
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
cd "${script_path}/../.." || exit 1
is_ignored_shell_file() {
case "$1" in
Tests/LibWeb/Text/input/wpt-import/*)
return 0
;;
esac
return 1
}
if [ "$#" -eq "0" ]; then
files=()
while IFS= read -r file; do
files+=("$file")
if ! is_ignored_shell_file "$file"; then
files+=("$file")
fi
done < <(
git ls-files -- \
'*.sh' \
@ -21,7 +33,7 @@ else
continue
fi
if [[ "${file}" == *".sh" && "${file}" != "Base/root/generate_manpages.sh" ]]; then
if [[ "${file}" == *".sh" && "${file}" != "Base/root/generate_manpages.sh" ]] && ! is_ignored_shell_file "$file"; then
files+=("${file}")
fi
done

View file

@ -21,4 +21,5 @@ exclude = [
"**/__pycache__",
"**/.*",
"**/lit.cfg.py",
"Tests/LibWeb/Text/input/wpt-import",
]