ZestFinance/zestphone

View on GitHub

Showing 19 of 51 total issues

Conversation has 32 functions (exceeds 20 allowed). Consider refactoring.
Open

Zest.Telephony.Models.Conversation = Backbone.Model.extend({
urlRoot: Zest.Telephony.Config.CONVERSATION_PATH,
 
defaults: {
state: "disabled_by_default"
Severity: Minor
Found in app/assets/javascripts/telephony/models/conversation.js - About 4 hrs to fix

    ConversationView has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    Zest.Telephony.Views.ConversationView = Backbone.View.extend({
    className: 'conversation-wrapper',
     
    events: {
    'click button.initiate-conversation' : 'createConversation',
    Severity: Minor
    Found in app/assets/javascripts/telephony/views/conversation_view.js - About 3 hrs to fix

      Class Conversation has 30 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Conversation < Base
      extend Telephony::NumberHelper
      include ConversationStateMachine
       
      module CONVERSATION_TYPES
      Severity: Minor
      Found in app/models/telephony/conversation.rb - About 3 hrs to fix

        Function Push has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Zest.Telephony.Push = (function($) {
        return {
        init: function(socket) {
        this.lastCallEventId = 0;
        this.lastQueueChangeEventId = 0;
        Severity: Major
        Found in app/assets/javascripts/telephony/push.js - About 3 hrs to fix

          Method check_for_terminate has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

          def check_for_terminate
          if active_on_call.size == 0
          terminate!
          elsif one_step_transferring? && active_on_call.size == 1
          fail_one_step_transfer!
          Severity: Minor
          Found in app/models/telephony/conversation.rb - About 2 hrs to fix

          File conversation_view.js has 276 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          Zest.Telephony.Views.ConversationView = Backbone.View.extend({
          className: 'conversation-wrapper',
           
          events: {
          'click button.initiate-conversation' : 'createConversation',
          Severity: Minor
          Found in app/assets/javascripts/telephony/views/conversation_view.js - About 2 hrs to fix

            Method child_detached has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            def child_detached
            @child_call = @call.conversation.child_call(params[:DialCallSid])
            @child_call.record! params
            @child_call.sid ||= params[:DialCallSid]
             
             
            Severity: Minor
            Found in app/controllers/telephony/providers/twilio/calls_controller.rb - About 2 hrs to fix

            Function init has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            init: function(socket) {
            this.lastCallEventId = 0;
            this.lastQueueChangeEventId = 0;
            this.lastStatusChangeEventAt = 0;
            var $widgetWrapper = $("#telephony-widget");
            Severity: Minor
            Found in app/assets/javascripts/telephony/push.js - About 1 hr to fix

              Function Application has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              Zest.Telephony.Application = (function () {
              var instance;
               
              return {
              init: function(agent) {
              Severity: Minor
              Found in app/assets/javascripts/telephony/views/application_view.js - About 1 hr to fix

                Method child_detached has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                def child_detached
                @child_call = @call.conversation.child_call(params[:DialCallSid])
                @child_call.record! params
                @child_call.sid ||= params[:DialCallSid]
                 
                 
                Severity: Minor
                Found in app/controllers/telephony/providers/twilio/calls_controller.rb - About 1 hr to fix

                  Method search has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  def self.search(args = {})
                  conversations = Conversation.scoped
                  .includes(:events, calls: [:recordings, :voicemail])
                  .order("telephony_conversations.created_at")
                  .reverse_order
                  Severity: Minor
                  Found in lib/telephony/conversation_data.rb - About 1 hr to fix

                    Method terminate_conversation_and_all_call_legs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def terminate_conversation_and_all_call_legs(trace_only = false)
                     
                    if self.conversation
                     
                    Rails.logger.info "zestphone: ** Terminating all linked calls and conversation **"
                    Severity: Minor
                    Found in app/models/telephony/call.rb - About 45 mins to fix

                    Method verify_status! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def verify_status!
                    return unless on_a_call?
                    call = active_call
                     
                    if call.nil?
                    Severity: Minor
                    Found in app/models/telephony/agent.rb - About 45 mins to fix

                    Method search has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def self.search(args = {})
                    conversations = Conversation.scoped
                    .includes(:events, calls: [:recordings, :voicemail])
                    .order("telephony_conversations.created_at")
                    .reverse_order
                    Severity: Minor
                    Found in lib/telephony/conversation_data.rb - About 35 mins to fix

                    Method two_step_transfer! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def two_step_transfer!(agent)
                    unless agent.transferrable?
                    errors[:base] << 'Agent is unavailable'
                    return false
                    end
                    Severity: Minor
                    Found in app/models/telephony/conversation.rb - About 35 mins to fix

                    Method dequeue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def self.dequeue(csr_id)
                    with_agent_on_a_call(csr_id) do |agent|
                    begin
                    conversation = oldest_queued_conversation
                     
                     
                    Severity: Minor
                    Found in app/models/telephony/inbound_conversation_queue.rb - About 35 mins to fix

                    Method transfer! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def transfer!(csr_id, one_step)
                    unless in_progress? || in_progress_hold?
                    errors[:base] << "Conversation already #{state}"
                    return false
                    end
                    Severity: Minor
                    Found in app/models/telephony/conversation.rb - About 25 mins to fix

                    Method after_save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def after_save(call)
                    return unless call.agent_id
                     
                    Agent.find_with_lock(call.agent_id) do |agent|
                    if call.terminated? && call.state_was != 'not_initiated' && call.state_was != 'terminated'
                    Severity: Minor
                    Found in app/observers/telephony/call_observer.rb - About 25 mins to fix

                    Method authenticate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def authenticate
                    @agent = Agent.find_by_csr_id params[:csr_id]
                     
                    @agent.verify_status!
                     
                     
                    Severity: Minor
                    Found in app/controllers/telephony/signals/agents/presences_controller.rb - About 25 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language