Class Time
has 54 methods (exceeds 20 allowed). Consider refactoring. Open
class Time
include Comparable
def self.now
Rubinius.primitive :time_s_now
File time.rb
has 397 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Time
include Comparable
def self.now
Rubinius.primitive :time_s_now
Method compose
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def self.compose(offset, p1, p2=nil, p3=nil, p4=nil, p5=nil, p6=nil, p7=nil,
yday=undefined, is_dst=undefined, tz=undefined)
if undefined.equal?(tz)
unless undefined.equal?(is_dst)
raise ArgumentError, "wrong number of arguments (9 for 1..8)"
- 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 compose
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.compose(offset, p1, p2=nil, p3=nil, p4=nil, p5=nil, p6=nil, p7=nil,
yday=undefined, is_dst=undefined, tz=undefined)
if undefined.equal?(tz)
unless undefined.equal?(is_dst)
raise ArgumentError, "wrong number of arguments (9 for 1..8)"
Method from_array
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.from_array(sec, min, hour, mday, month, year, nsec, is_dst, from_gmt, utc_offset)
Rubinius.primitive :time_s_from_array
if sec.kind_of?(String)
sec = sec.to_i
- 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 compose
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.compose(offset, p1, p2=nil, p3=nil, p4=nil, p5=nil, p6=nil, p7=nil,
yday=undefined, is_dst=undefined, tz=undefined)
Method from_array
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.from_array(sec, min, hour, mday, month, year, nsec, is_dst, from_gmt, utc_offset)
Method <=>
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def <=>(other)
if other.kind_of? Time
(seconds <=> other.seconds).nonzero? or (nsec <=> other.nsec)
else
r = (other <=> self)
- 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 at
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.at(sec, usec=undefined)
if undefined.equal?(usec)
if sec.kind_of?(Time)
return duplicate(sec)
elsif sec.kind_of?(Integer)
- 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 new
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.new(year=undefined, month=nil, day=nil, hour=nil, minute=nil, second=nil, utc_offset=nil)
Method _load
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self._load(data)
raise TypeError, 'marshaled time format differ' unless data.bytesize == 8
major, minor = data.unpack 'VV'
- 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"