Change linter file

This commit is contained in:
Andrew Morgan 2019-06-03 00:09:43 +01:00
parent e77f3b7146
commit ab6e15389e
2 changed files with 33 additions and 27 deletions

View file

@ -6,7 +6,7 @@ run:
concurrency: 4 concurrency: 4
# timeout for analysis, e.g. 30s, 5m, default is 1m # timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 1m deadline: 30m
# exit code when at least one issue was found, default is 1 # exit code when at least one issue was found, default is 1
issues-exit-code: 1 issues-exit-code: 1
@ -15,8 +15,8 @@ run:
tests: true tests: true
# list of build tags, all linters use it. Default is empty list. # list of build tags, all linters use it. Default is empty list.
build-tags: #build-tags:
- mytag # - mytag
# which dirs to skip: they won't be analyzed; # which dirs to skip: they won't be analyzed;
# can use regexp here: generated.*, regexp is applied on full path; # can use regexp here: generated.*, regexp is applied on full path;
@ -24,16 +24,16 @@ run:
# from this option's value: # from this option's value:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs: skip-dirs:
- src/external_libs - bin
- autogenerated_by_my_lib - docs
# which files to skip: they will be analyzed, but issues from them # which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is # won't be reported. Default value is empty list, but there is
# no need to include all autogenerated files, we confidently recognize # no need to include all autogenerated files, we confidently recognize
# autogenerated files. If it's not please let us know. # autogenerated files. If it's not please let us know.
skip-files: skip-files:
- ".*\\.my\\.go$" - ".*\\.md$"
- lib/bad.go - ".*\\.sh$"
# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules": # by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit # If invoked with -mod=readonly, the go command is disallowed from the implicit
@ -61,7 +61,7 @@ output:
# all available settings of specific linters # all available settings of specific linters
linters-settings: linters-settings:
errcheck: errcheck:
# report about not checking of errors in type assetions: `a := b.(MyStruct)`; # report about not checking of errors in type assertions: `a := b.(MyStruct)`;
# default is false: such cases aren't reported by default. # default is false: such cases aren't reported by default.
check-type-assertions: false check-type-assertions: false
@ -72,7 +72,7 @@ linters-settings:
# [deprecated] comma-separated list of pairs of the form pkg:regex # [deprecated] comma-separated list of pairs of the form pkg:regex
# the regex is used to ignore names within pkg. (default "fmt:.*"). # the regex is used to ignore names within pkg. (default "fmt:.*").
# see https://github.com/kisielk/errcheck#the-deprecated-method for details # see https://github.com/kisielk/errcheck#the-deprecated-method for details
ignore: fmt:.*,io/ioutil:^Read.* #ignore: fmt:.*,io/ioutil:^Read.*
# path to a file containing a list of functions to exclude from checking # path to a file containing a list of functions to exclude from checking
# see https://github.com/kisielk/errcheck#excluding-functions for details # see https://github.com/kisielk/errcheck#excluding-functions for details
@ -98,10 +98,10 @@ linters-settings:
goimports: goimports:
# put imports beginning with prefix after 3rd-party packages; # put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes # it's a comma-separated list of prefixes
local-prefixes: github.com/org/project #local-prefixes: github.com/org/project
gocyclo: gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20) # minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 10 min-complexity: 12
maligned: maligned:
# print struct with more effective memory layout or not, false by default # print struct with more effective memory layout or not, false by default
suggest-new: true suggest-new: true
@ -117,18 +117,18 @@ linters-settings:
list-type: blacklist list-type: blacklist
include-go-root: false include-go-root: false
packages: packages:
- github.com/davecgh/go-spew/spew # - github.com/davecgh/go-spew/spew
misspell: misspell:
# Correct spellings using locale preferences for US or UK. # Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English. # Default is to use a neutral variety of English.
# Setting locale to US will correct the British spelling of 'colour' to 'color'. # Setting locale to US will correct the British spelling of 'colour' to 'color'.
locale: US locale: US
ignore-words: ignore-words:
- someword # - someword
lll: lll:
# max line length, lines longer will be reported. Default is 120. # max line length, lines longer will be reported. Default is 120.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option # '\t' is counted as 1 character by default, and can be changed with the tab-width option
line-length: 120 line-length: 96
# tab width in spaces. Default to 1. # tab width in spaces. Default to 1.
tab-width: 1 tab-width: 1
unused: unused:
@ -179,16 +179,26 @@ linters-settings:
linters: linters:
enable: enable:
- megacheck - megacheck
- errcheck
- staticcheck
- unused
- gosimple
- structcheck
- varcheck
- ineffassign
- deadcode
- typecheck
- gosec
- gocyclo
- goimports
- dupl
- lll
- interfacer
- depguard
enable-all: false enable-all: false
disable: disable:
- maligned disable-all: true
- prealloc
- gosec
- scopelint
disable-all: false
presets: presets:
- bugs
- unused
fast: false fast: false
@ -198,7 +208,7 @@ issues:
# it can be disabled by `exclude-use-default: false`. To list all # it can be disabled by `exclude-use-default: false`. To list all
# excluded by default patterns execute `golangci-lint run --help` # excluded by default patterns execute `golangci-lint run --help`
exclude: exclude:
- abcdef # - abcdef
# Excluding configuration per-path, per-linter, per-text and per-source # Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules: exclude-rules:

View file

@ -21,12 +21,8 @@ if [ ${1:-""} = "fast" ]
then args="--fast" then args="--fast"
fi fi
if [ -n "${DENDRITE_LINT_CONCURRENCY:-}" ]
then args="$args --concurrency=$DENDRITE_LINT_CONCURRENCY"
fi
echo "Installing golangci-lint..." echo "Installing golangci-lint..."
go get github.com/golangci/golangci-lint/cmd/golangci-lint go get github.com/golangci/golangci-lint/cmd/golangci-lint
echo "Looking for lint..." echo "Looking for lint..."
golangci-lint run $args --deadline 30m golangci-lint run $args