Make linter stricker #148

Merged
fyrchik merged 1 commit from dstepanov-yadro/frostfs-node:feat/linters into master 2023-07-26 21:07:56 +00:00
8 changed files with 10 additions and 1 deletions

View file

@ -61,5 +61,6 @@ linters:
- containedctx - containedctx
- funlen - funlen
- gocognit - gocognit

Do we need both gocyclo and gocognit?
They estimate the same complexity but with different metrics.
What about using gocognit only?

Do we need both gocyclo and gocognit? They estimate the same complexity but with different metrics. What about using `gocognit` only?

These linters are slightly different: https://github.com/uudashr/gocognit#comparison-with-cyclometic-complexity

i`m ok with using gocognit only

These linters are slightly different: https://github.com/uudashr/gocognit#comparison-with-cyclometic-complexity i`m ok with using gocognit only

done

done
- contextcheck
disable-all: true disable-all: true
fast: false fast: false

View file

@ -41,6 +41,7 @@ func (s *Server) DropObjects(_ context.Context, req *control.DropObjectsRequest)
prm.WithForceRemoval() prm.WithForceRemoval()
prm.WithAddress(addrList[i]) prm.WithAddress(addrList[i])
//nolint: contextcheck
_, err := s.s.Delete(prm) _, err := s.s.Delete(prm)
if err != nil && firstErr == nil { if err != nil && firstErr == nil {
firstErr = err firstErr = err

View file

@ -107,7 +107,7 @@ func (exec *execCtx) HeadObject(ctx context.Context, id oid.ID) (*objectSDK.Obje
w := NewSimpleObjectWriter() w := NewSimpleObjectWriter()
prm.SetHeaderWriter(w) prm.SetHeaderWriter(w)
//nolint: contextcheck
err := exec.svc.Head(exec.context(), prm) err := exec.svc.Head(exec.context(), prm)
if err != nil { if err != nil {
@ -128,6 +128,7 @@ func (exec *execCtx) GetObject(ctx context.Context, id oid.ID, rng *objectSDK.Ra
p.addr.SetContainer(exec.containerID()) p.addr.SetContainer(exec.containerID())
p.addr.SetObject(id) p.addr.SetObject(id)
//nolint: contextcheck
statusError := exec.svc.get(exec.context(), p.commonPrm, withPayloadRange(rng)) statusError := exec.svc.get(exec.context(), p.commonPrm, withPayloadRange(rng))
if statusError.err != nil { if statusError.err != nil {

View file

@ -78,6 +78,7 @@ func (s *Service) get(ctx context.Context, prm commonPrm, opts ...execOption) st
exec.setLogger(s.log) exec.setLogger(s.log)
//nolint: contextcheck
exec.execute() exec.execute()
return exec.statusError return exec.statusError

View file

@ -43,6 +43,7 @@ func (exec *execCtx) processNode(ctx context.Context, info client.NodeInfo) bool
// has already been streamed to the requesting party // has already been streamed to the requesting party
if obj != nil { if obj != nil {
exec.collectedObject = obj exec.collectedObject = obj
//nolint: contextcheck
exec.writeCollectedObject() exec.writeCollectedObject()
} }
case errors.As(err, &errRemoved): case errors.As(err, &errRemoved):

View file

@ -18,6 +18,7 @@ func (s *Service) Search(ctx context.Context, prm Prm) error {
exec.setLogger(s.log) exec.setLogger(s.log)
//nolint: contextcheck
exec.execute() exec.execute()
return exec.statusError.err return exec.statusError.err

View file

@ -81,6 +81,7 @@ func (p *Policer) processObject(ctx context.Context, addrWithType objectcore.Add
prm.MarkAsGarbage(addrWithType.Address) prm.MarkAsGarbage(addrWithType.Address)
prm.WithForceRemoval() prm.WithForceRemoval()
//nolint: contextcheck
_, err := p.jobQueue.localStorage.Inhume(prm) _, err := p.jobQueue.localStorage.Inhume(prm)
if err != nil { if err != nil {
p.log.Error("could not inhume object with missing container", p.log.Error("could not inhume object with missing container",
@ -124,6 +125,7 @@ func (p *Policer) processObject(ctx context.Context, addrWithType objectcore.Add
default: default:
} }
//nolint: contextcheck
p.processNodes(c, addrWithType, nn[i], policy.ReplicaNumberByIndex(i), checkedNodes) p.processNodes(c, addrWithType, nn[i], policy.ReplicaNumberByIndex(i), checkedNodes)
} }

View file

@ -94,6 +94,7 @@ func (s *Service) replicationWorker() {
func (s *Service) replicateLoop(ctx context.Context) { func (s *Service) replicateLoop(ctx context.Context) {
for i := 0; i < s.replicatorWorkerCount; i++ { for i := 0; i < s.replicatorWorkerCount; i++ {
//nolint: contextcheck
go s.replicationWorker() go s.replicationWorker()
go s.localReplicationWorker() go s.localReplicationWorker()
} }