synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Function useSwapChainListArray has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const useSwapChainListArray = (searchStr: string) => {
  const { swapFromChainIds } = useSwapState()

  let possibleChains = sortChains(
    _(ALL_CHAINS)

    Function getBumpTestCases has 69 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func getBumpTestCases() []*bumpTestCase {
        // this will serve as a fuzz test for legacy txes
        gofakeit.Seed(time.Now().UnixNano())
        testCfg := gas.GetConfig()
    
    
    Severity: Minor
    Found in ethergo/chain/gas/cmp_test.go - About 1 hr to fix

      Function createQuoteTests has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const createQuoteTests = (
        quoteTemplate: FastBridgeQuote,
        originDecimals: number,
        destDecimals: number
      ) => {
      Severity: Minor
      Found in packages/sdk-router/src/rfq/quote.test.ts - About 1 hr to fix

        Function extraReducers has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          extraReducers: (builder) => {
            builder
              .addCase(executeBridgeTxn.pending, (state) => {
                state.bridgeTxnStatus = BridgeTransactionStatus.PENDING
              })
        Severity: Minor
        Found in packages/widget/src/state/slices/bridgeTransaction/reducer.ts - About 1 hr to fix

          Function handleApproval has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const handleApproval = async (token, tokenAddr) => {
              if (
                inputValue[tokenAddr] &&
                (inputValue[tokenAddr] === 0n ||
                  inputValue[tokenAddr] <= depositQuote.allowances[tokenAddr])
          Severity: Minor
          Found in packages/synapse-interface/utils/actions/approveAndDeposit.tsx - About 1 hr to fix

            Function NewExecutor has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
            Open

            func NewExecutor(ctx context.Context, config executor.Config, executorDB db.ExecutorDB, scribeClient client.ScribeClient, omniRPCClient omnirpcClient.RPCClient, handler metrics.Handler) (*Executor, error) {
                chainExecutors := make(map[uint32]*chainExecutor)
            
                conn, grpcClient, err := makeScribeClient(ctx, handler, fmt.Sprintf("%s:%d", scribeClient.URL, scribeClient.Port))
                if err != nil {
            Severity: Minor
            Found in agents/agents/executor/executor.go - About 1 hr to fix

            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 HarmonyProxy.getHarmonyReceiptVerify has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
            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)
            Severity: Minor
            Found in services/omnirpc/modules/harmonyproxy/harmonyproxy.go - About 1 hr to fix

            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 executionContext.field_Query_bridgeTransactions_args has 19 return statements (exceeds 4 allowed).
            Open

            func (ec *executionContext) field_Query_bridgeTransactions_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["chainIDFrom"]; ok {
            Severity: Major
            Found in services/explorer/graphql/server/graph/resolver/server.go - About 1 hr to fix

              Method synapseCCTPHandler.FetchAndProcessSentEvent has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
              Open

              func (s *synapseCCTPHandler) FetchAndProcessSentEvent(parentCtx context.Context, txhash common.Hash, originChain uint32) (msg *relayTypes.Message, err error) {
                  ctx, span := s.handler.Tracer().Start(parentCtx, "FetchAndProcessSentEvent", trace.WithAttributes(
                      attribute.String(metrics.TxHash, txhash.String()),
                      attribute.Int(metrics.ChainID, int(originChain)),
                  ))
              Severity: Minor
              Found in services/cctp-relayer/relayer/synapse.go - About 1 hr to fix

              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 formatAmount has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

              export const formatAmount = (
                amount: string,
                options?: FormatOptions
              ): string => {
                if (amount === '') {
              Severity: Minor
              Found in packages/explorer-ui/utils/formatAmount.ts - About 1 hr to fix

              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 commify has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

              export const commify = (value: string | number): string => {
                const comps = String(value).split('.')
              
                if (
                  comps.length > 2 ||
              Severity: Minor
              Found in packages/synapse-interface/utils/bigint/format.ts - About 1 hr to fix

              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 formatAmount has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

              export const formatAmount = (
                amount: string,
                options?: FormatOptions
              ): string => {
                if (amount === '') return ''
              Severity: Minor
              Found in packages/synapse-interface/utils/formatAmount.ts - About 1 hr to fix

              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 useBridgeTxStatus has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

              export const useBridgeTxStatus = ({
                synapseSDK,
                originChainId,
                destinationChainId,
                originTxHash,
              Severity: Minor
              Found in packages/widget/src/hooks/useBridgeTxStatus.tsx - About 1 hr to fix

              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 TokenSelect has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

              export const TokenSelect = ({ label, isOrigin, token, onChange }: Props) => {
                const {
                  originChainId,
                  destinationChainId,
                  originTokens,
              Severity: Minor
              Found in packages/widget/src/components/ui/TokenSelect.tsx - About 1 hr to fix

              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 TestBaseMessageEncodeParity has 68 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func TestBaseMessageEncodeParity(t *testing.T) {
                  ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
                  defer cancel()
              
                  testBackend := simulated.NewSimulatedBackend(ctx, t)
              Severity: Minor
              Found in agents/types/parity_test.go - About 1 hr to fix

                Method Manager.generateQuotes has 68 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (m *Manager) generateQuotes(parentCtx context.Context, chainID int, address common.Address, balance *big.Int, inv map[int]map[common.Address]*big.Int) (quotes []model.PutRelayerQuoteRequest, err error) {
                    ctx, span := m.metricsHandler.Tracer().Start(parentCtx, "generateQuotes", trace.WithAttributes(
                        attribute.Int(metrics.Origin, chainID),
                        attribute.String("address", address.String()),
                        attribute.String("balance", balance.String()),
                Severity: Minor
                Found in services/rfq/relayer/quoter/quoter.go - About 1 hr to fix

                  Method queryResolver.AmountStatistic has 68 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (r *queryResolver) AmountStatistic(ctx context.Context, typeArg model.StatisticType, duration *model.Duration, platform *model.Platform, chainID *int, address *string, tokenAddress *string, useCache *bool, useMv *bool) (*model.ValueResult, error) {
                      if useCache != nil && *useCache {
                          res, err := r.getValueResultFromCache(fmt.Sprintf("amountStatistic, %s, %s, %s, %s, %s, %s", typeArg.String(), platform.String(), duration.String(), keyGenHandleNilInt(chainID), keyGenHandleNilString(address), keyGenHandleNilString(tokenAddress)))
                          if err == nil {
                              return res, nil
                  Severity: Minor
                  Found in services/explorer/graphql/server/graph/queries.resolvers.go - About 1 hr to fix

                    Function getBridgeRoutes has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      public async getBridgeRoutes(
                        originChainId: number,
                        destChainId: number,
                        tokenIn: string,
                        tokenOut: string,
                    Severity: Minor
                    Found in packages/sdk-router/src/rfq/fastBridgeRouterSet.ts - About 1 hr to fix

                      Function UseCasesSection has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export default function UseCasesSection() {
                        const t = useTranslations('Landing.UseCasesSection')
                      
                        const useCases: UseCaseProp[] = [
                          {

                        Function MultiChainGamingIcon has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function MultiChainGamingIcon() {
                          return (
                            <svg
                              width="335"
                              height="196"
                          Severity
                          Category
                          Status
                          Source
                          Language