Skip to content

Commit 770421d

Browse files
authored
cmake: use format for ws checks (#403)
With the following PR, we no longer need to roll our own whitespace check in ci because the format target itself will cover it as it already does for cmake, clang, and python formatting. apache/trafficserver#12696
1 parent 2286af7 commit 770421d

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

jenkins/github/format.pipeline

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,28 +58,30 @@ pipeline {
5858
echo 'Starting build'
5959
dir('src') {
6060
sh '''#!/bin/bash
61-
set -x
62-
git grep -IE ' +$' | fgrep -v 'lib/yamlcpp' | fgrep -v 'lib/Catch2' | fgrep -v 'lib/systemtap' | fgrep -v '.gold:' | fgrep -v '.test_input'
63-
if [ "1" != "$?" ]; then
64-
echo "Error: Trailing whitespaces are not allowed!"
65-
echo "Error: Please run: git grep -IE ' +$'"
66-
exit 1
67-
fi
68-
echo "Success! No trailing whitespace"
69-
git grep -IE $'\r$' | fgrep -v 'lib/yamlcpp' | fgrep -v 'lib/Catch2' | fgrep -v 'lib/systemtap' | fgrep -v '.test_input'
70-
if [ "1" != "$?" ]; then
71-
echo "Error: Please make sure to run dos2unix on the above file(s)"
72-
exit 1
73-
fi
74-
echo "Success! No DOS carriage return"
75-
76-
set -x
7761

7862
if [ -d cmake ]
7963
then
8064
cmake -B build
8165
cmake --build build --target format || exit 1
8266
else
67+
# The following whitespace checks were added to the `format` cmake target in 10.2.0, but are not backported to 9.x.
68+
set -x
69+
git grep -IE ' +$' | fgrep -v 'lib/yamlcpp' | fgrep -v 'lib/Catch2' | fgrep -v 'lib/systemtap' | fgrep -v '.gold:' | fgrep -v '.test_input'
70+
if [ "1" != "$?" ]; then
71+
echo "Error: Trailing whitespaces are not allowed!"
72+
echo "Error: Please run: git grep -IE ' +$'"
73+
exit 1
74+
fi
75+
echo "Success! No trailing whitespace"
76+
git grep -IE $'\r$' | fgrep -v 'lib/yamlcpp' | fgrep -v 'lib/Catch2' | fgrep -v 'lib/systemtap' | fgrep -v '.test_input'
77+
if [ "1" != "$?" ]; then
78+
echo "Error: Please make sure to run dos2unix on the above file(s)"
79+
exit 1
80+
fi
81+
echo "Success! No DOS carriage return"
82+
83+
set -x
84+
8385
# Pre 10.x branches only supported autotools.
8486
autoreconf -if && ./configure && make clang-format || exit 1
8587

0 commit comments

Comments
 (0)