grokify/mogo

View on GitHub

Showing 159 of 159 total issues

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 WriteCSVFiltered has 5 return statements (exceeds 4 allowed).
    Open

    func WriteCSVFiltered(reader *csv.Reader, writer *csv.Writer, andFilter map[string]stringsutil.MatchInfo, writeHeader bool) error {
        csvHeader := CSVHeader{}
        i := -1
        for {
            line, err := reader.Read()
    Severity: Major
    Found in encoding/csvutil/write.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

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

        func (rng *RangeFloat64) binarySearch(v float64, l, r int32) (int32, error) {
            rng.iter += 1
            if rng.iter > MaxTries {
                return int32(0), fmt.Errorf("too many (%v) binary search iterations", MaxTries)
            }
        Severity: Major
        Found in math/mathutil/rangefloat64.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

            Method TimeMore.SeasonMeteorological has 5 return statements (exceeds 4 allowed).
            Open

            func (tm TimeMore) SeasonMeteorological() Yearquarter {
                m := tm.time.Month()
                if m < 3 {
                    return Winter // Starts December 1
                } else if m < 6 {
            Severity: Major
            Found in time/timeutil/timemore.go - About 35 mins to fix

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

              func NewRequest(method, url string, params url.Values, files []FileInfo) (*http.Request, error) {
                  mb := NewMultipartBuilder()
                  err := mb.WriteURLValues(params)
                  if err != nil {
                      return nil, err
              Severity: Major
              Found in mime/multipartutil/multipart_request.go - About 35 mins to fix

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

                func RatioInt(x1, y1, x2, y2 int) (int, int) {
                    if x2 > 0 && y2 > 0 {
                        return x2, y2
                    } else if x2 <= 0 && y2 <= 0 {
                        return x1, y1
                Severity: Major
                Found in math/ratio/ratio.go - About 35 mins to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  func (c *Currency) TrimSpace() {
                      c.Code = strings.TrimSpace(c.Code)
                      c.Symbol = strings.TrimSpace(c.Symbol)
                      c.Country = strings.TrimSpace(c.Country)
                      c.Name = strings.TrimSpace(c.Name)
                  Severity: Minor
                  Found in text/currencyutil/currencies.go and 1 other location - About 35 mins to fix
                  crypto/pkcs12util/pkcs12util.go on lines 24..29

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 104.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  func (opts *Options) TrimSpace() {
                      opts.In = strings.TrimSpace(opts.In)
                      opts.InKey = strings.TrimSpace(opts.InKey)
                      opts.CertFile = strings.TrimSpace(opts.CertFile)
                      opts.Out = strings.TrimSpace(opts.Out)
                  Severity: Minor
                  Found in crypto/pkcs12util/pkcs12util.go and 1 other location - About 35 mins to fix
                  text/currencyutil/currencies.go on lines 29..34

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 104.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  func (imgs Images) DxMin() int {
                      dxMin := 0
                      for i, img := range imgs {
                          if i == 0 {
                              dxMin = img.Bounds().Dx()
                  Severity: Minor
                  Found in image/imageutil/images.go and 1 other location - About 35 mins to fix
                  image/imageutil/images.go on lines 83..93

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 103.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  func (imgs Images) DyMin() int {
                      dyMin := 0
                      for i, img := range imgs {
                          if i == 0 {
                              dyMin = img.Bounds().Dy()
                  Severity: Minor
                  Found in image/imageutil/images.go and 1 other location - About 35 mins to fix
                  image/imageutil/images.go on lines 39..49

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 103.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  func (sint *SliceInt) Min() (int, error) {
                      if len(sint.Elements) == 0 {
                          return 0, ErrEmptyList
                      }
                      if !sort.IntsAreSorted(sint.Elements) {
                  Severity: Minor
                  Found in math/mathutil/sliceint.go and 1 other location - About 30 mins to fix
                  math/mathutil/slicefloat64.go on lines 38..46

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 102.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  func (sf64 *SliceFloat64) Min() (float64, error) {
                      if len(sf64.Elements) == 0 {
                          return 0, ErrEmptyList
                      }
                      if !sort.Float64sAreSorted(sf64.Elements) {
                  Severity: Minor
                  Found in math/mathutil/slicefloat64.go and 1 other location - About 30 mins to fix
                  math/mathutil/sliceint.go on lines 35..43

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 102.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  func DaysToDow(baseDow, wantDow time.Weekday, wantInclusive bool) int {
                      deltaDays1 := int(WeekdayNormalized(wantDow)) - int(WeekdayNormalized(baseDow))
                      deltaDays2 := deltaDays1
                      if deltaDays2 < 0 {
                          deltaDays2 += 7
                  Severity: Minor
                  Found in time/timeutil/timeutil_delta.go and 1 other location - About 30 mins to fix
                  time/timeutil/timeutil_delta.go on lines 81..91

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 101.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                  func SignRS384(r *rsa.PrivateKey, data []byte) ([]byte, error) {
                      h := sha512.New384()
                      h.Write(data)
                      d := h.Sum(nil)
                      return rsa.SignPKCS1v15(rand.Reader, r, crypto.SHA384, d)
                  Severity: Minor
                  Found in crypto/rsautil/pkcs1util.go and 2 other locations - About 30 mins to fix
                  crypto/rsautil/pkcs1util.go on lines 13..18
                  crypto/rsautil/pkcs1util.go on lines 29..34

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 101.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                  func SignRS256(r *rsa.PrivateKey, data []byte) ([]byte, error) {
                      h := sha256.New()
                      h.Write(data)
                      d := h.Sum(nil)
                      return rsa.SignPKCS1v15(rand.Reader, r, crypto.SHA256, d)
                  Severity: Minor
                  Found in crypto/rsautil/pkcs1util.go and 2 other locations - About 30 mins to fix
                  crypto/rsautil/pkcs1util.go on lines 21..26
                  crypto/rsautil/pkcs1util.go on lines 29..34

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 101.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                  func SignRS512(r *rsa.PrivateKey, data []byte) ([]byte, error) {
                      h := sha512.New()
                      h.Write(data)
                      d := h.Sum(nil)
                      return rsa.SignPKCS1v15(rand.Reader, r, crypto.SHA512, d)
                  Severity: Minor
                  Found in crypto/rsautil/pkcs1util.go and 2 other locations - About 30 mins to fix
                  crypto/rsautil/pkcs1util.go on lines 13..18
                  crypto/rsautil/pkcs1util.go on lines 21..26

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 101.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  func DaysAgoDow(baseDow, wantDow time.Weekday, wantInclusive bool) int {
                      deltaDays1 := int(WeekdayNormalized(baseDow)) - int(WeekdayNormalized(wantDow))
                      deltaDays2 := deltaDays1
                      if deltaDays2 < 0 {
                          deltaDays2 += 7
                  Severity: Minor
                  Found in time/timeutil/timeutil_delta.go and 1 other location - About 30 mins to fix
                  time/timeutil/timeutil_delta.go on lines 106..116

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 101.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language