synapsecns/sanguine

View on GitHub

Showing 13,422 of 13,422 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  if (searchStr?.length > 0) {
    const results = fuse.search(searchStr).map((i) => i.item)

    possibleTokens = results.filter((item) => item.source === 'possibleTokens')
    remainingChainTokens = results.filter(
packages/synapse-interface/components/StateManagedBridge/hooks/useFromTokenListArray.ts on lines 95..104
packages/synapse-interface/components/StateManagedSwap/hooks/useSwapToTokenListArray.ts on lines 78..88

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 127.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            <div className="flex items-center h-full">
              <button
                onClick={() => SetDailyStatisticCumulative(false)}
                className={
                  'font-medium rounded-l-md px-4 py-2 border  h-fit  ' +
Severity: Major
Found in packages/explorer-ui/pages/chain/[chainId].tsx and 1 other location - About 4 hrs to fix
packages/explorer-ui/components/pages/Home/index.tsx on lines 242..263

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 127.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  if (searchStr?.length > 0) {
    const results = fuse.search(searchStr).map((i) => i.item)
    possibleTokens = results.filter((item) => item.source === 'possibleTokens')
    remainingTokens = results.filter(
      (item) => item.source === 'remainingTokens'
packages/synapse-interface/components/StateManagedBridge/hooks/useToTokenListArray.ts on lines 77..87
packages/synapse-interface/components/StateManagedSwap/hooks/useSwapToTokenListArray.ts on lines 78..88

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 127.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            <div className="flex items-center h-full">
              <button
                onClick={() => SetDailyStatisticCumulative(false)}
                className={
                  'font-medium rounded-l-md px-4 py-2 border  h-fit  ' +
Severity: Major
Found in packages/explorer-ui/components/pages/Home/index.tsx and 1 other location - About 4 hrs to fix
packages/explorer-ui/pages/chain/[chainId].tsx on lines 260..281

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 127.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method Resolver.getAndParseLogs has a Cognitive Complexity of 46 (exceeds 20 allowed). Consider refactoring.
Open

func (r Resolver) getAndParseLogs(ctx context.Context, logFetcher *indexer.LogFetcher, chainID uint32, kappa string, bridgeType model.BridgeType) (interface{}, error) {
    streamLogsCtx, cancelStreamLogs := context.WithCancel(ctx)
    logsChan := *logFetcher.GetFetchedLogsChan()
    destinationData := make(chan *ifaceBridgeEvent, 1)
    destinationDataCCTP := make(chan *ifaceCCTPEvent, 1)
Severity: Minor
Found in services/explorer/graphql/server/graph/fetcher.go - About 4 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 ChainBackfiller.backfillContractLogs has a Cognitive Complexity of 46 (exceeds 20 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: Minor
Found in services/explorer/backfill/chain.go - About 4 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

func (ec *executionContext) fieldContext_Query_countByTokenAddress(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
    fc = &graphql.FieldContext{
        Object:     "Query",
        Field:      field,
        IsMethod:   true,
Severity: Major
Found in services/explorer/graphql/server/graph/resolver/server.go and 1 other location - About 4 hrs to fix
services/explorer/graphql/server/graph/resolver/server.go on lines 7725..7755

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 345.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

func (ec *executionContext) fieldContext_Query_getBlockHeight(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
    fc = &graphql.FieldContext{
        Object:     "Query",
        Field:      field,
        IsMethod:   true,
Severity: Major
Found in services/explorer/graphql/server/graph/resolver/server.go and 1 other location - About 4 hrs to fix
services/explorer/graphql/server/graph/resolver/server.go on lines 7117..7147

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 345.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

func (_m *IInbox) WatchSnapshotAccepted(opts *bind.WatchOpts, sink chan<- *inbox.InboxSnapshotAccepted, domain []uint32, agent []common.Address) (event.Subscription, error) {
    ret := _m.Called(opts, sink, domain, agent)

    var r0 event.Subscription
    if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *inbox.InboxSnapshotAccepted, []uint32, []common.Address) event.Subscription); ok {
Severity: Major
Found in agents/contracts/inbox/mocks/i_inbox.go and 2 other locations - About 4 hrs to fix
agents/contracts/bondingmanager/mocks/i_bonding_manager.go on lines 1537..1557
agents/contracts/lightmanager/mocks/i_light_manager.go on lines 1409..1429

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 344.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

func (_m *IBondingManager) WatchStatusUpdated(opts *bind.WatchOpts, sink chan<- *bondingmanager.BondingManagerStatusUpdated, domain []uint32, agent []common.Address) (event.Subscription, error) {
    ret := _m.Called(opts, sink, domain, agent)

    var r0 event.Subscription
    if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *bondingmanager.BondingManagerStatusUpdated, []uint32, []common.Address) event.Subscription); ok {
Severity: Major
Found in agents/contracts/bondingmanager/mocks/i_bonding_manager.go and 2 other locations - About 4 hrs to fix
agents/contracts/inbox/mocks/i_inbox.go on lines 1656..1676
agents/contracts/lightmanager/mocks/i_light_manager.go on lines 1409..1429

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 344.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

func (_m *ILightManager) WatchStatusUpdated(opts *bind.WatchOpts, sink chan<- *lightmanager.LightManagerStatusUpdated, domain []uint32, agent []common.Address) (event.Subscription, error) {
    ret := _m.Called(opts, sink, domain, agent)

    var r0 event.Subscription
    if rf, ok := ret.Get(0).(func(*bind.WatchOpts, chan<- *lightmanager.LightManagerStatusUpdated, []uint32, []common.Address) event.Subscription); ok {
Severity: Major
Found in agents/contracts/lightmanager/mocks/i_light_manager.go and 2 other locations - About 4 hrs to fix
agents/contracts/bondingmanager/mocks/i_bonding_manager.go on lines 1537..1557
agents/contracts/inbox/mocks/i_inbox.go on lines 1656..1676

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 344.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function render has 114 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const render = useMemo(() => {
    return (
      <ConnectButton.Custom>
        {({
          account,
Severity: Major
Found in packages/synapse-interface/components/Wallet.tsx - About 4 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export const CHAINS = {
      ETHEREUM,
      ARBITRUM,
      BNBCHAIN,
      AVALANCHE,
    Severity: Major
    Found in packages/widget/src/constants/chains.ts and 1 other location - About 4 hrs to fix
    packages/rest-api/src/constants/chains.ts on lines 490..514

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 126.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export const findValidToken = (
      tokens: Token[],
      routeSymbol: string,
      swapableType: string
    ): Token | null => {
    Severity: Major
    Found in packages/synapse-interface/utils/findValidToken.ts and 1 other location - About 4 hrs to fix
    packages/widget/src/utils/findValidTokens.ts on lines 4..15

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 126.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export const CHAINS = {
      ETHEREUM,
      ARBITRUM,
      BNBCHAIN,
      AVALANCHE,
    Severity: Major
    Found in packages/rest-api/src/constants/chains.ts and 1 other location - About 4 hrs to fix
    packages/widget/src/constants/chains.ts on lines 488..512

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 126.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export const findValidToken = (
      tokens: BridgeableToken[],
      routeSymbol: string,
      swapableType: string
    ): BridgeableToken | null => {
    Severity: Major
    Found in packages/widget/src/utils/findValidTokens.ts and 1 other location - About 4 hrs to fix
    packages/synapse-interface/utils/findValidToken.ts on lines 5..17

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 126.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function ImageUploader has 113 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function ImageUploader() {
      const [uploadedImage, setUploadedImage] = useState(null)
      const [processedImage, setProcessedImage] = useState(null)
    
      const t = useTranslations('ReturnToMonke')
    Severity: Major
    Found in packages/synapse-interface/pages/returntomonke/ImageUploader.tsx - About 4 hrs to fix

      EVM has 35 methods (exceeds 20 allowed). Consider refactoring.
      Open

      type EVM struct {
          mock.Mock
      }
      Severity: Minor
      Found in ethergo/client/mocks/evm.go - About 4 hrs to fix

        EVMClient has 35 methods (exceeds 20 allowed). Consider refactoring.
        Open

        type EVMClient struct {
            mock.Mock
        }
        Severity: Minor
        Found in ethergo/chain/client/mocks/evm_client.go - About 4 hrs to fix

          DeployManager has 35 methods (exceeds 20 allowed). Consider refactoring.
          Open

          func (d *DeployManager) GetOrigin(ctx context.Context, backend backends.SimulatedTestBackend) (contract contracts.DeployedContract, handle *origin.OriginRef) {
              d.T().Helper()
          
              return manager.GetContract[*origin.OriginRef](ctx, d.T(), d, backend, OriginType)
          }
          Severity: Minor
          Found in agents/testutil/typecast.go - About 4 hrs to fix
            Severity
            Category
            Status
            Source
            Language