Showing 3 of 7 total issues
Method authenticate_omniauth
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def authenticate_omniauth
authentication = Authentication.find_with_omniauth(@omniauth)
if authentication
success_after_authentication_for(authentication.user)
- 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 data_position
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def data_position
if Rails.env.development?
position = Geocoder.search("131.178.128.39").first
else
position = request.location
- 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 vote_link_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def vote_link_for(service_request, options={})
if user_signed_in? && !current_user.voted_on?(service_request)
link_to 'VOTA', vote_service_request_path(service_request), :remote => true, :method => :post, :class => "js-vote_service_request btn btn-primary #{options[:class]}"
elsif user_signed_in? && current_user.voted_on?(service_request)
link_to 'VOTASTE', "javascript:void(0)", class: "btn btn-success #{options[:class]}"
- 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"