lib/color/rgb.rb
Class RGB
has 51 methods (exceeds 20 allowed). Consider refactoring. Open
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
File rgb.rb
has 394 lines of code (exceeds 250 allowed). Consider refactoring. Open
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 to_hsl
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
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 delta_e94
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 to_hsl
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def to_hsl
min = [ @r, @g, @b ].min
max = [ @r, @g, @b ].max
delta = (max - min).to_f
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def initialize(r = 0, g = 0, b = 0, radix = 255.0, &block) # :yields self: