Showing 1,971 of 13,422 total issues
Method ScribeSuite.TestIndexToBlock
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s *ScribeSuite) TestIndexToBlock() {
// Get simulated blockchain, deploy the test contract, and set up test variables.
simulatedChain := geth.NewEmbeddedBackendForChainID(s.GetSuiteContext(), s.T(), big.NewInt(142))
simulatedClient, err := backend.DialBackend(s.GetTestContext(), simulatedChain.RPCAddress(), s.nullMetrics)
Nil(s.T(), err)
Method Store.StoreLogsAtHead
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s Store) StoreLogsAtHead(ctx context.Context, chainID uint32, logs ...types.Log) error {
var storeLogs []LogAtHead
for _, log := range logs {
var topics []sql.NullString
Function formatBigIntToString
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const formatBigIntToString = (
bi: bigint,
nativePrecision: number,
decimalPlaces?: number
) => {
Function getMenuItemStyleForChain
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getMenuItemStyleForChain = (color: string): string => {
switch (color) {
case ColorOptions.ETH:
return `hover:bg-opacity-20 hover:bg-[#3f4f8c] focus:bg-[#3f4f8c] active:bg-[#314367] active:bg-opacity-20 focus:bg-opacity-20`
case ColorOptions.GRAY:
Function useCurrentTokenBalance
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useCurrentTokenBalance = () => {
const web3Context = useContext(Web3Context)
const { connectedAddress } = web3Context.web3Provider
const { originChainId, originToken } = useBridgeState()
const { balances } = useWalletState()
Function checkElements
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const checkElements = () => {
originChainSelect = document.getElementById('origin-chain-select')
destinationChainSelect = document.getElementById(
'destination-chain-select'
)
Function PageFooter
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const PageFooter = () => {
return (
<footer>
<div className="max-w-md px-4 pt-4 pb-6 mx-auto sm:max-w-3xl sm:pt-6 sm:px-6 lg:max-w-7xl lg:px-8">
<Grid
Function payload
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
resp.map(async (quote) => {
const originQueryTokenOutInfo = tokenAddressToToken(
fromChain.toString(),
quote.originQuery.tokenOut
)
Function GasDropLabel
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const GasDropLabel = () => {
const { toChainId } = useBridgeState()
const {
bridgeQuote: { gasDropAmount },
} = useBridgeQuoteState()
Function useEventCountdownProgressBar
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useEventCountdownProgressBar = (
eventLabel: string,
startDate: Date,
endDate: Date | null,
hideProgress?: boolean
Method Guard.Start
has 11 return statements (exceeds 4 allowed). Open
func (g Guard) Start(parentCtx context.Context) error {
// First initialize a map to track what was the last state signed by this guard
g.loadSummitLatestStates(parentCtx)
group, ctx := errgroup.WithContext(parentCtx)
Method parserImpl.ParseEvent
has 11 return statements (exceeds 4 allowed). Open
func (p parserImpl) ParseEvent(log ethTypes.Log) (_ EventType, event interface{}, ok bool) {
// return an unknown event to avoid cases where user failed to check the event type
// make it high enough to make it obvious (we start iotas at +1, see uber style guide for details)
noOpEvent := EventType(len(topicMap()) + 1)
Method Manager.ShouldProcess
has 11 return statements (exceeds 4 allowed). Open
func (m *Manager) ShouldProcess(parentCtx context.Context, quote reldb.QuoteRequest) (res bool, err error) {
ctx, span := m.metricsHandler.Tracer().Start(parentCtx, "shouldProcess", trace.WithAttributes(
attribute.String("transaction_id", hexutil.Encode(quote.TransactionID[:])),
))
Method inventoryManagerImpl.initializeTokens
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
func (i *inventoryManagerImpl) initializeTokens(parentCtx context.Context, cfg relconfig.Config) (err error) {
i.mux.Lock()
defer i.mux.Unlock()
ctx, span := i.handler.Tracer().Start(parentCtx, "initializeTokens", trace.WithAttributes(
- 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 filterLogs
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
func filterLogs(logs []*types.Log, fromBlock, toBlock *big.Int, addresses []common.Address, topics [][]common.Hash) []*types.Log {
var ret []*types.Log
Logs:
for _, currentLog := range logs {
if fromBlock != nil && fromBlock.Int64() >= 0 && fromBlock.Uint64() > currentLog.BlockNumber {
- 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 rebalanceManagerSynapseCCTP.listen
has a Cognitive Complexity of 25 (exceeds 20 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)
}
- 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 parserImpl.ParseEvent
has 11 return statements (exceeds 4 allowed). Open
func (p parserImpl) ParseEvent(log ethTypes.Log) (_ EventType, event interface{}, ok bool) {
// return an unknown event to avoid cases where user failed to check the event type
// make it high enough to make it obvious (we start iotas at +1, see uber style guide for details)
noOpEvent := EventType(len(topicMap()) + 2)
Function NewGuard
has 11 return statements (exceeds 4 allowed). Open
func NewGuard(ctx context.Context, metricHandler metrics.Handler, cfg guardconfig.Config, txSubmitter submitter.TransactionSubmitter) (*Guard, error) {
omniClient := omniClient.NewOmnirpcClient(cfg.OmniRPCURL, metricHandler, omniClient.WithCaptureReqRes())
chainListeners := make(map[int]listener.ContractListener)
dbType, err := dbcommon.DBTypeFromString(cfg.Database.Type)
Method Guard.handleProveCalled
has 11 return statements (exceeds 4 allowed). Open
func (g *Guard) handleProveCalled(parentCtx context.Context, proven *guarddb.PendingProven) (err error) {
ctx, span := g.metrics.Tracer().Start(parentCtx, "handleProveCalled", trace.WithAttributes(
attribute.String("transaction_id", hexutil.Encode(proven.TransactionID[:])),
))
defer func() {
Function NewRelayerAPI
has 11 return statements (exceeds 4 allowed). Open
func NewRelayerAPI(
ctx context.Context,
cfg relconfig.Config,
handler metrics.Handler,
omniRPCClient omniClient.RPCClient,