Add check-style makefile target
This commit is contained in:
parent
b9e17a1c5f
commit
fbdb357823
1 changed files with 27 additions and 1 deletions
28
Makefile
28
Makefile
|
@ -11,13 +11,39 @@ include build/setup.mk
|
|||
BUNDLE_NAME ?= $(PLUGIN_ID)-$(PLUGIN_VERSION).tar.gz
|
||||
|
||||
# all, the default target, tests, builds and bundles the plugin.
|
||||
all: test dist
|
||||
all: check-style test dist
|
||||
|
||||
# apply propagates the plugin id into the server/ and webapp/ folders as required.
|
||||
.PHONY: apply
|
||||
apply:
|
||||
./build/bin/manifest apply
|
||||
|
||||
.PHONY: check-style
|
||||
check-style: webapp/.npminstall gofmt
|
||||
@echo Checking for style guide compliance
|
||||
|
||||
ifneq ($(HAS_WEBAPP),)
|
||||
cd webapp && npm run lint
|
||||
endif
|
||||
|
||||
gofmt:
|
||||
ifneq ($(HAS_SERVER),)
|
||||
@echo Running GOFMT
|
||||
@for package in $$(go list ./server/...); do \
|
||||
echo "Checking "$$package; \
|
||||
files=$$(go list -f '{{range .GoFiles}}{{$$.Dir}}/{{.}} {{end}}' $$package); \
|
||||
if [ "$$files" ]; then \
|
||||
gofmt_output=$$(gofmt -d -s $$files 2>&1); \
|
||||
if [ "$$gofmt_output" ]; then \
|
||||
echo "$$gofmt_output"; \
|
||||
echo "gofmt failure"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi; \
|
||||
done
|
||||
@echo "gofmt success";
|
||||
endif
|
||||
|
||||
# server/.depensure ensures the server dependencies are installed
|
||||
server/.depensure:
|
||||
ifneq ($(HAS_SERVER),)
|
||||
|
|
Reference in a new issue