support-foo/web

View on GitHub

Showing 51 of 51 total issues

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

    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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          if($subject.val()) {
            $subject.closest('.form-group').removeClass('has-error');
          } else {
            $subject.closest('.form-group').addClass('has-error');
            valid = false;
      Severity: Major
      Found in app/assets/javascripts/accounts_demo.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/accounts_demo.js on lines 45..50

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 63.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          if($body.val()) {
            $body.closest('.form-group').removeClass('has-error');
          } else {
            $body.closest('.form-group').addClass('has-error');
            valid = false;
      Severity: Major
      Found in app/assets/javascripts/accounts_demo.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/accounts_demo.js on lines 38..43

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 63.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              clearCannedResponseFilter: function(event) {
                $dropdown = $(event.target).closest('.dropdown-menu').removeClass('open');
                this.setState({ filter: '' });
              },
            app/assets/javascripts/components/assignment_button.js.jsx on lines 61..64

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 59.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    <button className="btn btn-default dropdown-toggle" data-search="tags" data-toggle="dropdown" onClick={this.focusInput}>
                      Tag {' '}
                      <span className="caret"></span>
                    </button>
            Severity: Major
            Found in app/assets/javascripts/components/tag_button.js.jsx and 1 other location - About 1 hr to fix
            app/assets/javascripts/components/assignment_button.js.jsx on lines 89..92

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 59.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              clearAssignmentFilter: function(event) {
                $dropdown = $(event.target).closest('.dropdown-menu').removeClass('open');
                this.setState({ filter: '' });
              },
            Severity: Major
            Found in app/assets/javascripts/components/assignment_button.js.jsx and 1 other location - About 1 hr to fix
            app/assets/javascripts/components/canned_response_button.js.jsx on lines 44..47

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 59.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    <button className="btn btn-default dropdown-toggle" data-search="assignments" data-toggle="dropdown" onClick={this.focusInput}>
                      Assign {' '}
                      <span className="caret"></span>
                    </button>
            Severity: Major
            Found in app/assets/javascripts/components/assignment_button.js.jsx and 1 other location - About 1 hr to fix
            app/assets/javascripts/components/tag_button.js.jsx on lines 125..128

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 59.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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 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 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
                      @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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      if(this.state.conversations.length) {
                        var conversations = this.state.conversations.map(this.renderConversation);
                  
                        return (
                          <div className="list list-conversations">{conversations}</div>
                  Severity: Minor
                  Found in app/assets/javascripts/components/conversation_list.js.jsx and 1 other location - About 50 mins to fix
                  app/assets/javascripts/components/stream.js.jsx on lines 17..21

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 51.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                    render: function() {
                      var streamItems = this.props.items.map(this.renderStreamItem);
                  
                      return <div className="stream">{streamItems}</div>
                    },
                  Severity: Minor
                  Found in app/assets/javascripts/components/stream.js.jsx and 1 other location - About 50 mins to fix
                  app/assets/javascripts/components/conversation_list.js.jsx on lines 235..241

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 51.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language