Showing 22 of 24 total issues
Class RGB
has 51 methods (exceeds 20 allowed). Consider refactoring. Open
class Color::RGB
include Color
# The format of a DeviceRGB colour for PDF. In color-tools 2.0 this will
# be removed from this package and added back as a modification by the
Method initialize
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def initialize(palette)
@colors = []
@names = {}
@statistics = Hash.new(0)
@lost = []
- 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
File rgb.rb
has 394 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Color::RGB
include Color
# The format of a DeviceRGB colour for PDF. In color-tools 2.0 this will
# be removed from this package and added back as a modification by the
Class CMYK
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class Color::CMYK
include Color
# The format of a DeviceCMYK colour for PDF. In color-tools 2.0 this will
# be removed from this package and added back as a modification by the
Method initialize
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(palette)
@colors = []
@names = {}
@statistics = Hash.new(0)
@lost = []
Class HSL
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class Color::HSL
include Color
class << self
# Creates an HSL colour object from fractional values 0..1.
Class GrayScale
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class Color::GrayScale
include Color
# The format of a DeviceGrey colour for PDF. In color-tools 2.0 this will
# be removed from this package and added back as a modification by the
Method to_hsl
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def to_hsl
min = [ @r, @g, @b ].min
max = [ @r, @g, @b ].max
delta = (max - min).to_f
- 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 initialize
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def initialize(palette)
@colors = []
@names = {}
@valid = false
@name = "(unnamed)"
- 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 to_aco
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_aco(version = @version) #:nodoc:
res = ""
res << [ version, @order.size ].pack("nn")
Method delta_e94
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def delta_e94(color_1, color_2, weighting_type = :graphic_arts)
case weighting_type
when :graphic_arts
k_1 = 0.045
k_2 = 0.015
Method regenerate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def regenerate(background, foreground = nil)
foreground ||= background
background = background.to_rgb
foreground = foreground.to_rgb
Method initialize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(palette)
@colors = []
@names = {}
@valid = false
@name = "(unnamed)"
Method to_hsl
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_hsl
min = [ @r, @g, @b ].min
max = [ @r, @g, @b ].max
delta = (max - min).to_f
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(h = 0, s = 0, l = 0, radix1 = 360.0, radix2 = 100.0, &block) # :yields self:
Method to_aco
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def to_aco(version = @version) #:nodoc:
res = ""
res << [ version, @order.size ].pack("nn")
- 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 initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(c = 0, m = 0, y = 0, k = 0, radix = 100.0, &block) # :yields self:
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(r = 0, g = 0, b = 0, radix = 255.0, &block) # :yields self:
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(y = 0, i = 0, q = 0, radix = 100.0, &block) # :yields self:
Method from_fraction
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def from_fraction(c = 0, m = 0, y = 0, k = 0, &block)