mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 10:08:41 +00:00
tools: enable stylechecker to handle new files
Since the tool is entirely diff based, it was having some issues diffing things that didn't exist. Also made it a bit smarter about ignoring kernel-specific style nits we don't really care about. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
a162e6a599
commit
f5fd113cbf
@ -13,15 +13,18 @@ if [[ -z "$1" || -z "$2" ]]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# remove temp directories
|
||||||
|
rm -rf /tmp/f1 /tmp/f2
|
||||||
|
|
||||||
# save working tree
|
# save working tree
|
||||||
if git -C $tree status --porcelain | egrep --silent '^(\?\?|.[DM])'; then
|
if git -C $tree status --porcelain | egrep --silent '^(\?\?|.[DM])'; then
|
||||||
echo "Detected dirty tree, caching state..."
|
echo "Detected dirty tree, caching state..."
|
||||||
dirty=1
|
dirty=1
|
||||||
git -C $tree config gc.auto 0;
|
git -C $tree config gc.auto 0;
|
||||||
td=$(git -C $tree status -z | grep -z "^[ARM]D" | cut -z -d' ' -f2- | tr '\0' '\n')
|
td=$(git -C $tree status -z | grep -z "^[ARM]D" | cut -z -d' ' -f2- | tr '\0' '\n')
|
||||||
INDEX=`git -C $tree write-tree`
|
INDEX=$(git -C $tree write-tree)
|
||||||
git -C $tree add -f .
|
git -C $tree add -f .
|
||||||
WORKTREE=`git -C $tree write-tree`
|
WORKTREE=$(git -C $tree write-tree)
|
||||||
echo "Saved index to $INDEX"
|
echo "Saved index to $INDEX"
|
||||||
echo "Saved working tree to $WORKTREE"
|
echo "Saved working tree to $WORKTREE"
|
||||||
fi
|
fi
|
||||||
@ -36,11 +39,14 @@ git -C $tree reset --hard
|
|||||||
git -C $tree apply < $patch
|
git -C $tree apply < $patch
|
||||||
mkdir -p /tmp/f1 /tmp/f2
|
mkdir -p /tmp/f1 /tmp/f2
|
||||||
mod=$(git -C $tree ls-files -m | grep ".*\.[ch]" | grep -v $ignore)
|
mod=$(git -C $tree ls-files -m | grep ".*\.[ch]" | grep -v $ignore)
|
||||||
|
mod+=" $(git -C $tree ls-files --others --exclude-standard | grep '.*\.[ch]' | grep -v $ignore)"
|
||||||
|
echo $mod
|
||||||
if [ -z "$mod" ]; then
|
if [ -z "$mod" ]; then
|
||||||
echo "There doesn't seem to be any changes."
|
echo "There doesn't seem to be any changes."
|
||||||
else
|
else
|
||||||
cp $tree/$mod /tmp/f1/
|
cp $tree/$mod /tmp/f1/
|
||||||
git -C $tree reset --hard
|
git -C $tree reset --hard
|
||||||
|
git -C $tree clean -fd
|
||||||
cp $tree/$mod /tmp/f2/
|
cp $tree/$mod /tmp/f2/
|
||||||
echo "Running style checks..."
|
echo "Running style checks..."
|
||||||
for file in /tmp/f1/*; do
|
for file in /tmp/f1/*; do
|
||||||
@ -56,12 +62,11 @@ else
|
|||||||
echo "Report for $(basename $file _cp)"
|
echo "Report for $(basename $file _cp)"
|
||||||
echo "==============================================="
|
echo "==============================================="
|
||||||
if [ -a /tmp/f2/$(basename $file) ]; then
|
if [ -a /tmp/f2/$(basename $file) ]; then
|
||||||
diff $file /tmp/f2/$(basename $file) | grep -A3 "ERROR\|WARNING"
|
diff $file /tmp/f2/$(basename $file) | grep -v "normally be const" | grep -A3 "ERROR\|WARNING"
|
||||||
else
|
else
|
||||||
cat $file
|
cat $file | grep -v "normally be const" | grep -A3 "ERROR\|WARNING"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
rm -rf /tmp/f1 /tmp/f2
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# restore working tree
|
# restore working tree
|
||||||
|
Loading…
Reference in New Issue
Block a user