Method get_attributes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_attributes(filepath, fullpath)
if File.directory?(filepath)
{
title: File.basename(filepath).humanize,
listed: false,
- 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 complete_attributes_from_data
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def complete_attributes_from_data(attributes, data, locale)
return if attributes.nil? # shouldn't happen (undeleted page? local files out of date?)
# this is super important to handle correctly url type settings in sections
attributes[:_id] = data['id']
- 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 load_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def load_data
Dir.glob(File.join(data_path, '**', '*.json')).each do |filepath|
filepath =~ /#{data_path}\/([a-z]+)\//
data = safe_json_file_load(filepath)
locale = $1.to_sym
- 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 each_file
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def each_file(&block)
Dir.glob(File.join(path, '**', '*')).each do |filepath|
next unless is_liquid_file?(filepath)
relative_path = get_relative_path(filepath)
- 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 load_tree
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load_tree
# load the core pages and layouts from the app/views/pages folder
each_file do |filepath, fullpath, locale|
if leaf = @pages_by_fullpath[fullpath]
update(leaf, filepath, fullpath, 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"