Cross Reference: whitespace_test
xref
: /
sssd
/
src
/
tests
/
whitespace_test
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
whitespace_test revision 900778b5afd0143005cfd40cc67ad5086481f7ee
0
N/A
#!/
bin
/
bash
0
N/A
0
N/A
set
-e -u -o
pipefail
0
N/A
0
N/A
# An AWK regex matching tracked file paths to be excluded from the search.
0
N/A
# Example: '.*\.po|README'
0
N/A
PATH_EXCLUDE_REGEX
=
'.*\.po|.*\.patch|.*\.diff|\/debian\/.*'
0
N/A
0
N/A
export
GIT_DIR
=
"
$ABS_TOP_SRCDIR
/.git"
0
N/A
export
GIT_WORK_TREE
=
"
$ABS_TOP_SRCDIR
"
0
N/A
0
N/A
if
[ ! -d
"
$GIT_DIR
"
];
then
0
N/A
echo
"Git repository is required for this test!"
1
>&
2
0
N/A
exit
77
0
N/A
fi
0
N/A
0
N/A
{
0
N/A
# Look for lines with trailing whitespace in all files tracked by Git
0
N/A
git
grep
-n -I
'\s\+$'
--
"
$(
git
rev
-
parse
--
show
-
toplevel
)
"
||
0
N/A
# Don't fail if no such lines were found anywhere
0
N/A
[[ $? ==
1
]]
0
N/A
}
|
0
N/A
awk
--
"
0
N/A
BEGIN {
0
N/A
found = 0
0
N/A
}
0
N/A
! /^(
$PATH_EXCLUDE_REGEX
):/ {
0
N/A
if (!found) {
0
N/A
print \"Trailing whitespace found:\"
0
N/A
found = 1
0
N/A
}
0
N/A
print
0
N/A
}
0
N/A
END {
0
N/A
exit found
0
N/A
}
0
N/A
"
0
N/A
0
N/A
declare
found_file
=
false
0
N/A
while
read
file
;
do
0
N/A
[[
$file
==
"
src
/
config
/
testconfigs
/
noparse.api.conf
"
]] &&
continue
0
N/A
[[
$file
=~ ^
src
/
tests
/
cmocka
/
p11_nssdb
/.*
db
]] &&
continue
0
N/A
test
`
tail
-c
1
$ABS_TOP_SRCDIR
/
$file
`
&& \
0
N/A
echo
"Missing new line at the eof:
$file
"
&& \
0
N/A
found_file
=
true
338
N/A
done
< <
(
git
ls
-
files
)
0
N/A
0
N/A
if
$found_file
;
then
0
N/A
exit
1
0
N/A
fi
0
N/A