Showing 1,971 of 13,422 total issues
Method executionContext.field_Query_receipts_args
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (ec *executionContext) field_Query_receipts_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
var arg0 int
if tmp, ok := rawArgs["chain_id"]; ok {
Method executionContext.field_Query_receipts_args
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (ec *executionContext) field_Query_receipts_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
var arg0 int
if tmp, ok := rawArgs["chain_id"]; ok {
Method executionContext.field_Query_transactionsRange_args
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (ec *executionContext) field_Query_transactionsRange_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 {
Function IntegrationSection
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function IntegrationSection() {
const OrderedSupportedNetworks: Chain[] = ORDERED_CHAINS_BY_ID.filter(
(chainId) => Number(chainId) !== ChainId.TERRA
).map((chainId) => {
return CHAINS_BY_ID[chainId]
Method SimulatedBackendsTestSuite.SetupBackends
has 74 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (a *SimulatedBackendsTestSuite) SetupBackends() {
useAnvil := a.shouldUseAnvil()
a.TestDeployManager = NewDeployManager(a.T())
var wg sync.WaitGroup
Method BackfillSuite.mintAndSwapParity
has 74 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (b *BackfillSuite) mintAndSwapParity(log *types.Log, parser *parser.BridgeParser, chainID uint32, useV1 bool) error {
// parse the log
if useV1 {
parsedLog, err := parser.Filterer.ParseTokenMintAndSwap(*log)
if err != nil {
Function Start
has 74 lines of code (exceeds 50 allowed). Consider refactoring. Open
func Start(ctx context.Context, cfg serverConfig.Config, handler metrics.Handler) error {
router := ginhelper.New(logger)
router.GET(ginhelper.MetricsEndpoint, gin.WrapH(handler.Handler()))
// initialize the database
Function getBridgeRoutes
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async getBridgeRoutes(
originChainId: number,
destChainId: number,
tokenIn: string,
tokenOut: string,
Method DBSuite.TestGetSnapshotRootsInNonceRange
has 73 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (t *DBSuite) TestGetSnapshotRootsInNonceRange() {
t.RunOnAllDBs(func(testDB db.ExecutorDB) {
origin := gofakeit.Uint32()
nonceA := uint32(5)
nonceB := uint32(10)
Function NewGuard
has 73 lines of code (exceeds 50 allowed). Consider refactoring. Open
func NewGuard(ctx context.Context, cfg config.AgentConfig, omniRPCClient omnirpcClient.RPCClient, scribeClient client.ScribeClient, guardDB db.GuardDB, handler metrics.Handler) (guard *Guard, err error) {
guard = &Guard{
refreshInterval: time.Second * time.Duration(cfg.RefreshIntervalSeconds),
domains: make(map[uint32]domains.DomainClient),
logChans: make(map[uint32]chan *ethTypes.Log),
Method ExecutorSuite.TestVerifyMessageMerkleProof
has 73 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (e *ExecutorSuite) TestVerifyMessageMerkleProof() {
// TODO (joe and lex): FIX ME
// e.T().Skip()
chainID := uint32(e.TestBackendOrigin.GetChainID())
destination := uint32(e.TestBackendDestination.GetChainID())
Method inventoryManagerImpl.initializeTokens
has 73 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (i *inventoryManagerImpl) initializeTokens(parentCtx context.Context, cfg relconfig.Config) (err error) {
i.mux.Lock()
defer i.mux.Unlock()
ctx, span := i.handler.Tracer().Start(parentCtx, "initializeTokens", trace.WithAttributes(
Function getRebalanceAmount
has 73 lines of code (exceeds 50 allowed). Consider refactoring. Open
func getRebalanceAmount(ctx context.Context, cfg relconfig.Config, tokens map[int]map[common.Address]*TokenMetadata, rebalance *RebalanceData) (amount *big.Int, err error) {
span := trace.SpanFromContext(ctx)
// get the maintenance and initial values for the destination chain
maintenancePctDest, err := cfg.GetMaintenanceBalancePct(rebalance.DestMetadata.ChainID, rebalance.DestMetadata.Addr.Hex())
Method executionContext.fieldContext_Query_dailyStatisticsByChain
has 73 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (ec *executionContext) fieldContext_Query_dailyStatisticsByChain(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Query",
Field: field,
IsMethod: true,
Function NewCCTPRelayer
has 73 lines of code (exceeds 50 allowed). Consider refactoring. 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())
Function TestValidateOptions
has 73 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestValidateOptions(t *testing.T) {
ctx := context.Background()
resource := &dockertest.Resource{
Container: &docker.Container{
ID: "test-container-id",
Function swapController
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const swapController = async (req, res) => {
const errors = validationResult(req)
if (!errors.isEmpty()) {
return res.status(400).json({ errors: errors.array() })
}
Method WatcherSuite.TestListeners
has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring. Open
func (s *WatcherSuite) TestListeners() {
// timeout the test after thie period
ctx, cancel := context.WithTimeout(s.GetTestContext(), 30*time.Second)
defer cancel()
- 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 GuardSuite.TestUpdateAgentStatusOnRemote
has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring. Open
func (g *GuardSuite) TestUpdateAgentStatusOnRemote() {
// This test requires a call to anvil's evm.IncreaseTime() cheat code, so we should
// set up the backends with anvil.
testDone := false
- 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 Relayer.runChainIndexer
has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring. Open
func (r *Relayer) runChainIndexer(ctx context.Context, chainID int) (err error) {
chainListener := r.chainListeners[chainID]
parser, err := fastbridge.NewParser(chainListener.Address())
if err != nil {
- 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"