@@ -34,17 +34,13 @@ function invgrep {
3434 #
3535 # This is useful for the CI, as we want to fail if one of the patterns
3636 # 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 ))
4439}
4540
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]"
4844else
4945 FLAKE8_FORMAT=" default"
5046fi
@@ -199,14 +195,10 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
199195 RET=$(( $RET + $? )) ; echo $MSG " DONE"
200196
201197 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$" *
209200 RET=$(( $RET + $? )) ; echo $MSG " DONE"
201+ unset INVGREP_APPEND
210202fi
211203
212204# ## CODE ###
0 commit comments