lib/tabulatr/data/filtering.rb
Method apply_filters
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def apply_filters(filter_params)
default_filters = table_columns.map do |col|
next if col.col_options.default_filter.nil?
["#{col.table_name}:#{col.name}", col.col_options.default_filter]
end.compact.to_h
- 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_search
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def apply_search(query)
like ||= Tabulatr::Utility.like_statement
return unless query.present?
if @search.is_a? Array
query = query.strip.gsub(/['*%\s]+/, '%')
- 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
unexpected token error
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
Open
filters = default_filters.merge(filter_params&.permit! || {})
- Exclude checks
unexpected token tCOMMA
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
Open
name, value = param
- Exclude checks
unexpected token kEND
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
Open
end
- Exclude checks
unexpected token tRPAREN
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
Open
filters = default_filters.merge(filter_params&.permit! || {})
- Exclude checks
unexpected token kDO_BLOCK
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
Open
filters.to_hash.with_indifferent_access.each do |param|
- Exclude checks