Showing 52 of 135 total issues
Method import_layout
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import_layout(path, parent)
identifier = path.split("/").last
# reading file content in, resulting in a hash
content_path = File.join(path, "content.html")
Method create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create
categories_scope = @site.categories.of_type("Comfy::Cms::File")
if params[:categories]
ids = categories_scope.where(label: params[:categories]).pluck(: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 import_translations
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def import_translations(path, page)
old_translations = page.translations.pluck(:locale)
new_translations = []
Dir["#{path}content.*.html"].each do |file_path|
- 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 assert_exception_raised
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def assert_exception_raised(exception_class = nil, error_message = nil)
exception_raised = nil
yield
rescue StandardError => exception_raised
exception_raised
- 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_site
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.find_site(host, path = nil)
return Comfy::Cms::Site.first if Comfy::Cms::Site.count == 1
cms_site = nil
public_cms_path = ComfortableMexicanSofa.configuration.public_cms_path
- 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 render_cms_layout
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render_cms_layout(identifier, options = {}, locals = {}, &block)
unless (@cms_layout = @cms_site.layouts.find_by_identifier(identifier))
raise ComfortableMexicanSofa::MissingLayout, identifier
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 assign_parent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def assign_parent
return unless site
self.parent ||= site.pages.root unless self == site.pages.root || site.pages.count.zero?
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 fragments_attributes=
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fragments_attributes=(frag_hashes = [])
frag_hashes = frag_hashes.values if frag_hashes.is_a?(Hash)
frag_hashes.each do |frag_attrs|
unless frag_attrs.is_a?(HashWithIndifferentAccess)
- 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 import!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def import!
Dir.glob("#{path}/*.html").each do |path|
identifier = File.basename(path, ".html")
# reading file content in, resulting in a 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 content
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def content(file: self.file, as: self.as, variant_attrs: self.variant_attrs, label: self.label)
return "" unless file
url_helpers = Rails.application.routes.url_helpers
- 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 export!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def export!
prepare_folder!(path)
site.pages.each do |page|
page.slug = "index" if page.slug.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 import_layout
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def import_layout(path, parent)
identifier = path.split("/").last
# reading file content in, resulting in a hash
content_path = File.join(path, "content.html")
- 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"