@@ -34,17 +34,13 @@ function invgrep {
34
34
#
35
35
# This is useful for the CI, as we want to fail if one of the patterns
36
36
# that we want to avoid is found by grep.
37
- if [[ " $AZURE " == " true" ]]; then
38
- set -o pipefail
39
- grep -n " $@ " | awk -F " :" ' {print "##vso[task.logissue type=error;sourcepath=" $1 ";linenumber=" $2 ";] Found unwanted pattern: " $3}'
40
- else
41
- grep " $@ "
42
- fi
43
- return $(( ! $? ))
37
+ grep -n " $@ " | sed " s/^/$INVGREP_PREPEND /" | sed " s/$/$INVGREP_APPEND /" ; EXIT_STATUS=${PIPESTATUS[0]}
38
+ return $(( ! $EXIT_STATUS ))
44
39
}
45
40
46
- if [[ " $AZURE " == " true" ]]; then
47
- FLAKE8_FORMAT=" ##vso[task.logissue type=error;sourcepath=%(path)s;linenumber=%(row)s;columnnumber=%(col)s;code=%(code)s;]%(text)s"
41
+ if [[ " $GITHUB_ACTIONS " == " true" ]]; then
42
+ FLAKE8_FORMAT=" ##[error]%(path)s:%(row)s:%(col)s:%(code):%(text)s"
43
+ INVGREP_PREPEND=" ##[error]"
48
44
else
49
45
FLAKE8_FORMAT=" default"
50
46
fi
@@ -199,14 +195,10 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
199
195
RET=$(( $RET + $? )) ; echo $MSG " DONE"
200
196
201
197
MSG=' Check that no file in the repo contains trailing whitespaces' ; echo $MSG
202
- set -o pipefail
203
- if [[ " $AZURE " == " true" ]]; then
204
- # we exclude all c/cpp files as the c/cpp files of pandas code base are tested when Linting .c and .h files
205
- ! grep -n ' --exclude=*.' {svg,c,cpp,html,js} --exclude-dir=env -RI " \s$" * | awk -F " :" ' {print "##vso[task.logissue type=error;sourcepath=" $1 ";linenumber=" $2 ";] Tailing whitespaces found: " $3}'
206
- else
207
- ! grep -n ' --exclude=*.' {svg,c,cpp,html,js} --exclude-dir=env -RI " \s$" * | awk -F " :" ' {print $1 ":" $2 ":Tailing whitespaces found: " $3}'
208
- fi
198
+ INVGREP_APPEND=" <- trailing whitespaces found"
199
+ invgrep -RI --exclude=\* .{svg,c,cpp,html,js} --exclude-dir=env " \s$" *
209
200
RET=$(( $RET + $? )) ; echo $MSG " DONE"
201
+ unset INVGREP_APPEND
210
202
fi
211
203
212
204
# ## CODE ###
0 commit comments