Showing 1,971 of 13,422 total issues
Method ChainIndexer.livefill
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
Open
func (c *ChainIndexer) livefill(parentContext context.Context) error {
timeout := time.Duration(0)
b := createBackoff()
livefillBlockMeter, err := c.handler.Metrics().NewHistogram(fmt.Sprintf("scribe_block_meter_%d_livefill", c.chainConfig.ChainID), "block_histogram", "a block height meter", "blocks")
if err != nil {
- 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 RegisterScribeServiceHandlerServer
has 7 return statements (exceeds 4 allowed). Open
Open
func RegisterScribeServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ScribeServiceServer) error {
mux.Handle("POST", pattern_ScribeService_Check_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
Method executionContext.field_Query_transactions_args
has 7 return statements (exceeds 4 allowed). Open
Open
func (ec *executionContext) field_Query_transactions_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 {
Method EventDB.StoreEthTx
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (_m *EventDB) StoreEthTx(ctx context.Context, tx *types.Transaction, chainID uint32, blockHash common.Hash, blockNumber uint64, transactionIndex uint64) error {
Function getLogs
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func getLogs(ctx context.Context, contractAddress string, fromBlock uint64, toBlock uint64, apiURL string, txs *map[int64]string) (int, error) {
Method Client.GetReceiptsRange
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (c *Client) GetReceiptsRange(ctx context.Context, chainID int, startBlock int, endBlock int, page int, httpRequestOptions ...client.HTTPRequestOption) (*GetReceiptsRange, error) {
Method Client.GetTransactionsRange
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (c *Client) GetTransactionsRange(ctx context.Context, chainID int, startBlock int, endBlock int, page int, httpRequestOptions ...client.HTTPRequestOption) (*GetTransactionsRange, error) {
Function DumpWithOptions
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func DumpWithOptions(showReq bool, showResp bool, showBody bool, showHeaders bool, showCookies bool, cb func(dumpStr string)) gin.HandlerFunc {
Function StartLogs
has 7 return statements (exceeds 4 allowed). Open
Open
func StartLogs(opts ...StdStreamLogArgsOption) (_ LogMetadata, err error) {
input, err := makeArgs(opts)
if err != nil {
return nil, err
}
Method TestHelperSuite.TestEmbeddedScribe
has 7 return statements (exceeds 4 allowed). Open
Open
func (s *TestHelperSuite) TestEmbeddedScribe() {
testScribe := testhelper.NewTestScribe(s.GetTestContext(), s.T(), s.deployManager.GetDeployedContracts(), s.testBackends...)
// let's send some messages on each domain
g, gctx := errgroup.WithContext(s.GetTestContext())
Function BuildReceiptFilter
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func BuildReceiptFilter(txHash *string, contractAddress *string, blockHash *string, blockNumber *int, transactionIndex *int, confirmed *bool) ReceiptFilter {
Function PopulateChainsWithLogs
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func PopulateChainsWithLogs(ctx context.Context, t *testing.T, chainBackends map[uint32]geth.Backend, desiredBlockHeight uint64, managers []*DeployManager, handler metrics.Handler) (map[uint32]*TestChainHandler, map[uint32][]backend.ScribeBackend, error) {
Method Client.GetLogsAtHeadRange
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (c *Client) GetLogsAtHeadRange(ctx context.Context, chainID int, startBlock int, endBlock int, page int, httpRequestOptions ...client.HTTPRequestOption) (*GetLogsAtHeadRange, error) {
Method EventDB.RetrieveUnconfirmedEthTxsFromHeadRangeQuery
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (_m *EventDB) RetrieveUnconfirmedEthTxsFromHeadRangeQuery(ctx context.Context, receiptFilter db.EthTxFilter, startBlock uint64, endBlock uint64, lastIndexed uint64, page int) ([]db.TxWithBlockNumber, error) {
Method Store.RetrieveReceiptsFromHeadRangeQuery
has 7 return statements (exceeds 4 allowed). Open
Open
func (s Store) RetrieveReceiptsFromHeadRangeQuery(ctx context.Context, receiptFilter db.ReceiptFilter, startBlock uint64, endBlock uint64, page int) ([]types.Receipt, error) {
if receiptFilter.ContractAddress == "" || receiptFilter.ChainID == 0 {
return nil, fmt.Errorf("contract address and chain ID must be passed")
}
if page < 1 {
Avoid deeply nested control flow statements. Open
Open
goto DumpRes
Method ChainIndexer.livefillAtHead
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
Open
func (c *ChainIndexer) livefillAtHead(parentContext context.Context) error {
timeout := time.Duration(0)
b := createBackoff()
addresses := getAddressesFromConfig(c.chainConfig.Contracts)
tipLivefillBlockMeter, err := c.handler.Metrics().NewHistogram(fmt.Sprintf("scribe_block_meter_%d_tip_livefill", c.chainConfig.ChainID), "block_histogram", "a block height meter", "blocks")
- 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
Avoid deeply nested control flow statements. Open
Open
goto DumpRes
Avoid deeply nested control flow statements. Open
Open
if err != nil {
logger.ReportIndexerError(err, x.indexerConfig, logger.StoreError)
return fmt.Errorf("could not store last indexed: %w", err)
}
Avoid deeply nested control flow statements. Open
Open
goto DumpRes