diff --git a/.golangci.yml b/.golangci.yml index eda5e5f4..fae355a3 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -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 diff --git a/client/client.go b/client/client.go index 77f33c2d..59de8abd 100644 --- a/client/client.go +++ b/client/client.go @@ -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 diff --git a/client/container.go b/client/container.go index 080e44db..9c1ccf88 100644 --- a/client/container.go +++ b/client/container.go @@ -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 { diff --git a/container/acl/acl.go b/container/acl/acl.go index 1df713f7..eedec575 100644 --- a/container/acl/acl.go +++ b/container/acl/acl.go @@ -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 diff --git a/container/acl/util.go b/container/acl/util.go index 91c4b216..79b5134f 100644 --- a/container/acl/util.go +++ b/container/acl/util.go @@ -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) diff --git a/container/container.go b/container/container.go index 1f5afdf5..11cd097e 100644 --- a/container/container.go +++ b/container/container.go @@ -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 diff --git a/netmap/policy.go b/netmap/policy.go index 14e3e117..114866f5 100644 --- a/netmap/policy.go +++ b/netmap/policy.go @@ -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 diff --git a/object/transformer/transformer.go b/object/transformer/transformer.go index 098d38f4..efe3d98c 100644 --- a/object/transformer/transformer.go +++ b/object/transformer/transformer.go @@ -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 diff --git a/pool/pool.go b/pool/pool.go index 772afc15..ef6ccf03 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -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