activescaffold/active_scaffold

View on GitHub

Showing 285 of 374 total issues

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

File search_column_helpers.rb has 328 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module ActiveScaffold
  module Helpers
    # Helpers that assist with the rendering of a Form Column
    module SearchColumnHelpers
      # This method decides which input to use for the given column.
Severity: Minor
Found in lib/active_scaffold/helpers/search_column_helpers.rb - About 3 hrs to fix

    Class Tableless has 31 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class ActiveScaffold::Tableless < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord
      class AssociationScope < ActiveRecord::Associations::AssociationScope
        INSTANCE = create
        def self.scope(association, connection)
          INSTANCE.scope association, connection
    Severity: Minor
    Found in lib/active_scaffold/tableless.rb - About 3 hrs to fix

      Function update_column has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

        update_column: function(element, url, send_form, source_id, val, additional_params) {
          if (!element) element = jQuery('#' + source_id);
          var as_form = element.closest('form.as_form');
          var params = null;
      
      
      Severity: Minor
      Found in app/assets/javascripts/jquery/active_scaffold.js - 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 apply_constraints_to_record has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          def apply_constraints_to_record(record, options = {})
            options[:allow_autosave] = false if options[:allow_autosave].nil?
            constraints = options[:constraints] || active_scaffold_constraints
      
            config = record.is_a?(active_scaffold_config.model) ? active_scaffold_config : active_scaffold_config_for(record.class)
      Severity: Minor
      Found in lib/active_scaffold/constraints.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

      Class Core has 30 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Core < ActiveScaffold::Config::Base
          include ActiveScaffold::OrmChecks
          # global level configuration
          # --------------------------
      
      
      Severity: Minor
      Found in lib/active_scaffold/config/core.rb - About 3 hrs to fix

        Method active_scaffold has a Cognitive Complexity of 25 (exceeds 5 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 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 pagination_ajax_links has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

              def pagination_ajax_links(current_page, url_options, options, inner_window, outer_window)
                start_number = current_page.number - inner_window
                end_number = current_page.number + inner_window
                start_number = 1 if start_number <= 0
                if current_page.pager.infinite?
        Severity: Minor
        Found in lib/active_scaffold/helpers/pagination_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

        Class Sorting has 28 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Sorting
            include Enumerable
            include ActiveScaffold::OrmChecks
        
            attr_accessor :constraint_columns
        Severity: Minor
        Found in lib/active_scaffold/data_structures/sorting.rb - About 3 hrs to fix

          Method action_link_html_options has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

                def action_link_html_options(link, record, options)
                  link_id = get_action_link_id(link, record)
                  html_options = link.html_options.merge(:class => [link.html_options[:class], link.action.to_s].compact.join(' '))
                  html_options[:link] = action_link_text(link, options)
          
          
          Severity: Minor
          Found in lib/active_scaffold/helpers/action_link_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

          Function in_place_editor_field_clicked has 81 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            in_place_editor_field_clicked: function(span) {
              // test editor is open
              if (typeof(span.data('editInPlace')) === 'undefined') {
                var options = {show_buttons: true,
                    hover_class: 'hover',
          Severity: Major
          Found in app/assets/javascripts/jquery/active_scaffold.js - About 3 hrs to fix

            Method active_scaffold_search_for has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

                  def active_scaffold_search_for(column, options = nil)
                    options ||= active_scaffold_search_options(column)
                    search_columns = active_scaffold_config.field_search.columns.visible_columns_names
                    options = update_columns_options(column, nil, options, form_columns: search_columns, url_params: {form_action: :field_search})
                    record = options[:object]
            Severity: Minor
            Found in lib/active_scaffold/helpers/search_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 display_action_link has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

                  def display_action_link(link, content, record, options)
                    if content
                      html_classes = hover_via_click? ? 'hover_click ' : ''
                      if (options[:level]).zero?
                        html_classes << 'action_group'
            Severity: Minor
            Found in lib/active_scaffold/helpers/action_link_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 link_for_association has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                  def link_for_association(column, options = {})
                    return if (controller = active_scaffold_controller_for_column(column, options)).nil?
                    options.reverse_merge! :position => :after, :type => :member, :column => column,
                                           :controller => (controller == :polymorph ? controller : "/#{controller.controller_path}")
                    options[:parameters] ||= {}
            Severity: Minor
            Found in lib/active_scaffold/core.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

            Class ActionLink has 25 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class ActionLink
                NO_OPTIONS = {}.freeze
            
                # provides a quick way to set any property of the object from a hash
                def initialize(action, options = {})
            Severity: Minor
            Found in lib/active_scaffold/data_structures/action_link.rb - About 2 hrs to fix

              Method display_action_links has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                    def display_action_links(action_links, record, options, &block)
                      options[:level_0_tag] ||= nil
                      options[:options_level_0_tag] ||= nil
                      options[:level] ||= 0
                      options[:first_action] = true
              Severity: Minor
              Found in lib/active_scaffold/helpers/action_link_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 authorized_for? has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                      def authorized_for?(options = {})
                        raise ArgumentError, "unknown crud type #{options[:crud_type]}" if options[:crud_type] && !%i[create read update delete].include?(options[:crud_type])
              
                        not_authorized_reason = ActiveRecordPermissions.not_authorized_reason
                        # collect other possibly-related methods that actually exist
              Severity: Minor
              Found in lib/active_scaffold/active_record_permissions.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

              Function create has 68 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                     create: function(options) {
                             
                             /*
                                     options - object to store initialization parameters
                                     options.blankURL - string to override the default location of blank.html. Must end in "?"
              Severity: Major
              Found in app/assets/javascripts/prototype/dhtml_history.js - About 2 hrs to fix

                Function render_form_field has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                  render_form_field: function(source, content, options) {
                    if (typeof(source) == 'string') source = '#' + source;
                    var source = jQuery(source);
                    var element, container = source.closest('.sub-form-record'), selector = '';
                    if (container.length == 0) {
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.js - 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_search_select has a Cognitive Complexity of 19 (exceeds 5 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 column.association
                          associated = associated.is_a?(Array) ? associated.map(&:to_i) : associated.to_i unless associated.nil?
                Severity: Minor
                Found in lib/active_scaffold/helpers/search_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

                Severity
                Category
                Status
                Source
                Language