Showing 29 of 59 total issues
Method run_on_page_layout_callbacks
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run_on_page_layout_callbacks
OnPageLayout.callbacks.each do |page_layout, callbacks|
next unless call_page_layout_callback_for?(page_layout)
callbacks.each do |callback|
- 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 update_element_positions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_element_positions
Alchemy::Page.all.each do |page|
if page.elements.any?
puts "\n## Updating element positions of page `#{page.name}`"
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 create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create
@page_version = PageVersion.find(params[:element][:page_version_id])
@page = @page_version.page
Element.transaction do
@paste_from_clipboard = params[:paste_from_clipboard].present?
- 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 page_hash
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def page_hash(page, level, folded)
p_hash = {
id: page.id,
name: page.name,
public: page.public?,
- 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 remove_orphaned_elements
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def remove_orphaned_elements
puts "\n## Removing orphaned elements"
elements = Alchemy::Element.unscoped.not_nested
if elements.any?
orphaned_elements = elements.select do |element|
- 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 copy_children_to
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def copy_children_to(new_parent)
children.each do |child|
next if child == new_parent
new_child = Alchemy::CopyPage.new(page: child).call(changed_attributes: {
- 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_primary_language
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_primary_language(code: "en", name: "English", auto_accept: false)
unless auto_accept
code = ask("- What is the language code of your site's primary language?", default: code)
end
unless auto_accept
- 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_to_success_page
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def redirect_to_success_page
flash[:notice] = Alchemy.t(:success, scope: "contactform.messages")
urlname = if success_page
success_page_urlname
elsif mailer_config["forward_to_page"] && mailer_config["mail_success_page"]
- 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_alchemy_language
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_alchemy_language(lang = nil)
@language = if lang
lang.is_a?(Language) ? lang : load_alchemy_language_from_id_or_code(lang)
else
load_alchemy_language_from_params || Language.default
- 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"