Showing 74 of 98 total issues
Method first_order
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
def first_order(x, scale = 0, with_error = false)
xmaxt = -Math::LOG_FLOAT_MIN
xmax = xmaxt - Math.log(xmaxt)
result = nil
error = with_error ? nil : 0.0
- 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
File chebyshev_series.rb
has 397 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Distribution
module MathExtension
# Adapted from GSL-1.9.
class ChebyshevSeries
DATA = { lopx: [2.16647910664395270521272590407,
Method evaluate
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def evaluate(a, b, x, with_error = false)
fail(ArgumentError, "Domain error: a(#{a}), b(#{b}) must be positive; x(#{x}) must be between 0 and 1, inclusive") if a <= 0 || b <= 0 || x < 0 || x > 1
if x == 0
return with_error ? [0.0, 0.0] : 0.0
elsif x == 1
- 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
Method cdf_genz
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cdf_genz(x, y, rho)
dh = -x
dk = -y
r = rho
twopi = 6.283185307179586
Method q
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def q(a, x, with_error = false)
fail(ArgumentError, 'Range Error: a and x must be non-negative') if a < 0.0 || x < 0.0
if x == 0.0
return with_error ? [1.0, 0.0] : 1.0
elsif a == 0.0
- 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
File incomplete_gamma.rb
has 340 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Distribution
module MathExtension
module IncompleteGamma
NMAX = 5000
SMALL = Float::EPSILON**3
Method cdf_genz
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def cdf_genz(x, y, rho)
dh = -x
dk = -y
r = rho
twopi = 6.283185307179586
- 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
Method log_beta
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def log_beta(x, y, with_error = false)
sign = nil
fail(ArgumentError, 'x and y must be nonzero') if x == 0.0 || y == 0.0
fail(ArgumentError, 'not defined for negative integers') if [x, y].any? { |v| v < 0 }
- 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
Method q_series
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
def q_series(a, x, with_error = false)
term1 = nil
sum = nil
term2 = nil
begin
Method d
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def d(a, x, with_error = false)
error = nil
if a < 10.0
ln_a = Math.lgamma(a + 1.0).first
lnr = a * Math.log(x) - x - ln_a
- 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
Method evaluate
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def evaluate(x, with_error = false)
ax = x.abs
e = nil
if ax <= 1.0
- 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
Method continued_fraction
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def continued_fraction(a, b, x, epsabs = nil, with_error = false)
num_term = 1
den_term = 1 - (a + b) * x.quo(a + 1)
k = 0
- 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
Method evaluate
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def evaluate(x, with_error = false)
fail(ArgumentError, 'x must be positive') if x <= 0
if x < 0.5
STDERR.puts("Warning: Don't know error on lg_x, error for this function will be incorrect") if with_error
lg = Math.lgamma(x).first
- 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
Method unnormalized
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def unnormalized(a, x, with_error = false)
fail(ArgumentError, 'x cannot be negative') if x < 0.0
if x == 0.0
result = Math.gamma(a.to_f)
- 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
Method swing
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def swing(n)
return SmallOddSwing[n] if n < 33
sqrtN = Math.sqrt(n).floor
count = 0
- 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
Method cdf
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def cdf(aa, bb, sigma, epsilon = 0.0001, alpha = 2.5, max_iterations = 100) # :nodoc:
fail "Doesn't work yet"
a = [nil] + aa
b = [nil] + bb
m = aa.size
- 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
Method p
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def p(a, x, with_error = false)
fail(ArgumentError, 'Range Error: a must be positive, x must be non-negative') if a <= 0.0 || x < 0.0
if x == 0.0
return with_error ? [0.0, 0.0] : 0.0
elsif x < 20.0 || x < 0.5 * a
- 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
Method first_order
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def first_order(x, scale = 0, with_error = false)
xmaxt = -Math::LOG_FLOAT_MIN
xmax = xmaxt - Math.log(xmaxt)
result = nil
error = with_error ? nil : 0.0
Method log_1plusx_minusx
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def log_1plusx_minusx(x, with_error = false)
fail(ArgumentError, 'Range error: x must be > -1') if x <= -1
if x.abs < Math::ROOT5_FLOAT_EPSILON
result = x * x * (C1 + x * (C2 + x * (C3 + x * (C4 + x * begin
- 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
Method pchi2
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def pchi2(n, y)
if n == 1
w = Distribution::Normal.p_value(1 - y / 2) # = p1.0-Distribution::Normal.cdf(y/2)
w * w
elsif n == 2
- 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"