Skip to content

Commit

Permalink
WIP linters
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekSi committed Aug 11, 2021
1 parent 470baea commit d417bb6
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2021-08-11T16:23:52Z by kres c77e3bf-dirty.
# Generated on 2021-08-11T16:38:33Z by kres b894ecf-dirty.

**
!cmd
Expand Down
88 changes: 38 additions & 50 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2021-08-11T16:25:38Z by kres c77e3bf-dirty.
# Generated on 2021-08-11T16:38:33Z by kres b894ecf-dirty.

# options for analysis running
run:
timeout: 10m
issues-exit-code: 1
Expand All @@ -13,57 +12,49 @@ run:
skip-files: []
modules-download-mode: readonly

# output configuration options
output:
format: colored-line-number
print-issued-lines: true
print-linter-name: true
uniq-by-line: true
path-prefix: ""

# all available settings of specific linters
linters-settings:
dogsled:
max-blank-identifiers: 2
dupl:
threshold: 150
cyclop:
max-complexity: 20
errcheck:
check-type-assertions: true
check-blank: true
errorlint:
errorf: false # https://github.com/polyfloyd/go-errorlint#fmterrorf-wrapping-verb
exhaustive:
default-signifies-exhaustive: false
funlen:
lines: 60
statements: 40
default-signifies-exhaustive: true
gci:
local-prefixes: github.com/talos-systems/kres
gocognit:
min-complexity: 30
nestif:
min-complexity: 5
goconst:
min-len: 3
min-occurrences: 3
gocritic:
disabled-checks: []
gocyclo:
min-complexity: 20
godot:
check-all: false
scope: all # FIXME `declarations`, `toplevel`, or `all`
capital: true # FIXME
godox:
keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting
- NOTE
keywords:
- OPTIMIZE # marks code that should be optimized before merging
- HACK # marks hack-arounds that should be removed before merging
gofmt:
simplify: true
gofumpt:
lang-version: "1.16"
goheader:
template: |
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
goimports:
local-prefixes: github.com/talos-systems/kres
golint:
min-confidence: 0.8
gomnd:
settings: {}
gomodguard: {}
gosimple:
go: "1.16"
checks: ["all"]
govet:
check-shadowing: true
enable-all: true
Expand All @@ -76,41 +67,32 @@ linters-settings:
misspell:
locale: US
ignore-words: []
nakedret:
max-func-lines: 30
prealloc:
simple: true
range-loops: true # Report preallocation suggestions on range loops, true by default
for-loops: false # Report preallocation suggestions on for loops, false by default
nolintlint:
allow-unused: false
allow-leading-space: false
allow-no-explanation: []
require-explanation: false
require-explanation: true
require-specific: true
rowserrcheck: {}
testpackage:
staticcheck:
go: "1.16"
checks: ["all"]
stylecheck:
go: "1.16"
unparam:
check-exported: false
unused:
check-exported: false
whitespace:
multi-if: false # Enforces newlines (or comments) after every multi-line if statement
multi-func: false # Enforces newlines (or comments) after every multi-line function signature
go: "1.16"
wsl:
strict-append: true
allow-assign-and-anything: false
allow-assign-and-call: true
allow-multiline-assign: true
allow-cuddle-declarations: false
allow-multiline-assign: true
allow-separated-leading-comment: false
allow-trailing-comment: false
force-case-trailing-whitespace: 0
force-err-cuddling: false
allow-separated-leading-comment: false
gofumpt:
extra-rules: false
cyclop:
# the maximal code complexity to report
max-complexity: 20
force-short-decl-cuddling: false
strict-append: true

linters:
enable-all: true
Expand All @@ -125,10 +107,16 @@ linters:
- gochecknoinits
- godox
- goerr113
- golint # deprecated, replaced by revive
- gomnd
- ifshort # https://github.com/esimonov/ifshort/issues/7
- interfacer # deprecated due to bad suggestions
- maligned # deprecated, replaced by govet's fieldalignment
- nestif
- paralleltest
- tagliatelle
- scopelint # deprecated, replaced by exportloopref
- tagliatelle # until https://github.com/ldez/tagliatelle/issues/2 is implemented in golangci-lint
- thelper
- typecheck
- wrapcheck

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2021-08-11T16:23:52Z by kres c77e3bf-dirty.
# Generated on 2021-08-11T16:38:33Z by kres b894ecf-dirty.

ARG TOOLCHAIN

