Skip to content

Commit

Permalink
feat: add lint stuff to makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
hackercat committed May 1, 2021
1 parent cf420f8 commit 62964cb
Showing 1 changed file with 46 additions and 1 deletion.
47 changes: 46 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,17 @@ MINOR_VERSION = $(word 2, $(subst ., ,$(VERSION)))
PATCH_VERSION = $(word 3, $(subst ., ,$(word 1,$(subst -, , $(VERSION)))))
NEW_VERSION ?= $(MAJOR_VERSION).$(MINOR_VERSION).$(shell echo $$(( $(PATCH_VERSION) + 1)) )

fix = false
ifeq (true,$(fix))
FIX = --fix
endif

ACT ?= go run main.go
export GITHUB_TOKEN := $(shell cat ~/.config/github/token)

HAS_TOKEN = $(if $(test -e ~/.config/github/token),true,false)
ifeq (true,$(HAS_TOKEN))
export GITHUB_TOKEN := $(shell cat ~/.config/github/token)
endif

.PHONY: build
build:
Expand All @@ -22,6 +31,42 @@ test:
go test ./...
$(ACT)

.PHONY: lint-go
lint-go:
golangci-lint run $(FIX)

.PHONY: lint-js
lint-js:
standard $(FIX)

.PHONY: lint-md
lint-md:
markdownlint . $(FIX)

.PHONY: lint-rest
lint-rest:
docker run --rm -it \
-e 'RUN_LOCAL=true' \
-e 'FILTER_REGEX_EXCLUDE=.*testdata/*' \
-e 'VALIDATE_BASH=false' \
-e 'VALIDATE_DOCKERFILE=false' \
-e 'VALIDATE_DOCKERFILE_HADOLINT=false' \
-e 'VALIDATE_GO=false' \
-e 'VALIDATE_JSCPD=false' \
-e 'VALIDATE_SHELL_SHFMT=false' \
-v $(PWD):/tmp/lint \
github/super-linter

.PHONY: lint
lint: lint-go lint-rest

.PHONY: lint-fix
lint-fix: lint-md lint-go

.PHONY: fix
fix:
make lint-fix fix=true

.PHONY: install
install: build
@cp dist/local/act $(PREFIX)/bin/act
Expand Down

0 comments on commit 62964cb

Please sign in to comment.