mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 13:27:53 +00:00
tools: add style checking scripts
Add shell script and modified checkpatch.pl for use with patch files targeting FRR. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
97c772b30b
commit
3e4ae70277
6487
tools/checkpatch.pl
Executable file
6487
tools/checkpatch.pl
Executable file
File diff suppressed because it is too large
Load Diff
28
tools/checkpatch.sh
Executable file
28
tools/checkpatch.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
# Check a patch for style errors.
|
||||
# Usage:
|
||||
# ./checkpatch.sh <patch>
|
||||
checkpatch="./checkpatch.pl --no-tree -f"
|
||||
|
||||
git status | grep "working directory clean"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "[!] git working directory must be clean."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p f1 f2
|
||||
bash -c "cd .. && git apply $1 2> /dev/null"
|
||||
mod=$(git ls-files -m .. | grep ".*\.[ch]")
|
||||
cp $mod f1/
|
||||
git reset --hard
|
||||
cp $mod f2/
|
||||
for file in f1/*; do
|
||||
$checkpatch $file > "$file"_cp 2> /dev/null
|
||||
done
|
||||
for file in f2/*; do
|
||||
$checkpatch $file > "$file"_cp 2> /dev/null
|
||||
done
|
||||
for file in f1/*_cp; do
|
||||
diff $file f2/$(basename $file) | grep -A3 "ERROR\|WARNING"
|
||||
done
|
||||
rm -rf f1 f2
|
Loading…
Reference in New Issue
Block a user