Showing 5 of 48 total issues
Method inherited
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.inherited(klazz)
klazz.instance_eval do
@allowed_values = Set.new
class << self
def categories
Method execute
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def execute
raise ArgumentError.new('Response is already defined, create another Request object.') if self.response
validate!
begin
self.response = shippo_phone_home
- 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 execute
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute
raise ArgumentError.new('Response is already defined, create another Request object.') if self.response
validate!
begin
self.response = shippo_phone_home
Method allowed_values
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def allowed_values(*values)
return @allowed_values if values.nil? || values.empty? || !@allowed_values.empty?
@allowed_values = self.value_transformer(values)
@allowed_values.each do |allowed_value|
- 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 url
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def url(value = nil)
return @url if @url
@url ||= value if value
@url ||= class_to_url
end
- 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"