activescaffold/active_scaffold

View on GitHub

Showing 272 of 361 total issues

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

    def record_for_update_column
      @record = find_if_allowed(params[:id], :read)
      return unless @record.authorized_for?(:crud_type => :update, :column => @column.name)

      if @column.delegated_association
Severity: Minor
Found in lib/active_scaffold/actions/update.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

Function changeTitle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

       changeTitle: function(historyData) {
               var winTitle = (historyData && historyData.newTitle
                       /*Plug the new title into the pattern*/
                       ? this.baseTitle.replace('@@@', historyData.newTitle)
                       /*Otherwise, if there is no new title, use the original document title. This is useful when some
Severity: Minor
Found in app/assets/javascripts/prototype/dhtml_history.js - 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

Function read_inplace_edit_heading_attributes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  read_inplace_edit_heading_attributes: function(column_heading, options) {
    if (column_heading.readAttribute('data-ie-cancel-text')) options.cancelText = column_heading.readAttribute('data-ie-cancel-text');
    if (column_heading.readAttribute('data-ie-loading-text')) options.loadingText = column_heading.readAttribute('data-ie-loading-text');
    if (column_heading.readAttribute('data-ie-saving-text')) options.savingText = column_heading.readAttribute('data-ie-saving-text');
    if (column_heading.readAttribute('data-ie-save-text')) options.okText = column_heading.readAttribute('data-ie-save-text');
Severity: Minor
Found in app/assets/javascripts/prototype/active_scaffold.js - 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

Function replace has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

Element.replace = function(element, html) {
  element = $(element);
  if (element.outerHTML) {
    try {
    element.outerHTML = html.stripScripts();
Severity: Minor
Found in app/assets/javascripts/prototype/active_scaffold.js - 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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def render(*args, &block)
      if self.class.uses_active_scaffold? && params[:adapter] && @rendering_adapter.nil? && request.xhr?
        @rendering_adapter = true # recursion control
        # if we need an adapter, then we render the actual stuff to a string and insert it into the adapter template
        opts = args.any? ? args.first : {}
Severity: Minor
Found in lib/active_scaffold/extensions/action_controller_rendering.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 cache_association has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def cache_association(association, column, size)
        associated_limit = column.associated_limit
        # we are not using eager loading, cache firsts records in order not to query the database for whole association in a future
        if associated_limit.nil?
          logger.warn "ActiveScaffold: Enable eager loading for #{column.name} association to reduce SQL queries"
Severity: Minor
Found in lib/active_scaffold/helpers/list_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 active_scaffold_human_condition_for has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def active_scaffold_human_condition_for(column)
        return if (value = field_search_params[column.name.to_s]).nil?
        search_ui = column.search_ui
        search_ui ||= column.column_type if column.column
        if override_human_condition_column?(column)
Severity: Minor
Found in lib/active_scaffold/helpers/human_condition_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 each has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def each(options = {}, &block)
          super(options) do |item|
            item = __wrap__(item) || item unless item.is_a?(ActiveScaffold::DataStructures::ActionLinks)
            if options[:include_set]
              yield item, __getobj__.instance_variable_get(:@set)
Severity: Minor
Found in lib/active_scaffold/extensions/cow_proxy.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 each has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def each(options = {}, &block)
      method = options[:reverse] ? :reverse_each : :each
      @set.sort_by(&:weight).send(method) do |item|
        if item.is_a?(ActiveScaffold::DataStructures::ActionLinks) && !options[:groups]
          item.each(options, &block)
Severity: Minor
Found in lib/active_scaffold/data_structures/action_links.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 [] has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def [](val)
      links = []
      @set.each do |item|
        if item.is_a?(ActiveScaffold::DataStructures::ActionLinks)
          collected = item[val]
Severity: Minor
Found in lib/active_scaffold/data_structures/action_links.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 datetime_from_to_for_trend has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def datetime_from_to_for_trend(column, value)
        case value['opt']
        when 'PAST'
          trend_number = [value['number'].to_i, 1].max
          now = datetime_now
Severity: Minor
Found in lib/active_scaffold/finder.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 as_marked= has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

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

    def show_blank_record?(associated)
      return false unless @show_blank_record
      return false unless association.klass.authorized_for?(:crud_type => :create) && !association.readonly?
      association.collection? || (association.singular? && associated.blank?)
    end
Severity: Minor
Found in lib/active_scaffold/data_structures/column.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(action, options = {})
      # set defaults
      @action = action
      @label = action
      @confirm = false
Severity: Minor
Found in lib/active_scaffold/data_structures/action_link.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 register_constraint? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def register_constraint?(column_name, value)
      if params_hash?(value)
        false
      elsif value.is_a?(Array)
        column = active_scaffold_config.columns[column_name]
Severity: Minor
Found in lib/active_scaffold/constraints.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 setup_constrained_fields has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def setup_constrained_fields
      @constrained_fields = [] if association.belongs_to? || association.through?
      @constrained_fields ||= Array(association.foreign_key).map(&:to_sym)
      return unless child_association && child_association != association

Severity: Minor
Found in lib/active_scaffold/data_structures/nested_info.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 active_scaffold_add_existing_input has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def active_scaffold_add_existing_input(options)
        record = options.delete(:object)
        if !ActiveScaffold.js_framework.nil? && controller.respond_to?(:record_select_config, true)
          remote_controller = active_scaffold_controller_for(record_select_config.model).controller_path
          options[:controller] = remote_controller
Severity: Minor
Found in lib/active_scaffold/helpers/form_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 update_column_association has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def update_column_association(parent_record, column, attribute, value)
      if belongs_to_counter_cache_hack?(column.association, attribute)
        parent_record.send "#{column.association.foreign_key}=", value&.id
        parent_record.association(column.name).target = value
      elsif column.association.collection? && column.association.through_singular?
Severity: Minor
Found in lib/active_scaffold/attribute_params.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 active_scaffold_input_singular_association has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def active_scaffold_input_singular_association(column, html_options, options = {}, ui_options: column.options)
        record = html_options.delete(:object)
        associated = record.send(column.association.name)

        select_options = sorted_association_options_find(column.association, nil, record)
Severity: Minor
Found in lib/active_scaffold/helpers/form_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 set_sorting_from_order_clause has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def set_sorting_from_order_clause(order_clause, model_table_name = nil)
      clear
      order_clause.to_s.split(',').each do |criterion|
        if criterion.present?
          order_parts = extract_order_parts(criterion)
Severity: Minor
Found in lib/active_scaffold/data_structures/sorting.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