Files
scripts/checkpatch_project.sh
2018-08-28 13:50:46 +03:00

20 lines
392 B
Bash
Executable File

#!/bin/bash
#checkpatch --no-tree -f
checkpatch="/usr/lib/modules/$(uname -r)/build/scripts/checkpatch.pl"
if [ -z "$1" ]; then
project_dir="$PWD"
elif [ -d "$1" ]; then
project_dir="$1"
else
source_file="$1"
fi
if [ -z "$project_dir" ]; then
"${checkpatch}" --no-tree -f "${source_file}"
else
find "${project_dir}" -regex '.*\.\(c\|h\)' -exec "${checkpatch}" --no-tree -f '{}' +
fi