Showing 4 of 4 total issues
Method tag_attributes
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def tag_attributes(options)
return '' unless options
options.inject('') do |all, (key, value)|
next all unless value
all << ' ' if all.empty?
- 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_data_options
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_data_options(tag, options)
return unless options
parsed_options = options.dup
options.each do |key, value|
next if !DATA_ATTRIBUTES.include?(key) || (tag.to_s == 'form' && key == :method)
- 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 content_tag
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def content_tag(name, content = nil, options = nil, &block)
if block_given?
options = content if content.is_a?(Hash)
content = capture_html(&block)
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
Method find_template
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_template(path)
configuration.engine ||= 'slim'
raise StandardError, 'Eldr::Rendering requires you to set config.views_dir' unless configuration.views_dir
template = Pathname.new(File.join(configuration.views_dir, path))
template = Pathname.new(template.to_s + '.' + configuration.engine) if template.extname.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"