Showing 1,971 of 13,422 total issues
Function getBridgeOriginMap
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getBridgeOriginMap = async (chainId) => {
const swapQuoter = await getSwapQuoter(chainId)
if (!swapQuoter) {
return {
originMap: {},
File getToChainIds.ts
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
import _ from 'lodash'
import { EXISTING_BRIDGE_ROUTES } from '@/constants/existingBridgeRoutes'
import { RouteQueryFields } from './generateRoutePossibilities'
import { getTokenAndChainId } from './getTokenAndChainId'
Method GuardSuite.TestUpdateAgentStatusOnRemote
has 23 return statements (exceeds 4 allowed). 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
Function bridgeLimitsController
has a Cognitive Complexity of 16 (exceeds 5 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() })
}
- 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 useValidations
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export const useValidations = (): {
hasValidSelections: boolean
hasEnoughBalance: boolean
isInputValid: boolean
isApproved: boolean
- 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 SwapInputContainer
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export const SwapInputContainer: React.FC<InputContainerProps> = ({
setIsTyping,
}) => {
const inputRef = useRef<HTMLInputElement>(null)
const { swapChainId, swapFromToken, swapToToken, swapFromValue } =
- 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 RegisterScribeServiceHandlerClient
has 77 lines of code (exceeds 50 allowed). Consider refactoring. Open
func RegisterScribeServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ScribeServiceClient) 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()
Function TestMakeArgs
has 77 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestMakeArgs(t *testing.T) {
pr, _ := io.Pipe()
tests := []struct {
name string
Function nest_results
has 52 lines of code (exceeds 25 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 } = {}
Function nest_results
has 52 lines of code (exceeds 25 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 } = {}
File approveAndDeposit.tsx
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
import _ from 'lodash'
import { zeroAddress } from 'viem'
import toast from 'react-hot-toast'
import { subtractSlippageBigInt } from '@utils/slippage'
Method Notary.isValidOnOrigin
has 76 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (n *Notary) isValidOnOrigin(parentCtx context.Context, state types.State, domain domains.DomainClient) bool {
if state == nil {
return false
}
Method APISuite.TestLogResolvers
has 76 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (g APISuite) TestLogResolvers() {
chainID := uint32(1)
blockNumber := uint64(16131419)
// store a transaction
tx := g.buildEthTx()
Method testJaeger.StartPyroscopeServer
has 76 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (j *testJaeger) StartPyroscopeServer(ctx context.Context) *uiResource {
if !j.cfg.enablePyroscope {
return &uiResource{
uiURL: core.GetEnv(internal.PyroscopeEndpoint, fmt.Sprintf("%s not found", internal.PyroscopeEndpoint)),
}
Function Warning
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Warning = () => {
const { fromChainId, toChainId } = useBridgeState()
const isChainHarmony = [fromChainId, toChainId].includes(HARMONY.id)
const isChainFantom = [fromChainId, toChainId].includes(FANTOM.id)
Function TestCallContractRevert
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestCallContractRevert(t *testing.T) {
t.Parallel()
testAddr := crypto.PubkeyToAddress(testKey.PublicKey)
sim := simTestBackend(testAddr)
defer sim.Close()
Method HarmonyProxy.getHarmonyReceiptVerify
has 22 return statements (exceeds 4 allowed). Open
func (r *HarmonyProxy) getHarmonyReceiptVerify(parentCtx context.Context, txHash common.Hash, rawBody []byte, checkVersion bool) (_ []byte, err error) {
ctx, span := r.tracer.Start(parentCtx, "getHarmonyReceiptVerify")
defer func() {
metrics.EndSpanWithErr(span, err)
Method executionContext.field_Query_amountStatistic_args
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (ec *executionContext) field_Query_amountStatistic_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
var arg0 model.StatisticType
if tmp, ok := rawArgs["type"]; ok {
Method executionContext._DateResultByChain
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (ec *executionContext) _DateResultByChain(ctx context.Context, sel ast.SelectionSet, obj *model.DateResultByChain) graphql.Marshaler {
fields := graphql.CollectFields(ec.OperationContext, sel, dateResultByChainImplementors)
out := graphql.NewFieldSet(fields)
deferred := make(map[string]*graphql.FieldSet)
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 {