Showing 276 of 365 total issues
Function update_column
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
update_column: function(element, url, send_form, source_id, val, additional_params) {
if (!element) element = $(source_id);
var as_form = element.up('form.as_form');
var params = null;
Method condition_for_column
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def condition_for_column(column, value, text_search = :full)
like_pattern = like_pattern(text_search)
value = value.with_indifferent_access if value.is_a? Hash
if respond_to?("condition_for_#{column.name}_column")
return send("condition_for_#{column.name}_column", column, value, like_pattern)
Function add
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
add: function(newLocation, historyData) {
var that = this;
/*Escape the location and remove any leading hash symbols*/
Method action_link_html_options
has 33 lines of code (exceeds 25 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)
Function create_record_row
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
create_record_row: function(active_scaffold_id, html, options) {
tbody = $(active_scaffold_id).down('tbody.records');
var new_row = null;
Method query_string_for_action_links
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def query_string_for_action_links(link)
if defined?(@query_string) && link.parameters.none? { |k, _| @query_string_params.include? k }
return [@query_string, @non_nested_query_string]
end
keep = true
Function add
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
add: function(newLocation, historyData) {
var that = this;
/*Escape the location and remove any leading hash symbols*/
- 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_search_range
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_search_range(column, options, input_method = :text_field_tag, input_options = {}, ui_options: column.options)
opt_value, from_value, to_value = field_search_params_range_values(column)
select_options = active_scaffold_search_range_comparator_options(column, ui_options: ui_options)
text_field_size = active_scaffold_search_range_string?(column) ? 15 : 10
- 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 set_includes_for_sorting
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def set_includes_for_sorting(columns, sorting)
sorting.each_column do |col|
next if sorting.constraint_columns.include? col.name
next unless col.includes.present? && !columns.include?(col)
if active_scaffold_config.model.connection.needs_order_expressions_in_select?
- 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 show_column_value
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def show_column_value(record, column)
value_record = column.delegated_association ? record.send(column.delegated_association.name) : record
return get_column_value(record, column) unless value_record
# check for an override helper
if (method = show_column_override(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 options_for_render_super
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def options_for_render_super(options)
options ||= {}
options[:locals] ||= {}
if view_stack.last
options[:locals] = view_stack.last[:locals].merge!(options[:locals]) if view_stack.last[:locals]
- 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 add
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def add(action, options = {})
link =
if action.is_a?(ActiveScaffold::DataStructures::ActionLink) || action.is_a?(ActiveScaffold::DataStructures::ActionLinks)
action
else
- 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 parse_time_with_format
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def parse_time_with_format(value, format, offset)
format.gsub!(/%-d|%-m|%_m/) { |s| s.gsub(/[-_]/, '') } # strptime fails with %-d, %-m, %_m
en_value = I18n.locale == :en ? value : translate_days_and_months(value, format)
time = Time.strptime(en_value, format)
offset ? time : Time.zone.local_to_utc(time).in_time_zone
- 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 create_record_row
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
create_record_row: function(active_scaffold_id, html, options) {
if (typeof(active_scaffold_id) == 'string') active_scaffold_id = '#' + active_scaffold_id;
var tbody = jQuery(active_scaffold_id).find('tbody.records').first(), new_row;
if (options.insert_at == 'top') {
Method conditions_from_params
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def conditions_from_params
@conditions_from_params ||= begin
conditions = [{}]
params.except(:controller, :action, :page, :sort, :sort_direction, :format, :id).each do |key, value|
distinct = true if key.match?(/!$/)
Method active_scaffold_search_for
has 29 lines of code (exceeds 25 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]
Method apply_constraints_to_record
has 29 lines of code (exceeds 25 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)
Method active_scaffold_search_select
has 28 lines of code (exceeds 25 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?
Method active_scaffold_record_select
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_record_select(record, column, options, value, multiple, ui_options: column.options)
unless column.association
raise ArgumentError, "record_select can only work against associations (and #{column.name} is not). "\
'A common mistake is to specify the foreign key field (like :user_id), instead of the association (:user).'
end
- 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 get
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
get: function(element) {
var element = $(element);
if (typeof(element.retrieve('action_link')) === 'undefined' && !element.hasClassName('as_adapter')) {
var parent = element.up('.actions');
if (typeof(parent) === 'undefined') {
- 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"