activescaffold/active_scaffold

View on GitHub

Showing 276 of 365 total issues

Method active_scaffold_refresh_link has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def active_scaffold_refresh_link(column, html_options, record, ui_options = {})
        link_options = {:object => record}
        if html_options['data-update_url']
          link_options['data-update_send_form'] = html_options['data-update_send_form']
          link_options['data-update_send_form_selector'] = html_options['data-update_send_form_selector']
Severity: Minor
Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 45 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 cache_association_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def cache_association_options(association, conditions, klass, cache = true)
        if active_scaffold_config.cache_association_options && cache
          @_associations_cache ||= Hash.new { |h, k| h[k] = {} }
          key = [association.name, association.inverse_klass.name, klass.respond_to?(:cache_key) ? klass.cache_key : klass.name].join('/')
          @_associations_cache[key][conditions] ||= yield
Severity: Minor
Found in lib/active_scaffold/helpers/association_helpers.rb - About 45 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 active_scaffold_file_with_remove_link has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def active_scaffold_file_with_remove_link(column, options, content, remove_file_prefix, controls_class, ui_options: column.options, &block) # rubocop:disable Metrics/ParameterLists
Severity: Minor
Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 45 mins to fix

    Method setup_association_info has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def setup_association_info
          assoc = active_record_class.reflect_on_association(name)
          @association =
            if assoc
              if active_record?
    Severity: Minor
    Found in lib/active_scaffold/data_structures/column.rb - About 45 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 reverse_association has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def reverse_association(klass = nil)
          assoc =
            if polymorphic?
              get_reverse(klass) unless klass.nil?
            else
    Severity: Minor
    Found in lib/active_scaffold/data_structures/association/abstract.rb - About 45 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 delete_group has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def delete_group(name)
          @set.each do |group|
            next unless group.is_a?(ActiveScaffold::DataStructures::ActionLinks)
            if group.name == name
              @set.delete group
    Severity: Minor
    Found in lib/active_scaffold/data_structures/action_links.rb - About 45 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

    Avoid deeply nested control flow statements.
    Open

                if reverse&.singular? && !reverse.belongs_to? && options[:allow_autosave]
                  record.send(k).send("#{reverse.name}=", record)
                end
    Severity: Major
    Found in lib/active_scaffold/constraints.rb - About 45 mins to fix

      Method add_association_columns has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def add_association_columns(association, *columns)
            column = self[association]
            raise ArgumentError, "unknown column #{association}" if column.nil?
            raise ArgumentError, "column #{association} is not an association" if column.association.nil?
            raise ArgumentError, "column #{association} is not singular association" unless column.association.singular?
      Severity: Minor
      Found in lib/active_scaffold/data_structures/columns.rb - About 45 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 usa_state_select has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def usa_state_select(object, method, priority_states = nil, options = {}, html_options = {})
      Severity: Minor
      Found in lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb - About 35 mins to fix

        Method active_scaffold_record_select has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def active_scaffold_record_select(record, column, options, value, multiple, ui_options: column.options)
        Severity: Minor
        Found in lib/active_scaffold/bridges/record_select/helpers.rb - About 35 mins to fix

          Method find_template has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def find_template(name, prefixes = [], partial = false, keys = [], options = {})
          Severity: Minor
          Found in lib/active_scaffold/extensions/action_view_rendering.rb - About 35 mins to fix

            Method pagination_ajax_links has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def pagination_ajax_links(current_page, url_options, options, inner_window, outer_window)
            Severity: Minor
            Found in lib/active_scaffold/helpers/pagination_helpers.rb - About 35 mins to fix

              Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def initialize(name, default, sql_type = nil, null = true, **)
              Severity: Minor
              Found in lib/active_scaffold/tableless.rb - About 35 mins to fix

                Method active_scaffold_file_with_content has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                      def active_scaffold_file_with_content(column, content, options, remove_file_prefix, controls_class)
                Severity: Minor
                Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 35 mins to fix

                  Method active_scaffold_checkbox_option has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                        def active_scaffold_checkbox_option(option, label_method, associated_ids, checkbox_options, li_options = {})
                  Severity: Minor
                  Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 35 mins to fix

                    Method form_attribute has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                          def form_attribute(column, record, scope = nil, only_value = false, col_class = nil)
                    Severity: Minor
                    Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 35 mins to fix

                      Method active_scaffold_input_chosen has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def active_scaffold_input_chosen(column, html_options, ui_options: column.options)
                              html_options[:class] << ' chosen'
                              if column.association&.collection?
                                record = html_options.delete(:object)
                                associated_options, select_options = active_scaffold_plural_association_options(column, record)
                      Severity: Minor
                      Found in lib/active_scaffold/bridges/chosen/helpers.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 each has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def each(options = {}, &block)
                                super(options) do |item|
                                  item = __wrap__(item) || item unless item.is_a?(ActiveScaffold::DataStructures::ActionLinks)
                                  if options[:include_set]
                                    yield item, __getobj__.instance_variable_get(:@set)
                      Severity: Minor
                      Found in lib/active_scaffold/extensions/cow_proxy.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 set_outer_joins_for_search has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def set_outer_joins_for_search(columns) # rubocop:disable Naming/AccessorMethodName
                              references = []
                              outer_joins = []
                              columns.each do |column|
                                next if column.search_joins.blank?
                      Severity: Minor
                      Found in lib/active_scaffold/actions/common_search.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

                      Function create_associated_record_form has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                        create_associated_record_form: function(element, content, options) {
                          var element = $(element);
                          if (options.singular == false) {
                            if (!(options.id && $(options.id))) {
                              element.insert(content);
                      Severity: Minor
                      Found in app/assets/javascripts/prototype/active_scaffold.js - 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

                      Severity
                      Category
                      Status
                      Source
                      Language