jfqd/redmine_helpdesk

View on GitHub

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]
Severity: Minor
Found in lib/helpdesk_mailer.rb - About 5 hrs to fix

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]
Severity: Major
Found in lib/helpdesk_mailer.rb - About 2 hrs to fix

    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,
    Severity: Major
    Found in lib/redmine_helpdesk/mailer_patch.rb - About 2 hrs to fix

      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?) ||
      Severity: Minor
      Found in lib/redmine_helpdesk/journal_patch.rb - About 2 hrs to fix

      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)
      Severity: Critical
      Found in lib/helpdesk_mailer.rb - About 2 hrs to fix

        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?)
        Severity: Critical
        Found in lib/redmine_helpdesk/journal_patch.rb - About 2 hrs to fix

          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,
          Severity: Minor
          Found in lib/redmine_helpdesk/mailer_patch.rb - About 1 hr to fix

          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)
          Severity: Minor
          Found in lib/redmine_helpdesk/mail_handler_patch.rb - About 1 hr to fix

            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)
            Severity: Minor
            Found in lib/redmine_helpdesk/mail_handler_patch.rb - About 1 hr to fix

            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
            Severity: Minor
            Found in lib/redmine_helpdesk/mail_handler_patch.rb - About 35 mins to fix

            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

            Severity
            Category
            Status
            Source
            Language