Skip to content

Commit 03c3b15

Browse files
author
Sauyon Lee
committedApr 27, 2021
Improve autoformatting check
1 parent 27b72b5 commit 03c3b15

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ clean:
3030
DATAFLOW_BRANCH=main
3131

3232
autoformat:
33-
find ql -name "*.ql" -or -name "*.qll" | xargs codeql query format -qq -i
34-
git ls-files | grep '\.go$$' | grep -v ^vendor/ | xargs grep -L "//\s*autoformat-ignore" | xargs gofmt -w
33+
find ql -iregex '.*\.qll?' -print0 | xargs -0 codeql query format -qq -i
34+
find . -path '**/vendor' -prune -or -type f -iname '*.go' ! -empty -print0 | xargs -0 grep -L "//\s*autoformat-ignore" | xargs gofmt -w
3535

3636
check-formatting:
37-
find ql -name "*.ql" -or -name "*.qll" | xargs codeql query format --check-only
38-
test -z "$$(git ls-files | grep '\.go$$' | grep -v ^vendor/ | xargs grep -L "//\s*autoformat-ignore" | xargs gofmt -l)"
37+
find ql -iregex '.*\.qll?' -print0 | xargs -0 codeql query format --check-only
38+
test -z "$$(find . -path '**/vendor' -prune -or -type f -iname '*.go' ! -empty -print0 | xargs -0 grep -L "//\s*autoformat-ignore" | xargs gofmt -l)"
3939

4040
ifeq ($(QHELP_OUT_DIR),)
4141
# If not otherwise specified, compile qhelp to markdown in place

0 commit comments

Comments
 (0)
Please sign in to comment.