synapsecns/sanguine

View on GitHub

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: {},
Severity: Major
Found in packages/synapse-interface/scripts/generateMaps.js - About 2 hrs to fix

    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'
    Severity: Minor
    Found in packages/widget/src/utils/routeMaker/getToChainIds.ts - About 2 hrs to fix

      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
      Severity: Major
      Found in agents/agents/guard/fraud_test.go - About 2 hrs to fix

        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() })
          }
        Severity: Minor
        Found in packages/rest-api/src/controllers/bridgeLimitsController.ts - About 2 hrs 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 useValidations has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        export const useValidations = (): {
          hasValidSelections: boolean
          hasEnoughBalance: boolean
          isInputValid: boolean
          isApproved: boolean
        Severity: Minor
        Found in packages/widget/src/hooks/useValidations.tsx - About 2 hrs 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 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 } =

        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()
        Severity: Major
        Found in services/scribe/grpc/types/types/v1/service.pb.gw.go - About 2 hrs to fix

          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
          Severity: Major
          Found in core/processlog/options_test.go - About 2 hrs to fix

            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 } = {}
            Severity: Major
            Found in packages/rfq-indexer/api/src/utils/nestResults.ts - About 2 hrs to fix

              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 } = {}
              Severity: Major
              Found in packages/rfq-indexer/api/src/graphql/resolvers.ts - About 2 hrs to fix

                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'
                Severity: Minor
                Found in packages/synapse-interface/utils/actions/approveAndDeposit.tsx - About 2 hrs to fix

                  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
                      }
                  
                  
                  Severity: Major
                  Found in agents/agents/notary/notary.go - About 2 hrs to fix

                    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()
                    Severity: Major
                    Found in services/scribe/api/resolver_test.go - About 2 hrs to fix

                      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)),
                              }
                      Severity: Major
                      Found in core/metrics/localmetrics/pyroscope.go - About 2 hrs to fix

                        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)
                        Severity: Major
                        Found in packages/synapse-interface/components/Warning.tsx - About 2 hrs to fix

                          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()
                          Severity: Minor
                          Found in ethergo/backends/simulated/multibackend/simulated_gen_test.go - About 2 hrs to fix

                            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)
                            Severity: Major
                            Found in services/omnirpc/modules/harmonyproxy/harmonyproxy.go - About 2 hrs to fix

                              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 {
                              Severity: Minor
                              Found in services/explorer/graphql/server/graph/resolver/server.go - About 2 hrs to fix

                                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)
                                Severity: Minor
                                Found in services/explorer/graphql/server/graph/resolver/server.go - About 2 hrs to fix

                                  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 {
                                  Severity: Minor
                                  Found in services/explorer/consumer/client/resolver-client/server.go - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language