tsuz/go-pine

View on GitHub

Showing 34 of 45 total issues

Function getRSIU has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring.
Open

func getRSIU(stop *Value, vs ValueSeries, rsiu ValueSeries, l int64) ValueSeries {
    firstVal := rsiu.GetLast()

    if firstVal == nil {
        firstVal = vs.GetFirst()
Severity: Minor
Found in pine/series_rsi.go - About 4 hrs 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 getRSID has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring.
Open

func getRSID(stop *Value, vs ValueSeries, rsid ValueSeries, l int64) ValueSeries {
    firstVal := rsid.GetLast()

    if firstVal == nil {
        firstVal = vs.GetFirst()
Severity: Minor
Found in pine/series_rsi.go - About 4 hrs 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 getSum has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring.
Open

func getSum(stop Value, sum ValueSeries, src ValueSeries, l int) ValueSeries {

    // keep track of the source values of sum, maximum of l+1 items
    sumSrc := make([]float64, 0)
    var startNew *Value
Severity: Minor
Found in pine/series_sum.go - About 3 hrs 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 SMA has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
Open

func SMA(p ValueSeries, l int64) ValueSeries {
    key := fmt.Sprintf("sma:%s:%d", p.ID(), l)
    sma := getCache(key)
    if sma == nil {
        sma = NewValueSeries()
Severity: Minor
Found in pine/series_sma.go - About 3 hrs 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 getRSI has 70 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func getRSI(stop *Value, vs ValueSeries, rsi ValueSeries, l int64) ValueSeries {

    rsiukey := fmt.Sprintf("rsiu:%s:%d", vs.ID(), l)
    rsiu := getCache(rsiukey)
    if rsiu == nil {
Severity: Minor
Found in pine/series_rsi.go - About 1 hr to fix

    Function SMA has 68 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func SMA(p ValueSeries, l int64) ValueSeries {
        key := fmt.Sprintf("sma:%s:%d", p.ID(), l)
        sma := getCache(key)
        if sma == nil {
            sma = NewValueSeries()
    Severity: Minor
    Found in pine/series_sma.go - About 1 hr to fix

      Function getSum has 68 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func getSum(stop Value, sum ValueSeries, src ValueSeries, l int) ValueSeries {
      
          // keep track of the source values of sum, maximum of l+1 items
          sumSrc := make([]float64, 0)
          var startNew *Value
      Severity: Minor
      Found in pine/series_sum.go - About 1 hr to fix

        Function valueWhen has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
        Open

        func valueWhen(stop Value, bs, src, vw ValueSeries, ocr int) ValueSeries {
        
            var val *Value
        
            lastvw := vw.GetCurrent()
        Severity: Minor
        Found in pine/series_value_when.go - About 1 hr 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 getRSIU has 63 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func getRSIU(stop *Value, vs ValueSeries, rsiu ValueSeries, l int64) ValueSeries {
            firstVal := rsiu.GetLast()
        
            if firstVal == nil {
                firstVal = vs.GetFirst()
        Severity: Minor
        Found in pine/series_rsi.go - About 1 hr to fix

          Function getRSID has 63 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func getRSID(stop *Value, vs ValueSeries, rsid ValueSeries, l int64) ValueSeries {
              firstVal := rsid.GetLast()
          
              if firstVal == nil {
                  firstVal = vs.GetFirst()
          Severity: Minor
          Found in pine/series_rsi.go - About 1 hr to fix

            Function getOHLCVAttr has 59 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func getOHLCVAttr(stop OHLCV, src OHLCVSeries, dest ValueSeries, p OHLCProp) ValueSeries {
            
                var startt time.Time
            
                firstVal := dest.GetLast()
            Severity: Minor
            Found in pine/series_ohlcv_attr.go - About 1 hr to fix

              Function DMI has 56 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func DMI(ohlcv OHLCVSeries, len, smoo int) (adx, plus, minus ValueSeries) {
                  adxkey := fmt.Sprintf("adx:%s:%d:%d", ohlcv.ID(), len, smoo)
                  adx = getCache(adxkey)
                  if adx == nil {
                      adx = NewValueSeries()
              Severity: Minor
              Found in pine/series_dmi.go - About 1 hr to fix

                Function roc has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                Open

                func roc(stop Value, src, roc, chg ValueSeries, l int) ValueSeries {
                
                    var val *Value
                
                    lastvw := roc.GetCurrent()
                Severity: Minor
                Found in pine/series_roc.go - About 1 hr 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 roc has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func roc(stop Value, src, roc, chg ValueSeries, l int) ValueSeries {
                
                    var val *Value
                
                    lastvw := roc.GetCurrent()
                Severity: Minor
                Found in pine/series_roc.go - About 1 hr to fix

                  Function valueWhen has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func valueWhen(stop Value, bs, src, vw ValueSeries, ocr int) ValueSeries {
                  
                      var val *Value
                  
                      lastvw := vw.GetCurrent()
                  Severity: Minor
                  Found in pine/series_value_when.go - About 1 hr to fix

                    Function MFI has 51 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func MFI(o OHLCVSeries, l int64) ValueSeries {
                        key := fmt.Sprintf("mfi:%s:%d", o.ID(), l)
                        mfi := getCache(key)
                        if mfi == nil {
                            mfi = NewValueSeries()
                    Severity: Minor
                    Found in pine/series_mfi.go - About 1 hr to fix

                      Function getRSI has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func getRSI(stop *Value, vs ValueSeries, rsi ValueSeries, l int64) ValueSeries {
                      
                          rsiukey := fmt.Sprintf("rsiu:%s:%d", vs.ID(), l)
                          rsiu := getCache(rsiukey)
                          if rsiu == nil {
                      Severity: Minor
                      Found in pine/series_rsi.go - About 55 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 getOHLCVAttr has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func getOHLCVAttr(stop OHLCV, src OHLCVSeries, dest ValueSeries, p OHLCProp) ValueSeries {
                      
                          var startt time.Time
                      
                          firstVal := dest.GetLast()
                      Severity: Minor
                      Found in pine/series_ohlcv_attr.go - About 55 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 DMI has 8 return statements (exceeds 4 allowed).
                      Open

                      func DMI(ohlcv OHLCVSeries, len, smoo int) (adx, plus, minus ValueSeries) {
                          adxkey := fmt.Sprintf("adx:%s:%d:%d", ohlcv.ID(), len, smoo)
                          adx = getCache(adxkey)
                          if adx == nil {
                              adx = NewValueSeries()
                      Severity: Major
                      Found in pine/series_dmi.go - About 50 mins to fix

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

                        func MFI(o OHLCVSeries, l int64) ValueSeries {
                            key := fmt.Sprintf("mfi:%s:%d", o.ID(), l)
                            mfi := getCache(key)
                            if mfi == nil {
                                mfi = NewValueSeries()
                        Severity: Major
                        Found in pine/series_mfi.go - About 50 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language