activescaffold/active_scaffold

View on GitHub

Showing 276 of 365 total issues

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

    def sti_nested_build_options(klass)
      config = active_scaffold_config_for(klass)
      return unless config
      column = klass.inheritance_column
      return unless column && config._columns_hash[column]
Severity: Minor
Found in lib/active_scaffold/actions/core.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 date_options has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def self.date_options(locale)
        date_picker_options = {
          :closeText => as_(:close),
          :prevText => as_(:previous),
          :nextText => as_(:next),
Severity: Minor
Found in lib/active_scaffold/bridges/date_picker/helper.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 call has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def call(mapper, options = {})
        options = @defaults.merge(options)
        actions = get_actions(ACTIVE_SCAFFOLD_CORE_ROUTING, options)

        mapper.collection do
Severity: Minor
Found in lib/active_scaffold/extensions/routing_mapper.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 updated_record_with_column has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def updated_record_with_column(column, value, scope)
      record = params[:id] ? copy_attributes(find_if_allowed(params[:id], :read)) : new_model
      apply_constraints_to_record(record) unless scope || params[:id]
      create_association_with_parent record, true if nested?
      if @form_action == :field_search && value.is_a?(Array) && column.association&.singular?
Severity: Minor
Found in lib/active_scaffold/actions/core.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 grouped_sorting has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def grouped_sorting(group_sql)
        return unless search_group_column && active_scaffold_config.list.user.sorting
        group_sort = search_group_function ? group_sql : search_group_column.sort[:sql] if search_group_column.sortable?
        grouped_columns = grouped_columns_calculations.merge(search_group_column.name => group_sort)
        sorting = active_scaffold_config.list.user.sorting.clause(grouped_columns)
Severity: Minor
Found in lib/active_scaffold/actions/field_search.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 include_habtm_actions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def include_habtm_actions
      if nested&.habtm?
        # Production mode is ok with adding a link everytime the scaffold is nested - we are not ok with that.
        unless active_scaffold_config.action_links['new_existing']
          active_scaffold_config.action_links.add('new_existing', :label => :add_existing, :type => :collection, :security_method => :add_existing_authorized?)
Severity: Minor
Found in lib/active_scaffold/actions/nested.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 column_heading_value has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def column_heading_value(column, sorting, sort_direction)
        if column.name == :as_marked
          mark_column_heading
        elsif column.sortable?
          options = {:id => nil, :class => 'as_sort',
Severity: Minor
Found in lib/active_scaffold/helpers/list_column_helpers.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 active_scaffold_input_ancestry has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def active_scaffold_input_ancestry(column, options, ui_options: column.options)
        record = options[:object]
        select_options = []
        select_control_options = {:selected => record.parent_id}
        select_control_options[:include_blank] = as_(:_select_) if record.parent_id.nil?
Severity: Minor
Found in lib/active_scaffold/bridges/ancestry/ancestry_bridge.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 method_missing has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def method_missing(name, *args, &block)
          CowProxy.debug { "method missing #{name} in #{__getobj__.name}" }
          return super if name.match?(/[!?]$/)
          subgroup =
            if _instance_variable_defined?("@#{name}")
Severity: Minor
Found in lib/active_scaffold/extensions/cow_proxy.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 name_to_cache has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def name_to_cache
      return @name_to_cache if defined? @name_to_cache
      [
        controller || 'self',
        type,
Severity: Minor
Found in lib/active_scaffold/data_structures/action_link.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 number_to_native has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def number_to_native(value)
      return value if value.blank? || !value.is_a?(String)
      native = '.' # native ruby separator
      format = {:separator => '', :delimiter => ''}.merge! I18n.t('number.format', :default => {})
      specific =
Severity: Minor
Found in lib/active_scaffold/data_structures/column.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 active_scaffold_file_with_content has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def active_scaffold_file_with_content(column, content, options, remove_file_prefix, controls_class)
        required = options.delete(:required)
        case ActiveScaffold.js_framework
        when :jquery
          js_remove_file_code = "jQuery(this).prev().val('true'); jQuery(this).parent().hide().next().show()#{".find('input').attr('required', 'required')" if required}; return false;"
Severity: Minor
Found in lib/active_scaffold/helpers/form_column_helpers.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 set_link has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def set_link(action, options = {})
      if action.is_a?(ActiveScaffold::DataStructures::ActionLink) || (action.is_a? Proc)
        @link = action
      else
        options[:label] ||= label
Severity: Minor
Found in lib/active_scaffold/data_structures/column.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 column_link_authorized? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def column_link_authorized?(link, column, record, associated)
        if column.association
          associated_for_authorized =
            if column.association.collection? || associated.nil?
              column.association.klass
Severity: Minor
Found in lib/active_scaffold/helpers/action_link_helpers.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 active_scaffold_input_options has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def active_scaffold_input_options(column, scope = nil, options = {})
        name = scope ? "record#{scope}[#{column.name}]" : "record[#{column.name}]"
        record = options[:object]

        # Add some HTML5 attributes for in-browser validation and better user experience
Severity: Minor
Found in lib/active_scaffold/helpers/form_column_helpers.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 initialize_search_sql has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize_search_sql
      self.search_sql =
        unless virtual?
          if association.nil?
            field.to_s unless tableless?
Severity: Minor
Found in lib/active_scaffold/data_structures/column.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 type_casted_tokens has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def type_casted_tokens(tokens, columns, like_pattern)
        tokens.map do |value|
          columns.each_with_object({}) do |column, column_tokens|
            column_tokens[column.name] =
              if column.text?
Severity: Minor
Found in lib/active_scaffold/finder.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 format_number_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def format_number_value(value, options = {})
        if value
          value =
            case options[:format]
            when :size
Severity: Minor
Found in lib/active_scaffold/helpers/list_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 history_state has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def history_state
        if active_scaffold_config.store_user_settings
          state = {page: @page&.number}
          state[:search] = search_params if respond_to?(:search_params) && search_params.present?
          if active_scaffold_config.list.user.user_sorting?
Severity: Minor
Found in lib/active_scaffold/helpers/view_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_render_subform_column has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def active_scaffold_render_subform_column(column, scope, crud_type, readonly, add_class = false, record = nil) # rubocop:disable Metrics/ParameterLists
Severity: Minor
Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 45 mins to fix
    Severity
    Category
    Status
    Source
    Language