ekylibre/active_list

View on GitHub

Showing 54 of 54 total issues

Method columns_to_cells has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring.
Open

      def columns_to_cells(nature, options = {})
        code = ''
        unless %i[body children].include?(nature)
          raise ArgumentError, 'Nature is invalid'
        end
Severity: Minor
Found in lib/active_list/renderers/simple_renderer.rb - About 2 days 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

File simple_renderer.rb has 387 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module ActiveList
  module Renderers
    class SimpleRenderer < AbstractRenderer
      include ActiveList::Helpers

Severity: Minor
Found in lib/active_list/renderers/simple_renderer.rb - About 5 hrs to fix

    Method operation has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

          def operation(record = 'record_of_the_death')
            link_options = ''
            if @options[:confirm]
              link_options << ", 'data-confirm' => #{(@options[:confirm]).inspect}.t(scope: 'labels')"
            end
    Severity: Minor
    Found in lib/active_list/definition/action_column.rb - About 4 hrs 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 columns_to_cells has 100 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def columns_to_cells(nature, options = {})
            code = ''
            unless %i[body children].include?(nature)
              raise ArgumentError, 'Nature is invalid'
            end
    Severity: Major
    Found in lib/active_list/renderers/simple_renderer.rb - About 4 hrs to fix

      Method column_classes has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

            def column_classes(column, without_id = false, without_interpolation = false)
              classes = []
              conds = []
              conds << [:sor, "#{var_name(:params)}[:sort] == '#{column.sort_id}'".c] if column.sortable?
              conds << [:hidden, "#{var_name(:params)}[:hidden_columns].include?(:#{column.name})".c] if column.is_a? ActiveList::Definition::DataColumn
      Severity: Minor
      Found in lib/active_list/renderers/simple_renderer.rb - About 3 hrs 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 build_table_code has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def build_table_code(options = {})
              record = 'r'
      
              # colgroup = columns_definition_code
              header = header_code
      Severity: Major
      Found in lib/active_list/renderers/simple_renderer.rb - About 3 hrs to fix

        Method select_data_code has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            def select_data_code(options = {})
              paginate = (options.key?(:paginate) ? options[:paginate] : @table.paginate?)
              # Check order
              unless @table.options.keys.include?(:order)
                columns = @table.table_columns
        Severity: Minor
        Found in lib/active_list/generator/finder.rb - About 3 hrs 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 initialize has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

              def initialize(table, name, options = {})
                super(table, name, options)
                unless @options[:through]
                  raise ArgumentError, 'Option :through must be given'
                end
        Severity: Minor
        Found in lib/active_list/definition/association_column.rb - About 2 hrs 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 extras_codes has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

              def extras_codes
                code = []
        
                codes = {}
                if table.global_action_columns.any?
        Severity: Minor
        Found in lib/active_list/renderers/simple_renderer.rb - About 2 hrs 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 build_table_code has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

              def build_table_code(options = {})
                record = 'r'
        
                # colgroup = columns_definition_code
                header = header_code
        Severity: Minor
        Found in lib/active_list/renderers/simple_renderer.rb - About 2 hrs 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

        Class Table has 23 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class Table
              attr_reader :name, :model, :options, :id, :columns, :parameters
        
              def initialize(name, model = nil, options = {})
                @name    = name
        Severity: Minor
        Found in lib/active_list/definition/table.rb - About 2 hrs to fix

          Method header_code has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

                def header_code
                  code = ''
                  code << "'<thead><tr>"
                  if table.selectable?
                    code << '<th class="list-selector"><input type="checkbox" data-list-selector="all" /></th>'
          Severity: Minor
          Found in lib/active_list/renderers/simple_renderer.rb - About 2 hrs 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 operation has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def operation(record = 'record_of_the_death')
                  link_options = ''
                  if @options[:confirm]
                    link_options << ", 'data-confirm' => #{(@options[:confirm]).inspect}.t(scope: 'labels')"
                  end
          Severity: Minor
          Found in lib/active_list/definition/action_column.rb - About 1 hr to fix

            Method select_data_code has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def select_data_code(options = {})
                  paginate = (options.key?(:paginate) ? options[:paginate] : @table.paginate?)
                  # Check order
                  unless @table.options.keys.include?(:order)
                    columns = @table.table_columns
            Severity: Minor
            Found in lib/active_list/generator/finder.rb - About 1 hr to fix

              Method column_classes has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def column_classes(column, without_id = false, without_interpolation = false)
                      classes = []
                      conds = []
                      conds << [:sor, "#{var_name(:params)}[:sort] == '#{column.sort_id}'".c] if column.sortable?
                      conds << [:hidden, "#{var_name(:params)}[:hidden_columns].include?(:#{column.name})".c] if column.is_a? ActiveList::Definition::DataColumn
              Severity: Minor
              Found in lib/active_list/renderers/simple_renderer.rb - About 1 hr to fix

                Method select_code has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    def select_code
                      return nil unless @table.options[:distinct] || @table.options[:select]
                      code = ''
                      code << 'DISTINCT ' if @table.options[:distinct]
                      if @table.options[:select]
                Severity: Minor
                Found in lib/active_list/generator/finder.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 extras_codes has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def extras_codes
                        code = []
                
                        codes = {}
                        if table.global_action_columns.any?
                Severity: Minor
                Found in lib/active_list/renderers/simple_renderer.rb - About 1 hr to fix

                  Method send_data_code has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def send_data_code
                          xml_escape = "to_s.gsub('&', '&amp;').gsub('\\'', '&apos;').gsub('<', '&lt;').gsub('>', '&gt;')"
                          xml_escape << ".force_encoding('US-ASCII')" if xml_escape.respond_to?(:force_encoding)
                          record = 'r'
                          code = generator.select_data_code(paginate: false)
                  Severity: Minor
                  Found in lib/active_list/exporters/open_document_spreadsheet_exporter.rb - About 1 hr to fix

                    Method initialize has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def initialize(table, name, options = {})
                            super(table, name, options)
                            unless @options[:through]
                              raise ArgumentError, 'Option :through must be given'
                            end
                    Severity: Minor
                    Found in lib/active_list/definition/association_column.rb - About 1 hr to fix

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

                            def columns_to_array(nature, options = {})
                              columns = table.exportable_columns
                      
                              array = []
                              record = options[:record] || 'record_of_the_death'
                      Severity: Minor
                      Found in lib/active_list/exporters/abstract_exporter.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

                      Severity
                      Category
                      Status
                      Source
                      Language