tsuz/go-pine

View on GitHub

Showing 45 of 45 total issues

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

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

          lo := OperateWithNil(hlc3, chg, "mfil", func(a, b *Value) *Value {
              var v float64
              // treat nil value as HLC3
              if b == nil {
                  return a
      Severity: Minor
      Found in pine/series_mfi.go and 1 other location - About 35 mins to fix
      pine/series_mfi.go on lines 25..41

      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 105.

      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

      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