Showing 10 of 10 total issues
Method email_to_supportclient
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def email_to_supportclient(issue, params)
# issue, recipient, journal=nil, text='', copy_to=nil
recipient = params[:recipient]
journal = params[:journal]
- 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 email_to_supportclient
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
def email_to_supportclient(issue, params)
# issue, recipient, journal=nil, text='', copy_to=nil
recipient = params[:recipient]
journal = params[:journal]
Method issue_edit_with_helpdesk
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def issue_edit_with_helpdesk(user, journal)
issue = journal.journalized
redmine_headers 'Project' => issue.project.identifier,
'Issue-Id' => issue.id,
'Issue-Author' => issue.author.login,
Method send_notification_with_helpdesk
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def send_notification_with_helpdesk
if notify? && (Setting.notified_events.include?('issue_updated') ||
(Setting.notified_events.include?('issue_note_added') && notes.present?) ||
(Setting.notified_events.include?('issue_status_updated') && new_status.present?) ||
(Setting.notified_events.include?('issue_assigned_to_updated') && detail_for_attribute('assigned_to_id').present?) ||
- 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
Consider simplifying this complex logical expression. Open
mail = if text.present? || reply.present?
# sending out the journal note to the support client
# or the first reply message
t = text.present? ? "#{text}\n\n#{footer}" : reply
body = expand_macros(t, issue, journal)
Consider simplifying this complex logical expression. Open
if notify? && (Setting.notified_events.include?('issue_updated') ||
(Setting.notified_events.include?('issue_note_added') && notes.present?) ||
(Setting.notified_events.include?('issue_status_updated') && new_status.present?) ||
(Setting.notified_events.include?('issue_assigned_to_updated') && detail_for_attribute('assigned_to_id').present?) ||
(Setting.notified_events.include?('issue_priority_updated') && new_value_for('priority_id').present?)
Method issue_edit_with_helpdesk
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def issue_edit_with_helpdesk(user, journal)
issue = journal.journalized
redmine_headers 'Project' => issue.project.identifier,
'Issue-Id' => issue.id,
'Issue-Author' => issue.author.login,
- 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 dispatch_to_default_with_helpdesk
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dispatch_to_default_with_helpdesk
issue = receive_issue
issue.reload # prevent ActiveRecord::StaleObjectError
roles = if issue.author.class == AnonymousUser
Role.where(builtin: issue.author.id)
Method dispatch_to_default_with_helpdesk
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def dispatch_to_default_with_helpdesk
issue = receive_issue
issue.reload # prevent ActiveRecord::StaleObjectError
roles = if issue.author.class == AnonymousUser
Role.where(builtin: issue.author.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
Method receive_issue_reply_with_helpdesk
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def receive_issue_reply_with_helpdesk(issue_id, from_journal=nil)
issue = Issue.find_by_id(issue_id)
return unless issue
# reopening a closed issues by email
- 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"