Method some_posts
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def some_posts(before_id: 0, offset: 0, max_id: nil, since_id: nil)
options = { limit: [(@limit || 50), 50].min }
options[:max_id] = max_id if max_id
options[:since_id] = since_id if since_id
options[@source == :draft ? :before_id : :offset] =
- 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 auto_poster
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def auto_poster(options = {})
process_options(options)
act_on_blog(name: @blog_name)
pprint "Retrieving posts...(can take a while for large queues)\r"
posts = all_posts.reverse # FIFO
Method auto_poster
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def auto_poster(options = {})
process_options(options)
act_on_blog(name: @blog_name)
pprint "Retrieving posts...(can take a while for large queues)\r"
posts = all_posts.reverse # FIFO
- 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 calculate_result
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def calculate_result(result_q)
mod_count = 0
mod_posts = []
return [mod_count, mod_posts] if result_q.empty?
while post = result_q.pop
- 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"