app/presenters/v3/droplet_presenter.rb
Method droplet_buildpack_info
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def droplet_buildpack_info
return nil if droplet.docker?
return nil unless droplet.lifecycle_data&.buildpack_lifecycle_buildpacks
droplet.lifecycle_data.buildpack_lifecycle_buildpacks.map do |buildpack|
- 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 build_links
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def build_links
{
self: { href: url_builder.build_url(path: "/v3/droplets/#{droplet.guid}") },
app: { href: url_builder.build_url(path: "/v3/apps/#{droplet.app_guid}") },
assign_current_droplet: { href: url_builder.build_url(path: "/v3/apps/#{droplet.app_guid}/relationships/current_droplet"), method: 'PATCH' }
- 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"