# SciRuby/statsample

### Showing 95 of 133 total issues

#### Method `prop_pearson` has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open

``````      def prop_pearson(t, size, tails=:both)
tails=:both if tails==2
tails=:right if tails==1 or tails==:positive
tails=:left if tails==:negative
``````
Found in lib/statsample/bivariate.rb - 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"

#### Method `iterate` has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open

``````    def iterate(m=nil)
@clean=false
m||=@m
@m=m
t = @max_iterations``````
Found in lib/statsample/factor/principalaxis.rb - 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"

#### Method `initialize` has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open

``````  def initialize(matrix,y_var, opts=Hash.new)
matrix.extend Statsample::CovariateMatrix
raise "#{y_var} variable should be on data" unless matrix.fields.include? y_var
if matrix._type==:covariance
@matrix_cov=matrix``````
Found in lib/statsample/regression/multiple/matrixengine.rb - 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"

#### Method `init_gsl` has 7 arguments (exceeds 4 allowed). Consider refactoring. Open

``      def init_gsl(a,b,cov00, cov01, covx1, chisq, status)``
Found in lib/statsample/regression/simple.rb - About 50 mins to fix

#### Method `increment` has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open

``````    def increment(x, w=1)
if x.respond_to? :each
x.each{|y| increment(y,w) }
elsif x.is_a? Numeric
(range.size - 1).times do |i|``````
Found in lib/statsample/histogram.rb - About 45 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"

#### Method `initialize` has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open

``````      def initialize(opts=Hash.new)
@name=@name_numerator=@name_denominator=nil

# First see if sum of squares or mean squares are entered
raise ArgumentError, "You should set d.f." unless (opts.has_key? :df_num and opts.has_key? :df_den)``````
Found in lib/statsample/anova/oneway.rb - About 45 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"

#### Method `separate_matrices` has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open

``````    def self.separate_matrices(matrix, y)
ac=[]
matrix.column_size.times do |i|
ac.push(matrix[y,i]) if i!=y
end``````
Found in lib/statsample/factor/principalaxis.rb - About 45 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"

#### Method `conditional_dominance_pairwise` has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open

``````    def conditional_dominance_pairwise(i,j)
dm=dominance_for_nil_model(i,j)
return 0.5 if dm==0.5
dominances=[dm]
for k in 1...@predictors.size``````
Found in lib/statsample/dominanceanalysis.rb - About 45 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"

#### Method `p_using_cdf` has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open

``````    def p_using_cdf(cdf, tails=:both)
tails=:both if tails==2 or tails==:two
tails=:right if tails==1 or tails==:positive
tails=:left if tails==:negative
case tails``````
Found in lib/statsample/test.rb - About 45 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"

#### Method `nice` has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open

``````    def self.nice(s, e) # :nodoc:
reverse = e < s
min = reverse ? e : s
max = reverse ? s : e
span = max - min``````
Found in lib/statsample.rb - About 45 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"

#### Method `report_building` has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open

``````        def report_building(b)
di="%0.#{digits}f"
b.section(:name=>@name) do |g|
c=coeffs
g.text _("Engine: %s") % self.class``````
Found in lib/statsample/regression/multiple/baseengine.rb - About 45 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"

#### Method `table_percentage` has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open

``````    def table_percentage(generator,type)
fq=frequencies
cn=cols_names
rn=rows_names
rt=rows_total``````
Found in lib/statsample/crosstab.rb - About 45 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"

#### Method `mean_confidence_interval` has 5 arguments (exceeds 4 allowed). Consider refactoring. Open

``      def mean_confidence_interval(mean,s,n_sample,n_population,x)``
Found in lib/statsample/srs.rb - About 35 mins to fix

#### Method `mean_confidence_interval_z` has 5 arguments (exceeds 4 allowed). Consider refactoring. Open

``      def mean_confidence_interval_z(mean,s,n_sample,n_population,margin=0.95)``
Found in lib/statsample/srs.rb - About 35 mins to fix

#### Method `mean_confidence_interval_t` has 5 arguments (exceeds 4 allowed). Consider refactoring. Open

``      def mean_confidence_interval_t(mean,s,n_sample,n_population,margin=0.95)``
Found in lib/statsample/srs.rb - About 35 mins to fix

#### Method `correlation` has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open

``````    def correlation
if(_type==:covariance)
matrix=Matrix.rows(row_size.times.collect { |i|
column_size.times.collect { |j|
if i==j``````
Found in lib/statsample/matrix.rb - 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"

#### Method `correlation_matrix_pairwise` has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open

``````      def correlation_matrix_pairwise(ds)
cache={}
vectors = ds.vectors.to_a
cm = vectors.collect do |row|
vectors.collect do |col|``````
Found in lib/statsample/bivariate.rb - 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"

#### Method `residuals` has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open

``````        def residuals
Daru::Vector.new(
(0...@total_cases).collect do |i|
invalid=false
vect=@dep_columns.collect{|v| invalid=true if v[i].nil?; v[i]}``````
Found in lib/statsample/regression/multiple/baseengine.rb - 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"

#### Method `report_building` has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open

``````      def report_building(builder) # :nodoc:
builder.section(:name=>@name) do |s|
if summary_descriptives
s.table(:name=>_("Descriptives"),:header=>%w{Name N Mean SD Min Max}.map {|v| _(v)}) do |t|
@vectors.each do |v|``````
Found in lib/statsample/anova/oneway.rb - 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"

#### Method `covariance_matrix_pairwise` has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open

``````      def covariance_matrix_pairwise(ds)
cache={}
vectors = ds.vectors.to_a
mat_rows = vectors.collect do |row|
vectors.collect do |col|``````
Found in lib/statsample/bivariate.rb - 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"