activescaffold/active_scaffold

View on GitHub

Showing 246 of 296 total issues

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

    def as_marked=(value)
      if [true, 'true', 1, '1', 'T', 't'].include?(value.respond_to?(:downcase) ? value.downcase : value)
        marked_records[id.to_s] = true unless as_marked
      else
        marked_records.delete(id.to_s)
Severity: Minor
Found in lib/active_scaffold/marked_model.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 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 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_tabs_for has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def active_scaffold_tabs_for(column, record, subsection_id, tab_options, used_tabs)
    Severity: Minor
    Found in lib/active_scaffold/helpers/tabs_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 = {}) # rubocop:disable Metrics, Style
      Severity: Minor
      Found in lib/active_scaffold/extensions/action_view_rendering.rb - About 35 mins to fix

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

              def active_scaffold_tabbed_by(column, record, scope, subsection_id, &block)
        Severity: Minor
        Found in lib/active_scaffold/helpers/tabs_helpers.rb - About 35 mins to fix

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

              def assign_tabbed_by(record, parent_column, tabbed_by, value, value_type)
          Severity: Minor
          Found in lib/active_scaffold/actions/subform.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 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 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_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 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_input_for_tabbed has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                            def active_scaffold_input_for_tabbed(column, record, subsection_id, tab_options, used_tabs)
                      Severity: Minor
                      Found in lib/active_scaffold/helpers/tabs_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 render_column has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

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

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

                                def update_column_association(parent_record, column, attribute, value, avoid_changes = false)
                            Severity: Minor
                            Found in lib/active_scaffold/attribute_params.rb - About 35 mins to fix

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

                                    def build_active_scaffold_search_range_ui(operators, from, to = nil, name:, id:, opt_value: nil)
                                      opt_value ||= operators[0][1]
                                      html = select_tag("#{name}[opt]", options_for_select(operators, opt_value),
                                                        id: "#{id}_opt", class: 'as_search_range_option')
                                      if to
                              Severity: Minor
                              Found in lib/active_scaffold/helpers/search_column_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 links_for_associations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def links_for_associations
                                      return unless active_scaffold_config.actions.include?(:list) && active_scaffold_config.actions.include?(:nested)
                              
                                      active_scaffold_config.columns.each do |column|
                                        next unless column.link.nil? && column.autolink?
                              Severity: Minor
                              Found in lib/active_scaffold/core.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

                              Severity
                              Category
                              Status
                              Source
                              Language