As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Unverified Commit 5f662d8c authored by Patrick Bajao's avatar Patrick Bajao
Browse files

Merge branch '683-follow-up-from-add-golangci-lint-to-ci-job' into 'main'

Add lefthook support and make lint target

Closes #683

See merge request https://gitlab.com/gitlab-org/gitlab-shell/-/merge_requests/843



Merged-by: default avatarPatrick Bajao <ebajao@gitlab.com>
Approved-by: default avatarJaime Martinez <jmartinez@gitlab.com>
Approved-by: default avatarPatrick Bajao <ebajao@gitlab.com>
Reviewed-by: default avatarPatrick Bajao <ebajao@gitlab.com>
Co-authored-by: default avatarAsh McKenzie <amckenzie@gitlab.com>
parents d67a26d9 9f500caa
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -19,6 +19,7 @@ cover.out
cover.xml
custom_hooks
hooks/*.d
/support/bin/golangci-*
/support/bin/gotestsum-*
tags
tmp/*
Loading
Loading
Loading
Loading
@@ -210,14 +210,12 @@ modules:tidy:
- git diff --exit-code go.mod go.sum
lint:
image: golangci/golangci-lint
stage: test
script:
- apt update && apt install -y libkrb5-dev
# Write the code coverage report to gl-code-quality-report.json
# and print linting issues to stdout in the format: path/to/file:line description
# remove `--issues-exit-code 0` or set to non-zero to fail the job if linting issues are detected
- golangci-lint run --issues-exit-code 0 --print-issued-lines=false --out-format code-climate:gl-code-quality-report.json,line-number
- make lint GOLANGCI_LINT_ARGS="--out-format code-climate:gl-code-quality-report.json,line-number"
artifacts:
reports:
codequality: gl-code-quality-report.json
Loading
Loading
.PHONY: validate verify verify_ruby verify_golang test test_ruby test_golang test_fancy test_golang_fancy coverage coverage_golang setup _script_install build compile check clean install
.PHONY: validate verify verify_ruby verify_golang test test_ruby test_golang test_fancy test_golang_fancy coverage coverage_golang setup _script_install build compile check clean install lint
FIPS_MODE ?= 0
OS := $(shell uname | tr A-Z a-z)
Loading
Loading
@@ -10,6 +10,9 @@ BUILD_TAGS := tracer_static tracer_static_jaeger continuous_profiler_stackdriver
GOTESTSUM_VERSION := 1.10.0
GOTESTSUM_FILE := support/bin/gotestsum-${GOTESTSUM_VERSION}
GOLANGCI_LINT_VERSION := 1.54.2
GOLANGCI_LINT_FILE := support/bin/golangci-lint-${GOLANGCI_LINT_VERSION}
export GOFLAGS := -mod=readonly
ifeq (${FIPS_MODE}, 1)
Loading
Loading
@@ -75,6 +78,13 @@ coverage: coverage_golang
coverage_golang:
[ -f cover.out ] && go tool cover -func cover.out
lint: ${GOLANGCI_LINT_FILE}
${GOLANGCI_LINT_FILE} run --issues-exit-code 0 --print-issued-lines=false ${GOLANGCI_LINT_ARGS}
${GOLANGCI_LINT_FILE}:
mkdir -p $(shell dirname ${GOLANGCI_LINT_FILE})
curl -L https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-${OS}-amd64.tar.gz | tar --strip-components 1 -zOxf - golangci-lint-${GOLANGCI_LINT_VERSION}-${OS}-amd64/golangci-lint > ${GOLANGCI_LINT_FILE} && chmod +x ${GOLANGCI_LINT_FILE}
setup: _script_install bin/gitlab-shell
_script_install:
Loading
Loading
pre-push:
commands:
test:
run: make test
# Disabled for now as there's _lots_ of linter errors
#lint:
# run: make lint
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment