Showing 1,971 of 13,422 total issues
Function DetectChangedModules
has 5 return statements (exceeds 4 allowed). Open
Open
func DetectChangedModules(repoPath string, ct tree.Tree, includeDeps bool) (modules map[string]bool, err error) {
modules = make(map[string]bool)
goWorkPath := path.Join(repoPath, "go.work")
Function ParseCall
has 5 return statements (exceeds 4 allowed). Open
Open
func ParseCall(step model.TraceStep) (map[string]string, error) {
result := make(map[string]string)
stack := GenerateStack(step.Stack)
memory := GenerateMemory(step.Memory)
gas := AccessStack(stack, 0)
Function DetectChangedModules
has 5 return statements (exceeds 4 allowed). Open
Open
func DetectChangedModules(repoPath string, ct tree.Tree, includeDeps bool) (modules map[string]bool, err error) {
modules = make(map[string]bool)
goWorkPath := path.Join(repoPath, "go.work")
Function loadConfig
has 5 return statements (exceeds 4 allowed). Open
Open
func loadConfig() *signoz.Client {
cfg := config{}
var configFormFields []huh.Field
Function resolveAddr
has 5 return statements (exceeds 4 allowed). Open
Open
func resolveAddr(ctx context.Context, client KeyClient, keyName string) (address common.Address, pubKeyBytes []byte, _ error) {
resp, err := client.GetPublicKey(ctx, &kmspb.GetPublicKeyRequest{Name: keyName})
if err != nil {
return common.Address{}, []byte{}, fmt.Errorf("google KMS public key %q lookup: %w", keyName, err)
}
Function newOtelRecorder
has 5 return statements (exceeds 4 allowed). Open
Open
func newOtelRecorder(meterHandler metrics.Handler, chainID int, name string) (_ iOtelRecorder, err error) {
or := otelRecorder{
metrics: meterHandler,
meter: meterHandler.Meter(meterName),
lastBlock: nil,
Function validatePath
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
Open
func validatePath(path string, allowedDirs ...string) error {
// Get repository root using go-findroot
root, err := find.Repo()
if err == nil {
// Add repository root to allowed directories
- 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 AddDirectoryPaths
has 5 return statements (exceeds 4 allowed). Open
Open
func AddDirectoryPaths(tree Tree, dirPath, trimPrefix string) error {
err := filepath.Walk(dirPath, func(path string, _ os.FileInfo, err error) error {
if err != nil {
return fmt.Errorf("error walking path %s: %w", path, err)
}
Function setupLinter
has 5 return statements (exceeds 4 allowed). Open
Open
func setupLinter(ctx context.Context, version, osName, arch string) (string, error) {
root, err := find.Repo()
if err != nil {
return "", fmt.Errorf("failed to get repository root: %w", err)
}
Method fileRateLimiter.obtainLock
has 5 return statements (exceeds 4 allowed). Open
Open
func (f *fileRateLimiter) obtainLock(ctx context.Context) (ok bool, err error) {
f.mux.Lock()
err = f.openFile()
if err != nil {
return false, fmt.Errorf("could not open file: %w", err)
Function UnpackInputDataToInterface
has 5 return statements (exceeds 4 allowed). Open
Open
func UnpackInputDataToInterface(v interface{}, input []byte, metadata *bind.MetaData) error {
abiData, err := metadata.GetAbi()
if err != nil {
return fmt.Errorf("failed to get abiData: %w", err)
}
Function setupOtterscan
has 5 return statements (exceeds 4 allowed). Open
Open
func setupOtterscan(ctx context.Context, tb testing.TB, pool *dockertest.Pool, anvilResource *dockertest.Resource, args *OptionBuilder) (string, error) {
tb.Helper()
runOptions := &dockertest.RunOptions{
Repository: "otterscan/otterscan",
Function validatePath
has 5 return statements (exceeds 4 allowed). Open
Open
func validatePath(path string, allowedDirs ...string) error {
// Get repository root using go-findroot
root, err := find.Repo()
if err == nil {
// Add repository root to allowed directories
Method nonceManagerImp.SignTx
has 5 return statements (exceeds 4 allowed). Open
Open
func (n *nonceManagerImp) SignTx(ogTx *types.Transaction, signer types.Signer, prv *ecdsa.PrivateKey, options ...Option) (*types.Transaction, error) {
cfg := &signTXConfig{}
for _, opt := range options {
opt(cfg)
Function FromRandom
has 5 return statements (exceeds 4 allowed). Open
Open
func FromRandom() (Wallet, error) {
newSeed, err := hdwallet.NewSeed()
if err != nil {
return nil, fmt.Errorf("could not generate seed: %w", err)
}
Method exporter.getAllTokens
has 5 return statements (exceeds 4 allowed). Open
Open
func (e *exporter) getAllTokens(parentCtx context.Context) (allTokens Tokens, err error) {
allTokens = []TokenConfig{}
ctx, span := e.metrics.Tracer().Start(parentCtx, "get_all_tokens")
Method exporter.fetchAllQuotes
has 5 return statements (exceeds 4 allowed). Open
Open
func (e *exporter) fetchAllQuotes(ctx context.Context, url string) ([]rfqAPIModel.GetQuoteResponse, error) {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if err != nil {
return nil, fmt.Errorf("could not get quotes: %w", err)
}
Method Guard.isStateSlashable
has 5 return statements (exceeds 4 allowed). Open
Open
func (g Guard) isStateSlashable(ctx context.Context, state types.State) (bool, error) {
statePayload, err := state.Encode()
if err != nil {
return false, fmt.Errorf("could not encode state: %w", err)
}
Method AgentConfig.IsValid
has 5 return statements (exceeds 4 allowed). Open
Open
func (a *AgentConfig) IsValid(ctx context.Context) (ok bool, err error) {
if int64(a.RefreshIntervalSeconds) == int64(0) {
return false, fmt.Errorf("refresh_interval_seconds cannot be 0")
}
Method receiptsProxyImpl.ProxyRequest
has 5 return statements (exceeds 4 allowed). Open
Open
func (r *receiptsProxyImpl) ProxyRequest(c *gin.Context) (err error) {
ctx, span := r.handler.Tracer().Start(c, "ProxyRequest",
trace.WithAttributes(attribute.String("endpoint", r.proxyURL)),
)