Skip to content

Commit

Permalink
refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
ReneWerner87 committed Dec 1, 2024
1 parent bc19709 commit 01832ab
Show file tree
Hide file tree
Showing 5 changed files with 744 additions and 52 deletions.
377 changes: 377 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,377 @@
# v1.2.0. Created based on golangci-lint v1.57.1

run:
timeout: 5m
modules-download-mode: readonly
allow-serial-runners: true

output:
sort-results: true
uniq-by-line: false

linters-settings:
depguard:
rules:
all:
list-mode: lax
deny:
- pkg: "flag"
desc: '`flag` package is only allowed in main.go'
- pkg: "log"
desc: 'logging is provided by `pkg/log`'
- pkg: "io/ioutil"
desc: '`io/ioutil` package is deprecated, use the `io` and `os` package instead'
# TODO: Prevent using these without a reason
# - pkg: "reflect"
# desc: '`reflect` package is dangerous to use'
# - pkg: "unsafe"
# desc: '`unsafe` package is dangerous to use'

errcheck:
check-type-assertions: true
check-blank: true
disable-default-exclusions: true
exclude-functions:
- '(*bytes.Buffer).Write' # always returns nil error
- '(*github.com/valyala/bytebufferpool.ByteBuffer).Write' # always returns nil error
- '(*github.com/valyala/bytebufferpool.ByteBuffer).WriteByte' # always returns nil error
- '(*github.com/valyala/bytebufferpool.ByteBuffer).WriteString' # always returns nil error

errchkjson:
report-no-exported: true

exhaustive:
check-generated: true
default-signifies-exhaustive: true

forbidigo:
forbid:
- ^print(ln)?$
- ^fmt\.Print(f|ln)?$
- ^http\.Default(Client|ServeMux|Transport)$
# TODO: Eventually enable these patterns
# - ^panic$
# - ^time\.Sleep$
analyze-types: true

gci:
sections:
- standard
- prefix(github.com/gofiber/fiber)
- default
- blank
- dot
# - alias
custom-order: true

goconst:
numbers: true

gocritic:
# TODO: Uncomment the following lines
enabled-tags:
- diagnostic
# - style
# - performance
# - experimental
# - opinionated
settings:
captLocal:
paramsOnly: false
elseif:
skipBalanced: false
underef:
skipRecvDeref: false
# NOTE: Set this option to false if other projects rely on this project's code
# unnamedResult:
# checkExported: false

gofumpt:
module-path: github.com/gofiber/fiber
extra-rules: true

gosec:
excludes:
- G104 # TODO: Enable this again. Mostly provided by errcheck
config:
global:
# show-ignored: true # TODO: Enable this
audit: true

govet:
enable-all: true
disable:
- shadow

grouper:
# const-require-grouping: true # TODO: Enable this
import-require-single-import: true
import-require-grouping: true
# var-require-grouping: true # TODO: Conflicts with gofumpt

loggercheck:
require-string-key: true
no-printf-like: true

misspell:
locale: US

nolintlint:
require-explanation: true
require-specific: true

nonamedreturns:
report-error-in-defer: true

perfsprint:
err-error: true

predeclared:
q: true

promlinter:
strict: true

# TODO: Enable this
# reassign:
# patterns:
# - '.*'

revive:
enable-all-rules: true
rules:
# Provided by gomnd linter
- name: add-constant
disabled: true
- name: argument-limit
disabled: true
# Provided by bidichk
- name: banned-characters
disabled: true
- name: cognitive-complexity
disabled: true
- name: comment-spacings
arguments:
- nolint
disabled: true # TODO: Do not disable
- name: cyclomatic
disabled: true
# TODO: Enable this check. Currently disabled due to upstream bug.
# - name: enforce-repeated-arg-type-style
# arguments:
# - short
- name: enforce-slice-style
arguments:
- make
disabled: true # TODO: Do not disable
- name: exported
disabled: true
- name: file-header
disabled: true
- name: function-result-limit
arguments: [3]
- name: function-length
disabled: true
- name: line-length-limit
disabled: true
- name: max-public-structs
disabled: true
- name: modifies-parameter
disabled: true
- name: nested-structs
disabled: true # TODO: Do not disable
- name: package-comments
disabled: true
- name: optimize-operands-order
disabled: true
- name: unchecked-type-assertion
disabled: true # TODO: Do not disable
- name: unhandled-error
arguments: ['bytes\.Buffer\.Write']

