activescaffold/active_scaffold

View on GitHub

Showing 284 of 371 total issues

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

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){
      xhr.cacheUrl = settings.url;
Severity: Major
Found in app/assets/javascripts/jquery/active_scaffold.js - About 3 days to fix

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

    if (typeof Prototype == 'undefined')
    {
      warning = "ActiveScaffold Error: Prototype could not be found. Please make sure that your application's layout includes prototype.js (e.g. <%= javascript_include_tag :defaults %>) *before* it includes active_scaffold.js (e.g. <%= active_scaffold_includes %>).";
      alert(warning);
    }
    Severity: Major
    Found in app/assets/javascripts/prototype/active_scaffold.js - About 2 days to fix

      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

        File finder.rb has 592 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 67 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class Column
              include ActiveScaffold::Configurable
              include ActiveScaffold::OrmChecks
              NO_PARAMS = Set.new.freeze
              NO_OPTIONS = {}.freeze
          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 dhtml_history.js has 476 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*
              Copyright (c) 2007 Brian Dillard and Brad Neuberg:
              Brian Dillard | Project Lead | bdillard@pathf.com | http://blogs.pathf.com/agileajax/
              Brad Neuberg | Original Project Creator | http://codinginparadise.org
              
              
              Severity: Minor
              Found in app/assets/javascripts/prototype/dhtml_history.js - About 7 hrs to fix

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

                module ActiveScaffold::DataStructures
                  class Column
                    include ActiveScaffold::Configurable
                    include ActiveScaffold::OrmChecks
                    NO_PARAMS = Set.new.freeze
                Severity: Minor
                Found in lib/active_scaffold/data_structures/column.rb - About 7 hrs to fix

                  ActiveScaffold has 51 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  var ActiveScaffold = {
                    last_focus: null,
                    setup: function(container) {
                      /* setup some elements on page/form load */
                      ActiveScaffold.load_embedded(container);
                  Severity: Major
                  Found in app/assets/javascripts/jquery/active_scaffold.js - About 7 hrs to fix

                    Function in_place_editor_field_clicked has a Cognitive Complexity of 42 (exceeds 5 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: Minor
                    Found in app/assets/javascripts/jquery/active_scaffold.js - 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 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

                    File core.rb has 414 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 5 hrs to fix

                      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

                      ActiveScaffold has 43 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      var ActiveScaffold = {
                        live_search: function(element) {
                          $$('form.search.live input[type=search]', element).each(function(item) {
                            new Form.Element.DelayedObserver(item, 0.5, function(element, value) {
                              if (!$(element.id)) return false; // because the element may have been destroyed
                      Severity: Minor
                      Found in app/assets/javascripts/prototype/active_scaffold.js - About 5 hrs to fix

                        File list_column_helpers.rb has 391 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 get_column_value(record, column)
                        Severity: Minor
                        Found in lib/active_scaffold/helpers/list_column_helpers.rb - About 5 hrs to fix

                          File action_link_helpers.rb has 377 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

                            Function create has a Cognitive Complexity of 32 (exceeds 5 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: Minor
                            Found in app/assets/javascripts/prototype/dhtml_history.js - 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 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

                            Class Abstract has 34 methods (exceeds 20 allowed). Consider refactoring.
                            Open

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