Showing 1,971 of 13,422 total issues
Method queryResolver.getAmountStatisticsAll
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (r *queryResolver) getAmountStatisticsAll(ctx context.Context, typeArg model.StatisticType, chainID *int, address *string, tokenAddress *string, compositeFilters string) (*string, error) {
Method Client.GetCountByChainID
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (c *Client) GetCountByChainID(ctx context.Context, chainID *int, address *string, direction *model.Direction, hours *int, httpRequestOptions ...client.HTTPRequestOption) (*GetCountByChainID, error) {
Avoid deeply nested control flow statements. Open
Open
if err != nil {
timeout = b.Duration()
logger.Warnf("could not process logs for chain %d: %s", c.chainConfig.ChainID, err)
continue
}
Avoid deeply nested control flow statements. Open
Open
if len(parsedLogs) > 0 {
g.Go(func() error {
return c.storeParsedLogs(groupCtx, parsedLogs)
})
}
Method executionContext.field_Query_transactions_args
has 7 return statements (exceeds 4 allowed). Open
Open
func (ec *executionContext) field_Query_transactions_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
var arg0 *string
if tmp, ok := rawArgs["tx_hash"]; ok {
Method Client.GetLeaderboard
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (c *Client) GetLeaderboard(ctx context.Context, duration *model.Duration, chainID *int, useMv *bool, page *int, httpRequestOptions ...client.HTTPRequestOption) (*GetLeaderboard, error) {
Method synapseCCTPHandler.HandleLog
has 7 return statements (exceeds 4 allowed). Open
Open
func (s *synapseCCTPHandler) HandleLog(ctx context.Context, log *types.Log, chainID uint32) (processQueue bool, err error) {
if log == nil {
return false, fmt.Errorf("log is nil")
}
Method CircleAPI.GetAttestation
has 7 return statements (exceeds 4 allowed). Open
Open
func (c CircleAPI) GetAttestation(ctx context.Context, txHash string) (attestation []byte, err error) {
url := fmt.Sprintf("%s/%s", c.baseURL, txHash)
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if err != nil {
err = fmt.Errorf("could not create request: %w", err)
Method Store.StoreSwapFee
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (s *Store) StoreSwapFee(ctx context.Context, chainID uint32, blockNumber uint64, contractAddress string, fee uint64, feeType string) error {
Function NewExplorerBackfiller
has 7 return statements (exceeds 4 allowed). Open
Open
func NewExplorerBackfiller(consumerDB db.ConsumerDB, config indexerConfig.Config, clients map[uint32]bind.ContractBackend, handler metrics.Handler) (*ExplorerBackfiller, error) {
chainBackfillers := make(map[uint32]*backfill.ChainBackfiller)
httpClient := http.Client{
Timeout: 10 * time.Second,
Transport: &http.Transport{
Function NewCCTPRelayer
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
Open
func NewCCTPRelayer(ctx context.Context, cfg config.Config, store db2.CCTPRelayerDB, omniRPCClient omniClient.RPCClient, handler metrics.Handler, attestationAPI attestation.CCTPAPI, rawOpts ...OptionsArgsOption) (*CCTPRelayer, error) {
opts := makeOptions(rawOpts)
omniClient := omniClient.NewOmnirpcClient(cfg.BaseOmnirpcURL, handler, omniClient.WithCaptureReqRes())
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method circleCCTPHandler.HandleLog
has 7 return statements (exceeds 4 allowed). Open
Open
func (c *circleCCTPHandler) HandleLog(ctx context.Context, log *types.Log, chainID uint32) (processQueue bool, err error) {
if log == nil {
return false, fmt.Errorf("log is nil")
}
Method circleCCTPHandler.getMessagePayload
has 7 return statements (exceeds 4 allowed). Open
Open
func (c *circleCCTPHandler) getMessagePayload(ctx context.Context, txHash common.Hash, chainID uint32, ethClient client.EVM) (message []byte, err error) {
chainCfg, err := c.cfg.GetChainConfig(chainID)
if err != nil {
return nil, fmt.Errorf("could not get chain config: %w", err)
}
Method synapseCCTPHandler.handleCircleRequestFulfilled
has 7 return statements (exceeds 4 allowed). Open
Open
func (s *synapseCCTPHandler) handleCircleRequestFulfilled(parentCtx context.Context, log *types.Log, destChain uint32) (err error) {
ctx, span := s.handler.Tracer().Start(parentCtx, "handleCircleRequestFulfilled", trace.WithAttributes(
attribute.String(metrics.TxHash, log.TxHash.String()),
attribute.Int(metrics.Destination, int(destChain)),
))
Method circleCCTPHandler.handleMessageReceived
has 7 return statements (exceeds 4 allowed). Open
Open
func (c *circleCCTPHandler) handleMessageReceived(parentCtx context.Context, log *types.Log, chainID uint32) (err error) {
ctx, span := c.handler.Tracer().Start(parentCtx, "handleMessageReceived", trace.WithAttributes(
attribute.String(metrics.TxHash, log.TxHash.Hex()),
attribute.Int(metrics.ChainID, int(chainID)),
attribute.Int("block_number", int(log.BlockNumber)),
Function getChainBackfiller
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func getChainBackfiller(consumerDB db.ConsumerDB, chainConfig indexerConfig.ChainConfig, fetcher fetcherpkg.ScribeFetcher, client bind.ContractBackend, tokenDataService tokendata.Service, priceDataService tokenprice.Service) (*backfill.ChainBackfiller, error) {
Method circleCCTPHandler.FetchAndProcessSentEvent
has 7 return statements (exceeds 4 allowed). Open
Open
func (c *circleCCTPHandler) FetchAndProcessSentEvent(parentCtx context.Context, txHash common.Hash, chainID uint32) (msg *relayTypes.Message, err error) {
ctx, span := c.handler.Tracer().Start(parentCtx, "FetchAndProcessSentEvent", trace.WithAttributes(
attribute.String(metrics.TxHash, txHash.String()),
attribute.Int(metrics.ChainID, int(chainID)),
))
Function NewSynapseCCTPHandler
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func NewSynapseCCTPHandler(ctx context.Context, cfg config.Config, db db2.CCTPRelayerDB, omniRPCClient omniClient.RPCClient, txSubmitter submitter.TransactionSubmitter, handler metrics.Handler) (_ CCTPHandler, err error) {
Function NewCircleCCTPHandler
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func NewCircleCCTPHandler(ctx context.Context, cfg config.Config, db db2.CCTPRelayerDB, omniRPCClient omniClient.RPCClient, txSubmitter submitter.TransactionSubmitter, handler metrics.Handler) (CCTPHandler, error) {
Function NewBridgeParser
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func NewBridgeParser(consumerDB db.ConsumerDB, bridgeAddress common.Address, tokenDataService tokendata.Service, consumerFetcher fetcher.ScribeFetcher, tokenPriceService tokenprice.Service, fromAPI bool) (*BridgeParser, error) {