activescaffold/active_scaffold

View on GitHub
lib/active_scaffold/helpers/form_column_helpers.rb

Summary

Maintainability
F
6 days
Test Coverage
F
45%

File form_column_helpers.rb has 670 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module ActiveScaffold
  module Helpers
    # Helpers that assist with the rendering of a Form Column
    module FormColumnHelpers
      # This method decides which input to use for the given column.
Severity: Major
Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 1 day to fix

    Method column_numerical_constraints has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

          def column_numerical_constraints(column, options)
            validators = column.active_record_class.validators.select do |v|
              v.is_a?(ActiveModel::Validations::NumericalityValidator) &&
                v.attributes.include?(column.name) &&
                !v.options[:if] && !v.options[:unless]
    Severity: Minor
    Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 6 hrs 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_render_input has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

          def active_scaffold_render_input(column, options)
            record = options[:object]
    
            # first, check if the dev has created an override for this specific field
            if (method = override_form_field(column))
    Severity: Minor
    Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 3 hrs 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_radio has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

          def active_scaffold_input_radio(column, html_options, ui_options: column.options)
            record = html_options[:object]
            html_options.merge!(ui_options[:html_options] || {})
            options =
              if column.association
    Severity: Minor
    Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 2 hrs 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_render_subform_column has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def active_scaffold_render_subform_column(column, scope, crud_type, readonly, add_class = false, record = nil) # rubocop:disable Metrics/ParameterLists
            if add_class
              col_class = []
              col_class << 'required' if column.required?(action_for_validation?(record))
              col_class << column.css_class unless column.css_class.nil? || column.css_class.is_a?(Proc)
    Severity: Minor
    Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 2 hrs 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 form_attribute has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

          def form_attribute(column, record, scope = nil, only_value = false, col_class = nil)
            column_options = active_scaffold_input_options(column, scope, :object => record)
            collapsible_id = column_options.delete :collapsible_id
            attributes = field_attributes(column, record)
            attributes[:class] = "#{attributes[:class]} #{col_class}" if col_class.present?
    Severity: Minor
    Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 2 hrs 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_columns_options has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

          def update_columns_options(column, scope, options, force = false, form_columns: nil, url_params: {})
            record = options[:object]
            subform_controller = controller.class.active_scaffold_controller_for(record.class) if scope
            if @main_columns && (scope.nil? || subform_controller == controller.class)
              form_columns ||= @main_columns.visible_columns_names
    Severity: Minor
    Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 2 hrs 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_new_record_subform has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

          def active_scaffold_new_record_subform(column, record, html_options, ui_options: column.options, new_record_attributes: nil, locals: {}, skip_link: false)
            klass =
              if column.association.polymorphic? && column.association.belongs_to?
                type = record.send(column.association.foreign_type)
                column.association.klass(record) if type.present? && (ui_options[:add_new] == true || type.in?(ui_options[:add_new]))
    Severity: Minor
    Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 1 hr 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_radio has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def active_scaffold_input_radio(column, html_options, ui_options: column.options)
            record = html_options[:object]
            html_options.merge!(ui_options[:html_options] || {})
            options =
              if column.association
    Severity: Minor
    Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 1 hr to fix

      Method column_numerical_constraints has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def column_numerical_constraints(column, options)
              validators = column.active_record_class.validators.select do |v|
                v.is_a?(ActiveModel::Validations::NumericalityValidator) &&
                  v.attributes.include?(column.name) &&
                  !v.options[:if] && !v.options[:unless]
      Severity: Minor
      Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 1 hr to fix

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

              def in_subform?(column, parent_record, parent_column)
                return true unless column.association
        
                if column.association.reverse.nil?
                  # Polymorphic associations can't appear because they *might* be the reverse association
        Severity: Minor
        Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 1 hr 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_new_record_subform has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def active_scaffold_new_record_subform(column, record, html_options, ui_options: column.options, new_record_attributes: nil, locals: {}, skip_link: false)
                klass =
                  if column.association.polymorphic? && column.association.belongs_to?
                    type = record.send(column.association.foreign_type)
                    column.association.klass(record) if type.present? && (ui_options[:add_new] == true || type.in?(ui_options[:add_new]))
        Severity: Minor
        Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 1 hr to fix

          Method active_scaffold_file_with_content has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def active_scaffold_file_with_content(column, content, options, remove_file_prefix, controls_class)
                  required = options.delete(:required)
                  case ActiveScaffold.js_framework
                  when :jquery
                    js_remove_file_code = "jQuery(this).prev().val('true'); jQuery(this).parent().hide().next().show()#{".find('input').attr('required', 'required')" if required}; return false;"
          Severity: Minor
          Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 55 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_options has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def active_scaffold_input_options(column, scope = nil, options = {})
                  name = scope ? "record#{scope}[#{column.name}]" : "record[#{column.name}]"
                  record = options[:object]
          
                  # Add some HTML5 attributes for in-browser validation and better user experience
          Severity: Minor
          Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 55 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_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

          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 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

              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 active_scaffold_render_subform_column has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

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

                  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 form_attribute has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                        def form_attribute(column, record, scope = nil, only_value = false, col_class = nil)
                  Severity: Minor
                  Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 35 mins to fix

                    Method active_scaffold_file_with_content has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                          def active_scaffold_file_with_content(column, content, options, remove_file_prefix, controls_class)
                    Severity: Minor
                    Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 35 mins to fix

                      Method active_scaffold_checkbox_option has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                            def active_scaffold_checkbox_option(option, label_method, associated_ids, checkbox_options, li_options = {})
                      Severity: Minor
                      Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 35 mins to fix

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

                              def form_hidden_field(column, record, scope)
                                options = active_scaffold_input_options(column, scope)
                                if column.association&.collection?
                                  associated = record.send(column.name)
                                  if associated.blank?
                        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_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 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 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

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                                unless options[:min]
                                  min = validators.map { |v| v.options[:greater_than_or_equal_to] }.compact.max
                                  greater_than = validators.map { |v| v.options[:greater_than] }.compact.max
                                  numerical_constraints[:min] = [min, (greater_than + margin if greater_than)].compact.max
                        Severity: Minor
                        Found in lib/active_scaffold/helpers/form_column_helpers.rb and 1 other location - About 45 mins to fix
                        lib/active_scaffold/helpers/form_column_helpers.rb on lines 801..804

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 39.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                                unless options[:max]
                                  max = validators.map { |v| v.options[:less_than_or_equal_to] }.compact.min
                                  less_than = validators.map { |v| v.options[:less_than] }.compact.min
                                  numerical_constraints[:max] = [max, (less_than - margin if less_than)].compact.min
                        Severity: Minor
                        Found in lib/active_scaffold/helpers/form_column_helpers.rb and 1 other location - About 45 mins to fix
                        lib/active_scaffold/helpers/form_column_helpers.rb on lines 794..797

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 39.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 4 locations. Consider refactoring.
                        Open

                              rescue StandardError => e
                                logger.error "#{e.class.name}: #{e.message} -- on the ActiveScaffold column = :#{column.name} in #{controller.class}"
                                raise e
                              end
                        Severity: Minor
                        Found in lib/active_scaffold/helpers/form_column_helpers.rb and 3 other locations - About 15 mins to fix
                        lib/active_scaffold/bridges/record_select/helpers.rb on lines 81..84
                        lib/active_scaffold/helpers/list_column_helpers.rb on lines 60..63
                        lib/active_scaffold/helpers/search_column_helpers.rb on lines 50..53

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 26.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        There are no issues that match your filters.

                        Category
                        Status