File time_opal_patch.rb
has 590 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'corelib/comparable'
class Time
include Comparable
Method strftime
has 184 lines of code (exceeds 25 allowed). Consider refactoring. Open
def strftime(format)
%x{
return format.replace(/%([\-_#^0]*:{0,2})(\d+)?([EO]*)(.)/g, function(full, flags, width, _, conv) {
var result = "",
zero = flags.indexOf('0') !== -1,
Class Time
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
class Time
include Comparable
%x{
var days_of_week = #{%w[Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday]},
Method cweek_cyear
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def cweek_cyear
jan01 = Time.new(self.year, 1, 1)
jan01_wday = jan01.wday
first_monday = 0
year = self.year
- 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 local
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.local(year, month = nil, day = nil, hour = nil, min = nil, sec = nil, millisecond = nil)
Method gm
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.gm(year, month = nil, day = nil, hour = nil, min = nil, sec = nil, millisecond = nil)
Method new
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.new(year = undefined, month = nil, day = nil, hour = nil, min = nil, sec = nil, utc_offset = nil)
Method strftime
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def strftime(format)
%x{
return format.replace(/%([\-_#^0]*:{0,2})(\d+)?([EO]*)(.)/g, function(full, flags, width, _, conv) {
var result = "",
zero = flags.indexOf('0') !== -1,
- 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 <=>
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def <=>(other)
if Time === other
to_f <=> other.to_f
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"