Commit a1d54270 authored by George Nash's avatar George Nash Committed by Kishen Maloor

Only only list the files with bad formatting whitespace_commit_checker

When originally written the whitespace_commit_checker did not save
a list of the files that had bad formatting. The idea was that
the developer could run clang-format on any of the files and it
would not be a big deal.  However, if the change is large this
results in the tool saying you have x file(s) with bad formating
but then shows every file that was changed. Just showing the files
with bad formatting seems to make more since. It lets the developer
focuse only on the files that need fixing.

Also fixed typo in the output text.
Signed-off-by: George Nash's avatarGeorge Nash <>
parent ad93eded
Pipeline #505 failed with stage
in 5 minutes and 44 seconds
......@@ -45,6 +45,7 @@ function isC() {
# from this script returns failure. The diff command should return failure
# every time the output from clang-format is different than the input file.
trap 'failures=$((failures+1))' ERR
echo "***********************************************************************"
......@@ -62,6 +63,9 @@ for f in $filelist; do
# the '-' at the end of the diff will cause the diff command to use the
# output from clang-format as part of the diff input.
clang-format -style=file ${f} | diff -u --color=auto ${f} -
if [ $? -ne 0 ]; then
fail_filelist+="${f} "
......@@ -75,18 +79,16 @@ else
# just print all of the C/C++ files. Even if the user runs a command on a file
# that does not need to be change it will leave the file unchanged.
echo "***********************************************************************"
echo "Found $failures file(s) with BAD formating!"
echo "Found $failures file(s) with BAD formatting!"
echo ""
echo "Please update the files formating."
echo "Please update the files formatting."
echo ""
echo "This can be done automatically by running the following commands from"
echo "the top directory of iotivity-lite project"
echo ""
echo " cp tools/_clang-format _clang-format"
for f in $filelist; do
if isC $f; then
for f in $fail_filelist; do
echo " clang-format -style=file -i ${f}"
echo ""
echo "The format tool can be added to git's pre-commit hook using the"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment