activescaffold/active_scaffold

View on GitHub

Showing 374 of 374 total issues

Method cached_action_link_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def cached_action_link_url(link, record)
        @action_links_urls ||= {}
        @action_links_urls[link.name_to_cache.to_s] || begin
          url_options = cached_action_link_url_options(link, record)
          if cache_action_link_url?(link, record)
Severity: Minor
Found in lib/active_scaffold/helpers/action_link_helpers.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

Method condition_for_numeric has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def condition_for_numeric(column, value)
        if !value.is_a?(Hash)
          ['%<search_sql>s = ?', condition_value_for_numeric(column, value)]
        elsif ActiveScaffold::Finder::NULL_COMPARATORS.include?(value[:opt])
          condition_for_null_type(column, value[:opt])
Severity: Minor
Found in lib/active_scaffold/finder.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

Method cached_authorized_for_methods has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def cached_authorized_for_methods(options)
          key = "#{options[:crud_type]}##{options[:column]}##{options[:action]}"
          if is_a? Class
            self.class_security_methods ||= {}
            self.class_security_methods[key] ||= authorized_for_methods(options)
Severity: Minor
Found in lib/active_scaffold/active_record_permissions.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

Method association_klass_scoped has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def association_klass_scoped(association, klass, record)
        if nested? && nested.through_association? && nested.child_association&.through_reflection == association
          # only ActiveRecord associations
          if nested.association.through_reflection.collection?
            nested_parent_record.send(nested.association.through_reflection.name)
Severity: Minor
Found in lib/active_scaffold/helpers/association_helpers.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

Method datetime_from_to_for_range has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def datetime_from_to_for_range(column, value)
        case value['range']
        when 'TODAY'
          [datetime_now.beginning_of_day, datetime_now.end_of_day]
        when 'YESTERDAY'
Severity: Minor
Found in lib/active_scaffold/finder.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

Method set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def set(*args)
      # TODO: add deprecation unless args.size == 1 && args[0].is_a? Hash
      # when deprecation is removed:
      # * change list#sorting= to sorting.set(val)
      clear
Severity: Minor
Found in lib/active_scaffold/data_structures/sorting.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

Method render_column has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def render_column(column, record, renders_as, scope = nil, only_value = false, col_class = nil) # rubocop:disable Metrics/ParameterLists
        if form_column_is_hidden?(column, record, scope)
          # creates an element that can be replaced by the update_columns routine,
          # but will not affect the value of the submitted form in this state:
          # <dl><input type="hidden" class="<%= column.name %>-input"></dl>
Severity: Minor
Found in lib/active_scaffold/helpers/form_column_helpers.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

Method active_scaffold_input_color has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def active_scaffold_input_color(column, options, ui_options: column.options)
        html = []
        options = active_scaffold_input_text_options(options)
        if column.null?
          no_color = options[:object].send(column.name).nil?
Severity: Minor
Found in lib/active_scaffold/helpers/form_column_helpers.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

Method estimate_weight has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def estimate_weight
      if association&.singular?
        400
      elsif association&.collection?
        500
Severity: Minor
Found in lib/active_scaffold/data_structures/column.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

Method active_scaffold_checkbox_option has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def active_scaffold_checkbox_option(option, label_method, associated_ids, checkbox_options, li_options = {})
        content_tag(:li, li_options) do
          option_id = option.is_a?(Array) ? option[1] : option.id
          label = option.is_a?(Array) ? option[0] : option.send(label_method)
          check_box_tag(checkbox_options[:name], option_id, associated_ids.include?(option_id), checkbox_options) <<
Severity: Minor
Found in lib/active_scaffold/helpers/form_column_helpers.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

Method sort_collection_by_column has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def sort_collection_by_column(collection, column, order)
      sorter = column.sort[:method]
      collection = collection.sort_by do |record|
        value = sorter.is_a?(Proc) ? record.instance_eval(&sorter) : record.instance_eval(sorter.to_s)
        value = '' if value.nil?
Severity: Minor
Found in lib/active_scaffold/finder.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

Method reverse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def reverse(klass = nil)
      unless polymorphic? || defined?(@reverse)
        @reverse ||= inverse || get_reverse&.name
      end
      @reverse || (get_reverse(klass)&.name unless klass.nil?)
Severity: Minor
Found in lib/active_scaffold/data_structures/association/abstract.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

Method reverse_match? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def reverse_match?(assoc)
      return assoc.name == as if as || assoc.polymorphic?
      return false if assoc.class_name != inverse_klass&.name

      if through?
Severity: Minor
Found in lib/active_scaffold/data_structures/association/abstract.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

Method validator_force_required? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def validator_force_required?(val)
      return false if val.options[:if] || val.options[:unless]
      case val
      when ActiveModel::Validations::PresenceValidator
        validator_required_on(val)
Severity: Minor
Found in lib/active_scaffold/data_structures/column.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

Method display_message has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def display_message(message)
        message = safe_join message, tag(:br) if message.is_a?(Array)
        if (highlights = active_scaffold_config.user.highlight_messages)
          message = highlights.inject(message) do |msg, (phrases, highlighter)|
            highlight(msg, phrases, highlighter || {})
Severity: Minor
Found in lib/active_scaffold/helpers/view_helpers.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

Method columns_accessor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.columns_accessor(*names, &block)
      options = names.extract_options!
      self.columns_collections = ((columns_collections || []) + names).uniq
      names.each do |name|
        columns_writer name
Severity: Minor
Found in lib/active_scaffold/config/base.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

Method readonly_through_association? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def readonly_through_association?(columns)
      return false unless through_association?
      return true if association.through_reflection.options[:through] # create not possible, too many levels
      return true if association.source_reflection.options[:through] # create not possible, too many levels
      return false if create_through_singular? # create allowed, AS has code for this
Severity: Minor
Found in lib/active_scaffold/data_structures/nested_info.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

Method columns has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def columns
      # we want to delay initializing to the @core.columns set for as long as possible. Too soon and .search_sql will not be available to .searchable?
      unless defined? @columns
        self.columns = @core.columns.collect { |c| c.name if @core.columns._inheritable.include?(c.name) && c.searchable? && c.association.nil? && c.text? }.compact
      end
Severity: Minor
Found in lib/active_scaffold/config/search.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

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

    def search_sql=(value)
      @search_sql =
        if value
          value == true || value.is_a?(Proc) ? value : Array(value)
        else
Severity: Minor
Found in lib/active_scaffold/data_structures/column.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

Method add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def add(column_name, direction = nil)
      direction ||= 'ASC'
      direction = direction.to_s.upcase
      column = get_column(column_name)
      raise ArgumentError, "Could not find column #{column_name}" if column.nil?
Severity: Minor
Found in lib/active_scaffold/data_structures/sorting.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