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
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 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
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def report_building(generator)
@name||= (_type==:correlation ? _("Correlation"):_("Covariance"))+_(" Matrix")
generator.table(:name=>@name, :header=>[""]+fields_y) do |t|
row_size.times {|i|
t.row([fields_x[i]]+row(i).to_a.collect {|i1|
- 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"