rmg/magic_grid

View on GitHub

Showing 5 of 5 total issues

Class Collection has 29 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Collection

    DEFAULTS = {
      :per_page               => 30,
      :searchable             => [],
Severity: Minor
Found in lib/magic_grid/collection.rb - About 3 hrs to fix

    Class Definition has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Definition
        attr_reader :columns, :options, :params
    
        def magic_collection
          @collection
    Severity: Minor
    Found in lib/magic_grid/definition.rb - About 2 hrs to fix

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

          def initialize(cols_or_opts, collection = nil, controller = nil, opts = {})
            @options, @columns = *self.class.normalize_columns_options(cols_or_opts, opts)
            @params = controller && controller.params || {}
      
            @collection = Collection.create_or_reuse collection, options
      Severity: Minor
      Found in lib/magic_grid/definition.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 perform_pagination has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def perform_pagination(collection)
            return collection unless @per_page
      
            total_entries = count(collection)
            @current_page = bound_current_page(@current_page,
      Severity: Minor
      Found in lib/magic_grid/collection.rb - About 35 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 render_empty_collection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def render_empty_collection(fallback)
            if fallback
              view.content_tag 'tr' do
                view.content_tag('td', :colspan => grid.columns.count,
                                  :class => 'if-empty') do
      Severity: Minor
      Found in lib/magic_grid/html_grid.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