activescaffold/active_scaffold

View on GitHub

Showing 296 of 296 total issues

Function activeScaffoldInit has 1327 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var activeScaffoldInit = function($, undefined) {
    jQuery(document).ready(function($) {
      /* It should not be needed, latest chrome is caching by itself
        if (ActiveScaffold.config.conditional_get) jQuery.ajaxSettings.ifModified = true;
        jQuery(document).on('ajax:beforeSend', function(event, xhr, settings){
Severity: Major
Found in app/assets/javascripts/jquery/active_scaffold.js - About 6 days to fix

    File active_scaffold.js has 1336 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    (function() {
      var activeScaffoldInit = function($, undefined) {
        jQuery(document).ready(function($) {
          /* It should not be needed, latest chrome is caching by itself
            if (ActiveScaffold.config.conditional_get) jQuery.ajaxSettings.ifModified = true;
    Severity: Major
    Found in app/assets/javascripts/jquery/active_scaffold.js - About 3 days to fix

      File form_column_helpers.rb has 689 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

        File finder.rb has 603 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module ActiveScaffold
          module Finder
            def self.like_operator
              @@like_operator ||= ::ActiveRecord::Base.connection.adapter_name.in?(%w[PostgreSQL PostGIS]) ? 'ILIKE' : 'LIKE'
            end
        Severity: Major
        Found in lib/active_scaffold/finder.rb - About 1 day to fix

          Class Column has 70 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class Column
              module ProxyableMethods
                extend ActiveSupport::Concern
          
                included do # rubocop:disable Metrics/BlockLength
          Severity: Major
          Found in lib/active_scaffold/data_structures/column.rb - About 1 day to fix

            File jquery.editinplace.js has 543 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*
            
            A jQuery edit in place plugin
            
            Version 2.2.0
            Severity: Major
            Found in app/assets/javascripts/jquery/jquery.editinplace.js - About 1 day to fix

              File column.rb has 493 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module ActiveScaffold::DataStructures
                class Column
                  module ProxyableMethods
                    extend ActiveSupport::Concern
              
              
              Severity: Minor
              Found in lib/active_scaffold/data_structures/column.rb - About 7 hrs to fix

                File core.rb has 440 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                module ActiveScaffold::Actions
                  module Core
                    def self.included(base)
                      base.class_eval do
                        before_action :set_vary_accept_header
                Severity: Minor
                Found in lib/active_scaffold/actions/core.rb - About 6 hrs 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_error_messages_for has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def active_scaffold_error_messages_for(*params)
                          options = params.extract_options!.symbolize_keys
                          options.reverse_merge!(container_tag: :div, list_type: :ul)
                  
                          objects = Array.wrap(options.delete(:object) || params).map do |object|
                  Severity: Minor
                  Found in lib/active_scaffold/helpers/view_helpers.rb - About 5 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 list_column_helpers.rb has 393 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  module ActiveScaffold
                    module Helpers
                      # Helpers that assist with the rendering of a List Column
                      module ListColumnHelpers
                        def list_record_view
                  Severity: Minor
                  Found in lib/active_scaffold/helpers/list_column_helpers.rb - About 5 hrs to fix

                    File action_link_helpers.rb has 391 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    module ActiveScaffold
                      module Helpers
                        # All extra helpers that should be included in the View.
                        # Also a dumping ground for uncategorized helpers.
                        module ActionLinkHelpers
                    Severity: Minor
                    Found in lib/active_scaffold/helpers/action_link_helpers.rb - About 5 hrs to fix

                      Method render has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def render(*args, &block)
                            if args.first.is_a?(Hash) && args.first[:active_scaffold]
                              render_embedded args.first
                            elsif args.first == :super
                              if @lookup_context # rails 6
                      Severity: Minor
                      Found in lib/active_scaffold/extensions/action_view_rendering.rb - About 4 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 format_column_value has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def format_column_value(record, column, value = nil)
                              value ||= record.send(column.name) unless record.nil?
                              if column.association.nil?
                                form_ui_options = column.form_ui_options || column.options if FORM_UI_WITH_OPTIONS.include?(column.form_ui)
                                if form_ui_options&.dig(:options)
                      Severity: Minor
                      Found in lib/active_scaffold/helpers/list_column_helpers.rb - About 4 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 32 (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 4 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 Abstract has 36 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                        class Abstract
                          def initialize(association)
                            @association = association
                          end
                      
                      
                      Severity: Minor
                      Found in lib/active_scaffold/data_structures/association/abstract.rb - About 4 hrs to fix

                        File search_column_helpers.rb has 347 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 4 hrs to fix

                          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 display_action_links has a Cognitive Complexity of 26 (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 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

                          Severity
                          Category
                          Status
                          Source
                          Language