Showing 33 of 52 total issues
Function once
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
, once = function (rm, element, type, fn, originalFn) {
Method filter_by_key_pattern
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def filter_by_key_pattern(type, pattern)
@all_keys.reject! do |key|
if type == 'starts_with'
if pattern == '.'
key.match(/\./)
- 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
Avoid too many return
statements within this function. Open
return this
Avoid too many return
statements within this function. Open
return select(selector, root)
Avoid too many return
statements within this function. Open
if (hasByClass && m[3]) return arrayify(root[byClass](m[3]))
Avoid too many return
statements within this function. Open
if (pseudo && qwery.pseudos[pseudo] && !qwery.pseudos[pseudo](this, pseudoVal)) return false
Avoid too many return
statements within this function. Open
return this
Avoid too many return
statements within this function. Open
return false
Avoid too many return
statements within this function. Open
if (m[2]) return arrayify(root[byTag](m[2]))
Method apply_filters
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def apply_filters(params)
params[:filter] ||= 'all'
remove_proc
filter_by_translated(params[:filter]) if params[:filter] != 'all'
filter_by_key_pattern(params[:key_type], params[:key_pattern]) unless params[:key_pattern].blank?
- 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 init_session
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def init_session
session[:from_locale] ||= I18n.default_locale
session[:to_locale] ||= I18n.default_locale
session[:per_page] ||= 50
session[:from_locale] = page_params.fetch(:from_locale) if page_params.has_key?(:from_locale)
- 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 simple_filter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def simple_filter(labels, param_name = 'filter')
filter = []
labels.each do |label|
if label.to_s == params[param_name].to_s
filter << "<i>#{label}</i>"
- 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 deep_stringify_keys
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def deep_stringify_keys(hash)
hash.reduce({}) do |result, (key, value)|
value = deep_stringify_keys(value) if value.is_a? Hash
result[(key.to_s rescue key) || key] = value
result
- 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"