Showing 1,971 of 13,422 total issues
Function overrideJsonBigIntSerialization
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const overrideJsonBigIntSerialization = () => {
const originalJSONStringify = JSON.stringify
JSON.stringify = function (value: any, replacer, space: number): string {
const bigIntReplacer = (_key: string, value: any): any => {
- 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 PriceImpactDisplay
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const PriceImpactDisplay = ({ priceImpact }: { priceImpact: bigint }) => {
let colorClassName: string
let labelText: string
let content: any
- 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 SelectorWrapper
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const SelectorWrapper = ({
dataTestId,
label,
placeholder,
selectedItem,
- 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 getChangeTreeFromGit
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func getChangeTreeFromGit(repoPath string, ghContext *actionscore.Context, head, base string) (tree.Tree, error) {
// open the repository
repository, err := git.PlainOpen(repoPath)
if err != nil {
return nil, fmt.Errorf("could not open repository %s: %w", repoPath, err)
Method Store.GetEarliestStateInRange
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s Store) GetEarliestStateInRange(ctx context.Context, chainID, destination, startNonce, endNonce uint32) (*agentsTypes.State, error) {
statesTableName, err := dbcommon.GetModelName(s.DB(), &State{})
if err != nil {
return nil, fmt.Errorf("failed to get states table name: %w", err)
}
Method QuoterAPIServer.collectRelayerResponses
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (r *QuoterAPIServer) collectRelayerResponses(ctx context.Context, request *model.PutRFQRequest, requestID string) (responses map[string]*model.WsRFQResponse) {
ctx, span := r.handler.Tracer().Start(ctx, "collectRelayerResponses", trace.WithAttributes(
attribute.String("user_address", request.UserAddress),
attribute.String("request_id", requestID),
))
Function deployParseNet
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func deployParseNet() error {
globMux.Lock()
defer globMux.Unlock()
// 100 million ether
Method BackfillSuite.redeemAndSwapParity
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (b *BackfillSuite) redeemAndSwapParity(log *types.Log, parser *parser.BridgeParser, chainID uint32, useV1 bool) error {
// parse the log
if useV1 {
parsedLog, err := parser.Filterer.ParseTokenRedeemAndSwap(*log)
if err != nil {
Method BackfillSuite.depositAndSwapParity
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (b *BackfillSuite) depositAndSwapParity(log *types.Log, parser *parser.BridgeParser, chainID uint32, useV1 bool) error {
// parse the log
if useV1 {
parsedLog, err := parser.Filterer.ParseTokenDepositAndSwap(*log)
if err != nil {
Function eventToSwapEvent
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func eventToSwapEvent(event swapTypes.EventLog, chainID uint32) model.SwapEvent {
var buyer sql.NullString
if event.GetBuyer() != nil {
buyer.Valid = true
Method APISuite.SetupTest
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (g *APISuite) SetupTest() {
g.TestSuite.SetupTest()
g.dbPath = filet.TmpDir(g.T(), "")
g.SetTestTimeout(time.Minute * 3)
Method ScribeSuite.TestLargeVolume
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s *ScribeSuite) TestLargeVolume() {
if os.Getenv("CI") != "" || !s.runVolumeTest {
s.T().Skip("This is a long running test")
}
const runtime = 100
Method DBSuite.TestUnconfirmedTxsQuery
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (t *DBSuite) TestUnconfirmedTxsQuery() {
t.RunOnAllDBs(func(testDB db.EventDB) {
chainID := gofakeit.Uint32()
const lastIndexed = 100
const confirmedBlockHeight = 100
Function TestHeadersToMap
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestHeadersToMap(t *testing.T) {
tests := []struct {
name string
input string
expected map[string]string
Method testJaeger.StartJaegerServer
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (j *testJaeger) StartJaegerServer(ctx context.Context) *uiResource {
if core.HasEnv(internal.JaegerEndpoint) && !core.HasEnv(internal.JaegerUIEndpoint) {
j.tb.Fatalf("%s is set but %s is not, please remove %s or set %s", internal.JaegerEndpoint, internal.JaegerUIEndpoint, internal.JaegerEndpoint, internal.JaegerUIEndpoint)
}
Function getSinglePoolData
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getSinglePoolData = async (
chainId: number,
pool: Token,
prices?: any
): Promise<PoolData> => {
Function useEventCountdownProgressBar
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useEventCountdownProgressBar = (
eventLabel: string,
startDate: Date,
endDate: Date | null,
hideProgress?: boolean
Function BridgeSection
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function BridgeSection() {
const t = useTranslations('Landing.BridgeSection')
return (
<SectionContainer
Function generateAllBridgeEventsQueryFromOriginMv
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
func generateAllBridgeEventsQueryFromOriginMv(chainIDFrom []*int, addressFrom *string, maxAmount *int, maxAmountUsd *int, startTime *int, endTime *int, tokenAddressFrom []*string, txHash *string, kappa *string, pending *bool, page int) string {
Function generateAllBridgeEventsQueryFromDestinationMv
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
func generateAllBridgeEventsQueryFromDestinationMv(chainIDTo []*int, addressTo *string, minAmount *int, minAmountUsd *int, startTime *int, endTime *int, tokenAddressTo []*string, kappa *string, txHash *string, pending *bool, page int) string {