Showing 626 of 626 total issues
Method has too many lines. [15/10] Open
def buttons(opts = {}, &block)
raise 'give a block to action column' unless block_given?
@table_columns ||= []
output = ->(r) {
tdbb = Tabulatr::Data::ButtonBuilder.new
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [14/10] Open
def self.build_hash_from requested_attributes, id
attrs = []
id_included = false
requested_attributes ||= ''
requested_attributes.split(',').each do |par|
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for insert_attribute_in_hash is too high. [19.34/15] Open
def self.insert_attribute_in_hash at, f, r={}
action = at[:action].to_sym
relation = at[:relation].try(:to_sym)
if at.has_key? :relation
check_if_attribute_is_in_hash(f, relation)
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [14/10] Open
def association(assoc, name, opts = {}, &block)
@table_columns ||= []
assoc_klass = main_class.reflect_on_association(assoc.to_sym)
tname = assoc_klass.try(:quoted_table_name) || assoc_klass.try(:klass).try(:quoted_table_name)
sql_options = determine_sql(opts, tname, name)
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [14/10] Open
def initialize(relation)
@relation = relation
@base = self.class.main_class rescue nil
@base ||= relation.respond_to?(:klass) ? relation.klass : relation
@table_name = @base.table_name
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Perceived complexity for apply_sorting is too high. [11/7] Open
def apply_sorting(sortparam)
if sortparam.present?
clname, orientation = sortparam.split(' ')
if clname[':']
splitted = clname.split(':')
- Read upRead up
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Cyclomatic complexity for determine_appropriate_filter! is too high. [9/6] Open
def determine_appropriate_filter!
typ = self.klass.columns_hash[self.name.to_s].type.to_sym rescue nil
case typ
when :integer then self.col_options.filter = filter_type_for_integer
when :enum then self.col_options.filter = :enum
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Assignment Branch Condition size for method_missing is too high. [18.63/15] Open
def method_missing(name, *args, &block)
@result ||= if @batch_action == name
s = yield(@ids)
if s.is_a?(Hash) && s[:data]
Tabulatr::Responses::RawResponse.new(s[:data], filename: s[:filename], type: s[:type])
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for buttons is too high. [18.28/15] Open
def buttons(opts = {}, &block)
raise 'give a block to action column' unless block_given?
@table_columns ||= []
output = ->(r) {
tdbb = Tabulatr::Data::ButtonBuilder.new
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [13/10] Open
def compute_pagination(page, pagesize)
count = @relation.count
count = count.count if count.is_a?(Hash)
page ||= 1
pagesize, page = pagesize.to_i, page.to_i
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Cyclomatic complexity for tabulatr_for is too high. [8/6] Open
def tabulatr_for(relation, tabulatr_data_class: nil, serializer: nil, render_action: nil, default_order: nil, locals: {}, &block)
klass = relation.respond_to?(:klass) ? relation.klass : relation
locals[:current_user] ||= current_user if respond_to?(:current_user)
if batch_params(klass, params).present?
response = klass.tabulatr(relation, tabulatr_data_class).data_for_table(params, locals: locals, controller: self, &block)
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Cyclomatic complexity for method_missing is too high. [8/6] Open
def method_missing(name, *args, &block)
@result ||= if @batch_action == name
s = yield(@ids)
if s.is_a?(Hash) && s[:data]
Tabulatr::Responses::RawResponse.new(s[:data], filename: s[:filename], type: s[:type])
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Perceived complexity for method_missing is too high. [9/7] Open
def method_missing(name, *args, &block)
@result ||= if @batch_action == name
s = yield(@ids)
if s.is_a?(Hash) && s[:data]
Tabulatr::Responses::RawResponse.new(s[:data], filename: s[:filename], type: s[:type])
- Read upRead up
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Method has too many lines. [12/10] Open
def value_for(record, view)
val = principal_value(record, view)
if self.col_options.format.present?
if val.respond_to?(:to_ary)
val.map do |v|
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [12/10] Open
def method_missing(name, *args, &block)
@result ||= if @batch_action == name
s = yield(@ids)
if s.is_a?(Hash) && s[:data]
Tabulatr::Responses::RawResponse.new(s[:data], filename: s[:filename], type: s[:type])
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [12/10] Open
def build_table(columns, filters, tabulatr_data_class, &block)
tdc = get_data_class(tabulatr_data_class)
set_columns_and_filters(tdc, columns, filters, &block)
@view.render(partial: '/tabulatr/tabulatr_table', locals: {
columns: @columns,
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [12/10] Open
def apply_formats(locals: {}, controller: nil)
view = Tabulatr::Data::Proxy.new(locals: locals, controller: controller)
return @relation.map do |record|
view.record = record
h = HashWithIndifferentAccess.new
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [11/10] Open
def self.insert_attribute_in_hash at, f, r={}
action = at[:action].to_sym
relation = at[:relation].try(:to_sym)
if at.has_key? :relation
check_if_attribute_is_in_hash(f, relation)
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [11/10] Open
def determine_appropriate_filter!
typ = self.klass.columns_hash[self.name.to_s].type.to_sym rescue nil
case typ
when :integer then self.col_options.filter = filter_type_for_integer
when :enum then self.col_options.filter = :enum
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [11/10] Open
def self.like_statement
case ActiveRecord::Base.connection.class.to_s
when "ActiveRecord::ConnectionAdapters::MysqlAdapter",
"ActiveRecord::ConnectionAdapters::Mysql2Adapter",
"ActiveRecord::ConnectionAdapters::SQLiteAdapter",
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.