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){
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;
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.
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
Class Column
has 71 methods (exceeds 20 allowed). Consider refactoring. Open
class Column
module ProxyableMethods
extend ActiveSupport::Concern
included do # rubocop:disable Metrics/BlockLength
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
File column.rb
has 497 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveScaffold::DataStructures
class Column
module ProxyableMethods
extend ActiveSupport::Concern
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]
- Read upRead up
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|
- Read upRead up
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
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?
- Read upRead up
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)
- Read upRead up
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
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.
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))
- Read upRead up
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?
- Read upRead up
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',
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)
- Read upRead up
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}")
- Read upRead up
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 = {})