app/helpers/link_to_helper.rb
File link_to_helper.rb
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module LinkToHelper
# Links to various models
# Requests
def request_url(info_request, options = {})
Method do_track_url
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def do_track_url(track_thing, feed = 'track', options = {})
if track_thing.track_type == 'request_updates'
track_request_url(options.merge(url_title: track_thing.info_request.url_title, feed: feed))
elsif track_thing.track_type == 'all_new_requests'
track_list_url(options.merge(view: 'recent', feed: feed))
- 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 user_link_for_request
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def user_link_for_request(request)
if request.is_external?
user_name = request.external_user_name || _("Anonymous user")
if !request.external_url.nil?
link_to user_name, request.external_url
- 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"