Method scan_available_timezones
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def scan_available_timezones(tzdir)
# There should be an /etc/localtime zoneinfo file that is a link to
# (or a copy of) a timezone data file under tzdir, which should have
# been installed under the "share" directory by the tzdata package.
#
- Read upRead up
- Create a ticketCreate a ticket
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 binaryround
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def binaryround(value)
# Keep a multiplier which grows through powers of 1
multiplier = 1
- Read upRead up
- Create a ticketCreate a ticket
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 binaryround
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def binaryround(value)
# Keep a multiplier which grows through powers of 1
multiplier = 1
- Create a ticketCreate a ticket
Method scan_available_timezones
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scan_available_timezones(tzdir)
# There should be an /etc/localtime zoneinfo file that is a link to
# (or a copy of) a timezone data file under tzdir, which should have
# been installed under the "share" directory by the tzdata package.
#
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if validate_zone(tzname)
if (bestzonename.nil? ||
tzname.length < bestzonename.length ||
(tzname.length == bestzonename.length &&
(tzname <=> bestzonename) < 0)
- Create a ticketCreate a ticket
Method identify_system_timezone
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def identify_system_timezone(tzdir)
resultbuf = scan_available_timezones(tzdir)
if !resultbuf.nil?
# Ignore Olson's rather silly "Factory" zone; use GMT instead
- Read upRead up
- Create a ticketCreate a ticket
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
Avoid too many return
statements within this method. Open
return "mdy"
- Create a ticketCreate a ticket