georgia-cms/georgia

View on GitHub

Showing 14 of 14 total issues

Method asset_icon_tag has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def asset_icon_tag extension
      icon_name = case extension.downcase
        when 'avi' then 'file-movie-o'
        when 'css' then 'file-text-o'
        when 'csv' then 'file-excel-o'
Severity: Minor
Found in app/helpers/georgia/ui_helper.rb - About 1 hr to fix

    Method active_facet_list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def active_facet_list(*facets)
          return unless facets and !facets.empty?
          output = ActiveSupport::SafeBuffer.new
          facets.each do |param|
            if params[param] and params[param].is_a?(Array)
    Severity: Minor
    Found in app/helpers/georgia/facets_helper.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 included has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.included(base)
          base.instance_eval do
            concern :pageable do
    
              collection do
    Severity: Minor
    Found in app/routes/georgia/pageable_route_concern.rb - About 1 hr to fix

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

          def notify_editors(message, url)
            @message = message
            @url = url
            emails_to = Georgia::User.where(roles: ['admin', 'editor']).where(receives_notifications: true).pluck(:email)
            unless emails_to.empty?
      Severity: Minor
      Found in app/mailers/georgia/notifier.rb and 1 other location - About 30 mins to fix
      app/mailers/georgia/notifier.rb on lines 4..13

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

      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 notify_admins(message, url)
            @message = message
            @url = url
            emails_to = Georgia::User.where(roles: ['admin', 'editor']).where(receives_notifications: true).pluck(:email)
            unless emails_to.empty?
      Severity: Minor
      Found in app/mailers/georgia/notifier.rb and 1 other location - About 30 mins to fix
      app/mailers/georgia/notifier.rb on lines 17..26

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

      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

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

            respond_to do |format|
              format.html { redirect_to :back, alert: @status_message }
              format.js   { render layout: false }
              format.json { render json: { message: @status_message, status: @status } }
      Severity: Minor
      Found in app/controllers/georgia/pages_controller.rb and 1 other location - About 25 mins to fix
      app/controllers/georgia/media_controller.rb on lines 94..97

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

      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 associations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def associations
            errors.add(:base, "An association to a page is required.") unless page_id.present?
            errors.add(:base, "An association to a UI Section is required.") unless ui_section_id.present?
            errors.add(:base, "An association to a Widget is required.") unless widget_id.present?
          end
      Severity: Minor
      Found in app/models/georgia/ui_association.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

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

            respond_to do |format|
              format.html { redirect_to :back, alert: @status_message }
              format.js   { render layout: false }
              format.json { render json: { message: @status_message, status: @status } }
      Severity: Minor
      Found in app/controllers/georgia/media_controller.rb and 1 other location - About 25 mins to fix
      app/controllers/georgia/pages_controller.rb on lines 199..202

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

      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 revision_partial_sorter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def revision_partial_sorter
            if current_revision? and policy(@revision).approve?
              nil
            elsif current_revision? and !policy(@revision).approve?
              'insufficient_rights'
      Severity: Minor
      Found in app/presenters/georgia/revision_status_message.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 sortable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def sortable(column, title=nil)
            title ||= column.humanize
            direction = (column.to_s == params[:o] && params[:dir] == "asc" ? "desc" : "asc")
            icon = direction == "asc" ? icon_tag('caret-up') : icon_tag('caret-down')
            "#{title} #{link_to(icon, params.merge({o: column, dir: direction}))}".html_safe
      Severity: Minor
      Found in app/helpers/georgia/forms_helper.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

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

          def unpublish
            set_pages
            authorize @pages
      
            unless @pages.map(&:unpublish).include?(false)
      Severity: Minor
      Found in app/controllers/georgia/pages_controller.rb and 1 other location - About 25 mins to fix
      app/controllers/georgia/pages_controller.rb on lines 104..113

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

      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 publish
            set_pages
            authorize @pages
            unless @pages.map(&:publish).include?(false)
              @pages.each do |page|
      Severity: Minor
      Found in app/controllers/georgia/pages_controller.rb and 1 other location - About 25 mins to fix
      app/controllers/georgia/pages_controller.rb on lines 118..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 29.

      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

      module Georgia
        module Uploader
          module Storage
            module Fog
              extend ActiveSupport::Concern
      Severity: Minor
      Found in lib/georgia/uploader/storage/fog.rb and 1 other location - About 20 mins to fix
      lib/georgia/uploader/storage/file.rb on lines 3..17

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

      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

      module Georgia
        module Uploader
          module Storage
            module File
              extend ActiveSupport::Concern
      Severity: Minor
      Found in lib/georgia/uploader/storage/file.rb and 1 other location - About 20 mins to fix
      lib/georgia/uploader/storage/fog.rb on lines 3..17

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

      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