grokify/mogo

View on GitHub

Showing 90 of 147 total issues

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

func ReadCSVFilesSingleColumnValuesString(files []string, sep rune, hasHeader, trimSpace bool, colIdx uint, condenseUniqueSort bool) ([]string, error) {
Severity: Minor
Found in encoding/csvutil/single_column.go - About 35 mins to fix

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

    func BuildGifAnimationSimpleRead(src *gif.GIF, delay int, names []string, f ToPalettedFunc, consistentSize bool) (*gif.GIF, error) {
    Severity: Minor
    Found in image/imageutil/animate.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

        Function NumQuartersInt32 has 5 return statements (exceeds 4 allowed).
        Open

        func NumQuartersInt32(start, end int32) (int, error) {
            start, end = mathutil.MinMaxInt32(start, end)
            if !IsQuarterInt32(start) {
                return -1, fmt.Errorf("quarterInt32 is not valid [%v] Must end in [1-4]", start)
            }
        Severity: Major
        Found in time/timeutil/quarter_int.go - About 35 mins to fix

          Method Times.IsSorted has 5 return statements (exceeds 4 allowed).
          Open

          func (ts Times) IsSorted(asc bool) bool {
              deltas := ts.Deltas()
              if len(deltas) == 0 {
                  return true
              }
          Severity: Major
          Found in time/timeutil/times.go - About 35 mins to fix

            Function ParseTimeRangeInterval has 5 return statements (exceeds 4 allowed).
            Open

            func ParseTimeRangeInterval(s string) (TimeRange, error) {
                s1 := strings.ToUpper(strings.TrimSpace(s))
                m := rxParseTimeRange.FindStringSubmatch(s1)
                if len(m) == 0 {
                    return TimeRange{}, fmt.Errorf("cannot parse time range rx (%s)", s)
            Severity: Major
            Found in time/timeutil/time_range.go - About 35 mins to fix

              Function CreateFileWithLines has 5 return statements (exceeds 4 allowed).
              Open

              func CreateFileWithLines(filename string, lines []string, lineSuffix string, useBuffer bool) error {
                  f, err := os.Create(filename)
                  if err != nil {
                      return err
                  }
              Severity: Major
              Found in os/osutil/osutil.go - About 35 mins to fix

                Function IsType has 5 return statements (exceeds 4 allowed).
                Open

                func IsType(mediaType, s string) bool {
                    mediaType = strings.ToLower(strings.TrimSpace(mediaType))
                    s = strings.ToLower(strings.TrimSpace(s))
                    if s == mediaType {
                        return true
                Severity: Major
                Found in mime/mimeutil/mediatype.go - About 35 mins to fix

                  Function ReadImageHTTP has 5 return statements (exceeds 4 allowed).
                  Open

                  func ReadImageHTTP(imageURL string) (image.Image, string, error) {
                      imageURL = strings.TrimSpace(imageURL)
                      if !urlutil.IsHTTP(imageURL, true, true) {
                          return nil, "", errors.New("url is not valid")
                      }
                  Severity: Major
                  Found in image/imageutil/read.go - About 35 mins to fix

                    Method RangeInt64.binarySearch has 5 return statements (exceeds 4 allowed).
                    Open

                    func (rng *RangeInt64) binarySearch(v int64, l, r int32) (int32, error) {
                        rng.iter += 1
                        if rng.iter > MaxTries {
                            return int32(0), fmt.Errorf("struct RangeInt64 too many (%v) binary search iterations", MaxTries)
                        }
                    Severity: Major
                    Found in math/mathutil/rangeint64.go - About 35 mins to fix

                      Function ParseJSONPointer has 5 return statements (exceeds 4 allowed).
                      Open

                      func ParseJSONPointer(s string) (JSONPointer, error) {
                          anchorSlash := "#/"
                          slash := "/"
                          ptr := JSONPointer{String: s}
                          if strings.Index(s, anchorSlash) == 0 {
                      Severity: Major
                      Found in encoding/jsonpointer/parser.go - About 35 mins to fix

                        Method MapStringInt.Sorted has 5 return statements (exceeds 4 allowed).
                        Open

                        func (msi MapStringInt) Sorted(sortBy string) []Record {
                            sortBy = strings.ToLower(strings.TrimSpace(sortBy))
                            records := []Record{}
                            for name, count := range msi {
                                records = append(records, Record{Name: name, Value: count})
                        Severity: Major
                        Found in type/maputil/map_string_int.go - About 35 mins to fix

                          Function newWriterExif has 5 return statements (exceeds 4 allowed).
                          Open

                          func newWriterExif(w io.Writer, exif []byte) (io.Writer, error) {
                              // Adapted from the following under MIT license: https://github.com/jdeng/goheif/blob/a0d6a8b3e68f9d613abd9ae1db63c72ba33abd14/heic2jpg/main.go
                              // See more here: https://en.wikipedia.org/wiki/JPEG_File_Interchange_Format
                              // https://www.codeproject.com/Articles/47486/Understanding-and-Reading-Exif-Data
                              wExif := ioutil.NewSkipWriter(w, 2)
                          Severity: Major
                          Found in image/imageutil/write.go - About 35 mins to fix

                            Method String.UnmarshalJSON has 5 return statements (exceeds 4 allowed).
                            Open

                            func (s *String) UnmarshalJSON(data []byte) error {
                                var a any
                            
                                if err := json.Unmarshal(data, &a); err != nil {
                                    panic(err)
                            Severity: Major
                            Found in encoding/jsonutil/tolerant_reader_types.go - About 35 mins to fix

                              Function CondenseResponseNot2xxToError has 5 return statements (exceeds 4 allowed).
                              Open

                              func CondenseResponseNot2xxToError(resp *http.Response, err error, msg string) error {
                                  if err != nil {
                                      if len(msg) > 0 {
                                          return errorsutil.Wrap(err, msg)
                                      } else {
                              Severity: Major
                              Found in net/http/httputilmore/http_response.go - About 35 mins to fix

                                Function TokenMatchLeft has 5 return statements (exceeds 4 allowed).
                                Open

                                func TokenMatchLeft(tokFilter, tok html.Token, attrValMatchinfo *stringsutil.MatchInfo) bool {
                                    if tokFilter.Type != tok.Type {
                                        return false
                                    } else if tokFilter.DataAtom != tok.DataAtom {
                                        return false
                                Severity: Major
                                Found in html/htmlutil/token.go - About 35 mins to fix

                                  Function ParseCurrency has 5 return statements (exceeds 4 allowed).
                                  Open

                                  func ParseCurrency(opts *ParseCurrencyOpts, s string) (string, float64, error) {
                                      try := strings.TrimSpace(s)
                                      if len(try) == 0 {
                                          return "", 0, nil
                                      }
                                  Severity: Major
                                  Found in text/currencyutil/parse.go - About 35 mins to fix

                                    Function ModifyConnectionRequest has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func ModifyConnectionRequest(conn net.Conn, modRequest func(r *http.Request) error) error {
                                        // Code adapted from: https://stackoverflow.com/a/76684845/1908967
                                        if conn == nil {
                                            return errors.New("net.Conn cannot be nil")
                                        }
                                    Severity: Major
                                    Found in net/netutil/connection.go - About 35 mins to fix

                                      Function SplitBest has 5 return statements (exceeds 4 allowed).
                                      Open

                                      func SplitBest(path string) (dir, file string, err error) {
                                          isDir, err := IsDir(path)
                                          if err != nil {
                                              return "", "", err
                                          } else if isDir {
                                      Severity: Major
                                      Found in os/osutil/filepath.go - About 35 mins to fix

                                        Function writeJPEG has 5 return statements (exceeds 4 allowed).
                                        Open

                                        func writeJPEG(w io.Writer, img image.Image, opt *JPEGEncodeOptions) error {
                                            if w == nil {
                                                return ErrWriterNotSet
                                            } else if img == nil {
                                                return ErrImageNotSet
                                        Severity: Major
                                        Found in image/imageutil/image_ext.go - About 35 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language