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++
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)
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
}
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)
Avoid deeply nested control flow statements. Open
for i := 1; i < int(l)+1; i++ {
if prevFirstVal.prev == nil {
break
}
removelb++
Avoid deeply nested control flow statements. Open
if ct == l {
break
}
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) {
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()
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
}
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()
- Read upRead up
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
}
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
}
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()
- Read upRead up
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()
- Read upRead up
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"