-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from form3tech-oss/nvloff-lint
fix: updates & cleanups
- Loading branch information
Showing
535 changed files
with
34,229 additions
and
8,178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
on: [push] | ||
jobs: | ||
Test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: "actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608" # v4.1.0 | ||
with: | ||
fetch-depth: 0 | ||
fetch-tags: true | ||
- uses: "actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491" # v5.0.0 | ||
- name: test | ||
run: | | ||
make lint | ||
make build | ||
make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,5 @@ pacttesting/logs | |
pact/ | ||
pacttesting/log/pact.log | ||
pacttesting/logs/pact.log | ||
build/ | ||
build/ | ||
/tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# Using golangci-lint@v1.56.2 | ||
run: | ||
timeout: 5m | ||
tests: true | ||
skip-dirs: | ||
- vendor$ | ||
build-tags: | ||
- all | ||
output: | ||
print-linter-name: true | ||
linters: | ||
enable-all: true | ||
fast: false | ||
disable: | ||
# Deprecated (see https://golangci-lint.run/usage/linters/) | ||
- deadcode | ||
- golint | ||
- ifshort | ||
- interfacer | ||
- maligned | ||
- nosnakecase | ||
- scopelint | ||
- structcheck | ||
- varcheck | ||
- exhaustivestruct | ||
|
||
# Style guides that are very subjective | ||
- funlen | ||
- nlreturn | ||
- wsl | ||
- cyclop | ||
- varnamelen | ||
- maintidx | ||
- gocognit | ||
- godot | ||
- gocyclo | ||
- nestif | ||
- nilnil | ||
- tagliatelle | ||
- ireturn | ||
- gomnd | ||
|
||
# Dynamic errors are OK here | ||
- goerr113 | ||
|
||
# We don't need to limit dependencies or replacements | ||
- gomoddirectives | ||
|
||
# Too many false positives for structs with optional fields | ||
- exhaustruct | ||
|
||
# Requires massive test rewrite | ||
- testpackage | ||
|
||
# Most tests can't run in parallel | ||
- paralleltest | ||
|
||
linters-settings: | ||
depguard: | ||
rules: | ||
main: | ||
deny: | ||
- pkg: "github.com/pkg/errors" | ||
desc: Use standard library errors package | ||
exhaustive: | ||
default-signifies-exhaustive: true | ||
errcheck: | ||
check-blank: false | ||
gci: | ||
sections: | ||
- standard | ||
- default | ||
- prefix(github.com/form3tech-oss) | ||
- prefix(github.com/form3tech-oss/go-pact-testing) | ||
issues: | ||
max-issues-per-linter: 0 | ||
max-same-issues: 0 | ||
exclude-rules: | ||
- path: _test\.go | ||
linters: | ||
- unparam | ||
- errcheck | ||
- bodyclose | ||
- path: _test\.go | ||
# ST1003: Poorly chosen identifiers (https://staticcheck.io/docs/checks/#ST1003) | ||
# This is to allow identifiers to be snake_cased in favor of BDD integration tests | ||
text: "ST1003" | ||
linters: | ||
- stylecheck | ||
- path: _test\.go | ||
# This is to allow identifiers to be snake_cased in favor of BDD integration tests | ||
text: "var-naming: don't use underscores in Go names;" | ||
linters: | ||
- revive | ||
- path: _test\.go | ||
# This is to allow stages to be private strcts | ||
text: "unexported-return: exported func" | ||
linters: | ||
- revive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,46 @@ | ||
.DEFAULT_GOAL := default | ||
|
||
GOLANGCI_VERSION := 1.56.2 | ||
|
||
platform := $(shell uname) | ||
pact_version := "1.88.51" | ||
|
||
GOFMT_FILES?=$$(find ./ -name '*.go' | grep -v vendor) | ||
|
||
default: build test | ||
|
||
default: lint build test | ||
|
||
ifeq (${platform},Darwin) | ||
pact_filename := "pact-${pact_version}-osx.tar.gz" | ||
else | ||
pact_filename := "pact-${pact_version}-linux-x86_64.tar.gz" | ||
endif | ||
|
||
build: goimportscheck vet install-pact-go | ||
.PHONY: build | ||
build: install-pact-go | ||
go install ./pacttesting | ||
|
||
.PHONY: test | ||
test: | ||
@echo "executing tests..." | ||
@go test -count=1 -v github.com/form3tech-oss/go-pact-testing/v2/pacttesting | ||
|
||
install-pact-go: | ||
@if [ ! -d ./pact ]; then \ | ||
echo "pact-go not installed, installing..."; \ | ||
wget https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v${pact_version}/${pact_filename} -O /tmp/pactserver.tar.gz && tar -xvf /tmp/pactserver.tar.gz -C .; \ | ||
fi | ||
|
||
install-goimports: | ||
@go get golang.org/x/tools/cmd/goimports | ||
|
||
test: goimportscheck | ||
@echo "executing tests..." | ||
@go test -v github.com/form3tech-oss/go-pact-testing/v2/pacttesting | ||
|
||
vet: | ||
@echo "go vet ." | ||
@go vet $$(go list ./... | grep -v vendor/) ; if [ $$? -eq 1 ]; then \ | ||
echo ""; \ | ||
echo "Vet found suspicious constructs. Please check the reported constructs"; \ | ||
echo "and fix them if necessary before submitting the code for review."; \ | ||
exit 1; \ | ||
fi | ||
|
||
goimports: | ||
goimports: | ||
goimports -w $(GOFMT_FILES) | ||
|
||
goimportscheck: | ||
@sh -c "'$(CURDIR)/scripts/goimportscheck.sh'" | ||
.PHONY: lint | ||
lint: tools/golangci-lint | ||
@echo "==> Running golangci-lint..." | ||
@tools/golangci-lint run | ||
|
||
.PHONY: lint-fix | ||
lint-fix: tools/golangci-lint | ||
@echo "==> Running golangci-lint with autofix..." | ||
@tools/golangci-lint run --fix | ||
|
||
.PHONY: build test vet goimports goimportscheck errcheck package | ||
.PHONY: tools/golangci-lint | ||
tools/golangci-lint: | ||
@echo "==> Installing golangci-lint..." | ||
@./scripts/install-golangci-lint.sh $(GOLANGCI_VERSION) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.