support-foo/web

View on GitHub

Showing 20 of 51 total issues

Function applyTextcomplete has 91 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function applyTextcomplete($btnGroup) {
  var textcompletesPath = $btnGroup.attr('data-textcomplete-path');
  var $input = $('input', $btnGroup);
  var $dropdownToggle = $('.dropdown-toggle', $btnGroup);
  var $dropdown = $('.dropdown-menu', $btnGroup);
Severity: Major
Found in app/assets/javascripts/command_bar.js - About 3 hrs to fix

    Class Account has 25 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Account < ActiveRecord::Base
      include ActiveRecord::UUID
    
      PRO_PLAN_ID = 'pro-30'
    
    
    Severity: Minor
    Found in app/models/account.rb - About 2 hrs to fix

      Method create has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        def create
          if existing_user = User.find_by(email: params[:user][:email])
            @user = existing_user
      
            if current_user.email == params[:user][:email]
      Severity: Minor
      Found in app/controllers/users/invitations_controller.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 create has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def create
          if existing_user = User.find_by(email: params[:user][:email])
            @user = existing_user
      
            if current_user.email == params[:user][:email]
      Severity: Minor
      Found in app/controllers/users/invitations_controller.rb - About 1 hr to fix

        Function renderHeader has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          renderHeader: function() {
            var title = null;
            var preview = null;
            var timestamp = null;
        
        
        Severity: Minor
        Found in app/assets/javascripts/components/conversation.js.jsx - About 1 hr to fix

          Method create has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def create
              content_type = 'application/json'
          
              if params[:callback].present?
                request.format = 'json'
          Severity: Minor
          Found in app/controllers/incoming_messages_controller.rb - About 1 hr to fix

            Method create has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def create
                @account = Account.new(account_params)
                @user = User.new(user_params)
            
                @person = Person.where(email: @user.email).first_or_initialize
            Severity: Minor
            Found in app/controllers/accounts_controller.rb - About 1 hr to fix

              Function createMessage has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                createMessage: function() {
                  if(this.props.demo) {
                    $.get('/user.json', function(response) {
                      var message = {
                        id: 'message-' + (new Date()).getTime(),
              Severity: Minor
              Found in app/assets/javascripts/components/response.js.jsx - About 1 hr to fix

                Method create has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def create
                    require_mailgun_params!
                
                    ActiveRecord::Base.transaction do
                      # Finds Account
                Severity: Minor
                Found in app/controllers/webhooks/mailgun_controller.rb - About 1 hr to fix

                  Function render has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    render: function() {
                      var creatorName = null;
                      var creatorEmail = null;
                      var participants = null;
                  
                  

                    Function toggleHandler has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      toggleHandler: function(toggled) {
                        return function(event) {
                          event.stopPropagation();
                          event.preventDefault();
                    
                    
                    Severity: Minor
                    Found in app/assets/javascripts/components/conversation_list.js.jsx - 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

                    Function archiveHandler has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      archiveHandler: function(conversation) {
                        return function(event) {
                          if(event) {
                            event.stopPropagation();
                            event.preventDefault();
                    Severity: Minor
                    Found in app/assets/javascripts/components/conversation_list.js.jsx - About 1 hr to fix

                      Function removeTagHandler has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        removeTagHandler: function(removeFrom) {
                          return function(tag) {
                            return function(event) {
                              event.stopPropagation();
                              event.preventDefault();
                      Severity: Minor
                      Found in app/assets/javascripts/components/conversation_list.js.jsx - About 1 hr to fix

                        Method links has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def links
                                _fast_links
                              rescue NameError
                                method = "def _fast_links\n"
                        
                        
                        Severity: Minor
                        Found in lib/active_model/serializer/hal_link_utils.rb - About 55 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

                        Method create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def create
                            message = MessageFactory.build(message_params)
                        
                            if message.save
                              message.conversation.archive! if archive_conversation?
                        Severity: Minor
                        Found in app/controllers/messages_controller.rb - About 55 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

                        Method create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def create
                            @account = Account.new(account_params)
                            @user = User.new(user_params)
                        
                            @person = Person.where(email: @user.email).first_or_initialize
                        Severity: Minor
                        Found in app/controllers/accounts_controller.rb - About 55 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

                        Function render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          render: function() {
                            if(this.state.conversations.length) {
                              var conversations = this.state.conversations.map(this.renderConversation);
                        
                              return (
                        Severity: Minor
                        Found in app/assets/javascripts/components/conversation_list.js.jsx - 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

                        Function conversationsPath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          conversationsPath: function() {
                            var path = [];
                            path.push('/accounts/');
                            path.push(this.props.accountSlug);
                            path.push('/conversations.json');
                        Severity: Minor
                        Found in app/assets/javascripts/components/conversation_list.js.jsx - 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

                        Function addStreamItemHandler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          addStreamItemHandler: function(addedTo) {
                            return function(streamItem) {
                              var conversations = this.state.conversations.map(function(conversation) {
                                if(conversation === addedTo) {
                                  switch(streamItem.type) {
                        Severity: Minor
                        Found in app/assets/javascripts/components/conversation_list.js.jsx - 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

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

                          def create
                            require_mailgun_params!
                        
                            ActiveRecord::Base.transaction do
                              # Finds Account
                        Severity: Minor
                        Found in app/controllers/webhooks/mailgun_controller.rb - About 25 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