Showing 1,971 of 13,422 total issues
Function PoolInfoSection
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
const PoolInfoSection = () => {
const { pool, poolData, isLoading } = usePoolDataState()
const t = useTranslations('Pools.Other')
ProxySuite
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
func (p *ProxySuite) captureResponse(backendURL string, makeReq func(client ethClient.EVMClient), checkResp func(req []rpc.Request, response proxy.JSONRPCMessage, rawResponse []byte)) {
doneChan := make(chan bool)
parsedURL, err := url.Parse(backendURL)
Nil(p.T(), err)
Method rebalanceManagerSynapseCCTP.listen
has 83 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (c *rebalanceManagerSynapseCCTP) listen(parentCtx context.Context, chainID int) (err error) {
listener, ok := c.chainListeners[chainID]
if !ok {
return fmt.Errorf("could not find listener for chain %d", chainID)
}
Method Relayer.handleBridgeRequestedLog
has 83 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (r *Relayer) handleBridgeRequestedLog(parentCtx context.Context, req *fastbridge.FastBridgeBridgeRequested, chainID uint64) (err error) {
ctx, span := r.metrics.Tracer().Start(parentCtx, "handleBridgeRequestedLog", trace.WithAttributes(
attribute.String("transaction_id", hexutil.Encode(req.TransactionId[:])),
))
File Grid.tsx
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
@NOTE: super repetitive code here is actually necessary...
*/
const GRID_COLS_LOOKUP = {
Method queryResolver.AddressData
has 82 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (r *queryResolver) AddressData(ctx context.Context, address string) (*model.AddressData, error) {
bridgeQuery := fmt.Sprintf("SELECT toFloat64(sumKahan(famount_usd)) AS volumeTotal, toFloat64(sumKahan(tfee_amount_usd)) AS feeTotal, toInt64(uniq(fchain_id, ftx_hash)) AS txTotal FROM (SELECT * FROM mv_bridge_events where fsender = '%s' LIMIT 1 BY fchain_id,fcontract_address, fevent_type, fblock_number, fevent_index, ftx_hash)", address)
swapQuery := fmt.Sprintf("SELECT toFloat64(sumKahan(multiIf(event_type = 0, amount_usd[sold_id], event_type = 1, arraySum(mapValues(amount_usd)), event_type = 9, arraySum(mapValues(amount_usd)), event_type = 10, amount_usd[sold_id],0))) AS volumeTotal, toFloat64(sumKahan(arraySum(mapValues(fee_usd)))) AS feeTotal, toInt64(uniq(chain_id, tx_hash)) AS txTotal FROM (SELECT * FROM swap_events where sender = '%s' LIMIT 1 BY chain_id, contract_address, event_type, block_number, event_index, tx_hash)", address)
rankingQuery := fmt.Sprintf("select rowNumber from (select sender, row_number() over (order by sumTotal desc ) as rowNumber from (select fsender as sender, sumKahan(famount_usd) as sumTotal from (SELECT * FROM mv_bridge_events where fsender != '' LIMIT 1 BY fchain_id, fcontract_address, fevent_type, fblock_number, fevent_index, ftx_hash) where fsender != '' group by fsender)) where sender = '%s'", address)
firstTx := fmt.Sprintf("SELECT min(ftimestamp) AS earliestTime FROM (SELECT * FROM mv_bridge_events where fsender = '%s' LIMIT 1 BY fchain_id,fcontract_address, fevent_type, fblock_number, fevent_index, ftx_hash)", address)
Method Resolver.getAndParseLogs
has 82 lines of code (exceeds 50 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)
Function bridgeTxInfoController
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const bridgeTxInfoController = async (req, res) => {
const errors = validationResult(req)
if (!errors.isEmpty()) {
return res.status(400).json({ errors: errors.array() })
}
Function Footer
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function Footer() {
return (
<footer>
<div>
<a href="https://synapseprotocol.com/landing">
Function Appearance
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Appearance = () => {
return (
<>
<h4>Dark mode</h4>
<p>
Method txSubmitterImpl.processQueue
has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring. Open
func (t *txSubmitterImpl) processQueue(parentCtx context.Context) (err error) {
// TODO: this might be too short of a deadline depending on the number of pendingTxes in the queue
deadlineCtx, cancel := context.WithTimeout(parentCtx, time.Second*60)
defer cancel()
- Read upRead up
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 Executor.setMinimumTime
has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring. Open
func (e Executor) setMinimumTime(parentCtx context.Context, chainID uint32) (err error) {
backoffInterval := time.Duration(0)
for {
select {
- Read upRead up
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 inventoryManagerImpl.Start
has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring. Open
func (i *inventoryManagerImpl) Start(ctx context.Context) error {
g, ctx := errgroup.WithContext(ctx)
for _, rebalanceManager := range i.rebalanceManagers {
rebalanceManager := rebalanceManager
g.Go(func() error {
- Read upRead up
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 queryResolver.GetBridgeTxs
has 18 arguments (exceeds 4 allowed). Consider refactoring. Open
func (r *queryResolver) GetBridgeTxs(ctx context.Context, 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) ([]*model.BridgeTransaction, error) {
Method Resolver.bwDestinationFallback
has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring. Open
func (r Resolver) bwDestinationFallback(ctx context.Context, chainID uint32, address string, identifier string, timestamp int, historical bool, bridgeType model.BridgeType) (*model.BridgeWatcherTx, error) {
txFetchContext, cancelTxFetch := context.WithTimeout(ctx, maxTimeToWaitForTx)
defer cancelTxFetch()
b := &backoff.Backoff{
- Read upRead up
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 ScribeSuite.TestLivefillParity
has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring. Open
func (s *ScribeSuite) TestLivefillParity() {
if os.Getenv("CI") != "" {
s.T().Skip("Network test flake")
}
const blockRange = uint64(100)
- Read upRead up
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 Receipt
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export const Receipt = ({ quote, loading, send, receive }) => {
const { originChainId, destinationChainId } = useBridgeState()
const estTime = useMemo(() => {
if (!quote.estimatedTime) {
- Read upRead up
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 DecodeConfig
has 81 lines of code (exceeds 50 allowed). Consider refactoring. Open
func DecodeConfig(filePath string) (_ Config, err error) {
cfg := &Config{}
input, err := os.ReadFile(filepath.Clean(filePath))
if err != nil {
return Config{}, fmt.Errorf("failed to read file: %w", err)
Function TestEstimateGasWithPrice
has 81 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestEstimateGasWithPrice(t *testing.T) {
t.Parallel()
key, _ := crypto.GenerateKey()
addr := crypto.PubkeyToAddress(key.PublicKey)
Method server.StreamLogs
has 81 lines of code (exceeds 50 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 {