synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Function GetDeployments has 61 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func GetDeployments(deploymentDir string) (contracts []Contract, err error) {
    var files []os.DirEntry

    files, err = os.ReadDir(deploymentDir)
    if err != nil {
Severity: Minor
Found in ethergo/parser/hardhat/parser.go - About 1 hr to fix

    Method chainListener.doPoll has 61 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (c *chainListener) doPoll(parentCtx context.Context, handler HandleLog) (err error) {
        ctx, span := c.handler.Tracer().Start(parentCtx, "doPoll", trace.WithAttributes(attribute.Int(metrics.ChainID, int(c.chainID))))
        c.pollInterval = c.pollIntervalSetting
    
        // Note: in the case of an error, you don't have to handle the poll interval by calling b.duration.
    Severity: Minor
    Found in ethergo/listener/listener.go - About 1 hr to fix

      Method Oracle.SuggestPrice has 61 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) {
          head, _ := gpo.backend.HeaderByNumber(ctx, rpc.LatestBlockNumber)
          headHash := head.Hash()
      
          // If the latest gasprice is still available, return it.
      Severity: Minor
      Found in ethergo/chain/gas/londinium/gasprice.go - About 1 hr to fix

        Function TestPendingAndCallContract has 61 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func TestPendingAndCallContract(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 1 hr to fix

          Method DBSuite.TestGetRelayableAgentStatuses has 61 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (t *DBSuite) TestGetRelayableAgentStatuses() {
              // Test by setting up multiple addresses and agent roots in the database. Then, once each agent tree is stored with
              // the agent root and address, get the agent trees that match up with a specific chain ID.
              t.RunOnAllDBs(func(testDB db.GuardDB) {
                  addressA := common.BigToAddress(big.NewInt(gofakeit.Int64()))
          Severity: Minor
          Found in agents/agents/guard/db/crosstable_test.go - About 1 hr to fix

            Method circleCCTPHandler.handleDepositForBurn has 61 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (c *circleCCTPHandler) handleDepositForBurn(parentCtx context.Context, log *types.Log, chainID uint32) (msg *relayTypes.Message, err error) {
                ctx, span := c.handler.Tracer().Start(parentCtx, "handleDepositForBurn", trace.WithAttributes(
                    attribute.String(metrics.TxHash, log.TxHash.Hex()),
                    attribute.Int(metrics.ChainID, int(chainID)),
                    attribute.Int("block_number", int(log.BlockNumber)),
            Severity: Minor
            Found in services/cctp-relayer/relayer/circle.go - About 1 hr to fix

              Function conflictingProofsController has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const conflictingProofsController = async (
                req: Request,
                res: Response
              ) => {
                try {

                Function createSlippageTests has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const createSlippageTests = (
                  moduleSet: SynapseModuleSet,
                  originQuery: Query,
                  destQuery: Query,
                  expectedOriginMinAmountOut: BigNumber,
                Severity: Minor
                Found in packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts - About 1 hr to fix

                  Function PageFooter has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function PageFooter() {
                    const t = useTranslations('Nav')
                    return (
                      <footer>
                        <div className="flex flex-wrap justify-between max-w-4xl gap-8 p-8 m-auto">

                    Function handleDeposit has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const handleDeposit = async () => {
                        setIsDepositing(true)
                        const currentTimestamp: number = getUnixTimeMinutesFromNow(0)
                        try {
                          const txReceipt = await deposit(amount)

                      Function balancePromises has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          const balancePromises = filteredChains.map(async (chainId) => {
                            const currentChainId = Number(chainId)
                      
                            return (async () => {
                              try {
                      Severity: Minor
                      Found in packages/synapse-interface/utils/actions/fetchPortfolioBalances.tsx - About 1 hr to fix

                        Method baseChain.HeaderByTime has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (b *baseChain) HeaderByTime(ctx context.Context, startHeight *big.Int, targetTime time.Time) (*types.Header, error) {
                            // grab the MeteredEVMClient explicitly to avoid ambiguous references
                            client, err := newHeaderCacheClient(b, 4)
                            if err != nil {
                                return nil, fmt.Errorf("could not create header cache client: %w", err)
                        Severity: Minor
                        Found in ethergo/chain/block.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 NewAnvilBackend has 15 return statements (exceeds 4 allowed).
                        Open

                        func NewAnvilBackend(ctx context.Context, t *testing.T, args *OptionBuilder) (*Backend, error) {
                            t.Helper()
                        
                            pool, err := dockertest.NewPool("")
                            if err != nil {
                        Severity: Major
                        Found in ethergo/backends/anvil/anvil.go - About 1 hr to fix

                          Method Guard.updateAgentStatus has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (g Guard) updateAgentStatus(ctx context.Context, chainID uint32) error {
                              eligibleAgentTrees, err := g.guardDB.GetRelayableAgentStatuses(ctx, chainID)
                              if err != nil {
                                  return fmt.Errorf("could not get update agent status parameters: %w", err)
                              }
                          Severity: Minor
                          Found in agents/agents/guard/fraud.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 Guard.handleReceiptAccepted has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (g Guard) handleReceiptAccepted(ctx context.Context, log ethTypes.Log) error {
                              fraudReceipt, err := g.inboxParser.ParseReceiptAccepted(log)
                              if err != nil {
                                  return fmt.Errorf("could not parse receipt accepted: %w", err)
                              }
                          Severity: Minor
                          Found in agents/agents/guard/fraud.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_messageBusTransactions_args has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (ec *executionContext) field_Query_messageBusTransactions_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["chainID"]; ok {
                          Severity: Minor
                          Found in services/explorer/graphql/server/graph/resolver/server.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_transactionsAtHeadRange_args has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (ec *executionContext) field_Query_transactionsAtHeadRange_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 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_logs_args has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (ec *executionContext) field_Query_logs_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 {
                          Severity: Minor
                          Found in services/explorer/consumer/client/resolver-client/server.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_logs_args has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (ec *executionContext) field_Query_logs_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 {
                          Severity: Minor
                          Found in services/scribe/graphql/server/graph/resolver/server.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_transactionsAtHeadRange_args has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (ec *executionContext) field_Query_transactionsAtHeadRange_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/scribe/graphql/server/graph/resolver/server.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

                          Severity
                          Category
                          Status
                          Source
                          Language