Showing 1,971 of 13,422 total issues
Function WaitForConfirmation
has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring. Open
Open
func WaitForConfirmation(ctx context.Context, client ConfirmationClient, transaction *types.Transaction, timeout time.Duration) {
// if tx is nil , we should panic here so we can see the call context
_ = transaction.Hash()
const debugTimeout = time.Second * 5
- 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 SwapParser.Parse
has 41 return statements (exceeds 4 allowed). Open
Open
func (p *SwapParser) Parse(ctx context.Context, log ethTypes.Log, chainID uint32) (interface{}, error) {
logTopic := log.Topics[0]
iFace, err := func(log ethTypes.Log) (swapTypes.EventLog, error) {
// nolint:nestif
Function DumpWithOptions
has 114 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func DumpWithOptions(showReq bool, showResp bool, showBody bool, showHeaders bool, showCookies bool, cb func(dumpStr string)) gin.HandlerFunc {
headerHiddenFields := make([]string, 0)
bodyHiddenFields := make([]string, 0)
if !showCookies {
Method ScribeSuite.TestChainIndexerLivefill
has 114 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (s *ScribeSuite) TestChainIndexerLivefill() {
if os.Getenv("CI") != "" || !s.runVolumeTest {
s.T().Skip("This is a long running test")
}
const numberOfContracts = 5
Method APISuite.TestGetBridgeTransactions
has 113 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (g APISuite) TestGetBridgeTransactions() {
chainID := g.chainIDs[0]
destinationChainID := g.chainIDs[1]
contractAddr := common.BigToAddress(big.NewInt(gofakeit.Int64())).String()
tokenAddress := common.BigToAddress(big.NewInt(gofakeit.Int64())).String()
Function StakePage
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const StakePage = () => {
const { chain: connectedChain } = useAccount()
const { address: currentAddress } = useAccount()
const [address, setAddress] = useState(undefined)
const [isClient, setIsClient] = useState<boolean>(false)
Function NewAnvilBackend
has 112 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func NewAnvilBackend(ctx context.Context, t *testing.T, args *OptionBuilder) (*Backend, error) {
t.Helper()
pool, err := dockertest.NewPool("")
if err != nil {
Function useBridgeValidations
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useBridgeValidations = () => {
const { chainId } = useAccount()
const {
fromChainId,
toChainId,
Method executionContext.field_Query_logsRange_args
has 111 lines of code (exceeds 50 allowed). Consider refactoring. Open
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 executionContext.field_Query_logsRange_args
has 111 lines of code (exceeds 50 allowed). Consider refactoring. Open
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 {
Function GetPartialInfoFromBridgeEventHybrid
has 110 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func GetPartialInfoFromBridgeEventHybrid(bridgeEvent sql.HybridBridgeEvent, includePending *bool) (*model.BridgeTransaction, error) {
if includePending != nil && *includePending && bridgeEvent.TTxHash != "" {
// nolint:nilnil
return nil, nil
}
Function useFromTokenListArray
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useFromTokenListArray = (searchStr: string = '') => {
const { fromTokens, fromChainId } = useBridgeState()
const portfolioBalances = usePortfolioBalances()
const t = useTranslations('Bridge')
Function setDestinationChainId
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setDestinationChainId: (
state: BridgeState,
action: PayloadAction<number>
) => {
const incomingToChainId = action.payload
Function setOriginChainId
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setOriginChainId: (state: BridgeState, action: PayloadAction<number>) => {
const incomingFromChainId = action.payload
const validFromTokens = getFromTokens({
fromChainId: incomingFromChainId ?? null,
Function CrossChainExchangeIcon
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function CrossChainExchangeIcon() {
return (
<svg
width="335"
height="196"
Function useConfirmNewBridgePrice
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useConfirmNewBridgePrice = () => {
const triggerQuoteRef = useRef<BridgeQuote | null>(null)
const bpsThreshold = 0.0001 // 1bps
const [hasQuoteOutputChanged, setHasQuoteOutputChanged] =
Function Home
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function Home() {
const [config, setConfig] = useState<ConsumerExampleConfig>(initialConfig)
const [container, setContainer] = useState(false)
const { web3Provider } = useEthereumWallet()
File typecast.go
has 555 lines of code (exceeds 500 allowed). Consider refactoring. Open
Open
package testutil
import (
"context"
"fmt"
Function useMaintenance
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useMaintenance = () => {
const { pausedChainsList, pausedModulesList } = useMaintenanceData()
const { fromChainId: bridgeFromChainId, toChainId: bridgeToChainId } =
useBridgeState()
const { swapChainId } = useSwapState()
Function bridgeController
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const bridgeController = async (req, res) => {
const errors = validationResult(req)
if (!errors.isEmpty()) {
return res.status(400).json({ errors: errors.array() })
}