Method delete_segment_by_title
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def delete_segment_by_title(title, segments, days = 14, force = false)
return if segments.empty?
dead_line = Time.now - days * 60 * 60 * 24
filtered_segments = segments.select do |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 delete_ads_by_title
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def delete_ads_by_title(title, client, days = 14, force = false)
warehouses = client.warehouses
return if warehouses.empty?
deleted = 0
- 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 clean_up!
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def clean_up!(client, force, days, opts = {})
projects = client.projects
if opts[:domain_id]
domain = client.domain(opts[:domain_id])
Method delete_project_by_title
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def delete_project_by_title(title, projects, days = 14, force = false)
dead_line = Time.now - days * 60 * 60 * 24
filtered_projects = projects.select do |p|
p.title.match(title) && p.created < dead_line
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"