Method profile_image_link
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def profile_image_link(profile, size = :portrait, tag = "li", extra_info = nil)
if content = @plugins.dispatch_first(:profile_image_link, profile, size, tag, extra_info)
return instance_exec(&content)
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 profile_image_link
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def profile_image_link(profile, size = :portrait, tag = "li", extra_info = nil)
if content = @plugins.dispatch_first(:profile_image_link, profile, size, tag, extra_info)
return instance_exec(&content)
end
Method profile_icon
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def profile_icon(profile, size = :portrait, return_mimetype = false)
filename, mimetype = "", "image/png"
if profile.image.present?
filename = profile.image.public_filename(size)
mimetype = profile.image.content_type
- 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 profile_sex_icon
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def profile_sex_icon(profile)
return "" unless profile.is_a?(Person)
return "" unless !environment.enabled?("disable_gender_icon")
sex = (profile.sex ? profile.sex.to_s() : "undef")
- 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 links_for_balloon
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def links_for_balloon(profile)
if environment.enabled?(:show_balloon_with_profile_links_when_clicked)
if profile.kind_of?(Person)
return [
{ _("Wall") => { href: url_for(profile.public_profile_url) } },
Method links_for_balloon
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def links_for_balloon(profile)
if environment.enabled?(:show_balloon_with_profile_links_when_clicked)
if profile.kind_of?(Person)
return [
{ _("Wall") => { href: url_for(profile.public_profile_url) } },
- 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 profile_pic
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def profile_pic(profile)
if profile.image
filename = profile.image.public_filename
else
pic = if profile.organization?
- 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 profile_image
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def profile_image(profile, size = :portrait, opt = {})
return "" if profile.nil?
opt[:alt] ||= profile.name()
opt[:title] ||= ""
- 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"