Skip to content

Commit

Permalink
Change to golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
dnephin committed Mar 10, 2019
1 parent 1b86808 commit 0ebdcf9
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 67 deletions.
36 changes: 4 additions & 32 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
version: 2.1

orbs:
go: gotest/tools@dev:0.0.8

workflows:
version: 2
ci:
Expand All @@ -21,7 +24,7 @@ workflows:
name: go/golang
tag: 1.12-alpine

- lint
- go/lint
- build
- run

Expand All @@ -32,9 +35,6 @@ workflows:
tags: {only: '/v[0-9]+(\.[0-9]+)*/'}
branches: {ignore: '/.*/'}

orbs:
go: gotest/tools@0.0.7

commands:
install-deps:
description: Install dep and dependencies
Expand All @@ -59,34 +59,6 @@ commands:
jobs:

lint:
working_directory: /work
docker: [{image: 'docker:18.03-git'}]
steps:
- checkout
- setup_remote_docker
- run:
command: docker version
- run:
name: "Install Dependencies"
command: |
docker build -f dobifiles/Dockerfile \
--target dev-with-source \
--tag testsum-builder:$CIRCLE_BUILD_NUM .
docker run --name \
deps-$CIRCLE_BUILD_NUM testsum-builder:$CIRCLE_BUILD_NUM \
dep ensure
docker cp \
deps-$CIRCLE_BUILD_NUM:/go/src/gotest.tools/gotestsum/vendor \
.
- run:
name: "Lint"
command: |
docker build -f dobifiles/Dockerfile \
--target linter-with-source \
--tag testsum-linter:$CIRCLE_BUILD_NUM .
docker run --rm testsum-linter:$CIRCLE_BUILD_NUM
build:
parameters:
publish:
Expand Down
38 changes: 38 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
linters-settings:
gocyclo:
min-complexity: 10
goconst:
min-len: 2
min-occurrences: 4
lll:
line-length: 100
gocritic:
enabled-tags:
- performance
- style
- experimental
disabled-checks:
- importShadow
- paramTypeCombine
- commentFormatting # https://github.com/go-critic/go-critic/issues/755
- unnamedResult
settings:
hugeParam:
sizeThreshold: 256

issues:
exclude-use-default: false
exclude:
# unparam
- 'result .* is always'
- 'always receives'

linters:
enable-all: true
disable:
- dupl
- gochecknoglobals
- gochecknoinits
- gosec
- scopelint
- maligned
31 changes: 0 additions & 31 deletions .gometalinter.json

This file was deleted.

6 changes: 3 additions & 3 deletions testjson/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (p Package) Result() Action {
func (p Package) Elapsed() time.Duration {
elapsed := time.Duration(0)
for _, testcase := range p.TestCases() {
elapsed = elapsed + testcase.Elapsed
elapsed += testcase.Elapsed
}
return elapsed
}
Expand Down Expand Up @@ -217,7 +217,7 @@ func (e *Execution) Failed() []TestCase {
}

func sortedKeys(pkgs map[string]*Package) []string {
var keys []string
keys := make([]string, 0, len(pkgs))
for key := range pkgs {
keys = append(keys, key)
}
Expand All @@ -227,7 +227,7 @@ func sortedKeys(pkgs map[string]*Package) []string {

// Skipped returns a list of all the skipped test cases.
func (e *Execution) Skipped() []TestCase {
var skipped []TestCase
skipped := make([]TestCase, 0, len(e.packages))
for _, pkg := range sortedKeys(e.packages) {
skipped = append(skipped, e.packages[pkg].Skipped...)
}
Expand Down
2 changes: 1 addition & 1 deletion testjson/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (s Summary) String() string {
return "none"
}
var result []string
for v := Summary(1); v <= s; v = v << 1 {
for v := Summary(1); v <= s; v <<= 1 {
if s.Includes(v) {
result = append(result, summaryValues[v])
}
Expand Down

0 comments on commit 0ebdcf9

Please sign in to comment.