Files
scst/scripts/checkpatch_scan
Gleb Chesnokov 88b5653b06 scripts: Group source maintenance helpers under source/
Keep source inventory, cleanup and shell lint helpers together. Update the
Makefile, Debian packaging, scstadmin and the kernel, release and existing
checkpatch callers in the same commit so each consumer uses a valid path.

Keep run-shellcheck rooted at scripts/ after the move, preserving its
coverage of all tracked Bash helpers. Source selection and the existing
checkpatch exclusions are unchanged.
2026-10-19 10:31:32 +03:00

25 lines
863 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
rootdir="$(readlink -f "$(dirname "$0")/..")"
scriptsdir="${rootdir}/scripts"
outputfile="checkpatch.out"
mapfile -t src_files < <(
"${scriptsdir}/source/list-source-files" "${rootdir}" | \
grep -vE '^debian/|^fcst/linux-patches|patch$|pdf$|png$|^iscsi-scst/usr|^qla|^scripts/|^scstadmin/|^usr/|^www/' | \
while read -r filename; do echo "${rootdir}/$filename"; done)
"${scriptsdir}/checkpatch" -f "${src_files[@]}" 1> "${outputfile}" || true
errors=$(grep -c '^ERROR' "${outputfile}" || true)
warnings=$(grep -c '^WARNING' "${outputfile}" || true)
checks=$(grep -c '^CHECK' "${outputfile}" || true)
echo "${errors} errors / ${warnings} warnings / ${checks} checks."
grep -E '^WARNING|^ERROR|^CHECK' "${outputfile}" |
sort |
sed 's/^CHECK:CAMELCASE: Avoid CamelCase:.*/CHECK:CAMELCASE Avoid CamelCase/' |
uniq -c