Showing 8 of 22 total issues
Method heroicons_naming_v1_to_v2
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
def heroicons_naming_v1_to_v2(name)
lookup_table = {
"adjustments" => "adjustments-vertical",
"annotation" => "chat-bubble-bottom-center-text",
"archive" => "archive-box",
Method new_page_templates
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def new_page_templates(resource: nil)
page_collection = resource&.name || "main"
@view_templates.map do |view_template|
next if is_custom_undeletable_page?(view_template[:name])
next if view_template[:exclude_from]&.include?(page_collection)
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
def create
@images = params[:image][:files].map do |file|
next if file.blank? # Skip the blank string posted by the hidden files[] field
# Create the image and attach the file
- 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_or_set_settings
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def find_or_set_settings
@setting = setting_class.first_or_create do |setting|
plugin.settings.each do |attribute, type|
setting.send("#{attribute}=", (type.is_a?(Hash) ? type.first.last : nil))
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 render_item
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render_item(item)
return nil unless item.materialized_path
children = scoped_collection(item.children)
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update
@image = Image.find(params[:id])
old_signed_id = @image.file&.blob&.signed_id
@image.update(image_params) if params[:image].present?
if params[:filename].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 find_by
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_by(opts = {})
all.find do |plugin|
matches = true
opts.each do |key, value|
matches = false unless plugin.send(key) == value
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update
Mobility.locale = @locale
if @page.update(page_params)
if @page.saved_change_to_draft? && @page.live?
flash[:confetti] = t("spina.pages.published")
- 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"