Skip to content

Commit 8896de6

Browse files
committed
Port Tab Check and check_tabs.sh script back to release/* branches.
1 parent 24c4d7d commit 8896de6

2 files changed

Lines changed: 41 additions & 1 deletion

File tree

jenkins/check_tabs.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#-------------------------------------------------------------------------------------------------------
2+
# Copyright (C) Microsoft. All rights reserved.
3+
# Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
#-------------------------------------------------------------------------------------------------------
5+
6+
# Need to make sure that the reference to origin/master is available.
7+
# We know that HEAD is checked out so that the tests on that source can be run.
8+
9+
# configure the sh environment to run scripts from the bin dir in case that's missing
10+
ls &> /dev/null # checking for ls script on the path
11+
if [ $? -ne 0 ]; then
12+
PATH=/bin:/usr/bin:$PATH
13+
fi
14+
15+
ERRFILE=check_tabs.sh.err
16+
rm -f $ERRFILE
17+
18+
# git diff --name-only `git merge-base origin/master HEAD` HEAD | xargs grep -P -l "\t" > /dev/nul
19+
20+
git diff --name-only `git merge-base origin/master HEAD` HEAD |
21+
xargs grep -P -l "\t" |
22+
grep -v -E '^pal/' |
23+
grep -v -E '\.sln$' |
24+
grep -v -E '\.js$' |
25+
grep -v -E '\.baseline$' |
26+
grep -v -E 'bin/External/.*$' |
27+
xargs -I % sh -c 'echo --- IN FILE % ---; git blame HEAD -- % | grep -P "(\t|--- IN FILE)"' > check_tabs.sh.err
28+
29+
if [ -s $ERRFILE ]; then # if file exists and is non-empty then there were errors
30+
>&2 echo "--------------" # leading >&2 means echo to stderr
31+
>&2 echo "--- ERRORS ---"
32+
>&2 echo ""
33+
34+
cat $ERRFILE 1>&2 # send output to stderr so it can be redirected as error if desired
35+
36+
exit 1
37+
else
38+
echo "--- NO PROBLEMS DETECTED ---"
39+
fi

netci.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,9 @@ CreateBuildTasks('Windows_NT', 'daily_disablejit', '"/p:BuildJIT=false"', '-disa
186186
// CODE STYLE TASKS
187187
// ----------------
188188

189-
CreateStyleCheckTasks('./jenkins/check_eol.sh', 'ubuntu_check_eol', 'EOL Check')
190189
CreateStyleCheckTasks('./jenkins/check_copyright.sh', 'ubuntu_check_copyright', 'Copyright Check')
190+
CreateStyleCheckTasks('./jenkins/check_eol.sh', 'ubuntu_check_eol', 'EOL Check')
191+
CreateStyleCheckTasks('./jenkins/check_tabs.sh', 'ubuntu_check_tabs', 'Tab Check')
191192

192193
// ------------
193194
// HELP MESSAGE

0 commit comments

Comments
 (0)