activescaffold/active_scaffold

View on GitHub

Showing 194 of 252 total issues

Function activeScaffoldInit has 1359 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 1368 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 741 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 611 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 71 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 497 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

                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

                  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 grouped_search? && column == search_group_column && search_group_function
                            format_grouped_search_column(record[column.name], column.options)
                          elsif column.association.nil?
                  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 352 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 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

                      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_select has a Cognitive Complexity of 22 (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 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 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}")
                        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
                          Severity
                          Category
                          Status
                          Source
                          Language