ece517-p3/expertiza

View on GitHub
app/models/rscore.rb

Summary

Maintainability
A
50 mins
Test Coverage

Assignment Branch Condition size for initialize is too high. [21.59/15]
Open

  def initialize(my_score, type)
    @my_max = my_score[type][:scores][:max] == -1 ? "N/A" : my_score[type][:scores][:max]
    @my_min = my_score[type][:scores][:min] == -1 ? "N/A" : my_score[type][:scores][:min]
    @my_avg = my_score[type][:scores][:avg] == -1 ? "N/A" : my_score[type][:scores][:avg]
    @my_type = type
Severity: Minor
Found in app/models/rscore.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

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

  def initialize(my_score, type)
    @my_max = my_score[type][:scores][:max] == -1 ? "N/A" : my_score[type][:scores][:max]
    @my_min = my_score[type][:scores][:min] == -1 ? "N/A" : my_score[type][:scores][:min]
    @my_avg = my_score[type][:scores][:avg] == -1 ? "N/A" : my_score[type][:scores][:avg]
    @my_type = type
Severity: Minor
Found in app/models/rscore.rb - About 25 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"

Further reading

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

  def initialize(max = 0.0, min = 0.0, avg = 0.0, type = nil)
    @my_max = max == -1 ? "N/A" : max
    @my_min = min == -1 ? "N/A" : min
    @my_avg = avg == -1 ? "N/A" : avg
    @my_type = type
Severity: Minor
Found in app/models/rscore.rb - About 25 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"

Further reading

Method Rscore#initialize is defined at both app/models/rscore.rb:3 and app/models/rscore.rb:10.
Open

  def initialize(my_score, type)
Severity: Minor
Found in app/models/rscore.rb by rubocop

This cop checks for duplicated instance (or singleton) method definitions.

Example:

# bad

def duplicated
  1
end

def duplicated
  2
end

Example:

# bad

def duplicated
  1
end

alias duplicated other_duplicated

Example:

# good

def duplicated
  1
end

def other_duplicated
  2
end

There are no issues that match your filters.

Category
Status