Showing 77 of 89 total issues
Class ContentEntry
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class ContentEntry
include Locomotive::Steam::Models::Entity
attr_accessor :content_type
Method apply_transformation
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def apply_transformation(url, context)
# resize image with the image_resizer service?
if (format = attributes[:resize]).present?
options = []
- 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
Class ContentEntryRepository
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class ContentEntryRepository
include Models::Repository
attr_accessor :content_type_repository, :content_type
Method resize
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def resize(input, resize_string, *args)
args ||= {}
options = []
args.flatten.each do |arg|
- 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
Class MongoDBAdapter
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class MongoDBAdapter
attr_accessor_initialize :options
def all(mapper, query)
Class FilesystemAdapter
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class FilesystemAdapter
include Morphine
include Locomotive::Steam::Adapters::Concerns::Key
Class Nav
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Nav < ::Liquid::Tag
Syntax = /(#{::Liquid::VariableSignature}+)/o
attr_accessor :current_site, :current_page, :current_locale, :services, :page_repository
Method to_hash
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def to_hash
@_source.to_hash.tap do |hash|
hash['id'] = hash['_id']
@_source.content_type.fields_by_name.each do |name, field|
- 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_block_delimiter?
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def find_block_delimiter?(tokenizer)
tokenizer.instance_variable_get(:@tokens).each do |token|
next if token.empty?
if token.start_with?(::Liquid::BlockBody::TAGSTART)
if token =~ ::Liquid::BlockBody::FullToken
- 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 action_url
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def action_url(context, options)
url = options[:action]
if url.blank?
if options[:json]
- 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 map
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def map(input, property)
::Liquid::StandardFilters::InputIterator.new(input).map do |e|
e = e.call if e.is_a?(Proc)
if property == 'to_liquid'.freeze
- 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 any_asset_url
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def any_asset_url(input, extension = nil, folder = nil)
return '' if input.nil?
if input =~ /^https?:/
input
- 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
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _load(path, frontmatter = false, strict = false, &block)
if File.exists?(path)
yaml = File.open(path).read.force_encoding('utf-8')
template = nil
- 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 redirect_if_required
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def redirect_if_required(site)
return if env['steam.is_default_host'] || env['steam.live_editing']
if redirect_to_first_domain?(site) || redirect_to_https?(site)
klass = request.scheme == 'https' || redirect_to_https?(site) ? URI::HTTPS : URI::HTTP
- 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 set_default_values
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def set_default_values(entity)
each_field_with_default(entity) do |field|
name = field.type == 'select' ? "#{field.name}_id" : field.name
value = field.localized? ? entity[name][default_locale] : entity[name]
- 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_metafields
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def parse_metafields(fields)
fields.each_with_index.map do |(name, attributes), position|
name, attributes = name.to_a[0] if name.is_a?(Hash) # ordered list of fields
if attributes # Hash
- 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 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 match
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def match(path)
decorate do
repository.matching_fullpath(path_combinations(path))
end.sort do |page_1, page_2|
# normal pages have priority over the templatized ones if they're not in the same "folder"
- 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 liquify
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def liquify(*records, &block)
i = -1
records =
records.inject [] do |all, r|
i += 1
- 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"