From 97c36ed3ecb197b99b937061fbc0d463703edc4d Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Mon, 20 Mar 2023 10:01:27 +0300 Subject: [PATCH] [#148] linter: Add funlen linter Long functions are hard to understand and source of errors Signed-off-by: Dmitrii Stepanov --- .golangci.yml | 4 ++++ cmd/frostfs-adm/internal/modules/morph/balance.go | 1 + cmd/frostfs-adm/internal/modules/morph/container.go | 1 + cmd/frostfs-adm/internal/modules/morph/deploy.go | 1 + cmd/frostfs-adm/internal/modules/morph/initialize.go | 1 + cmd/frostfs-adm/internal/modules/morph/initialize_deploy.go | 1 + cmd/frostfs-adm/internal/modules/morph/notary.go | 1 + cmd/frostfs-adm/internal/modules/morph/root.go | 1 + cmd/frostfs-adm/internal/modules/morph/subnet.go | 5 +++++ cmd/frostfs-adm/internal/modules/storagecfg/root.go | 1 + cmd/frostfs-cli/modules/object/get.go | 1 + cmd/frostfs-cli/modules/object/put.go | 1 + cmd/frostfs-cli/modules/object/util.go | 2 ++ cmd/frostfs-ir/defaults.go | 1 + cmd/frostfs-node/config.go | 4 ++++ cmd/frostfs-node/container.go | 1 + cmd/frostfs-node/netmap.go | 1 + cmd/frostfs-node/object.go | 1 + cmd/frostfs-node/reputation.go | 1 + pkg/core/object/fmt.go | 2 ++ pkg/innerring/alphabet.go | 2 ++ pkg/innerring/innerring.go | 4 ++++ pkg/innerring/processors/alphabet/process_emit.go | 1 + pkg/innerring/processors/audit/process.go | 1 + pkg/innerring/processors/container/common.go | 2 ++ pkg/innerring/processors/governance/process_update.go | 1 + pkg/local_object_storage/blobstor/blobovniczatree/put.go | 2 ++ .../blobstor/internal/blobstortest/iterate.go | 1 + pkg/local_object_storage/engine/evacuate.go | 2 ++ pkg/local_object_storage/engine/get.go | 1 + pkg/local_object_storage/engine/range.go | 1 + pkg/local_object_storage/metabase/inhume.go | 2 ++ pkg/local_object_storage/metabase/put.go | 1 + pkg/local_object_storage/shard/control.go | 1 + pkg/metrics/engine.go | 1 + pkg/metrics/object.go | 1 + pkg/morph/client/notary.go | 1 + pkg/morph/event/listener.go | 1 + pkg/morph/event/notary_preparator.go | 2 ++ pkg/services/audit/auditor/por.go | 1 + pkg/services/object/acl/acl.go | 2 ++ pkg/services/object/acl/eacl/v2/headers.go | 1 + pkg/services/object/acl/v2/service.go | 1 + pkg/services/object/get/util.go | 1 + pkg/services/object/get/v2/util.go | 3 +++ pkg/services/object/put/distributed.go | 1 + pkg/services/object/put/streamer.go | 1 + pkg/services/object/search/v2/util.go | 1 + pkg/services/object/util/chain.go | 1 + pkg/services/policer/check.go | 1 + pkg/services/reputation/eigentrust/calculator/calls.go | 1 + pkg/services/tree/sync.go | 1 + 52 files changed, 76 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index f4eed767..683d976a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -26,6 +26,9 @@ linters-settings: check-shadowing: false staticcheck: checks: ["all", "-SA1019"] # TODO Enable SA1019 after deprecated warning are fixed. + funlen: + lines: 80 + statements: 60 linters: enable: @@ -54,5 +57,6 @@ linters: - reassign - whitespace - containedctx + - funlen disable-all: true fast: false diff --git a/cmd/frostfs-adm/internal/modules/morph/balance.go b/cmd/frostfs-adm/internal/modules/morph/balance.go index 72485eef..c8549268 100644 --- a/cmd/frostfs-adm/internal/modules/morph/balance.go +++ b/cmd/frostfs-adm/internal/modules/morph/balance.go @@ -44,6 +44,7 @@ const ( notaryEnabled = true ) +// nolint: funlen func dumpBalances(cmd *cobra.Command, _ []string) error { var ( dumpStorage, _ = cmd.Flags().GetBool(dumpBalancesStorageFlag) diff --git a/cmd/frostfs-adm/internal/modules/morph/container.go b/cmd/frostfs-adm/internal/modules/morph/container.go index 5c0b18e0..1dec6127 100644 --- a/cmd/frostfs-adm/internal/modules/morph/container.go +++ b/cmd/frostfs-adm/internal/modules/morph/container.go @@ -152,6 +152,7 @@ func listContainers(cmd *cobra.Command, _ []string) error { return nil } +// nolint: funlen func restoreContainers(cmd *cobra.Command, _ []string) error { filename, err := cmd.Flags().GetString(containerDumpFlag) if err != nil { diff --git a/cmd/frostfs-adm/internal/modules/morph/deploy.go b/cmd/frostfs-adm/internal/modules/morph/deploy.go index 2aaddce1..97e216f3 100644 --- a/cmd/frostfs-adm/internal/modules/morph/deploy.go +++ b/cmd/frostfs-adm/internal/modules/morph/deploy.go @@ -57,6 +57,7 @@ func init() { ff.String(customZoneFlag, "frostfs", "Custom zone for NNS") } +// nolint: funlen func deployContractCmd(cmd *cobra.Command, args []string) error { v := viper.GetViper() c, err := newInitializeContext(cmd, v) diff --git a/cmd/frostfs-adm/internal/modules/morph/initialize.go b/cmd/frostfs-adm/internal/modules/morph/initialize.go index bab8e12c..68e02e77 100644 --- a/cmd/frostfs-adm/internal/modules/morph/initialize.go +++ b/cmd/frostfs-adm/internal/modules/morph/initialize.go @@ -108,6 +108,7 @@ func (c *initializeContext) close() { } } +// nolint: funlen func newInitializeContext(cmd *cobra.Command, v *viper.Viper) (*initializeContext, error) { walletDir := config.ResolveHomePath(viper.GetString(alphabetWalletsFlag)) wallets, err := openAlphabetWallets(v, walletDir) diff --git a/cmd/frostfs-adm/internal/modules/morph/initialize_deploy.go b/cmd/frostfs-adm/internal/modules/morph/initialize_deploy.go index 1be94bf1..c74b78e2 100644 --- a/cmd/frostfs-adm/internal/modules/morph/initialize_deploy.go +++ b/cmd/frostfs-adm/internal/modules/morph/initialize_deploy.go @@ -156,6 +156,7 @@ func (c *initializeContext) deployNNS(method string) error { return c.awaitTx() } +// nolint: funlen func (c *initializeContext) updateContracts() error { alphaCs := c.getContract(alphabetContract) diff --git a/cmd/frostfs-adm/internal/modules/morph/notary.go b/cmd/frostfs-adm/internal/modules/morph/notary.go index 47466563..24cfd7d1 100644 --- a/cmd/frostfs-adm/internal/modules/morph/notary.go +++ b/cmd/frostfs-adm/internal/modules/morph/notary.go @@ -22,6 +22,7 @@ import ( // https://github.com/nspcc-dev/neo-go/blob/master/pkg/core/native/notary.go#L48 const defaultNotaryDepositLifetime = 5760 +// nolint: funlen func depositNotary(cmd *cobra.Command, _ []string) error { p, err := cmd.Flags().GetString(storageWalletFlag) if err != nil { diff --git a/cmd/frostfs-adm/internal/modules/morph/root.go b/cmd/frostfs-adm/internal/modules/morph/root.go index c1d81560..0b3ee756 100644 --- a/cmd/frostfs-adm/internal/modules/morph/root.go +++ b/cmd/frostfs-adm/internal/modules/morph/root.go @@ -238,6 +238,7 @@ var ( } ) +// nolint: funlen func init() { RootCmd.AddCommand(generateAlphabetCmd) generateAlphabetCmd.Flags().String(alphabetWalletsFlag, "", "Path to alphabet wallets dir") diff --git a/cmd/frostfs-adm/internal/modules/morph/subnet.go b/cmd/frostfs-adm/internal/modules/morph/subnet.go index 229a2cea..f289400a 100644 --- a/cmd/frostfs-adm/internal/modules/morph/subnet.go +++ b/cmd/frostfs-adm/internal/modules/morph/subnet.go @@ -307,6 +307,8 @@ const ( ) // common executor cmdSubnetAdminAdd and cmdSubnetAdminRemove commands. +// +// nolint: funlen func manageSubnetAdmins(cmd *cobra.Command, rm bool) error { // read private key var key keys.PrivateKey @@ -651,6 +653,8 @@ func addCommandInheritPreRun(par *cobra.Command, subs ...*cobra.Command) { } // registers flags and binds sub-commands for subnet commands. +// +// nolint: funlen func init() { cmdSubnetCreate.Flags().StringP(flagSubnetWallet, "w", "", "Path to file with wallet") _ = cmdSubnetCreate.MarkFlagRequired(flagSubnetWallet) @@ -868,6 +872,7 @@ func invokeNonNotary(c Client, key keys.PrivateKey, method string, args ...any) return nil } +// nolint: funlen func invokeNotary(c Client, key keys.PrivateKey, method string, notaryHash util.Uint160, args ...any) error { nnsCs, err := c.GetContractStateByID(1) if err != nil { diff --git a/cmd/frostfs-adm/internal/modules/storagecfg/root.go b/cmd/frostfs-adm/internal/modules/storagecfg/root.go index 682350ba..d08eb6cc 100644 --- a/cmd/frostfs-adm/internal/modules/storagecfg/root.go +++ b/cmd/frostfs-adm/internal/modules/storagecfg/root.go @@ -79,6 +79,7 @@ type config struct { MetabasePath string } +// nolint: funlen func storageConfig(cmd *cobra.Command, args []string) { var outPath string if len(args) != 0 { diff --git a/cmd/frostfs-cli/modules/object/get.go b/cmd/frostfs-cli/modules/object/get.go index b077610f..900326df 100644 --- a/cmd/frostfs-cli/modules/object/get.go +++ b/cmd/frostfs-cli/modules/object/get.go @@ -42,6 +42,7 @@ func initObjectGetCmd() { flags.Bool(binaryFlag, false, "Serialize whole object structure into given file(id + signature + header + payload).") } +// nolint: funlen func getObject(cmd *cobra.Command, _ []string) { var cnr cid.ID var obj oid.ID diff --git a/cmd/frostfs-cli/modules/object/put.go b/cmd/frostfs-cli/modules/object/put.go index ef3b6dcb..b672e15e 100644 --- a/cmd/frostfs-cli/modules/object/put.go +++ b/cmd/frostfs-cli/modules/object/put.go @@ -58,6 +58,7 @@ func initObjectPutCmd() { flags.Bool(binaryFlag, false, "Deserialize object structure from given file.") } +// nolint: funlen func putObject(cmd *cobra.Command, _ []string) { binary, _ := cmd.Flags().GetBool(binaryFlag) cidVal, _ := cmd.Flags().GetString(commonflags.CIDFlag) diff --git a/cmd/frostfs-cli/modules/object/util.go b/cmd/frostfs-cli/modules/object/util.go index 25adffc1..90b897c1 100644 --- a/cmd/frostfs-cli/modules/object/util.go +++ b/cmd/frostfs-cli/modules/object/util.go @@ -339,6 +339,8 @@ func initFlagSession(cmd *cobra.Command, verb string) { // container. // // The object itself is not included in the result. +// +// nolint: funlen func collectObjectRelatives(cmd *cobra.Command, cli *client.Client, cnr cid.ID, obj oid.ID) []oid.ID { common.PrintVerbose(cmd, "Fetching raw object header...") diff --git a/cmd/frostfs-ir/defaults.go b/cmd/frostfs-ir/defaults.go index 8c313fa4..9157d282 100644 --- a/cmd/frostfs-ir/defaults.go +++ b/cmd/frostfs-ir/defaults.go @@ -41,6 +41,7 @@ func newConfig(path, directory string) (*viper.Viper, error) { return v, err } +// nolint: funlen func defaultConfiguration(cfg *viper.Viper) { cfg.SetDefault("logger.level", "info") diff --git a/cmd/frostfs-node/config.go b/cmd/frostfs-node/config.go index b2b12241..25222ed4 100644 --- a/cmd/frostfs-node/config.go +++ b/cmd/frostfs-node/config.go @@ -171,6 +171,8 @@ type subStorageCfg struct { // readConfig fills applicationConfiguration with raw configuration values // not modifying them. +// +// nolint: funlen func (a *applicationConfiguration) readConfig(c *config.Config) error { if a._read { err := c.Reload() @@ -522,6 +524,7 @@ type cfgReputation struct { var persistateSideChainLastBlockKey = []byte("side_chain_last_processed_block") +// nolint: funlen func initCfg(appCfg *config.Config) *cfg { c := &cfg{} @@ -654,6 +657,7 @@ type shardOptsWithID struct { shOpts []shard.Option } +// nolint: funlen func (c *cfg) shardOpts() []shardOptsWithID { shards := make([]shardOptsWithID, 0, len(c.EngineCfg.shards)) diff --git a/cmd/frostfs-node/container.go b/cmd/frostfs-node/container.go index ac049922..bcd9e3be 100644 --- a/cmd/frostfs-node/container.go +++ b/cmd/frostfs-node/container.go @@ -39,6 +39,7 @@ const ( stopEstimationNotifyEvent = "StopEstimation" ) +// nolint: funlen func initContainerService(c *cfg) { // container wrapper that tries to invoke notary // requests if chain is configured so diff --git a/cmd/frostfs-node/netmap.go b/cmd/frostfs-node/netmap.go index d5f3036c..00bbdbf5 100644 --- a/cmd/frostfs-node/netmap.go +++ b/cmd/frostfs-node/netmap.go @@ -135,6 +135,7 @@ func (c *cfg) addressNum() int { return 0 } +// nolint: funlen func initNetmapService(c *cfg) { network.WriteToNodeInfo(c.localAddr, &c.cfgNodeInfo.localInfo) c.cfgNodeInfo.localInfo.SetPublicKey(c.key.PublicKey().Bytes()) diff --git a/cmd/frostfs-node/object.go b/cmd/frostfs-node/object.go index df838464..0f6fcc0b 100644 --- a/cmd/frostfs-node/object.go +++ b/cmd/frostfs-node/object.go @@ -163,6 +163,7 @@ func (x *coreClientConstructor) Get(info coreclient.NodeInfo) (coreclient.MultiA return c.(coreclient.MultiAddressClient), nil } +// nolint: funlen func initObjectService(c *cfg) { ls := c.cfgObject.cfgLocalStorage.localStorage keyStorage := util.NewKeyStorage(&c.key.PrivateKey, c.privateTokenStore, c.cfgNetmap.state) diff --git a/cmd/frostfs-node/reputation.go b/cmd/frostfs-node/reputation.go index e9626b14..8854b21c 100644 --- a/cmd/frostfs-node/reputation.go +++ b/cmd/frostfs-node/reputation.go @@ -33,6 +33,7 @@ import ( "go.uber.org/zap" ) +// nolint: funlen func initReputationService(c *cfg) { wrap, err := repClient.NewFromMorph(c.cfgMorph.client, c.cfgReputation.scriptHash, 0, repClient.TryNotary()) fatalOnErr(err) diff --git a/pkg/core/object/fmt.go b/pkg/core/object/fmt.go index 804f0bd4..217c0466 100644 --- a/pkg/core/object/fmt.go +++ b/pkg/core/object/fmt.go @@ -202,6 +202,8 @@ func (i ContentMeta) Objects() []oid.ID { } // ValidateContent validates payload content according to the object type. +// +// nolint: funlen func (v *FormatValidator) ValidateContent(o *object.Object) (ContentMeta, error) { meta := ContentMeta{ typ: o.Type(), diff --git a/pkg/innerring/alphabet.go b/pkg/innerring/alphabet.go index be16f823..518c1819 100644 --- a/pkg/innerring/alphabet.go +++ b/pkg/innerring/alphabet.go @@ -53,6 +53,8 @@ const ( ) // String returns l in config-compatible format. +// +// nolint: funlen func (l GlagoliticLetter) String() string { switch l { default: diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 33cfc39a..ae3217fc 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -158,6 +158,8 @@ var ( ) // Start runs all event providers. +// +// nolint: funlen func (s *Server) Start(ctx context.Context, intError chan<- error) (err error) { s.setHealthStatus(control.HealthStatus_STARTING) defer func() { @@ -319,6 +321,8 @@ func (s *Server) registerStarter(f func() error) { } // New creates instance of inner ring sever structure. +// +// nolint: funlen func New(ctx context.Context, log *logger.Logger, cfg *viper.Viper, errChan chan<- error) (*Server, error) { var err error server := &Server{log: log} diff --git a/pkg/innerring/processors/alphabet/process_emit.go b/pkg/innerring/processors/alphabet/process_emit.go index 353adb45..867d9622 100644 --- a/pkg/innerring/processors/alphabet/process_emit.go +++ b/pkg/innerring/processors/alphabet/process_emit.go @@ -10,6 +10,7 @@ import ( const emitMethod = "emit" +// nolint: funlen func (ap *Processor) processEmit() { index := ap.irList.AlphabetIndex() if index < 0 { diff --git a/pkg/innerring/processors/audit/process.go b/pkg/innerring/processors/audit/process.go index 7feecb7b..3bdb0010 100644 --- a/pkg/innerring/processors/audit/process.go +++ b/pkg/innerring/processors/audit/process.go @@ -17,6 +17,7 @@ import ( "go.uber.org/zap" ) +// nolint: funlen func (ap *Processor) processStartAudit(epoch uint64) { log := ap.log.With(zap.Uint64("epoch", epoch)) diff --git a/pkg/innerring/processors/container/common.go b/pkg/innerring/processors/container/common.go index bfbf6c78..56adc0ce 100644 --- a/pkg/innerring/processors/container/common.go +++ b/pkg/innerring/processors/container/common.go @@ -46,6 +46,8 @@ type signatureVerificationData struct { // - v.binPublicKey is a public session key // - session context corresponds to the container and verb in v // - session is "alive" +// +// nolint: funlen func (cp *Processor) verifySignature(v signatureVerificationData) error { var err error var key frostfsecdsa.PublicKeyRFC6979 diff --git a/pkg/innerring/processors/governance/process_update.go b/pkg/innerring/processors/governance/process_update.go index 913ad3d7..c9764fee 100644 --- a/pkg/innerring/processors/governance/process_update.go +++ b/pkg/innerring/processors/governance/process_update.go @@ -18,6 +18,7 @@ const ( alphabetUpdateIDPrefix = "AlphabetUpdate" ) +// nolint: funlen func (gp *Processor) processAlphabetSync(txHash util.Uint256) { if !gp.alphabetState.IsAlphabet() { gp.log.Info("non alphabet mode, ignore alphabet sync") diff --git a/pkg/local_object_storage/blobstor/blobovniczatree/put.go b/pkg/local_object_storage/blobstor/blobovniczatree/put.go index 614d66fe..438c2e23 100644 --- a/pkg/local_object_storage/blobstor/blobovniczatree/put.go +++ b/pkg/local_object_storage/blobstor/blobovniczatree/put.go @@ -13,6 +13,8 @@ import ( // Put saves object in the maximum weight blobobnicza. // // returns error if could not save object in any blobovnicza. +// +// nolint: funlen func (b *Blobovniczas) Put(prm common.PutPrm) (common.PutRes, error) { if b.readOnly { return common.PutRes{}, common.ErrReadOnly diff --git a/pkg/local_object_storage/blobstor/internal/blobstortest/iterate.go b/pkg/local_object_storage/blobstor/internal/blobstortest/iterate.go index 231df3ef..e2a310ef 100644 --- a/pkg/local_object_storage/blobstor/internal/blobstortest/iterate.go +++ b/pkg/local_object_storage/blobstor/internal/blobstortest/iterate.go @@ -9,6 +9,7 @@ import ( "github.com/stretchr/testify/require" ) +// nolint: funlen func TestIterate(t *testing.T, cons Constructor, min, max uint64) { s := cons(t) require.NoError(t, s.Open(false)) diff --git a/pkg/local_object_storage/engine/evacuate.go b/pkg/local_object_storage/engine/evacuate.go index 59965ba4..ee04212c 100644 --- a/pkg/local_object_storage/engine/evacuate.go +++ b/pkg/local_object_storage/engine/evacuate.go @@ -57,6 +57,8 @@ var errMustHaveTwoShards = errors.New("must have at least 1 spare shard") // Evacuate moves data from one shard to the others. // The shard being moved must be in read-only mode. +// +// nolint: funlen func (e *StorageEngine) Evacuate(prm EvacuateShardPrm) (EvacuateShardRes, error) { sidList := make([]string, len(prm.shardID)) for i := range prm.shardID { diff --git a/pkg/local_object_storage/engine/get.go b/pkg/local_object_storage/engine/get.go index 264ace58..787a7bac 100644 --- a/pkg/local_object_storage/engine/get.go +++ b/pkg/local_object_storage/engine/get.go @@ -52,6 +52,7 @@ func (e *StorageEngine) Get(prm GetPrm) (res GetRes, err error) { return } +// nolint: funlen func (e *StorageEngine) get(prm GetPrm) (GetRes, error) { if e.metrics != nil { defer elapsed(e.metrics.AddGetDuration)() diff --git a/pkg/local_object_storage/engine/range.go b/pkg/local_object_storage/engine/range.go index d6e6b08f..491b226b 100644 --- a/pkg/local_object_storage/engine/range.go +++ b/pkg/local_object_storage/engine/range.go @@ -65,6 +65,7 @@ func (e *StorageEngine) GetRange(prm RngPrm) (res RngRes, err error) { return } +// nolint: funlen func (e *StorageEngine) getRange(prm RngPrm) (RngRes, error) { if e.metrics != nil { defer elapsed(e.metrics.AddRangeDuration)() diff --git a/pkg/local_object_storage/metabase/inhume.go b/pkg/local_object_storage/metabase/inhume.go index ce772576..a067a187 100644 --- a/pkg/local_object_storage/metabase/inhume.go +++ b/pkg/local_object_storage/metabase/inhume.go @@ -118,6 +118,8 @@ var ErrLockObjectRemoval = logicerr.New("lock object removal") // // NOTE: Marks any object with GC mark (despite any prohibitions on operations // with that object) if WithForceGCMark option has been provided. +// +// nolint: funlen func (db *DB) Inhume(prm InhumePrm) (res InhumeRes, err error) { db.modeMtx.RLock() defer db.modeMtx.RUnlock() diff --git a/pkg/local_object_storage/metabase/put.go b/pkg/local_object_storage/metabase/put.go index 06b1d3ac..07bb4c2b 100644 --- a/pkg/local_object_storage/metabase/put.go +++ b/pkg/local_object_storage/metabase/put.go @@ -76,6 +76,7 @@ func (db *DB) Put(prm PutPrm) (res PutRes, err error) { return } +// nolint: funlen func (db *DB) put( tx *bbolt.Tx, obj *objectSDK.Object, id []byte, si *objectSDK.SplitInfo, currEpoch uint64) error { diff --git a/pkg/local_object_storage/shard/control.go b/pkg/local_object_storage/shard/control.go index 6d17114b..05f58f83 100644 --- a/pkg/local_object_storage/shard/control.go +++ b/pkg/local_object_storage/shard/control.go @@ -156,6 +156,7 @@ func (s *Shard) Init() error { return nil } +// nolint: funlen func (s *Shard) refillMetabase() error { err := s.metaBase.Reset() if err != nil { diff --git a/pkg/metrics/engine.go b/pkg/metrics/engine.go index 2696d4a8..fbc18483 100644 --- a/pkg/metrics/engine.go +++ b/pkg/metrics/engine.go @@ -26,6 +26,7 @@ type ( const engineSubsystem = "engine" +// nolint: funlen func newEngineMetrics() engineMetrics { var ( listContainersDuration = prometheus.NewCounter(prometheus.CounterOpts{ diff --git a/pkg/metrics/object.go b/pkg/metrics/object.go index 0bb16b78..ffa5d481 100644 --- a/pkg/metrics/object.go +++ b/pkg/metrics/object.go @@ -75,6 +75,7 @@ func (m methodCount) Inc(success bool) { } } +// nolint: funlen func newObjectServiceMetrics() objectServiceMetrics { var ( // Request counter metrics. getCounter = newMethodCallCounter("get") diff --git a/pkg/morph/client/notary.go b/pkg/morph/client/notary.go index a1980e2d..307a989f 100644 --- a/pkg/morph/client/notary.go +++ b/pkg/morph/client/notary.go @@ -445,6 +445,7 @@ func (c *Client) notaryInvokeAsCommittee(method string, nonce, vub uint32, args return c.notaryInvoke(true, true, designate, nonce, &vub, method, args...) } +// nolint: funlen func (c *Client) notaryInvoke(committee, invokedByAlpha bool, contract util.Uint160, nonce uint32, vub *uint32, method string, args ...any) error { alphabetList, err := c.notary.alphabetSource() // prepare arguments for test invocation if err != nil { diff --git a/pkg/morph/event/listener.go b/pkg/morph/event/listener.go index 13ad868e..17be3ea1 100644 --- a/pkg/morph/event/listener.go +++ b/pkg/morph/event/listener.go @@ -191,6 +191,7 @@ func (l *listener) listen(ctx context.Context, intError chan<- error) error { return nil } +// nolint: funlen func (l *listener) listenLoop(ctx context.Context, chEvent <-chan *state.ContainedNotificationEvent, intErr chan<- error) { var ( blockChan <-chan *block.Block diff --git a/pkg/morph/event/notary_preparator.go b/pkg/morph/event/notary_preparator.go index f661268f..f85b5b64 100644 --- a/pkg/morph/event/notary_preparator.go +++ b/pkg/morph/event/notary_preparator.go @@ -103,6 +103,8 @@ func notaryPreparator(prm PreparatorPrm) NotaryPreparator { // transaction is expected to be received one more time // from the Notary service but already signed. This happens // since every notary call is a new notary request in fact. +// +// nolint: funlen func (p Preparator) Prepare(nr *payload.P2PNotaryRequest) (NotaryEvent, error) { // notary request's main tx is expected to have // three or four witnesses: one for proxy contract, diff --git a/pkg/services/audit/auditor/por.go b/pkg/services/audit/auditor/por.go index 432826ac..1922213e 100644 --- a/pkg/services/audit/auditor/por.go +++ b/pkg/services/audit/auditor/por.go @@ -35,6 +35,7 @@ func (c *Context) executePoR() { c.report.SetPoRCounters(c.porRequests.Load(), c.porRetries.Load()) } +// nolint: funlen func (c *Context) checkStorageGroupPoR(sgID oid.ID, sg storagegroupSDK.StorageGroup) { members := sg.Members() c.updateSGInfo(sgID, members) diff --git a/pkg/services/object/acl/acl.go b/pkg/services/object/acl/acl.go index 6734f9f7..a068eadb 100644 --- a/pkg/services/object/acl/acl.go +++ b/pkg/services/object/acl/acl.go @@ -118,6 +118,8 @@ func (c *Checker) StickyBitCheck(info v2.RequestInfo, owner user.ID) bool { } // CheckEACL is a main check function for extended ACL. +// +// nolint: funlen func (c *Checker) CheckEACL(msg any, reqInfo v2.RequestInfo) error { basicACL := reqInfo.BasicACL() if !basicACL.Extendable() { diff --git a/pkg/services/object/acl/eacl/v2/headers.go b/pkg/services/object/acl/eacl/v2/headers.go index 31188fbf..63e733cf 100644 --- a/pkg/services/object/acl/eacl/v2/headers.go +++ b/pkg/services/object/acl/eacl/v2/headers.go @@ -101,6 +101,7 @@ func requestHeaders(msg xHeaderSource) []eaclSDK.Header { var errMissingOID = errors.New("object ID is missing") +// nolint: funlen func (h *cfg) readObjectHeaders(dst *headerSource) error { switch m := h.msg.(type) { default: diff --git a/pkg/services/object/acl/v2/service.go b/pkg/services/object/acl/v2/service.go index 6bae0d0c..6bf8c440 100644 --- a/pkg/services/object/acl/v2/service.go +++ b/pkg/services/object/acl/v2/service.go @@ -443,6 +443,7 @@ func (b Service) GetRangeHash( return b.next.GetRangeHash(ctx, request) } +// nolint: funlen func (p putStreamBasicChecker) Send(request *objectV2.PutRequest) error { body := request.GetBody() if body == nil { diff --git a/pkg/services/object/get/util.go b/pkg/services/object/get/util.go index dc98e6c5..d647b07f 100644 --- a/pkg/services/object/get/util.go +++ b/pkg/services/object/get/util.go @@ -87,6 +87,7 @@ func (c *clientCacheWrapper) get(info coreclient.NodeInfo) (getClient, error) { }, nil } +// nolint: funlen func (c *clientWrapper) getObject(exec *execCtx, info coreclient.NodeInfo) (*object.Object, error) { if exec.isForwardingEnabled() { return exec.prm.forwarder(info, c.client) diff --git a/pkg/services/object/get/v2/util.go b/pkg/services/object/get/v2/util.go index e0393e56..fb8e9970 100644 --- a/pkg/services/object/get/v2/util.go +++ b/pkg/services/object/get/v2/util.go @@ -33,6 +33,7 @@ import ( var errWrongMessageSeq = errors.New("incorrect message sequence") +// nolint: funlen func (s *Service) toPrm(req *objectV2.GetRequest, stream objectSvc.GetObjectStream) (*getsvc.Prm, error) { body := req.GetBody() @@ -199,6 +200,7 @@ func (s *Service) toPrm(req *objectV2.GetRequest, stream objectSvc.GetObjectStre return p, nil } +// nolint: funlen func (s *Service) toRangePrm(req *objectV2.GetRangeRequest, stream objectSvc.GetObjectRangeStream) (*getsvc.RangePrm, error) { body := req.GetBody() @@ -424,6 +426,7 @@ func (w *headResponseWriter) WriteHeader(_ context.Context, hdr *object.Object) return nil } +// nolint: funlen func (s *Service) toHeadPrm(ctx context.Context, req *objectV2.HeadRequest, resp *objectV2.HeadResponse) (*getsvc.HeadPrm, error) { body := req.GetBody() diff --git a/pkg/services/object/put/distributed.go b/pkg/services/object/put/distributed.go index 8d47e63b..47104b32 100644 --- a/pkg/services/object/put/distributed.go +++ b/pkg/services/object/put/distributed.go @@ -164,6 +164,7 @@ func (t *distributedTarget) sendObject(node nodeDesc) error { return nil } +// nolint: funlen func (t *distributedTarget) iteratePlacement(f func(nodeDesc) error) (*transformer.AccessIdentifiers, error) { id, _ := t.obj.ID() diff --git a/pkg/services/object/put/streamer.go b/pkg/services/object/put/streamer.go index 8ca90e86..915b718a 100644 --- a/pkg/services/object/put/streamer.go +++ b/pkg/services/object/put/streamer.go @@ -54,6 +54,7 @@ func (p *Streamer) MaxObjectSize() uint64 { return p.maxPayloadSz } +// nolint: funlen func (p *Streamer) initTarget(prm *PutInitPrm) error { // prevent re-calling if p.target != nil { diff --git a/pkg/services/object/search/v2/util.go b/pkg/services/object/search/v2/util.go index a2acb48f..c15217a1 100644 --- a/pkg/services/object/search/v2/util.go +++ b/pkg/services/object/search/v2/util.go @@ -22,6 +22,7 @@ import ( oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" ) +// nolint: funlen func (s *Service) toPrm(req *objectV2.SearchRequest, stream objectSvc.SearchStream) (*searchsvc.Prm, error) { body := req.GetBody() diff --git a/pkg/services/object/util/chain.go b/pkg/services/object/util/chain.go index 33bcd6c1..ded63731 100644 --- a/pkg/services/object/util/chain.go +++ b/pkg/services/object/util/chain.go @@ -72,6 +72,7 @@ func TraverseSplitChain(r HeadReceiver, addr oid.Address, h SplitMemberHandler) return err } +// nolint: funlen func traverseSplitChain(r HeadReceiver, addr oid.Address, h SplitMemberHandler) (bool, error) { v, err := r.Head(addr) if err != nil { diff --git a/pkg/services/policer/check.go b/pkg/services/policer/check.go index e240bbea..7b4bf826 100644 --- a/pkg/services/policer/check.go +++ b/pkg/services/policer/check.go @@ -147,6 +147,7 @@ type processPlacementContext struct { removeLocalCopy bool } +// nolint: funlen func (p *Policer) processNodes(ctx *processPlacementContext, addrWithType objectcore.AddressWithType, nodes []netmap.NodeInfo, shortage uint32, checkedNodes *nodeCache) { addr := addrWithType.Address diff --git a/pkg/services/reputation/eigentrust/calculator/calls.go b/pkg/services/reputation/eigentrust/calculator/calls.go index 09286d79..23e41872 100644 --- a/pkg/services/reputation/eigentrust/calculator/calls.go +++ b/pkg/services/reputation/eigentrust/calculator/calls.go @@ -104,6 +104,7 @@ type iterDaughterPrm struct { consumersIter TrustIterator } +// nolint: funlen func (c *Calculator) iterateDaughter(p iterDaughterPrm) { initTrust, err := c.prm.InitialTrustSource.InitialTrust(p.id) if err != nil { diff --git a/pkg/services/tree/sync.go b/pkg/services/tree/sync.go index a1bab61d..fa7cc69f 100644 --- a/pkg/services/tree/sync.go +++ b/pkg/services/tree/sync.go @@ -255,6 +255,7 @@ func (s *Service) SynchronizeAll() error { } } +// nolint: funlen func (s *Service) syncLoop(ctx context.Context) { for { select {