CommunityGrows/communitygrows

View on GitHub

Showing 187 of 187 total issues

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

    def create
        @title = event_params[:title]
        @location = event_params[:location]
        @description = event_params[:description]
        @date = event_params[:date]
Severity: Minor
Found in app/controllers/events_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 update has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def update
        @event = Event.find params[:id]
        @title = event_params[:title]
        @date = event_params[:date]
        if @title.empty?
Severity: Minor
Found in app/controllers/events_controller.rb - About 1 hr to fix

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

            if Rails.env.production?
                User.all.each do |user|
                    if user.digest_pref == "daily"
                        NotificationMailer.announcement_update_email(user, @target_announcement).deliver_later!(wait_until: (Time.now.tomorrow.noon - Time.now).seconds.from_now)
                    elsif user.digest_pref == "weekly"
    Severity: Major
    Found in app/controllers/admin_controller.rb and 2 other locations - About 1 hr to fix
    app/controllers/events_controller.rb on lines 40..48
    app/controllers/events_controller.rb on lines 85..93

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

    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

            if Rails.env.production?
                User.all.each do |user| 
                    if user.digest_pref == "daily"
                        NotificationMailer.event_update_email(user, @event).deliver_later!(wait_until: (Time.now.tomorrow.noon - Time.now).seconds.from_now)
                    elsif user.digest_pref == "weekly"
    Severity: Major
    Found in app/controllers/events_controller.rb and 2 other locations - About 1 hr to fix
    app/controllers/admin_controller.rb on lines 108..116
    app/controllers/events_controller.rb on lines 40..48

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

    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

            if Rails.env.production?
                User.all.each do |user|
                    if user.digest_pref == "daily"
                        NotificationMailer.new_event_email(user, @event).deliver_later!(wait_until: (Time.now.tomorrow.noon - Time.now).seconds.from_now)
                    elsif user.digest_pref == "weekly"
    Severity: Major
    Found in app/controllers/events_controller.rb and 2 other locations - About 1 hr to fix
    app/controllers/admin_controller.rb on lines 108..116
    app/controllers/events_controller.rb on lines 85..93

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

    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 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def update
            @event = Event.find params[:id]
            @title = event_params[:title]
            @date = event_params[:date]
            if @title.empty?
    Severity: Minor
    Found in app/controllers/events_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

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

        def send_doc_email(file)
            User.all.each do |user|
                # NotificationMailer.document_update_email(user, Document.find_by_title(@title)).deliver
    
                if user.digest_pref == "daily"
    Severity: Major
    Found in app/helpers/email_helper.rb and 1 other location - About 1 hr to fix
    app/helpers/email_helper.rb on lines 47..55

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

    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

        def send_doc_email_update(file)
            User.all.each do |user|
                if user.digest_pref == "daily"
                    NotificationMailer.document_update_email(user, file).deliver_later!(wait_until: (Time.now.tomorrow.noon - Time.now).seconds.from_now)
                elsif user.digest_pref == "weekly"
    Severity: Major
    Found in app/helpers/email_helper.rb and 1 other location - About 1 hr to fix
    app/helpers/email_helper.rb on lines 33..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 54.

    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_category has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def update_category
            if !current_user.admin
                flash[:message] = "Only admins can create categories."
                redirect_to root_path and return
            end
    Severity: Minor
    Found in app/controllers/category_controller.rb - About 1 hr to fix

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

          def create_category
              if !current_user.admin
                  flash[:message] = "Only admins can create categories."
                  redirect_to root_path and return
              end
      Severity: Minor
      Found in app/controllers/category_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 update_category has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def update_category
              if !current_user.admin
                  flash[:message] = "Only admins can create categories."
                  redirect_to root_path and return
              end
      Severity: Minor
      Found in app/controllers/category_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

      XSS vulnerability in rails-html-sanitizer
      Open

          rails-html-sanitizer (1.0.3)
      Severity: Minor
      Found in Gemfile.lock by bundler-audit

      Advisory: CVE-2018-3741

      URL: https://groups.google.com/d/msg/rubyonrails-security/tP7W3kLc5u4/uDy2Br7xBgAJ

      Solution: upgrade to >= 1.0.4

      Denial of Service Vulnerability in Action View
      Open

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

      Advisory: CVE-2019-5419

      Criticality: High

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

      Solution: upgrade to >= 6.0.0.beta3, >= 5.2.2.1, ~> 5.2.2, >= 5.1.6.2, ~> 5.1.6, >= 5.0.7.2, ~> 5.0.7, >= 4.2.11.1, ~> 4.2.11

      Denial of Service Vulnerability in Rack Multipart Parsing
      Open

          rack (2.0.1)
      Severity: Critical
      Found in Gemfile.lock by bundler-audit

      Advisory: CVE-2022-30122

      Criticality: High

      URL: https://groups.google.com/g/ruby-security-ann/c/L2Axto442qk

      Solution: upgrade to >= 2.0.9.1, ~> 2.0.9, >= 2.1.4.1, ~> 2.1.4, >= 2.2.3.1

      Possible XSS vulnerability in Rack
      Open

          rack (2.0.1)
      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

      Regular Expression Denial of Service in websocket-extensions (RubyGem)
      Open

          websocket-extensions (0.1.2)
      Severity: Critical
      Found in Gemfile.lock by bundler-audit

      Advisory: CVE-2020-7663

      Criticality: High

      URL: https://github.com/faye/websocket-extensions-ruby/security/advisories/GHSA-g6wq-qcwm-j5g2

      Solution: upgrade to >= 0.1.5

      Path Traversal in Sprockets
      Open

          sprockets (3.7.0)
      Severity: Critical
      Found in Gemfile.lock by bundler-audit

      Advisory: CVE-2018-3760

      Criticality: High

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

      Solution: upgrade to < 3.0.0, >= 2.12.5, < 4.0.0, >= 3.7.2, >= 4.0.0.beta8

      TZInfo relative path traversal vulnerability allows loading of arbitrary files
      Open

          tzinfo (1.2.2)
      Severity: Critical
      Found in Gemfile.lock by bundler-audit

      Advisory: CVE-2022-31163

      Criticality: High

      URL: https://github.com/tzinfo/tzinfo/security/advisories/GHSA-5cm2-9h8c-rvfx

      Solution: upgrade to ~> 0.3.61, >= 1.2.10

      Possible shell escape sequence injection vulnerability in Rack
      Open

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

      Advisory: CVE-2022-30123

      Criticality: Critical

      URL: https://groups.google.com/g/ruby-security-ann/c/LWB10kWzag8

      Solution: upgrade to >= 2.0.9.1, ~> 2.0.9, >= 2.1.4.1, ~> 2.1.4, >= 2.2.3.1

      Broken Access Control vulnerability in Active Job
      Open

          activejob (5.0.0.1)
      Severity: Critical
      Found in Gemfile.lock by bundler-audit

      Advisory: CVE-2018-16476

      Criticality: High

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

      Solution: upgrade to ~> 4.2.11, ~> 5.0.7.1, ~> 5.1.6.1, ~> 5.1.7, >= 5.2.1.1

      Severity
      Category
      Status
      Source
      Language