tsuz/go-pine

View on GitHub

Showing 34 of 45 total issues

Avoid deeply nested control flow statements.
Open

                    for i := 1; i < int(l)+1; i++ {
                        if prevFirstVal.prev == nil {
                            break
                        }
                        removelb++
Severity: Major
Found in pine/series_rsi.go - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if int64(removelb) == l+1 {
                            toAdd := math.Max(v.v-v.prev.v, 0)
                            remval := math.Max(prevFirstVal.next.v-prevFirstVal.v, 0)
                            newrsiu := prevr.v - remval + toAdd
                            rsiu.Set(v.t, newrsiu)
    Severity: Major
    Found in pine/series_rsi.go - About 45 mins to fix

      Method ohlcvBaseSeries.Next has 7 return statements (exceeds 4 allowed).
      Open

      func (s *ohlcvBaseSeries) Next() (*OHLCV, error) {
          if s.cur == nil {
              if len(s.vals) == 0 {
                  return nil, nil
              }
      Severity: Major
      Found in pine/ohlcv_series_base.go - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if int64(removelb) == l+1 {
                                toAdd := math.Max(v.prev.v-v.v, 0)
                                remval := math.Max(prevFirstVal.v-prevFirstVal.next.v, 0)
                                newrsiu := prevr.v - remval + toAdd
                                rsid.Set(v.t, newrsiu)
        Severity: Major
        Found in pine/series_rsi.go - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              for i := 1; i < int(l)+1; i++ {
                                  if prevFirstVal.prev == nil {
                                      break
                                  }
                                  removelb++
          Severity: Major
          Found in pine/series_rsi.go - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if ct == l {
                                    break
                                }
            Severity: Major
            Found in pine/series_sum.go - About 45 mins to fix

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

              func KC(src ValueSeries, o OHLCVSeries, l int64, mult float64, usetr bool) (middle, upper, lower ValueSeries) {
              Severity: Minor
              Found in pine/series_kc.go - About 35 mins to fix

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

                func CCI(tp ValueSeries, l int64) ValueSeries {
                    key := fmt.Sprintf("cci:%s:%d", tp.ID(), l)
                    cci := getCache(key)
                    if cci == nil {
                        cci = NewValueSeries()
                Severity: Major
                Found in pine/series_cci.go - About 35 mins to fix

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

                  func Cross(a, b ValueSeries) ValueSeries {
                      c := OperateWithNil(a, b, "cross", func(av, bv *Value) *Value {
                          if av == nil || bv == nil {
                              return nil
                          }
                  Severity: Major
                  Found in pine/series_cross.go - About 35 mins to fix

                    Function change has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func change(stop Value, src, chg ValueSeries, l int) ValueSeries {
                    
                        var val *Value
                    
                        lastvw := chg.GetCurrent()
                    Severity: Minor
                    Found in pine/series_change.go - About 35 mins to fix

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

                    func Crossover(a, b ValueSeries) ValueSeries {
                        c := OperateWithNil(a, b, "crossover", func(av, bv *Value) *Value {
                            if av == nil || bv == nil {
                                return nil
                            }
                    Severity: Major
                    Found in pine/series_crossover.go - About 35 mins to fix

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

                      func Crossunder(a, b ValueSeries) ValueSeries {
                          c := OperateWithNil(a, b, "crossunder", func(av, bv *Value) *Value {
                              if av == nil || bv == nil {
                                  return nil
                              }
                      Severity: Major
                      Found in pine/series_crossunder.go - About 35 mins to fix

                        Function getRMA has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func getRMA(stop *Value, vs ValueSeries, rma ValueSeries, l int64) ValueSeries {
                        
                            var mul float64 = 1.0 / float64(l)
                            firstVal := rma.GetLast()
                        
                        
                        Severity: Minor
                        Found in pine/series_rma.go - About 25 mins to fix

                        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 getEMA has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func getEMA(stop *Value, vs ValueSeries, ema ValueSeries, l int64) ValueSeries {
                        
                            var mul float64 = 2.0 / float64(l+1.0)
                            firstVal := ema.GetLast()
                        
                        
                        Severity: Minor
                        Found in pine/series_ema.go - About 25 mins to fix

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language