lib/gmail/mailbox.rb
Consider simplifying this complex logical expression. Open
Open
if args.first.is_a?(Symbol)
search = MAILBOX_ALIASES[args.shift].dup
opts = args.first.is_a?(Hash) ? args.first : {}
opts[:after] and search.concat ['SINCE', Net::IMAP.format_date(opts[:after])]
Method wait_once
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
def wait_once(options = {})
options[:idle_timeout] ||= 29 * 60
response = nil
loop do
- 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 fetch_uids
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
def fetch_uids(*args)
args << :all if args.empty?
if args.first.is_a?(Symbol)
search = MAILBOX_ALIASES[args.shift].dup
- 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 fetch_uids
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def fetch_uids(*args)
args << :all if args.empty?
if args.first.is_a?(Symbol)
search = MAILBOX_ALIASES[args.shift].dup