services/scribe/service/scribe_test.go
Method ScribeSuite.TestLivefillParity
has 223 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (s *ScribeSuite) TestLivefillParity() {
if os.Getenv("CI") != "" {
s.T().Skip("Network test flake")
}
const blockRange = uint64(100)
Method ScribeSuite.TestLivefillParity
has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring. Open
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
Method ScribeSuite.TestSimulatedScribe
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (s *ScribeSuite) TestSimulatedScribe() {
if os.Getenv("CI") != "" {
s.T().Skip("Test flake: 20 sec of livefilling may fail on CI")
}
const numberOfContracts = 3
Function processBatch
has 8 return statements (exceeds 4 allowed). Open
Open
func processBatch(ctx context.Context, client *http.Client, url string, txs *map[int64]string) (int, error) {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if err != nil {
return 0, fmt.Errorf("error getting data: %w", err)
}
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) {
Function getLogAmount
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func getLogAmount(ctx context.Context, db db.EventDB, filter db.LogFilter, startBlock uint64, endBlock uint64) (int, []*types.Log, error) {