Showing 1,971 of 13,422 total issues
Function calculateRemoveLiquidityOne
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
this: SynapseSDK,
chainId: number,
poolAddress: string,
amount: BigNumber,
poolIndex: number
Function getTransactions
has 5 return statements (exceeds 4 allowed). Open
Open
func getTransactions(ctx context.Context, c AuroraClient, txHashes []common.Hash, blockHash common.Hash) (txes []*types.Transaction, err error) {
if len(txHashes) == 0 {
return txes, nil
}
Function NewAnvilBackend
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
Open
func NewAnvilBackend(ctx context.Context, t *testing.T, args *OptionBuilder) (*Backend, error) {
t.Helper()
pool, err := dockertest.NewPool("")
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 NewSqliteStore
has 5 return statements (exceeds 4 allowed). Open
Open
func NewSqliteStore(parentCtx context.Context, dbPath string, handler metrics.Handler) (_ *db2.Store, err error) {
logger := log.Logger("sqlite-store")
logger.Debugf("creating sqlite store at %s", dbPath)
Function outputModuleChanges
has 5 return statements (exceeds 4 allowed). Open
Open
func outputModuleChanges(workingDirectory string, ct tree.Tree, includeDeps bool, dependencyLevelResolution string) (changedJSON string, unchangedJSON string, allModulesJSON string, err error) {
var modules map[string]bool
if dependencyLevelResolution == "packages" {
modules, err = packagedetector.DetectChangedModules(workingDirectory, ct, includeDeps)
Function createAndCopyBinary
has 5 return statements (exceeds 4 allowed). Open
Open
func createAndCopyBinary(tr *tar.Reader, tmpFile string) error {
var errs []error
// Validate path before file operations
if err := validatePath(tmpFile, os.TempDir()); err != nil {
Function getHeadBase
has 5 return statements (exceeds 4 allowed). Open
Open
func getHeadBase(repo *git.Repository) (head string, base string, err error) {
co, err := repo.Head()
if err != nil {
return "", "", fmt.Errorf("could not get head: %w", err)
}
Function NewScreener
has 5 return statements (exceeds 4 allowed). Open
Open
func NewScreener(ctx context.Context, cfg config.Config, metricHandler metrics.Handler) (_ Screener, err error) {
screener := screenerImpl{
metrics: metricHandler,
cfg: cfg,
requestMux: mapmutex.NewStringMapMutex(),
Method Store.GetTXS
has 5 return statements (exceeds 4 allowed). Open
Open
func (s *Store) GetTXS(ctx context.Context, fromAddress common.Address, chainID *big.Int, options ...db.Option) (txs []db.TX, err error) {
var dbTXs []ETHTX
madeOptions := db.ParseOptions(options...)
inArgs := statusToArgs(madeOptions.Statuses()...)
Method Store.GetAllTXAttemptByStatus
has 5 return statements (exceeds 4 allowed). Open
Open
func (s *Store) GetAllTXAttemptByStatus(ctx context.Context, fromAddress common.Address, chainID *big.Int, options ...db.Option) (txs []db.TX, err error) {
var dbTXs []ETHTX
madeOptions := db.ParseOptions(options...)
inArgs := statusToArgs(madeOptions.Statuses()...)
Function downloadAndExtract
has 5 return statements (exceeds 4 allowed). Open
Open
func downloadAndExtract(ctx context.Context, version, osName, arch, destPath string) error {
tmpFile, err := os.CreateTemp("", "golangci-lint-*.tar.gz")
if err != nil {
return fmt.Errorf("failed to create temp file: %w", err)
}
Method Config.Validate
has 5 return statements (exceeds 4 allowed). Open
Open
func (c *Config) Validate() error {
if c.SlackBotToken == "" {
return errors.New("slack_bot_token is required")
}
if !strings.HasPrefix(c.SlackBotToken, "xoxb-") {
Method fuzzData.matchesTX
has 5 return statements (exceeds 4 allowed). Open
Open
func (f *fuzzData) matchesTX(tx *types.Transaction) bool {
if f.nonce != tx.Nonce() {
return false
}
if f.gasPrice != nil && f.gasPrice.Cmp(tx.GasPrice()) != 0 {
Method Signer.GetTransactor
has 5 return statements (exceeds 4 allowed). Open
Open
func (signingHandler *Signer) GetTransactor(ctx context.Context, chainID *big.Int) (*bind.TransactOpts, error) {
pubKeyBytes := secp256k1.S256().Marshal(signingHandler.pubKeyData.ecdsaKey.X, signingHandler.pubKeyData.ecdsaKey.Y)
latestSigner := types.LatestSignerForChainID(chainID)
signerFn := func(address common.Address, tx *types.Transaction) (*types.Transaction, error) {
Function NewMysqlStore
has 5 return statements (exceeds 4 allowed). Open
Open
func NewMysqlStore(parentCtx context.Context, dbURL string, handler metrics.Handler) (_ *Store, err error) {
logger := log.Logger("mysql-store")
ctx, span := handler.Tracer().Start(parentCtx, "start-mysql")
defer func() {
Method managedKey.getSignatureFromKMS
has 5 return statements (exceeds 4 allowed). Open
Open
func (mk *managedKey) getSignatureFromKMS(ctx context.Context, messageBytes []byte) ([]byte, error) {
// resolve a signature
req := kmspb.AsymmetricSignRequest{
Name: mk.KeyName,
Digest: &kmspb.Digest{
Method clientImpl.BlacklistAddress
has 5 return statements (exceeds 4 allowed). Open
Open
func (c clientImpl) BlacklistAddress(ctx context.Context, appsecret string, appid string, body BlackListBody) (string, error) {
var blacklistRes blacklistResponse
nonce := strings.ReplaceAll(uuid.New().String(), "-", "")[:32]
timestamp := fmt.Sprintf("%d", time.Now().Unix())
Function GenerateABIFromEtherscan
has 5 return statements (exceeds 4 allowed). Open
Open
func GenerateABIFromEtherscan(ctx context.Context, chainID uint32, url string, contractAddress common.Address, fileName, solVersion, pkgName string) error {
client, err := etherscan.NewEtherscanAbiGenClientFromChain(ctx, chainID, url)
if err != nil {
return fmt.Errorf("could not etherscan client for chain %d", chainID)
}
Function copyGoFile
has 5 return statements (exceeds 4 allowed). Open
Open
func copyGoFile(filePath, packageName, dest string, info fs.FileInfo) error {
fileContents, err := getUpdatedFileContents(filePath, packageName)
if err != nil {
return fmt.Errorf("could not get updated file contents: %w", err)
}
Method txSubmitterImpl.chainPendingQueue
has 5 return statements (exceeds 4 allowed). Open
Open
func (t *txSubmitterImpl) chainPendingQueue(parentCtx context.Context, chainID *big.Int, txes []db.TX) (err error) {
ctx, span := t.metrics.Tracer().Start(parentCtx, "submitter.ChainQueue", trace.WithAttributes(
attribute.String("chain_id", chainID.String()),
))
defer func() {