Skip to content

Commit

Permalink
CI: update GolangCI-Lint settings (#104)
Browse files Browse the repository at this point in the history
* CI: update GolangCI-Lint settings

Use .golangci.yml for GolangCI-Lint configuration and remove Gocritic
since it can be called from the GolangCI-Lint.

* ResellV2: fix spelling in Quotas package

Use "length" in the projectQuotasSlice comment.
  • Loading branch information
ozerovandrei authored Dec 7, 2018
1 parent d609e5c commit 6431e52
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 34 deletions.
8 changes: 8 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
linters:
fast: false
enable-all: true
disable:
- dupl
- gochecknoglobals
- gosec
- lll
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ language: go
install:
- go get github.com/mattn/goveralls
- go get github.com/wadey/gocovmerge
- go get github.com/go-critic/go-critic/...
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.11.2
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.12.3
go:
- "1.11"
script:
Expand Down
7 changes: 2 additions & 5 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
default: tests

tests: golangci-lint critic unittest
tests: golangci-lint unittest

unittest:
@sh -c "'$(CURDIR)/scripts/gotest.sh'"

golangci-lint:
@sh -c "'$(CURDIR)/scripts/golangci_lint_check.sh'"

critic:
@sh -c "'$(CURDIR)/scripts/gocritic_check.sh'"

.PHONY: tests unittest golangci-lint critic
.PHONY: tests unittest golangci-lint
12 changes: 0 additions & 12 deletions scripts/gocritic_check.sh

This file was deleted.

15 changes: 1 addition & 14 deletions scripts/golangci_lint_check.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
#!/usr/bin/env bash

echo "==> Running golangci-lint..."
golangci-lint run \
--enable golint \
--enable interfacer \
--enable unconvert \
--enable goconst \
--enable gocyclo \
--enable gofmt \
--enable goimports \
--enable maligned \
--enable depguard \
--enable unparam \
--enable nakedret \
--enable prealloc \
./...
golangci-lint run ./...
if [ $? -eq 1 ]; then
echo ""
echo "Golangci-lint found suspicious constructs. Please check the reported"; \
Expand Down
2 changes: 1 addition & 1 deletion selvpcclient/resell/v2/quotas/schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (result *ProjectsQuotas) UnmarshalJSON(b []byte) error {
if len(s.ProjectsQuotas) != 0 {
// Convert projects quota maps to the slice of ProjectQuota types.
// Here we're allocating memory in advance for both of project and resource quotas
// because we already know the lenght of each slices from the JSON bytearray.
// because we already know the length of each slices from the JSON bytearray.
projectQuotasSlice := make([]*ProjectQuota, len(s.ProjectsQuotas))
i := 0
for projectName, projectQuotas := range s.ProjectsQuotas {
Expand Down

0 comments on commit 6431e52

Please sign in to comment.