synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Method server.StreamLogs has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring.
Open

func (s *server) StreamLogs(req *pbscribe.StreamLogsRequest, res pbscribe.ScribeService_StreamLogsServer) error {
    streamNewBlocks := false
    retrieveLogsBackoff := 3
    fromBlock, toBlock, err := s.setBlocks(res.Context(), req)
    if err != nil {
Severity: Minor
Found in services/scribe/grpc/server/server.go - 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 OpenGormClickhouse has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring.
Open

func OpenGormClickhouse(ctx context.Context, address string, readOnly bool, handler metrics.Handler) (*Store, error) {
    clickhouseDB, err := gorm.Open(gormClickhouse.New(gormClickhouse.Config{
        DSN: address,
    }), &gorm.Config{
        Logger:               gormLogger.Default.LogMode(gormLogger.Silent),
Severity: Minor
Found in services/explorer/db/sql/store.go - 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 TestNewBufferedPipe has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring.
Open

func TestNewBufferedPipe(t *testing.T) {
    t.Run("Write and read data", func(t *testing.T) {
        pipe := processlog.NewBufferedPipe()

        testData := []byte("Hello, World!")
Severity: Minor
Found in core/processlog/stream_test.go - 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 TestCombineStreams has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring.
Open

func TestCombineStreams(t *testing.T) {
    tests := []struct {
        name           string
        inputs         []string
        expectedOutput []string
Severity: Minor
Found in core/processlog/stream_test.go - 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 HolisticStats has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

export const HolisticStats = ({
  platform: parentPlatform,
  setPlatform: parentSetPlatform,

  baseVariables,
Severity: Minor
Found in packages/explorer-ui/components/misc/HolisticStats.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 SwapTransactionButton has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

export const SwapTransactionButton = ({
  isTyping,
  approveTxn,
  executeSwap,
  isApproved,

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

export const BridgeButton = ({
  originChain,
  isValidQuote,
  handleApprove,
  handleBridge,
Severity: Minor
Found in packages/widget/src/components/BridgeButton.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

Method HarmonyProxy.getLogsHarmonyVerify has 89 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (r *HarmonyProxy) getLogsHarmonyVerify(parentCtx context.Context, query ethereum.FilterQuery, rawBody []byte) (rawResp []byte, err error) {
    ctx, span := r.tracer.Start(parentCtx, "getLogsHarmonyVerify")

    defer func() {
        metrics.EndSpanWithErr(span, err)
Severity: Major
Found in services/omnirpc/modules/harmonyproxy/harmonyproxy.go - About 2 hrs to fix

    Function useSwapFromTokenListArray has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const useSwapFromTokenListArray = (searchStr: string) => {
      const { swapFromTokens, swapChainId } = useSwapState()
      const portfolioBalances = usePortfolioBalances()
    
      const chain = CHAINS_BY_ID[swapChainId]

      Function useStaleQuoteUpdater has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const useStaleQuoteUpdater = (
        quote: BridgeQuote,
        refreshQuoteCallback: () => Promise<void>,
        enabled: boolean,
        staleTimeout: number = 15000, // in ms

        Function SocialButtons has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const SocialButtons = () => {
          return (
            <Grid cols={{ xs: 2, sm: 1 }} gapY={1}>
              <MiniInfoItem
                href={DOCS_URL}
        Severity: Major
        Found in packages/explorer-ui/components/layouts/MainLayout/index.tsx - About 2 hrs to fix

          Function LanguageSelector has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const LanguageSelector = () => {
            const router = useRouter()
            const t = useTranslations('LanguageSelector')
            const { pathname, asPath, query } = router
            const [isOpen, setIsOpen] = useState(false)
          Severity: Major
          Found in packages/synapse-interface/components/LanguageSelector.tsx - About 2 hrs to fix

            Function SettingsSlideOver has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const SettingsSlideOver = () => {
              const dispatch = useAppDispatch()
              const t = useTranslations('Settings')
            
              const { showDestinationAddress } = useBridgeDisplayState()

              Function destinationTxController has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const destinationTxController = async (req, res) => {
                const errors = validationResult(req)
                if (!errors.isEmpty()) {
                  return res.status(400).json({ errors: errors.array() })
                }
              Severity: Major
              Found in packages/rest-api/src/controllers/destinationTxController.ts - About 2 hrs to fix

                File index.ts has 271 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { BigNumber } from '@ethersproject/bignumber'
                
                import { makeMultiChainObj } from '../utils/makeMultiChainObj'
                import { validateAddresses } from '../utils/validateAddresses'
                
                
                Severity: Minor
                Found in packages/synapse-constants/src/types/index.ts - About 2 hrs to fix

                  Method queryResolver.GetBridgeTxsFromOrigin has 20 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  func (r *queryResolver) GetBridgeTxsFromOrigin(ctx context.Context, useMv *bool, chainIDFrom []*int, chainIDTo []*int, addressFrom *string, addressTo *string, maxAmount *int, minAmount *int, maxAmountUsd *int, minAmountUsd *int, startTime *int, endTime *int, txHash *string, tokenAddressTo []*string, tokenAddressFrom []*string, kappa *string, pending *bool, onlyCctp *bool, page *int, latest bool) ([]*model.BridgeTransaction, error) {
                  Severity: Major
                  Found in services/explorer/graphql/server/graph/queryutils.go - About 2 hrs to fix

                    File main.go has 520 lines of code (exceeds 500 allowed). Consider refactoring.
                    Open

                    // Package main provides a tool for downloading and running specific versions of golangci-lint
                    // across different architectures and repositories. It supports version pinning through
                    // .golangci-version files and maintains a local cache of downloaded binaries.
                    //
                    // Security Features:
                    Severity: Minor
                    Found in contrib/golang-ci-lint/main.go - About 2 hrs to fix

                      Method GuardSuite.TestGuardE2E has 87 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (g GuardSuite) TestGuardE2E() {
                          testConfig := config.AgentConfig{
                              Domains: map[string]config.DomainConfig{
                                  "origin_client":      g.OriginDomainClient.Config(),
                                  "destination_client": g.DestinationDomainClient.Config(),
                      Severity: Major
                      Found in agents/agents/guard/guard_test.go - About 2 hrs to fix

                        Method ChainBackfiller.backfillContractLogs has 87 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (c *ChainBackfiller) backfillContractLogs(parentCtx context.Context, contract indexerconfig.ContractConfig) (err error) {
                            // make the event parser
                            eventParser, err := c.makeEventParser(contract)
                            if err != nil {
                                return err
                        Severity: Major
                        Found in services/explorer/backfill/chain.go - About 2 hrs to fix

                          Method ScribeSuite.TestChainIndexerLivefillToTip has 87 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (s *ScribeSuite) TestChainIndexerLivefillToTip() {
                              const numberOfContracts = 3
                              currentBlockHeight := uint64(10) // starting with zero to emit events while indexing.
                              chainID := gofakeit.Uint32()
                              chainBackends := make(map[uint32]geth.Backend)
                          Severity: Major
                          Found in services/scribe/service/chain_test.go - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language