activescaffold/active_scaffold

View on GitHub

Showing 246 of 296 total issues

Method active_scaffold has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def active_scaffold(model_id = nil, &block)
        extend Prefixes
        # initialize bridges here
        ActiveScaffold::Bridges.run_all

Severity: Minor
Found in lib/active_scaffold/core.rb - About 1 hr to fix

    Function handleSubmitToServer has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        handleSubmitToServer: function(enteredText) {
            var data = '';
            if (typeof(enteredText) === 'string') {
                data += this.settings.update_value + '=' + encodeURIComponent(enteredText) + '&';
            } else {
    Severity: Minor
    Found in app/assets/javascripts/jquery/jquery.editinplace.js - About 1 hr to fix

      Method build_associated has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

            def build_associated(association, parent_record)
              if association.through? && association.through_reflection.collection?
                # build full chain, only check create_associated on initial parent_record
                parent_record = build_associated(association.class.new(association.through_reflection), parent_record)
                source_assoc = association.class.new(association.source_reflection)
      Severity: Minor
      Found in lib/active_scaffold/helpers/controller_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 format_collection_association_value has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

            def format_collection_association_value(value, column, label_method, size)
              associated_limit = column.associated_limit
              if associated_limit.nil?
                firsts = value.collect(&label_method)
                safe_join firsts, association_join_text(column)
      Severity: Minor
      Found in lib/active_scaffold/helpers/list_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 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 render_parent_action has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

            def render_parent_action
              if @parent_action.nil?
                @parent_action = :row
                if parent_sti_controller
                  parent_sti_config = parent_sti_controller.active_scaffold_config
      Severity: Minor
      Found in lib/active_scaffold/helpers/controller_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 visibles_and_hiddens has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

            def visibles_and_hiddens(search_config)
              visibles = []
              hiddens = []
              search_config.columns.each_column(flatten: true) do |column|
                next unless column.search_sql
      Severity: Minor
      Found in lib/active_scaffold/helpers/search_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 render_action_link has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

            def render_action_link(link, record = nil, options = {})
              if link.action.nil? || link.column&.association&.polymorphic?
                link = action_link_to_inline_form(link, record) if link.column&.association
                options[:authorized] = false if link.action.nil? || link.controller.nil?
                options.delete :link if link.crud_type == :create
      Severity: Minor
      Found in lib/active_scaffold/helpers/action_link_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 get_action_link_id has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

            def get_action_link_id(link, record = nil)
              column = link.column
              if column&.association && record
                associated = record.send(column.association.name) unless column.association.collection?
                id =
      Severity: Minor
      Found in lib/active_scaffold/helpers/action_link_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 default_select_columns has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def default_select_columns
            if association.nil? && column
              [field]
            elsif association&.polymorphic?
              [field, quoted_field(quoted_field_name(association.foreign_type))]
      Severity: Minor
      Found in lib/active_scaffold/data_structures/column.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 each_column has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def each_column(options = {}, &proc)
            columns = options[:core_columns] || (action.core.user || action.core).columns
            self.unauthorized_columns = []
            options[:for] ||= columns.active_record_class
      
      
      Severity: Minor
      Found in lib/active_scaffold/data_structures/action_columns.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 condition_for_range has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

            def condition_for_range(column, value, like_pattern = nil)
              if ActiveScaffold::Finder::NULL_COMPARATORS.include?(value[:opt])
                condition_for_null_type(column, value[:opt], like_pattern)
              elsif value[:from].is_a?(Array) # opt can be only =
                from = Array(value[:from]).compact_blank
      Severity: Minor
      Found in lib/active_scaffold/finder.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 find_page has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def find_page(options = {})
            options.assert_valid_keys :sorting, :per_page, :page, :count_includes, :pagination, :select
            options[:per_page] ||= 999_999_999
            options[:page] ||= 1
      
      
      Severity: Minor
      Found in lib/active_scaffold/finder.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 39 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 condition_for_column has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def condition_for_column(column, value, text_search, session)
                like_pattern = like_pattern(text_search)
                value = value.with_indifferent_access if value.is_a? Hash
                column_method = "condition_for_#{column.name}_column"
                if respond_to?(column_method)
        Severity: Minor
        Found in lib/active_scaffold/finder.rb - About 1 hr to fix

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

              def initialize(name, active_record_class, delegated_association = nil) # :nodoc:
                @name = name.to_sym
                @active_record_class = active_record_class
                @column = _columns_hash[name.to_s]
                if @column.nil? && active_record? && active_record_class._default_attributes.key?(name.to_s)
          Severity: Minor
          Found in lib/active_scaffold/data_structures/column.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 active_scaffold_search_select has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def active_scaffold_search_select(column, html_options, options = {}, ui_options: column.options)
                      record = html_options.delete(:object)
                      associated = html_options.delete :value
                      if include_null_comparators?(column, ui_options: ui_options)
                        range_opts = html_options.slice(:name, :id)
              Severity: Minor
              Found in lib/active_scaffold/helpers/search_column_helpers.rb - About 1 hr to fix

                Method look_for_parent_sti_controller has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    def look_for_parent_sti_controller
                      klass = self.class.active_scaffold_config.model
                      loop do
                        klass = klass.superclass
                        controller = self.class.active_scaffold_controller_for(klass)
                Severity: Minor
                Found in lib/active_scaffold/actions/core.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 keeping_errors has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  def keeping_errors
                    old_errors = errors.dup if errors.present?
                    result = yield
                    old_errors&.each do |e|
                      if e.is_a?(String) || e.is_a?(Symbol)
                Severity: Minor
                Found in lib/active_scaffold/extensions/unsaved_record.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

                Severity
                Category
                Status
                Source
                Language