Showing 1,971 of 13,422 total issues
Method executionContext.field_Query_getDestinationBridgeTx_args
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (ec *executionContext) field_Query_getDestinationBridgeTx_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["chainID"]; ok {
Method executionContext.field_Query_dailyStatisticsByChain_args
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (ec *executionContext) field_Query_dailyStatisticsByChain_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["chainID"]; ok {
Method executionContext.field_Query_transactions_args
has 57 lines of code (exceeds 50 allowed). Consider refactoring. 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 APISuite.TestLeaderboard
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (g APISuite) TestLeaderboard() {
chainID := g.chainIDs[0]
address := common.BigToAddress(big.NewInt(gofakeit.Int64()))
var addressNS gosql.NullString
addressNS.String = address.String()
Function RegisterScribeServiceHandlerServer
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func RegisterScribeServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ScribeServiceServer) error {
mux.Handle("POST", pattern_ScribeService_Check_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
Method executionContext.field_Query_transactions_args
has 57 lines of code (exceeds 50 allowed). Consider refactoring. 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 {
Function Start
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func Start(ctx context.Context, cfg Config, handler metrics.Handler) error {
logger.Warnf("starting api server")
router := ginhelper.New(logger)
// wrap gin with metrics
router.GET(ginhelper.MetricsEndpoint, gin.WrapH(handler.Handler()))
Function createZeroAmountTests
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const createZeroAmountTests = (quote: FastBridgeQuote) => {
describe('Returns zero', () => {
it('If origin amount is zero', () => {
expect(applyQuote(quote, BigNumber.from(0))).toEqual(BigNumber.from(0))
})
Function TransactionSupport
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const TransactionSupport = () => {
return (
<div
id="transaction-support"
className="flex items-center justify-between w-full"
Method Guard.updateAgentStatus
has 13 return statements (exceeds 4 allowed). Open
Open
func (g Guard) updateAgentStatus(ctx context.Context, chainID uint32) error {
eligibleAgentTrees, err := g.guardDB.GetRelayableAgentStatuses(ctx, chainID)
if err != nil {
return fmt.Errorf("could not get update agent status parameters: %w", err)
}
Function NewGuard
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
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),
- 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 Notary.shouldNotaryRegisteredOnDestination
has 13 return statements (exceeds 4 allowed). Open
Open
func (n *Notary) shouldNotaryRegisteredOnDestination(parentCtx context.Context) (bool, bool) {
ctx, span := n.handler.Tracer().Start(parentCtx, "shouldNotaryRegisteredOnDestination", trace.WithAttributes(
attribute.Int(metrics.ChainID, int(n.destinationDomain.Config().DomainID)),
))
defer span.End()
Method QuoteRequestHandler.commitPendingBalance
has 13 return statements (exceeds 4 allowed). Open
Open
func (q *QuoteRequestHandler) commitPendingBalance(ctx context.Context, span trace.Span, request *reldb.QuoteRequest) (err error) {
// lock the consumed balance
key := getBalanceMtxKey(q.Dest.ChainID, request.Transaction.DestToken)
span.SetAttributes(attribute.String("balance_lock_key", key))
unlocker, ok := q.balanceMtx.TryLock(key)
Method parserImpl.ParseEvent
has 13 return statements (exceeds 4 allowed). Open
Open
func (p parserImpl) ParseEvent(log ethTypes.Log) (_ EventType, event interface{}, ok bool) {
// return an unknown event to avoid cases where user failed to check the event type
// make it high enough to make it obvious (we start iotas at +1, see uber style guide for details)
noOpEvent := EventType(len(topicMap()) + 2)
Method inventoryManagerImpl.ApproveAllTokens
has 13 return statements (exceeds 4 allowed). Open
Open
func (i *inventoryManagerImpl) ApproveAllTokens(ctx context.Context) (err error) {
ctx, span := i.handler.Tracer().Start(ctx, "approveAllTokens")
defer func() {
metrics.EndSpanWithErr(span, err)
}()
Method HarmonyProxy.getLogsHarmonyVerify
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
Open
func (r *HarmonyProxy) getLogsHarmonyVerify(parentCtx context.Context, query ethereum.FilterQuery, rawBody []byte) (rawResp []byte, err error) {
ctx, span := r.tracer.Start(parentCtx, "getLogsHarmonyVerify")
defer func() {
metrics.EndSpanWithErr(span, err)
- 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.handleBridgeRequestedLog
has 13 return statements (exceeds 4 allowed). Open
Open
func (r *Relayer) handleBridgeRequestedLog(parentCtx context.Context, req *fastbridge.FastBridgeBridgeRequested, chainID uint64) (err error) {
ctx, span := r.metrics.Tracer().Start(parentCtx, "handleBridgeRequestedLog", trace.WithAttributes(
attribute.String("transaction_id", hexutil.Encode(req.TransactionId[:])),
))
Method rebalanceManagerSynapseCCTP.listen
has 13 return statements (exceeds 4 allowed). Open
Open
func (c *rebalanceManagerSynapseCCTP) listen(parentCtx context.Context, chainID int) (err error) {
listener, ok := c.chainListeners[chainID]
if !ok {
return fmt.Errorf("could not find listener for chain %d", chainID)
}
Function EnableGraphql
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func EnableGraphql(engine *gin.Engine, consumerDB db.ConsumerDB, fetcher fetcher.ScribeFetcher, apiCache cache.Service, clients map[uint32]etherClient.EVM, parsers *types.ServerParsers, refs *types.ServerRefs, swapFilters map[string]*swap.SwapFlashLoanFilterer, config serverConfig.Config, handler metrics.Handler) {
Method queryResolver.GetMessageBusTxs
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (r *queryResolver) GetMessageBusTxs(ctx context.Context, chainID []*int, address *string, startTime *int, endTime *int, txHash *string, messageID *string, pending bool, reverted bool, page *int) ([]*model.MessageBusTransaction, error) {