Showing 1,971 of 13,422 total issues
Method Indexer.store
has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring. Open
func (x *Indexer) store(parentCtx context.Context, log types.Log) (err error) {
ctx, span := x.handler.Tracer().Start(parentCtx, "store", trace.WithAttributes(
attribute.String("contract", x.addressesToString(x.indexerConfig.Addresses)),
attribute.String("tx", log.TxHash.Hex()),
attribute.String("block", fmt.Sprintf("%d", log.BlockNumber)),
- 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 nest_results
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
const nest_results = (sqlResults: any[]) => {
return sqlResults.map((transaction: any) => {
const bridgeRequest: { [key: string]: any } = {}
const bridgeRelay: { [key: string]: any } = {}
const bridgeProof: { [key: string]: any } = {}
- 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 nest_results
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
export const nest_results = (sqlResults: any[]) => {
return sqlResults.map((transaction: any) => {
const bridgeRequest: { [key: string]: any } = {}
const bridgeRelay: { [key: string]: any } = {}
const bridgeProof: { [key: string]: any } = {}
- 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 useGasEstimator
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useGasEstimator = () => {
const dispatch = useAppDispatch()
const { address } = useAccount()
const { synapseSDK } = useSynapseContext()
const { balances } = usePortfolioState()
Function LandingNav
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const LandingNav = () => {
const topBarBtns = <TopBarButtons />
const mobileBarBtns = <MobileBarButtons />
const moreInfoBtns = <MoreInfoButtons />
const socialBtns = <SocialButtons />
Method Bot.rfqRefund
has 123 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (b *Bot) rfqRefund() *slacker.CommandDefinition {
return &slacker.CommandDefinition{
Command: "refund <tx>",
Description: "refund a quote request",
Examples: []string{"refund 0x1234"},
File index.tsx
has 330 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Fragment } from 'react'
import { useRouter } from 'next/router'
import { Popover, Transition } from '@headlessui/react'
import { MenuIcon, XIcon } from '@heroicons/react/outline'
import { useTranslations } from 'next-intl'
Method ExecutorSuite.TestSetMinimumTime
has 121 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (e *ExecutorSuite) TestSetMinimumTime() {
// TODO (joe and lex): FIX ME
// e.T().Skip()
testDone := false
defer func() {
BackfillSuite
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
func (b *BackfillSuite) TestBackfill() {
testChainID := b.testBackend.GetBigChainID()
bridgeContract, bridgeRef := b.testDeployManager.GetTestSynapseBridge(b.GetTestContext(), b.testBackend)
bridgeV1Contract, bridgeV1Ref := b.testDeployManager.GetTestSynapseBridgeV1(b.GetTestContext(), b.testBackend)
Function executeSwap
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
const executeSwap = async () => {
const currentChainName = CHAINS_BY_ID[swapChainId]?.name
dispatch(setIsWalletPending(true))
File avSwapWrapper.ts
has 323 lines of code (exceeds 250 allowed). Consider refactoring. Open
export const AV_SWAP_WRAPPER_ABI = [
{
inputs: [
{
internalType: 'contract Swap',
Method executionContext._Query
has 43 return statements (exceeds 4 allowed). Open
func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler {
fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors)
ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{
Object: "Query",
})
Function generateTheme
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
export function generateTheme(theme: CustomThemeVariables = {}) {
function str2hsl(color: string) {
// TODO: Support hex short codes
if (/^#?[\da-fA-F]{6,8}$/.test(color)) {
let [r, g, b, a] = color
- 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 BridgeParser.ParseLog
has 118 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (p *BridgeParser) ParseLog(log ethTypes.Log, chainID uint32) (*model.BridgeEvent, bridgeTypes.EventLog, error) {
logTopic := log.Topics[0]
iFace, err := func(log ethTypes.Log) (bridgeTypes.EventLog, error) {
switch logTopic {
Function useBridgeSelectionData
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useBridgeSelectionData = (): BridgeSelections => {
const [originChain, setOriginChain] = useState('')
const [originToken, setOriginToken] = useState('')
const [destinationChain, setDestinationChain] = useState('')
const [destinationToken, setDestinationToken] = useState('')
File index.tsx
has 319 lines of code (exceeds 250 allowed). Consider refactoring. Open
import _ from 'lodash'
import { useRef, useState, useEffect } from 'react'
import { SynapseLogoSvg } from '@components/layouts/MainLayout/SynapseLogoSvg'
import { formatUSD } from '@utils/formatUSD'
import {
Method DBSuite.TestStoreRetrieveState
has 116 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (t *DBSuite) TestStoreRetrieveState() {
t.RunOnAllDBs(func(testDB db.ExecutorDB) {
rootA := common.BigToHash(big.NewInt(gofakeit.Int64()))
originA := gofakeit.Uint32()
nonceA := gofakeit.Uint32()
Function bridgeLimitsController
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const bridgeLimitsController = async (req, res) => {
const errors = validationResult(req)
if (!errors.isEmpty()) {
return res.status(400).json({ errors: errors.array() })
}
File manager.go
has 567 lines of code (exceeds 500 allowed). Consider refactoring. Open
package inventory
import (
"context"
"errors"
Function getAndSetSwapQuote
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getAndSetSwapQuote = async () => {
currentSDKRequestID.current += 1
const thisRequestId = currentSDKRequestID.current
try {
dispatch(setIsLoading(true))