activescaffold/active_scaffold

View on GitHub

Showing 272 of 361 total issues

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

    def create_respond_to_html
      if successful?
        flash[:info] = as_(:created_model, :model => ERB::Util.h(@record.to_label))
        if (action = active_scaffold_config.create.action_after_create)
          redirect_to params_for(:action => action, :id => @record.to_param)
Severity: Minor
Found in lib/active_scaffold/actions/create.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 render_column has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def render_column(column, record, renders_as, scope = nil, only_value = false, col_class = nil) # rubocop:disable Metrics/ParameterLists
Severity: Minor
Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 45 mins to fix

    Function update_column has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          update_column: function(element, url, send_form, source_id, val, additional_params) {
    Severity: Minor
    Found in app/assets/javascripts/jquery/active_scaffold.js - About 45 mins to fix

      Method do_add_existing has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def do_add_existing
            parent_record = nested_parent_record(:update)
            @record = active_scaffold_config.model.find(params[:associated_id])
            if parent_record && @record
              self.successful = false unless parent_record.send(nested.association.name) << @record
      Severity: Minor
      Found in lib/active_scaffold/actions/nested.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 responds_to_parent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def responds_to_parent(&block)
            yield
            return unless performed?
      
            # Either pull out a redirect or the request body
      Severity: Minor
      Found in lib/active_scaffold/responds_to_parent.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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(model_id)
            super
            return unless ActiveScaffold::Bridges::DatePicker.default_ui
      
            date_picker_fields = _columns.collect { |c| {:name => c.name.to_sym, :type => c.type} if %i[date datetime].include?(c.type) }.compact
      Severity: Minor
      Found in lib/active_scaffold/bridges/date_picker/ext.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 add_to_javascript_manifest has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_to_javascript_manifest
              file = 'app/assets/javascripts/application.js'
              unless File.exist?(file)
                if Rails.version >= '6.0'
                  create_javascript_manifest file
      Severity: Minor
      Found in lib/generators/active_scaffold/install_generator.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 nested_chain_with_association has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def nested_chain_with_association
            if nested.association.collection?
              nested_parent_record.send(nested.association.name)
            elsif nested.association.through? # has_one :through
              active_scaffold_config.model.where(active_scaffold_config.model.primary_key => nested_parent_record.send(nested.association.name)&.id)
      Severity: Minor
      Found in lib/active_scaffold/actions/nested.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 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 current_form_columns has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def current_form_columns(record, scope, subform_controller = nil)
              if scope
                subform_controller.active_scaffold_config.subform.columns.visible_columns_names
              elsif %i[new create edit update render_field].include? action_name.to_sym
                # disable update_columns for inplace_edit (GET render_field)
      Severity: Minor
      Found in lib/active_scaffold/helpers/form_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 active_scaffold_file_with_remove_link has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def active_scaffold_file_with_remove_link(column, options, content, remove_file_prefix, controls_class, ui_options: column.options, &block) # rubocop:disable Metrics/ParameterLists
      Severity: Minor
      Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 45 mins to fix

        Method default_for_empty_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def default_for_empty_value
              return nil unless column
              if column.is_a?(ActiveModel::Attribute)
                column.value
              elsif active_record?
        Severity: Minor
        Found in lib/active_scaffold/data_structures/column.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 find_duplicate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def find_duplicate(link)
              links = []
              @set.each do |item|
                if item.is_a?(ActiveScaffold::DataStructures::ActionLinks)
                  collected = item.find_duplicate(link)
        Severity: Minor
        Found in lib/active_scaffold/data_structures/action_links.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

        Avoid deeply nested control flow statements.
        Open

                    options[:size] ||= options[:maxlength].to_i > 30 ? 30 : options[:maxlength]
        Severity: Major
        Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 45 mins to fix

          Method active_scaffold_refresh_link has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def active_scaffold_refresh_link(column, html_options, record, ui_options = {})
                  link_options = {:object => record}
                  if html_options['data-update_url']
                    link_options['data-update_send_form'] = html_options['data-update_send_form']
                    link_options['data-update_send_form_selector'] = html_options['data-update_send_form_selector']
          Severity: Minor
          Found in lib/active_scaffold/helpers/form_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 setup_association_info has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def setup_association_info
                assoc = active_record_class.reflect_on_association(name)
                @association =
                  if assoc
                    if active_record?
          Severity: Minor
          Found in lib/active_scaffold/data_structures/column.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 delete_group has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def delete_group(name)
                @set.each do |group|
                  next unless group.is_a?(ActiveScaffold::DataStructures::ActionLinks)
                  if group.name == name
                    @set.delete group
          Severity: Minor
          Found in lib/active_scaffold/data_structures/action_links.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 add_association_columns has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def add_association_columns(association, *columns)
                column = self[association]
                raise ArgumentError, "unknown column #{association}" if column.nil?
                raise ArgumentError, "column #{association} is not an association" if column.association.nil?
                raise ArgumentError, "column #{association} is not singular association" unless column.association.singular?
          Severity: Minor
          Found in lib/active_scaffold/data_structures/columns.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 reverse_association has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def reverse_association(klass = nil)
                assoc =
                  if polymorphic?
                    get_reverse(klass) unless klass.nil?
                  else
          Severity: Minor
          Found in lib/active_scaffold/data_structures/association/abstract.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

          Severity
          Category
          Status
          Source
          Language