grokify/mogo

View on GitHub

Showing 98 of 159 total issues

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

func DirRemoveAllChildren(dir string) error {
    isDir, err := IsDir(dir)
    if err != nil {
        return err
    }
Severity: Major
Found in os/osutil/dir.go - About 40 mins to fix

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

    func CopyFile(src, dst string) error {
        r, err := os.Open(src)
        if err != nil {
            return err
        }
    Severity: Major
    Found in os/osutil/copy.go - About 40 mins to fix

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

      func AnyStringToQuarterTime(yyyyqSrcStr string) time.Time {
          yyyyqSrcStr = strings.TrimSpace(yyyyqSrcStr)
          // If not a string, return now time.
          if len(yyyyqSrcStr) != 5 {
              return time.Now().UTC()
      Severity: Major
      Found in time/timeutil/quarter_int.go - About 40 mins to fix

        Method SliceInt.BuildStats has 6 return statements (exceeds 4 allowed).
        Open

        func (sint *SliceInt) BuildStats() (SliceIntStats, error) {
            stats := NewSliceIntStats()
            stats.Len = sint.Len()
            max, err := sint.Max()
            if err != nil {
        Severity: Major
        Found in math/mathutil/sliceint.go - About 40 mins to fix

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

          func AddFileToArchive(tw *tar.Writer, filename, archivename string) error {
              // Open the file which will be written into the archive
              file, err := os.Open(filename)
              if err != nil {
                  return err
          Severity: Major
          Found in archive/tarutil/writer.go - About 40 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

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

              func Dd6ToTime(dd6 string, reverse bool) (time.Time, error) {
                  dd6 = strings.ToLower(strings.TrimSpace(dd6))
                  yyyy := ""
                  mm36 := ""
                  dd36 := ""
              Severity: Major
              Found in time/timeutil/day.go - About 40 mins to fix

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

                func GetWriteFile(client *http.Client, url, filename string) (*http.Response, error) {
                    if client == nil {
                        client = &http.Client{}
                    }
                    resp, err := client.Get(url)
                Severity: Major
                Found in net/http/httputilmore/http_request.go - About 40 mins to fix

                  Method SliceFloat64.BuildStats has 6 return statements (exceeds 4 allowed).
                  Open

                  func (sf64 *SliceFloat64) BuildStats() (SliceFloat64Stats, error) {
                      stats := NewSliceFloat64Stats()
                      stats.Len = sf64.Len()
                      max, err := sf64.Max()
                      if err != nil {
                  Severity: Major
                  Found in math/mathutil/slicefloat64.go - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                        if t.Before(tr.Min) || t.After(tr.Max) ||
                            (!inclusiveMin && t.Equal(tr.Min)) ||
                            (!inclusiveMax && t.Equal(tr.Max)) {
                    Severity: Major
                    Found in time/timeutil/time_range.go - About 40 mins to fix

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

                      func VisitFiles(name string, visitFunc func(dir string, info fs.FileInfo) error) error {
                          fileInfo, err := os.Stat(name)
                          if err != nil {
                              return err
                          }
                      Severity: Major
                      Found in os/osutil/dir.go - About 40 mins to fix

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

                        func DT6sToString(startDT6, endDT6 int32, layout, presentText, prefixText, joinText, suffixText string) (string, error) {
                            if startDT6 <= 0 && endDT6 <= 0 {
                                return "", nil
                            }
                            startText, endText, err := DT6sToStrings(startDT6, endDT6, layout, presentText)
                        Severity: Major
                        Found in time/month/strconv.go - About 40 mins to fix

                          Consider simplifying this complex logical expression.
                          Open

                                  if !(inclExists && inclNotExists) &&
                                      ((!inclExists && exists) || (!inclNotExists && !exists)) {
                          Severity: Major
                          Found in path/filepathutil/filepathutil.go - About 40 mins to fix

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

                            func GetRSAPublicKeyForPKCS8PublicKeyPath(pubKeyPkcs8Path string) (*rsa.PublicKey, error) {
                                var pubKey *rsa.PublicKey
                            
                                isFile, err := osutil.IsFile(pubKeyPkcs8Path, true)
                                if err != nil {
                            Severity: Major
                            Found in crypto/x509util/x509util.go - About 40 mins to fix

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

                              func AddFileToZip(zipWriter *zip.Writer, filename string, removePaths bool) error {
                                  fileToZip, err := os.Open(filename)
                                  if err != nil {
                                      return err
                                  }
                              Severity: Major
                              Found in compress/ziputil/create_achive.go - About 40 mins to fix

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

                                func ValidAlphabets(a1, a2 string, a2optional bool) error {
                                    if a1 == "" {
                                        return errors.New("alphabet 1 cannot be empty")
                                    } else if !stringsutil.UniqueRunes(a1) {
                                        return errors.New("alphabet 1 chars are not unique")
                                Severity: Major
                                Found in encoding/basex/encoding.go - About 40 mins to fix

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

                                  func ParseEndpoint(s string) (*Endpoint, error) {
                                      parts := strings.Fields(s)
                                      if len(parts) == 0 {
                                          return nil, errors.New("empty string cannot be parsed as RUL")
                                      } else if len(parts) == 1 {
                                  Severity: Major
                                  Found in net/http/httputilmore/endpoint.go - About 40 mins to fix

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

                                    func AbsFilepath(path string) (string, error) {
                                        path = strings.TrimSpace(path)
                                        if len(path) == 0 {
                                            return path, nil
                                        } else if filepath.IsAbs(path) {
                                    Severity: Major
                                    Found in os/osutil/osutil.go - About 40 mins to fix

                                      Function LogOrNot has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                      func LogOrNot(ctx context.Context, logger *slog.Logger, level slog.Level, msg string, attrs ...slog.Attr) {
                                      Severity: Minor
                                      Found in log/slogutil/slogutil.go - About 35 mins to fix

                                        Function JoinInterface has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                        func JoinInterface(arr []any, sep string, stripRepeatedSep bool, stripEmbeddedSep bool, altSep string) string {
                                        Severity: Minor
                                        Found in type/stringsutil/stringsutil.go - About 35 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language