NIT-dgp/cat-forum

View on GitHub

Showing 12 of 145 total issues

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

  def create
    @user = User.find(current_user.id)
    @reply = Reply.find(params[:reply_id])
    @like_count_reply = @user.add_reply(@reply.id)
    @reply_user = @reply.user
Severity: Minor
Found in app/controllers/like_count_replies_controller.rb - About 1 hr to fix

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

      def create
        @user = @new_thread.user
    
        respond_to do |format|
          if @reply.save
    Severity: Minor
    Found in app/controllers/replies_controller.rb - About 1 hr to fix

      Method update_badge has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def update_badge(user_id)
          user = User.find_by_id(user_id)
          user.badge =
            case user.points
            when -100_000..199
      Severity: Minor
      Found in app/models/user.rb - About 1 hr to fix

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

          def create
            @user = User.find(current_user.id)
            @reply = Reply.find(params[:reply_id])
            @dislike_count_reply = @user.add_reply_dislike(@reply.id)
            @reply_user = @reply.user
        Severity: Minor
        Found in app/controllers/dislike_count_replies_controller.rb - About 1 hr to fix

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

            def create
              @user = User.find(current_user.id)
              @new_thread = NewThread.friendly.find(params[:new_thread_id])
              @like_count = @user.add_new_thread(@new_thread.id)
              @thread_user = @new_thread.user
          Severity: Minor
          Found in app/controllers/like_counts_controller.rb - About 1 hr to fix

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

              def update
                with_unconfirmed_confirmable do
                  if @confirmable.has_no_password?
                    @confirmable.attempt_set_password password[:user]
                    if @confirmable.valid?
            Severity: Minor
            Found in app/controllers/confirmations_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 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def create
                @user = User.find(current_user.id)
                @new_thread = NewThread.friendly.find(params[:new_thread_id])
                @dislike_count = @user.add_new_thread_dislike(@new_thread.id)
                @thread_user = @new_thread.user
            Severity: Minor
            Found in app/controllers/dislike_counts_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

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

              def create
                @user = User.find(current_user.id)
                @reply = Reply.find(params[:reply_id])
                @dislike_count_reply = @user.add_reply_dislike(@reply.id)
                @reply_user = @reply.user
            Severity: Minor
            Found in app/controllers/dislike_count_replies_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

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

              def create
                @user = @new_thread.user
            
                respond_to do |format|
                  if @reply.save
            Severity: Minor
            Found in app/controllers/replies_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

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

              def create
                @user = User.find(current_user.id)
                @reply = Reply.find(params[:reply_id])
                @like_count_reply = @user.add_reply(@reply.id)
                @reply_user = @reply.user
            Severity: Minor
            Found in app/controllers/like_count_replies_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

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

              def self.new_with_session(params, session)
                super.tap do |user|
                  if data = session['devise.facebook_data'] &&
                            session['devise.facebook_data']['extra']['raw_info']
                    user.email = data['email'] if user.email.blank?
            Severity: Minor
            Found in app/models/user.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

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

              def create
                @user = User.find(current_user.id)
                @new_thread = NewThread.friendly.find(params[:new_thread_id])
                @like_count = @user.add_new_thread(@new_thread.id)
                @thread_user = @new_thread.user
            Severity: Minor
            Found in app/controllers/like_counts_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