activescaffold/active_scaffold

View on GitHub

Showing 273 of 362 total issues

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 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 _configure_sti has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _configure_sti
      return if sti_children.nil?
      column = model.inheritance_column
      if sti_create_links
        columns[column].form_ui ||= :hidden
Severity: Minor
Found in lib/active_scaffold/config/core.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 find_or_create_for_params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def find_or_create_for_params(params, parent_column, parent_record)
      current = parent_record.send(parent_column.name)
      klass = parent_column.association.klass(parent_record)
      if params.key? klass.primary_key
        record_from_current_or_find(klass, params[klass.primary_key], current)
Severity: Minor
Found in lib/active_scaffold/attribute_params.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 label has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def label(record = nil, scope = nil)
      if @label.respond_to?(:call)
        if record
          @label.call(record, self, scope)
        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 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 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 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 cache has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.cache(kind, key = nil, &block)
      unless key
        key = kind
        kind = :cache
      end
Severity: Minor
Found in lib/active_scaffold/registry.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 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 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

Severity
Category
Status
Source
Language