stylecheck:
checks:
- all
- -ST1000
- -ST1020
- -ST1021
- -ST1022

tagalign:
strict: true

tagliatelle:
case:
rules:
json: snake

tenv:
all: true

testifylint:
enable-all: true

testpackage:
skip-regexp: "^$"

unparam:
# NOTE: Set this option to false if other projects rely on this project's code
check-exported: false

unused:
# TODO: Uncomment these two lines
# parameters-are-used: false
# local-variables-are-used: false
# NOTE: Set these options to true if other projects rely on this project's code
field-writes-are-uses: true
# exported-is-used: true # TODO: Fix issues with this option (upstream)
exported-fields-are-used: true

usestdlibvars:
http-method: true
http-status-code: true
time-weekday: false # TODO: Set to true
time-month: false # TODO: Set to true
time-layout: false # TODO: Set to true
crypto-hash: true
default-rpc-path: true
sql-isolation-level: true
tls-signature-scheme: true
constant-kind: true

wrapcheck:
ignorePackageGlobs:
- github.com/gofiber/fiber/*
- github.com/valyala/fasthttp

issues:
exclude-use-default: false
exclude-case-sensitive: true
max-issues-per-linter: 0
max-same-issues: 0
exclude-dirs:
- internal # TODO: Do not ignore interal packages
exclude-rules:
- linters:
- err113
text: 'do not define dynamic errors, use wrapped static errors instead*'
- path: log/.*\.go
linters:
- depguard
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- bodyclose
- err113
# fix: true

linters:
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- containedctx
- contextcheck
# - cyclop
- decorder
- depguard
- dogsled
# - dupl
- dupword # TODO: Enable
- durationcheck
- errcheck
- errchkjson
- errname
- errorlint
- exhaustive
# - exhaustivestruct
# - exhaustruct
- copyloopvar
- forbidigo
- forcetypeassert
# - funlen
# - gci # TODO: Enable
- ginkgolinter
# - gocheckcompilerdirectives # TODO: Enable
# - gochecknoglobals # TODO: Enable
# - gochecknoinits # TODO: Enable
- gochecksumtype
# - gocognit
- goconst # TODO: Enable
- gocritic
# - gocyclo
# - godot
# - godox
- err113
- gofmt
- gofumpt
# - goheader
- goimports
# - mnd # TODO: Enable
- gomoddirectives
# - gomodguard
- goprintffuncname
- gosec
- gosimple
# - gosmopolitan # TODO: Enable
- govet
- grouper
# - ifshort # TODO: Enable
# - importas
# - inamedparam
- ineffassign
# - interfacebloat
# - interfacer
# - ireturn
# - lll
- loggercheck
# - maintidx
- makezero
# - maligned
- mirror
- misspell
- musttag
- nakedret
# - nestif
- nilerr
- nilnil
# - nlreturn
- noctx
- nolintlint
- nonamedreturns
- nosprintfhostport
# - paralleltest # TODO: Enable
- perfsprint
# - prealloc
- predeclared
- promlinter
- protogetter
- reassign
- revive
- rowserrcheck
# - scopelint # TODO: Enable
- sloglint
- spancheck
- sqlclosecheck
- staticcheck
- stylecheck
# - tagalign # TODO: Enable
- tagliatelle
- tenv
- testableexamples
- testifylint
# - testpackage # TODO: Enable
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
# - varnamelen
# - wastedassign # TODO: Enable
- whitespace
- wrapcheck
# - wsl
- zerologlint
Loading

0 comments on commit 01832ab

Please sign in to comment.