8000 add golangci-lint by lwsanty · Pull Request #114 · src-d/ci · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

add golangci-lint #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: v1
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion Makefile.main
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "-dirty" || true)
DEV_PREFIX := dev
VERSION ?= $(DEV_PREFIX)-$(COMMIT)$(GIT_DIRTY)

# Linter
LINTER_VERSION ?= v1.21.0
LINTER_BINARY_PATH := bin/golangci-lint
LINTER_RUN := run
LINTER_CONFIG := .golangci.yml
LINTER_TARGET ?= ./...
# should start with option --no-config, see https://github.com/golangci/golangci-lint#comparison-with-gometalinter
# example: --no-config --issues-exit-code=0 --timeout=30m --disable-all --enable=deadcode --enable=gocyclo --enable=golint --enable=varcheck
LINTER_NON_CONFIG_OPTIONS ?=

# Travis CI
ifneq ($(TRAVIS_TAG), )
VERSION := $(TRAVIS_TAG)
Expand Down Expand Up @@ -311,6 +321,21 @@ update-python-index: install-python-indexer
exit 1; \
fi

linter:
if [ ! -f "$(LINTER_BINARY_PATH)" ]; then \
wget -O - -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s $(LINTER_VERSION); \
fi ; \
if [ ! -f "$(LINTER_CONFIG)" ]; then \
echo -e "\033[1;32mWARNING! Linter config not found, will run in a non-config mode"; \
if [ ! -z "$(LINTER_NON_CONFIG_OPTIONS)" ]; then \
$(LINTER_BINARY_PATH) $(LINTER_RUN) $(LINTER_NON_CONFIG_OPTIONS) $(LINTER_TARGET) ; \
else \
echo -e "\033[1;32mWARNING! Linter's non-config options are not set"; \
fi ; \
else \
$(LINTER_BINARY_PATH) $(LINTER_RUN) $(LINTER_TARGET) ; \
fi

.PHONY: dependencies $(DEPENDENCIES) \
build $(COMMANDS) \
test test-race test-coverage \
Expand All @@ -322,4 +347,5 @@ update-python-index: install-python-indexer
ci-script ci-install \
update-python-index \
install-python-indexer \
install-helm deploy
install-helm deploy \
linter
0