Expand Down
4 changes: 3 additions & 1 deletion internal/output/golangci/golangci.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ type Output struct {
output.FileAdapter

canonicalPath string
goVersion string
enabled bool
}

// NewOutput creates new Makefile output.
func NewOutput() *Output {
output := &Output{
canonicalPath: "github.com/example.com/example.proj",
goVersion: "1.16",
}

output.FileAdapter.FileWriter = output
Expand Down Expand Up @@ -84,7 +86,7 @@ func (o *Output) config(w io.Writer) error {
return err
}

if _, err := fmt.Fprintf(w, configTemplate, o.canonicalPath); err != nil {
if _, err := fmt.Fprintf(w, configTemplate, o.canonicalPath, o.goVersion); err != nil {
return err
}

Expand Down
86 changes: 37 additions & 49 deletions internal/output/golangci/golangci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# options for analysis running
run:
timeout: 10m
issues-exit-code: 1
Expand All @@ -9,57 +8,49 @@ run:
skip-files: []
modules-download-mode: readonly

# output configuration options
output:
format: colored-line-number
print-issued-lines: true
print-linter-name: true
uniq-by-line: true
path-prefix: ""

# all available settings of specific linters
linters-settings:
dogsled:
max-blank-identifiers: 2
dupl:
threshold: 150
cyclop:
max-complexity: 20
errcheck:
check-type-assertions: true
check-blank: true
errorlint:
errorf: false # https://github.com/polyfloyd/go-errorlint#fmterrorf-wrapping-verb
exhaustive:
default-signifies-exhaustive: false
funlen:
lines: 60
statements: 40
default-signifies-exhaustive: true
gci:
local-prefixes: %[1]s
gocognit:
min-complexity: 30
nestif:
min-complexity: 5
goconst:
min-len: 3
min-occurrences: 3
gocritic:
disabled-checks: []
gocyclo:
min-complexity: 20
godot:
check-all: false
scope: all # FIXME `declarations`, `toplevel`, or `all`
capital: true # FIXME
godox:
keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting
- NOTE
keywords:
- OPTIMIZE # marks code that should be optimized before merging
- HACK # marks hack-arounds that should be removed before merging
gofmt:
simplify: true
gofumpt:
lang-version: "%[2]s"
goheader:
template: |
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
goimports:
local-prefixes: %[1]s
golint:
min-confidence: 0.8
gomnd:
settings: {}
gomodguard: {}
gosimple:
go: "%[2]s"
checks: ["all"]
govet:
check-shadowing: true
enable-all: true
Expand All @@ -72,41 +63,32 @@ linters-settings:
misspell:
locale: US
ignore-words: []
nakedret:
max-func-lines: 30
prealloc:
simple: true
range-loops: true # Report preallocation suggestions on range loops, true by default
for-loops: false # Report preallocation suggestions on for loops, false by default
nolintlint:
allow-unused: false
allow-leading-space: false
allow-no-explanation: []
require-explanation: false
require-explanation: true
require-specific: true
rowserrcheck: {}
testpackage:
staticcheck:
go: "%[2]s"
checks: ["all"]
stylecheck:
go: "%[2]s"
unparam:
check-exported: false
unused:
check-exported: false
whitespace:
multi-if: false # Enforces newlines (or comments) after every multi-line if statement
multi-func: false # Enforces newlines (or comments) after every multi-line function signature
go: "%[2]s"
wsl:
strict-append: true
allow-assign-and-anything: false
allow-assign-and-call: true
allow-multiline-assign: true
allow-cuddle-declarations: false
allow-multiline-assign: true
allow-separated-leading-comment: false
allow-trailing-comment: false
force-case-trailing-whitespace: 0
force-err-cuddling: false
allow-separated-leading-comment: false
gofumpt:
extra-rules: false
cyclop:
# the maximal code complexity to report
max-complexity: 20
force-short-decl-cuddling: false
strict-append: true

linters:
enable-all: true
Expand All @@ -121,10 +103,16 @@ linters:
- gochecknoinits
- godox
- goerr113
- golint # deprecated, replaced by revive
- gomnd
- ifshort # https://github.com/esimonov/ifshort/issues/7
- interfacer # deprecated due to bad suggestions
- maligned # deprecated, replaced by govet's fieldalignment
- nestif
- paralleltest
- tagliatelle
- scopelint # deprecated, replaced by exportloopref
- tagliatelle # until https://github.com/ldez/tagliatelle/issues/2 is implemented in golangci-lint
- thelper
- typecheck
- wrapcheck

Expand Down

0 comments on commit d417bb6

Please sign in to comment.