cmake: match filename suffixes with file content

To:
- simplify recognizing CMake sources.
- ensure syntax highlighters use the correct file type.
- sync .h template filename with its autotools counterpart.

Also:
- cmakelint.sh: simplify, alpha sort the filelist.
- perlcheck.sh: simplify.

Closes #20039
This commit is contained in:
Viktor Szakats 2025-12-19 14:57:10 +01:00
parent 7ded0e21cd
commit 1892286086
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
12 changed files with 23 additions and 28 deletions

View file

@ -45,15 +45,13 @@ cd "$(dirname "$0")"/..
{
if [ -n "${1:-}" ]; then
for A in "$@"; do printf "%s\n" "$A"; done
for A in "$@"; do printf '%s\n' "$A"; done
elif git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
git ls-files
git ls-files '**CMakeLists.txt' '*.cmake'
else
# strip off the leading ./ to make the grep regexes work properly
find . -type f | sed 's@^\./@@'
find . -type f \( -name 'CMakeLists.txt' -o -name '*.cmake' \)
fi
} | grep -E '(^CMake|/CMake|\.cmake$|\.cmake\.in$)' | grep -v -E '(\.h\.cmake|\.c)$' \
| xargs \
} | sort | xargs \
cmake-lint \
--suppress-decorations \
--disable \

View file

@ -38,14 +38,11 @@ echo "parallel: ${procs}"
{
if [ -n "${1:-}" ]; then
for A in "$@"; do printf "%s\n" "$A"; done
for A in "$@"; do printf '%s\n' "$A"; done
elif git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
{
git ls-files | grep -E '\.(pl|pm)$'
git grep -l '^#!/usr/bin/env perl'
} | sort -u
git ls-files '*.pl' '*.pm'
git grep -l '^#!/usr/bin/env perl'
else
# strip off the leading ./ to make the grep regexes work properly
find . -type f \( -name '*.pl' -o -name '*.pm' \) | sed 's@^\./@@'
find . -type f \( -name '*.pl' -o -name '*.pm' \)
fi
} | xargs -n 1 -P "${procs}" perl -c -Itests --
} | sort -u | xargs -n 1 -P "${procs}" perl -c -Itests --