activescaffold/active_scaffold

View on GitHub

Showing 277 of 366 total issues

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

  def self.should_respond_to_parent(description = nil, &block)
    should "respond to parent #{description}" do
      script = block ? instance_eval(&block) : /.*/
      script = script.is_a?(Regexp) ? script.source : Regexp.quote(script)
      script = script.gsub('\n', '\\\\\\n')
Severity: Minor
Found in shoulda_macros/macros.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 init_field_search_params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def init_field_search_params(default_params)
        return unless (params[:search].is_a?(String) || search_params.nil?) && params[:search].blank?
        params[:search] = default_params.is_a?(Proc) ? instance_eval(&default_params) : default_params
      end
Severity: Minor
Found in lib/active_scaffold/actions/field_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 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 datepicker_format_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def datepicker_format_options(column, format)
          return {} if format == :default
          if column.form_ui == :date_picker
            js_format = to_datepicker_format(I18n.translate!("date.formats.#{format}"))
            js_format.nil? ? {} : {dateFormat: js_format}
Severity: Minor
Found in lib/active_scaffold/bridges/date_picker/helper.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_search_multi_select has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def active_scaffold_search_multi_select(column, options, ui_options: column.options)
        record = options.delete(:object)
        associated = options.delete :value
        associated = [associated].compact unless associated.is_a? Array

Severity: Minor
Found in lib/active_scaffold/helpers/search_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

Function removeHash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

       removeHash: function(hashValue) {
               var r;
               if (hashValue === null || hashValue === undefined) {
                       r = null;
               }
Severity: Minor
Found in app/assets/javascripts/prototype/dhtml_history.js - 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_nested has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def configure_nested
      return unless nested?
      register_constraints_with_action_columns(nested.constrained_fields)
      return unless active_scaffold_config.actions.include? :list
      active_scaffold_config.list.user.label = nested_label
Severity: Minor
Found in lib/active_scaffold/actions/nested.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 get_column_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def get_column_method(record, column)
        # check for an override helper
        ActiveScaffold::Registry.cache :column_methods, column.cache_key do
          if (method = column_override(column))
            # we only pass the record as the argument. we previously also passed the formatted_value,
Severity: Minor
Found in lib/active_scaffold/helpers/list_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 setup_jquery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def setup_jquery(file, original_js = nil, where: 'ujs')
        original_js ||= File.binread(file)
        if ActiveScaffold.js_framework == :jquery
          unless original_js.include?('require jquery')
            insert_into_file file, before: %r{//= require +.*#{where}['"]?\n} do
Severity: Minor
Found in lib/generators/active_scaffold/install_generator.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 value_for_update_column has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def value_for_update_column(param_value, column, record)
      unless param_value
        param_value = column.default_for_empty_value
        param_value = false if param_value == true
      end
Severity: Minor
Found in lib/active_scaffold/actions/update.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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def call(mapper, options = {})
        actions = get_actions(ACTIVE_SCAFFOLD_ASSOCIATION_ROUTING, options)

        mapper.collection do
          ActiveScaffold::Routing::ACTIVE_SCAFFOLD_ASSOCIATION_ROUTING[:collection].each do |name, type|
Severity: Minor
Found in lib/active_scaffold/extensions/routing_mapper.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_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 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 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 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 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 active_scaffold_radio_option has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def active_scaffold_radio_option(option, selected, column, radio_options, ui_options: column.options)
        if column.association
          label_method = ui_options[:label_method] || :to_label
          text = option.send(label_method)
          value = option.id
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 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

Severity
Category
Status
Source
Language