NIT-dgp/cat-forum

View on GitHub

Showing 145 of 145 total issues

Devise Gem for Ruby confirmation token validation with a blank string
Open

    devise (4.2.0)
Severity: Minor
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2019-16109

Criticality: Medium

URL: https://github.com/plataformatec/devise/issues/5071

Solution: upgrade to >= 4.7.1

RuboCop gem Insecure use of /tmp
Open

    rubocop (0.42.0)
Severity: Info
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2017-8418

Criticality: Low

URL: https://github.com/bbatsov/rubocop/issues/4336

Solution: upgrade to >= 0.49.0

Possible XSS vulnerability in Rack
Open

    rack (1.5.5)
Severity: Minor
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2018-16471

URL: https://groups.google.com/forum/#!topic/ruby-security-ann/NAalCee8n6o

Solution: upgrade to ~> 1.6.11, >= 2.0.6

Potential remote code execution of user-provided local names in ActionView
Open

    actionview (4.1.8)
Severity: Critical
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2020-8163

Criticality: High

URL: https://groups.google.com/forum/#!topic/rubyonrails-security/hWuKcHyoKh0

Solution: upgrade to >= 4.2.11.2

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

    respond_to do |format|
      if @like_count_reply.save
        @like_count_reply.create_activity :create,
                                          owner: current_user,
                                          recipient: @reply.user,
Severity: Major
Found in app/controllers/like_count_replies_controller.rb and 1 other location - About 2 hrs to fix
app/controllers/like_counts_controller.rb on lines 32..51

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 80.

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

    respond_to do |format|
      if @like_count.save
        @like_count.create_activity :create,
                                    owner: current_user,
                                    recipient: @new_thread.user,
Severity: Major
Found in app/controllers/like_counts_controller.rb and 1 other location - About 2 hrs to fix
app/controllers/like_count_replies_controller.rb on lines 31..54

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 80.

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

    respond_to do |format|
      if @dislike_count_reply.save
        if current_user != @reply_user
          @reply_user.update_attributes(points: @reply_user.points -= 15)
          @badge = @reply_user.update_badge(@reply_user.id)
Severity: Major
Found in app/controllers/dislike_count_replies_controller.rb and 1 other location - About 1 hr to fix
app/controllers/dislike_counts_controller.rb on lines 31..46

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 66.

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

    respond_to do |format|
      if @dislike_count.save
        if current_user != @thread_user
          @thread_user.update_attributes(points: @thread_user.points -= 10)
          @badge = @thread_user.update_badge(@user.id)
Severity: Major
Found in app/controllers/dislike_counts_controller.rb and 1 other location - About 1 hr to fix
app/controllers/dislike_count_replies_controller.rb on lines 32..51

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 66.

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

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

              def create
                @flag = Flag.new(flag_params)
            
                respond_to do |format|
                  if @flag.save
            Severity: Major
            Found in app/controllers/flags_controller.rb and 2 other locations - About 1 hr to fix
            app/controllers/blockeds_controller.rb on lines 30..45
            app/controllers/pages_controller.rb on lines 33..45

            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 47.

            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 3 locations. Consider refactoring.
            Open

              def create
                @blocked = Blocked.new(blocked_params)
            
                respond_to do |format|
                  if @blocked.save
            Severity: Major
            Found in app/controllers/blockeds_controller.rb and 2 other locations - About 1 hr to fix
            app/controllers/flags_controller.rb on lines 35..47
            app/controllers/pages_controller.rb on lines 33..45

            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 47.

            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 3 locations. Consider refactoring.
            Open

              def create
                @page = Page.new(page_params)
            
                respond_to do |format|
                  if @page.save
            Severity: Major
            Found in app/controllers/pages_controller.rb and 2 other locations - About 1 hr to fix
            app/controllers/blockeds_controller.rb on lines 30..45
            app/controllers/flags_controller.rb on lines 35..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 47.

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

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

              def update
                respond_to do |format|
                  if @blocked.update(blocked_params)
                    format.html do
                      redirect_to @blocked,
            Severity: Major
            Found in app/controllers/blockeds_controller.rb and 5 other locations - About 55 mins to fix
            app/controllers/dislike_count_replies_controller.rb on lines 58..75
            app/controllers/dislike_counts_controller.rb on lines 53..66
            app/controllers/like_count_replies_controller.rb on lines 61..74
            app/controllers/pages_controller.rb on lines 52..62
            app/controllers/reply_flags_controller.rb on lines 44..57

            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 44.

            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 6 locations. Consider refactoring.
            Open

              def update
                respond_to do |format|
                  if @page.update(page_params)
                    format.html do
                      redirect_to @page,
            Severity: Major
            Found in app/controllers/pages_controller.rb and 5 other locations - About 55 mins to fix
            app/controllers/blockeds_controller.rb on lines 52..65
            app/controllers/dislike_count_replies_controller.rb on lines 58..75
            app/controllers/dislike_counts_controller.rb on lines 53..66
            app/controllers/like_count_replies_controller.rb on lines 61..74
            app/controllers/reply_flags_controller.rb on lines 44..57

            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 44.

            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 6 locations. Consider refactoring.
            Open

              def update
                respond_to do |format|
                  if @dislike_count_reply.update(dislike_count_reply_params)
                    format.html do
                      redirect_to @dislike_count_reply,
            Severity: Major
            Found in app/controllers/dislike_count_replies_controller.rb and 5 other locations - About 55 mins to fix
            app/controllers/blockeds_controller.rb on lines 52..65
            app/controllers/dislike_counts_controller.rb on lines 53..66
            app/controllers/like_count_replies_controller.rb on lines 61..74
            app/controllers/pages_controller.rb on lines 52..62
            app/controllers/reply_flags_controller.rb on lines 44..57

            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 44.

            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