Showing 95 of 133 total issues
File matrix.rb
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ::Vector
def to_matrix
::Matrix.columns([self.to_a])
end
def to_vector
File multiset.rb
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Statsample
# Multiset joins multiple dataset with the same fields and vectors
# but with different number of cases.
# This is the base class for stratified and cluster sampling estimation
class Multiset
Method initialize
has 50 lines of code (exceeds 25 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
Method report_building
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def report_building(g)
compute if @models.nil?
g.section(:name=>@name) do |generator|
header=["","r2",_("sign")]+@predictors.collect {|c| DominanceAnalysis.predictor_name(c) }
- 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 write
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def write(dataset,filename,type=:covariance)
puts "Writing MX File"
File.open(filename,"w") do |fp|
fp.puts "! #{filename}"
fp.puts "! Output generated by Statsample"
- 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 table_percentage
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def table_percentage(generator,type)
fq=frequencies
cn=cols_names
rn=rows_names
rt=rows_total
Method report_building
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def report_building(g)
compute if @models.nil?
g.section(:name=>@name) do |generator|
header=["","r2",_("sign")]+@predictors.collect {|c| DominanceAnalysis.predictor_name(c) }
Method initialize
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(opts=Hash.new)
# First see if sum of squares or mean squares are entered
raise ArgumentError, "You should set all d.f." unless [:df_a, :df_b, :df_within].all? {|v| opts.has_key? v}
@df_a=opts.delete :df_a
Method report_building
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def report_building(builder)
builder.section(:name=>@name) do |generator|
fq=frequencies
rn=rows_names
cn=cols_names
Method submatrix
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def submatrix(rows,columns = nil)
raise ArgumentError, "rows shouldn't be empty" if rows.respond_to? :size and rows.size == 0
columns ||= rows
# Convert all fields on index
row_index = rows.collect do |v|
- 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 report_building
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def report_building(g) #:nodoc:
g.section(:name=>@name) do |s|
s.text _("Bootstrap Method: %s") % bootstrap_method
s.text _("Uses SMC: %s") % (smc ? _("Yes") : _("No"))
s.text _("Correlation Matrix type : %s") % matrix_method
- 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 report_building
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def report_building(builder) # :nodoc:
raise "You should bootstrap first" if @n_samples==0
builder.section(:name=>@name) do |generator|
generator.text _("Sample size: %d\n") % @n_samples
generator.text "t: #{t}\n"
Method report_building
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def report_building(generator)
iterate if @clean
generator.section(:name=>@name) do |s|
s.text _("Number of factors: %d") % m
s.text _("Iterations: %d") % @iterations
Method pairs
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def pairs(matrix)
# calculate concordant #p matrix
rs=matrix.row_size
cs=matrix.column_size
conc=disc=ties_x=ties_y=0
Method compute
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def compute
gsl_m=(use_gsl and Statsample.has_gsl?) ? @matrix.to_gsl : @matrix
klass_m=gsl_m.class
eigvect,@eigenvalues=gsl_m.eigenvectors_matrix, gsl_m.eigenvalues
eigenvalues_sqrt=@eigenvalues.collect {|v| Math.sqrt(v)}
- 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 initialize
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def initialize(input, dependent, opts=Hash.new)
@build_from_dataset=false
if dependent.is_a? Array
@regression_class= MULTIVARIATE_REGRESSION_CLASS
@method_association=:r2yx
- 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 report_building
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def report_building(builder)
builder.section(:name=>@name) do |generator|
fq=frequencies
rn=rows_names
cn=cols_names
- 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 out
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def out(dataset,opt={})
require 'ostruct'
default_opt = {:dataname => "Default", :description=>"", :missing=>"NA"}
default_opt.merge! opt
carrier=OpenStruct.new
Method compute
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def compute
gsl_m=(use_gsl and Statsample.has_gsl?) ? @matrix.to_gsl : @matrix
klass_m=gsl_m.class
eigvect,@eigenvalues=gsl_m.eigenvectors_matrix, gsl_m.eigenvalues
eigenvalues_sqrt=@eigenvalues.collect {|v| Math.sqrt(v)}
Method tetrachoric_correlation_matrix
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def tetrachoric_correlation_matrix(ds)
dsv=ds.reject_values(*Daru::MISSING_VALUES)
# Delete all vectors doesn't have variation
dsv.vectors.each { |f|
if dsv[f].factors.size==1