[#47] .golangci.yml: Unify with other FrostFS repos

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-04-07 08:12:41 +03:00
parent 4fa52312c7
commit 708d933fe3
9 changed files with 39 additions and 12 deletions

View file

@ -4,10 +4,10 @@
# options for analysis running
run:
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 5m
timeout: 10m
# include test files or not, default is true
tests: true
tests: false
# output configuration options
output:
@ -26,7 +26,11 @@ linters-settings:
check-shadowing: false
staticcheck:
checks: ["all", "-SA1019"] # TODO Enable SA1019 after deprecated warning are fixed.
funlen:
lines: 80 # default 60
statements: 60 # default 40
gocognit:
min-complexity: 40 # default 30
linters:
enable:
@ -37,23 +41,26 @@ linters:
# some default golangci-lint linters
- errcheck
- gosimple
- godot
- ineffassign
- staticcheck
- typecheck
- unused
# extra linters
- bidichk
- durationcheck
- exhaustive
- godot
- exportloopref
- gofmt
- whitespace
- goimports
- misspell
- predeclared
- reassign
- whitespace
- containedctx
- funlen
- gocognit
- contextcheck
disable-all: true
fast: false
issues:
include:
- EXC0002 # should have a comment
- EXC0003 # test/Test ... consider calling this
- EXC0004 # govet
- EXC0005 # C-style breaks

View file

@ -180,6 +180,8 @@ func (x *PrmInit) SetResponseInfoCallback(f func(ResponseMetaInfo) error) {
// PrmDial groups connection parameters for the Client.
//
// See also Dial.
//
// nolint: containedctx
type PrmDial struct {
endpoint string

View file

@ -82,6 +82,8 @@ func (x ResContainerPut) ID() cid.ID {
//
// Return statuses:
// - global (see Client docs).
//
// nolint: funlen
func (c *Client) ContainerPut(ctx context.Context, prm PrmContainerPut) (*ResContainerPut, error) {
// check parameters
switch {

View file

@ -9,6 +9,7 @@ import "strconv"
// use corresponding constants and/or methods instead.
type Op uint32
// nolint: unused
const (
opZero Op = iota // extreme value for testing
@ -53,6 +54,7 @@ func (x Op) String() string {
// use corresponding constants and/or methods instead.
type Role uint32
// nolint: unused
const (
roleZero Role = iota // extreme value for testing

View file

@ -8,6 +8,8 @@ func setBit(num *uint32, n uint8) {
}
// resets n-th bit in num (starting at 0).
//
// nolint: unused
func resetBit(num *uint32, n uint8) {
var mask uint32
setBit(&mask, n)

View file

@ -50,6 +50,8 @@ const (
// reads Container from the container.Container message. If checkFieldPresence is set,
// returns an error on absence of any protocol-required field.
//
// nolint: funlen
func (x *Container) readFromV2(m container.Container, checkFieldPresence bool) error {
var err error

View file

@ -393,6 +393,8 @@ func (p *PlacementPolicy) AddFilters(fs ...Filter) {
// the result into w. Returns w's errors directly.
//
// See also DecodeString.
//
// nolint: funlen, gocognit
func (p PlacementPolicy) WriteStringTo(w io.StringWriter) (err error) {
writtenSmth := false

View file

@ -131,6 +131,7 @@ func (s *payloadSizeLimiter) initPayloadHashers() {
}
}
// nolint: funlen
func (s *payloadSizeLimiter) release(finalize bool) (*AccessIdentifiers, error) {
// Arg finalize is true only when called from Close method.
// We finalize parent and generate linking objects only if it is more

View file

@ -1938,6 +1938,7 @@ func initSessionForDuration(ctx context.Context, dst *session.Object, c client,
return nil
}
// nolint: containedctx
type callContext struct {
// base context for RPC
context.Context
@ -2072,6 +2073,7 @@ func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (oid.ID, error)
if ctxCall.sessionDefault {
ctxCall.sessionTarget = prm.UseSession
// nolint: contextcheck
if err := p.openDefaultSession(&ctxCall); err != nil {
return oid.ID{}, fmt.Errorf("open default session: %w", err)
}
@ -2124,6 +2126,7 @@ func (p *Pool) DeleteObject(ctx context.Context, prm PrmObjectDelete) error {
return err
}
// nolint: contextcheck
return p.call(&cc, func() error {
if err = cc.client.objectDelete(ctx, prm); err != nil {
return fmt.Errorf("remove object via client: %w", err)
@ -2176,6 +2179,7 @@ func (p *Pool) GetObject(ctx context.Context, prm PrmObjectGet) (ResGetObject, e
return res, err
}
// nolint: contextcheck
return res, p.call(&cc, func() error {
res, err = cc.client.objectGet(ctx, prm)
return err
@ -2200,6 +2204,7 @@ func (p *Pool) HeadObject(ctx context.Context, prm PrmObjectHead) (object.Object
return obj, err
}
// nolint: contextcheck
return obj, p.call(&cc, func() error {
obj, err = cc.client.objectHead(ctx, prm)
return err
@ -2249,6 +2254,7 @@ func (p *Pool) ObjectRange(ctx context.Context, prm PrmObjectRange) (ResObjectRa
return res, err
}
// nolint: contextcheck
return res, p.call(&cc, func() error {
res, err = cc.client.objectRange(ctx, prm)
return err
@ -2312,6 +2318,7 @@ func (p *Pool) SearchObjects(ctx context.Context, prm PrmObjectSearch) (ResObjec
return res, err
}
// nolint: contextcheck
return res, p.call(&cc, func() error {
res, err = cc.client.objectSearch(ctx, prm)
return err