Showing 4 of 39 total issues
Method international_rate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def international_rate(weight, region)
rate = 0
@rates['international_ems'].each do |w, r|
next if w.to_i < weight
r.each do |r_rate|
- 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 domestic_rate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def domestic_rate(size = 100, area = 'okinawa')
rate = 0
@rates['domestic_parcel'].each do |w, r|
next if w.to_i < size
r.each do |r_rate|
- 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 region_of_country
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def region_of_country(country_code = 'JP')
result = @regions['asia'].to_s
@regions.each do |region, countries|
countries.each do |country|
return result = region.to_s unless country[country_code].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 area_of_prefecture
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def area_of_prefecture(state_name = 'kyoto')
result = 'okinawa'
@jp_areas.each do |area, states|
states.each do |state|
return result = area.to_s unless state[state_name].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"