Skip to content

Commit

Permalink
Add pre-commit check $lookup multiple join
Browse files Browse the repository at this point in the history
Signed-off-by: DongYoung Kim <[email protected]>
  • Loading branch information
kwx4957 committed Sep 16, 2024
1 parent dc74d1b commit 2c0848c
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions chaoscenter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# NOTE - These will be executed when any make target is invoked.
#
IS_DOCKER_INSTALLED = $(shell which docker >> /dev/null 2>&1; echo $$?)
SHELL := /bin/bash

.PHONY: help
help:
Expand Down Expand Up @@ -69,6 +70,22 @@ backend-services-checks:
echo "$${result}" | awk '/unsupported operators were found/ {f=1} f' \
&& exit 1; \
fi
@lookupResults=""; \
while read file; do \
fileLookupResult=$$(awk 'BEGIN {found_lookup=0} \
/\$$lookup/ {found_lookup=1} \
found_lookup && NF==0 {found_lookup=0} \
found_lookup && /"let"|"pipeline"/ { \
print "Found let or pipeline in file " FILENAME " at line " NR; \
}' "$${file}"); \
if [ -n "$${fileLookupResult}" ]; then \
lookupResults="$${lookupResults}$${fileLookupResult}\n"; \
fi; \
done < <(find graphql/server -name "*.go"); \
if [ -n "$${lookupResults}" ]; then \
echo -e "$${lookupResults}" \
&& exit 1; \
fi
@echo "------------------"
@echo "--> Check chaos-center authentication [go mod tidy]"
@echo "------------------"
Expand All @@ -87,6 +104,22 @@ backend-services-checks:
echo "$${result}" | awk '/unsupported operators were found/ {f=1} f' \
&& exit 1; \
fi
@lookupResults=""; \
while read file; do \
fileLookupResult=$$(awk 'BEGIN {found_lookup=0} \
/\$$lookup/ {found_lookup=1} \
found_lookup && NF==0 {found_lookup=0} \
found_lookup && /"let"|"pipeline"/ { \
print "Found let or pipeline in file " FILENAME " at line " NR; \
}' "$${file}"); \
if [ -n "$${fileLookupResult}" ]; then \
lookupResults="$${lookupResults}$${fileLookupResult}\n"; \
fi; \
done < <(find authentication -name "*.go"); \
if [ -n "$${lookupResults}" ]; then \
echo -e "$${lookupResults}" \
&& exit 1; \
fi
@echo "------------------"
@echo "--> Check chaos-center subscriber [go mod tidy]"
@echo "------------------"
Expand Down

0 comments on commit 2c0848c

Please sign in to comment.