Showing 1,971 of 13,422 total issues
Function BridgeButton
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
const BridgeButton = () => {
const t = useTranslations('FauxBridge')
return (
<div className="relative group">
Method Notary.isValidOnOrigin
has 17 return statements (exceeds 4 allowed). Open
func (n *Notary) isValidOnOrigin(parentCtx context.Context, state types.State, domain domains.DomainClient) bool {
if state == nil {
return false
}
Method QuoteRequestHandler.handleProofPosted
has 17 return statements (exceeds 4 allowed). Open
func (q *QuoteRequestHandler) handleProofPosted(ctx context.Context, span trace.Span, request reldb.QuoteRequest) (err error) {
// we shouldnt' check the claim yet
if !q.shouldCheckClaim(request) {
return nil
}
Method HarmonyProxy.getLogsHarmonyVerify
has 17 return statements (exceeds 4 allowed). Open
func (r *HarmonyProxy) getLogsHarmonyVerify(parentCtx context.Context, query ethereum.FilterQuery, rawBody []byte) (rawResp []byte, err error) {
ctx, span := r.tracer.Start(parentCtx, "getLogsHarmonyVerify")
defer func() {
metrics.EndSpanWithErr(span, err)
Function Start
has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring. Open
func Start(ctx context.Context, cfg serverConfig.Config, handler metrics.Handler) error {
router := ginhelper.New(logger)
router.GET(ginhelper.MetricsEndpoint, gin.WrapH(handler.Handler()))
// initialize the database
- 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 sortedInsert
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const sortedInsert = <T>(
items: T[],
add: T,
maxSize: number,
comparator: (a: T, b: T) => number
- 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 DepositButton
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const DepositButton = ({ approveTxn, depositTxn }) => {
const t = useTranslations('Pools.DepositButton')
const [isConnected, setIsConnected] = useState(false)
const { openConnectModal } = useConnectModal()
- 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.DailyStatisticsByChain
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (r *queryResolver) DailyStatisticsByChain(ctx context.Context, chainID *int, typeArg *model.DailyStatisticType, platform *model.Platform, duration *model.Duration, useCache *bool, useMv *bool) ([]*model.DateResultByChain, error) {
cacheKey := fmt.Sprintf("dailyStatisticsByChain, %s, %s, %s, %s", keyGenHandleNilInt(chainID), typeArg.String(), duration.String(), platform.String())
if useCache != nil && *useCache {
locker := r.CacheMutex.Lock(cacheKey)
Method BackfillSuite.withdrawParity
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (b *BackfillSuite) withdrawParity(log *types.Log, parser *parser.BridgeParser, chainID uint32, useV1 bool) error {
// parse the log
if useV1 {
parsedLog, err := parser.FiltererV1.ParseTokenWithdraw(*log)
if err != nil {
Method BackfillSuite.mintParity
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (b *BackfillSuite) mintParity(log *types.Log, parser *parser.BridgeParser, chainID uint32, useV1 bool) error {
// parse the log
if useV1 {
parsedLog, err := parser.Filterer.ParseTokenMint(*log)
if err != nil {
Function NewClickhouseStore
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func NewClickhouseStore(src string) (func(), *int, error) {
timeout := time.Second
port := freeport.GetPort()
portStr := strconv.Itoa(port)
conn, err := net.DialTimeout("tcp", net.JoinHostPort("localhost", portStr), timeout)
Method IndexerSuite.TestContractBackfillFromPreIndexed
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (x *IndexerSuite) TestContractBackfillFromPreIndexed() {
// Get simulated blockchain, deploy the test contract, and set up test variables.
simulatedChain := geth.NewEmbeddedBackendForChainID(x.GetSuiteContext(), x.T(), big.NewInt(142))
simulatedClient, err := backend.DialBackend(x.GetTestContext(), simulatedChain.RPCAddress(), x.metrics)
Nil(x.T(), err)
Function TestCombineStreams
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestCombineStreams(t *testing.T) {
tests := []struct {
name string
inputs []string
expectedOutput []string
Function TestGetEnvBool
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestGetEnvBool(t *testing.T) {
type args struct {
name string
defaultVal bool
}
Function SecuritySection
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function SecuritySection() {
const t = useTranslations('Landing.SecuritySection')
return (
<SectionContainer
Function txErrorHandler
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const txErrorHandler = (err: any) => {
if (err?.details && checkStringForRejection(err?.details)) {
return toast.error('User denied transaction', {
id: 'toast-error-user-reject',
duration: 5000,
Function ConfirmDestinationAddressWarning
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const ConfirmDestinationAddressWarning = () => {
const dispatch = useAppDispatch()
const t = useTranslations('Destination')
const {
Method chainQueue.bumpTX
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (c *chainQueue) bumpTX(parentCtx context.Context, ogTx db.TX) (err error) {
if !c.isBumpIntervalElapsed(ogTx) {
c.addToReprocessQueue(ogTx)
return nil
}
Function TestSnapshotRootAndProofs
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestSnapshotRootAndProofs(t *testing.T) {
// TODO (Max Planck): Fix me
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()
Method QuoteRequestHandler.commitPendingBalance
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (q *QuoteRequestHandler) commitPendingBalance(ctx context.Context, span trace.Span, request *reldb.QuoteRequest) (err error) {
// lock the consumed balance
key := getBalanceMtxKey(q.Dest.ChainID, request.Transaction.DestToken)
span.SetAttributes(attribute.String("balance_lock_key", key))
unlocker, ok := q.balanceMtx.TryLock(key)