Method convert_icon_links_into_images
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def convert_icon_links_into_images
uri = URI.join(Rails.application.routes.url_helpers.root_url, "/api/v1/images/create.json")
links = Link.where(type: ["IconLink", "PhotoLink"]).find_each do |l|
url = Addressable::URI.parse(l.url).normalize.to_s
- 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 convert_icon_links_into_images
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def convert_icon_links_into_images
uri = URI.join(Rails.application.routes.url_helpers.root_url, "/api/v1/images/create.json")
links = Link.where(type: ["IconLink", "PhotoLink"]).find_each do |l|
url = Addressable::URI.parse(l.url).normalize.to_s
Method fix_links_for_calendary
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def fix_links_for_calendary string, slug
cal = Calendary.by_slug(slug).first
Link.transaction do
Link.where("url ~* ?", string).where(info_type: "Memory").map do |x|
- 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 fix_links_for_calendary
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fix_links_for_calendary string, slug
cal = Calendary.by_slug(slug).first
Link.transaction do
Link.where("url ~* ?", string).where(info_type: "Memory").map do |x|
Method fix_memo_scripta_for_scripta
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def fix_memo_scripta_for_scripta
Scriptum.transaction do
Scriptum.find_each do |s|
begin
if s.memo_scripta.blank? && s.service_scripta.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 fix_root_in_names
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def fix_root_in_names
Name.all.each do |name|
line = [ name ]
last = 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
unexpected token error
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
x.info.events.where(kind_code: name).first&.memos
- Exclude checks