Skip to content

lint(network): split gocognit fixes out of #2327 - #2604

Open
EaswarKilari wants to merge 1 commit into
LFDT-Panurus:mainfrom
EaswarKilari:2385-gocognit-network
Open

EaswarKilari wants to merge 1 commit into
LFDT-Panurus:mainfrom
EaswarKilari:2385-gocognit-network

Conversation

@EaswarKilari

Copy link
Copy Markdown

Fixes #2385

Part of the gocognit cleanup in #2377, same approach as #2529.

Seven functions in the files listed on #2385 were over the complexity limit of 15. I split them into smaller helpers without changing behaviour. The checks, their order, the ledger writes and the error messages are the same as before.

  1. common/rws/translator/translator.go
    1. Translator.commitTransferAction (31) -> storeOutput, storeActionMetadata
    2. Translator.spendInputs (27) -> spendInput, writeSerialNumbers
    3. Translator.commitIssueAction (22) -> storeOutput, storeActionMetadata
  2. fabric/lookup/deliveryqs.go
    1. DeliveryScanQueryByID.queryByID (42) -> groupKeysByNamespace, queryNamespace, scanForKeys, collectKeysFromTx
  3. fabric/tcc/tcc.go
    1. TokenChaincode.Invoke (27) -> dispatch, invokeTokenRequest, logInvokeResult
  4. fabric/tcc/main/main.go
    1. main (21) -> loadServerConfig, newTokenChaincode, loadTLSProperties
  5. fabric/endorsement/fsc/service_test.go
    1. TestNewEndorsementService (24) -> endorsersStub

Tested with:

  1. go test and go test -race on ./token/services/network/...
  2. golangci-lint with gocognit enabled on the touched packages
  3. the tcc fuzz targets

Integration tests were not run locally.

Fixes LFDT-Panurus#2385

Signed-off-by: Easwar Kilari <81870353+EaswarKilari@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gocognit split: token/services/network

1 participant