grokify/mogo

View on GitHub
type/interfaceutil/interfaceutil.go

Summary

Maintainability
A
3 hrs
Test Coverage

Function ToInt has 8 return statements (exceeds 4 allowed).
Open

func ToInt(v any, defaultValue int) int {
    if v == nil {
        return defaultValue
    } else if valBool, ok := v.(bool); ok {
        if valBool {
Severity: Major
Found in type/interfaceutil/interfaceutil.go - About 50 mins to fix

    Avoid deeply nested control flow statements.
    Open

        } else if valFloat, ok := v.(float64); ok {
            return valFloat != 0.0
        }
    Severity: Major
    Found in type/interfaceutil/interfaceutil.go - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

          } else if valFloat, ok := v.(float64); ok {
              return int(valFloat)
          } else {
              return defaultValue
          }
      Severity: Major
      Found in type/interfaceutil/interfaceutil.go - About 45 mins to fix

        Function ToBool has 6 return statements (exceeds 4 allowed).
        Open

        func ToBool(v any) bool {
            if v == nil {
                return false
            } else if valBool, ok := v.(bool); ok {
                return valBool
        Severity: Major
        Found in type/interfaceutil/interfaceutil.go - About 40 mins to fix

          There are no issues that match your filters.

          Category
          Status