Showing 133 of 133 total issues
Method compute
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def compute
@original=Statsample::Bivariate.send(matrix_method, @ds).eigenvalues unless no_data
@ds_eigenvalues=Daru::DataFrame.new({}, order: (1..@n_variables).map{|v| ("ev_%05d" % v).to_sym})
if bootstrap_method==:parameter or bootstrap_method==:random
Method report_building
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def report_building(b) # :nodoc:
b.section(:name=>name) do |s|
s.section(:name=>_("Reliability analysis of scales")) do |s2|
@scales.each_pair do |k, scale|
s2.parse_element(scale)
Method iterate
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def iterate(m=nil)
@clean=false
m||=@m
@m=m
t = @max_iterations
Method report_building
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def report_building(builder)
builder.section(:name=>@name) do |s|
sa = scale_analysis
s.parse_element(sa)
if summary_show_problematic_items
- 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 total_dominance_pairwise
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def total_dominance_pairwise(i,j)
dm=dominance_for_nil_model(i,j)
return 0.5 if dm==0.5
dominances=[dm]
models_data.each do |k,m|
- 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 rubyvis_panel
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def rubyvis_panel # :nodoc:
pre_vis
#that=self
@minimum_x||=@hist.min
- 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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(ds,y_var, opts=Hash.new)
super
@ds = ds.reject_values(*Daru::MISSING_VALUES)
@ds_valid = @ds
@valid_cases = @ds_valid.nrows
Method initialize
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(ds, opts=Hash.new)
@dumped=ds.vectors.to_a.find_all {|f|
ds[f].variance == 0
}
Method write
has 31 lines of code (exceeds 25 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"
Method initialize
has 30 lines of code (exceeds 25 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
Method to_multiset_by_split_multiple_fields
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_multiset_by_split_multiple_fields(*fields)
fields.map!(&:to_sym)
factors_total=nil
fields.each do |f|
if factors_total.nil?
Method initialize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(matrix, opts=Hash.new)
@matrix=matrix
if @matrix.respond_to? :fields
@fields=@matrix.fields
else
Method kmo_univariate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.kmo_univariate(matrix, var)
if var.is_a? String
if matrix.respond_to? :fields
j=matrix.fields.index(var)
raise "Matrix doesn't have field #{var}" if j.nil?
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize(matrix, opts=Hash.new)
@use_gsl = opts[:use_gsl]
opts.delete :use_gsl
@name=_("Principal Component Analysis")
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def report_building(b) # :nodoc:
b.section(:name=>name) do |s|
s.section(:name=>_("Reliability analysis of scales")) do |s2|
@scales.each_pair do |k, scale|
s2.parse_element(scale)
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def report_building(g) #:nodoc:
g.section(:name=>@name) do |s|
s.table(:name=>_("Eigenvalues"),:header=>[_("Value")]) do |t|
eigenvalues.each_with_index do |e,i|
t.row([@errors.include?(i) ? "*" : "%0.6f" % e])
- 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 fix_with_regression
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def fix_with_regression
i = 0
@ds_indep.each(:row) do |row|
empty = []
row.each { |k,v| empty.push(k) if v.nil? }
- 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 _recode_dataset
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _recode_dataset(dataset, h , sep=Statsample::SPLIT_TOKEN, split=false)
v_names||=h.keys
v_names.each do |v_name|
raise Exception, "Vector #{v_name} doesn't exists on Dataset" if !dataset.vectors.include? v_name
recoded = Daru::Vector.new(
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
def icc_3_1_ci(alpha=0.05)
per=1-(0.5*alpha)
fl=icc_3_f.f.quo(Distribution::F.p_value(per, @df_bt, @df_residual))
fu=icc_3_f.f*Distribution::F.p_value(per, @df_residual, @df_bt)
[(fl-1).quo(fl+k-1), (fu-1).quo(fu+k-1)]
- Read upRead up
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 49.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
def icc_1_1_ci(alpha=0.05)
per=1-(0.5*alpha)
fu=icc_1_f.f*Distribution::F.p_value(per, @df_wt, @df_bt)
fl=icc_1_f.f.quo(Distribution::F.p_value(per, @df_bt, @df_wt))
- Read upRead up
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 49.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76