Showing 1,971 of 13,422 total issues
Method ChainBackfiller.Backfill
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func (c *ChainBackfiller) Backfill(ctx context.Context, livefill bool, refreshRate int) (err error) {
chainCtx := context.WithValue(ctx, chainKey, fmt.Sprintf("%d", c.chainConfig.ChainID))
contractsGroup, contractCtx := errgroup.WithContext(chainCtx)
if !livefill {
- 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 queryResolver.MessageBusTransactions
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
func (r *queryResolver) MessageBusTransactions(ctx context.Context, chainID []*int, contractAddress *string, startTime *int, endTime *int, txnHash *string, messageID *string, pending *bool, reverted *bool, page *int) ([]*model.MessageBusTransaction, error) {
Method ChainBackfiller.backfillContractLogs
has 13 return statements (exceeds 4 allowed). Open
func (c *ChainBackfiller) backfillContractLogs(parentCtx context.Context, contract indexerconfig.ContractConfig) (err error) {
// make the event parser
eventParser, err := c.makeEventParser(contract)
if err != nil {
return err
Method executionContext.field_Query_logsRange_args
has 13 return statements (exceeds 4 allowed). Open
func (ec *executionContext) field_Query_logsRange_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["contract_address"]; ok {
Method MessageBusParser.Parse
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func (m *MessageBusParser) Parse(ctx context.Context, log ethTypes.Log, chainID uint32) (interface{}, error) {
logTopic := log.Topics[0]
iFace, err := func(log ethTypes.Log) (messageBusTypes.EventLog, error) {
switch logTopic {
case messagebus.Topic(messageBusTypes.ExecutedEvent):
- 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 synapseCCTPHandler.FetchAndProcessSentEvent
has 13 return statements (exceeds 4 allowed). Open
func (s *synapseCCTPHandler) FetchAndProcessSentEvent(parentCtx context.Context, txhash common.Hash, originChain uint32) (msg *relayTypes.Message, err error) {
ctx, span := s.handler.Tracer().Start(parentCtx, "FetchAndProcessSentEvent", trace.WithAttributes(
attribute.String(metrics.TxHash, txhash.String()),
attribute.Int(metrics.ChainID, int(originChain)),
))
Method queryResolver.TransactionsAtHeadRange
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
func (r *queryResolver) TransactionsAtHeadRange(ctx context.Context, txHash *string, chainID int, blockNumber *int, blockHash *string, confirmed *bool, startBlock int, endBlock int, lastIndexed int, page int) ([]*model.Transaction, error) {
Method executionContext.field_Query_logsRange_args
has 13 return statements (exceeds 4 allowed). Open
func (ec *executionContext) field_Query_logsRange_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["contract_address"]; ok {
Method queryResolver.Logs
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
func (r *queryResolver) Logs(ctx context.Context, contractAddress *string, chainID int, blockNumber *int, txHash *string, txIndex *int, blockHash *string, index *int, confirmed *bool, page int) ([]*model.Log, error) {
Function bridgeTxStatusController
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const bridgeTxStatusController = async (req, res) => {
const errors = validationResult(req)
if (!errors.isEmpty()) {
return res.status(400).json({ errors: errors.array() })
}
- 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
Function useMaintenanceData
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const useMaintenanceData = () => {
const { pausedChainsData, pausedModulesData } = useMaintenanceState()
const pausedChainsList: ChainPause[] = pausedChainsData
? pausedChainsData?.map((pause: ChainPause) => {
- 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
Function ChainPopoverSelect
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const ChainPopoverSelect = ({
options,
remaining,
targets,
onSelect,
- 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
Function getGasGtTestCases
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
func getGasGtTestCases() []*gtTestCase {
var legacyTxCases = []*gtTestCase{
{
tx: types.NewTx(&types.LegacyTx{
GasPrice: big.NewInt(500),
Method screenerImpl.authMiddleware
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s *screenerImpl) authMiddleware(cfg config.Config) gin.HandlerFunc {
return func(c *gin.Context) {
_, span := s.metrics.Tracer().Start(c.Request.Context(), "authMiddleware")
defer span.End()
Method PricerSuite.SetupTest
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (c *PricerSuite) SetupTest() {
c.TestSuite.SetupTest()
// Setup
c.origin = 42161
c.destination = 137
Method contractTypeImpl.ContractInfo
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (c contractTypeImpl) ContractInfo() *compiler.Contract {
switch c {
case OriginType:
return origin.Contracts["solidity/Origin.sol:Origin"]
case MessageHarnessType:
Method BackfillSuite.depositParity
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (b *BackfillSuite) depositParity(log *types.Log, parser *parser.BridgeParser, chainID uint32, useV1 bool) error {
// parse the log
if useV1 {
parsedLog, err := parser.FiltererV1.ParseTokenDeposit(*log)
_ = parsedLog
Function OpenGormClickhouse
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
func OpenGormClickhouse(ctx context.Context, address string, readOnly bool, handler metrics.Handler) (*Store, error) {
clickhouseDB, err := gorm.Open(gormClickhouse.New(gormClickhouse.Config{
DSN: address,
}), &gorm.Config{
Logger: gormLogger.Default.LogMode(gormLogger.Silent),
Method ChainIndexer.livefill
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (c *ChainIndexer) livefill(parentContext context.Context) error {
timeout := time.Duration(0)
b := createBackoff()
livefillBlockMeter, err := c.handler.Metrics().NewHistogram(fmt.Sprintf("scribe_block_meter_%d_livefill", c.chainConfig.ChainID), "block_histogram", "a block height meter", "blocks")
if err != nil {
Function useChainInputFilter
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useChainInputFilter = (
options: Chain[],
remaining: Chain[],
targets: Chain[],
isActive: boolean