Method render_task_dependants
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def render_task_dependants(t, depth, root_present)
res = ''
@printed_ids ||= []
return if @printed_ids.include? t.id
- 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
File tasks_helper.rb
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
module TasksHelper
def render_task_form(show_timer = true)
render partial: 'tasks/form', locals: {show_timer: show_timer}
end
Method milestones_to_select_tag
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def milestones_to_select_tag(milestones)
options = [%Q[<option value="0" title="#{t('forms.select.please_select')}">#{t('forms.select.none')}</option>]] + milestones.collect do |milestone|
date = milestone.due_at.nil? ? t('shared.not_set') : l(milestone.due_at, format: current_user.date_format)
selected = if (@task.milestone_id == milestone.id) || (@task.milestone_id.nil? && milestone.id == '0')
- 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 render_task_dependants
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_task_dependants(t, depth, root_present)
res = ''
@printed_ids ||= []
return if @printed_ids.include? t.id
Method human_future_date
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def human_future_date(date, tz)
return t('shared.unknown') unless date
tz_day_end = tz.now.end_of_day
local_date = tz.utc_to_local(date.utc)
Method due_date_field
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def due_date_field(task, permissions)
task_due_at = task.due_at.nil? ? '' : task.due_at.utc.strftime(current_user.date_format)
milestone_due_at = task.milestone.try(:due_at)
placeholder = milestone_due_at.nil? ? '' : milestone_due_at.strftime(current_user.date_format)
date_tooltip = if task.due_at.nil? && !milestone_due_at.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 due_date_field
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def due_date_field(task, permissions)
task_due_at = task.due_at.nil? ? '' : task.due_at.utc.strftime(current_user.date_format)
milestone_due_at = task.milestone.try(:due_at)
placeholder = milestone_due_at.nil? ? '' : milestone_due_at.strftime(current_user.date_format)
date_tooltip = if task.due_at.nil? && !milestone_due_at.nil?
Method milestones_to_select_tag
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def milestones_to_select_tag(milestones)
options = [%Q[<option value="0" title="#{t('forms.select.please_select')}">#{t('forms.select.none')}</option>]] + milestones.collect do |milestone|
date = milestone.due_at.nil? ? t('shared.not_set') : l(milestone.due_at, format: current_user.date_format)
selected = if (@task.milestone_id == milestone.id) || (@task.milestone_id.nil? && milestone.id == '0')
Method options_for_task_services
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def options_for_task_services(customers, task)
services = []
customers.each { |c| services.concat(c.services.all) }
services = services.uniq
- 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 task_detail
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def task_detail(task, user = current_user)
task.due_at ||= task.milestone.due_at if task.milestone
options = {
task.human_name(:status) => task.human_value(:open_or_closed),
task.human_name(:project) => task.project.name,
- 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 perms
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def perms
if @perms.nil?
@perms = {}
permissions = ['comment', 'edit', 'reassign', 'close', 'milestone']
permissions.each do |p|
- 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"