halostatue/color

View on GitHub

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
Severity: Major
Found in lib/color/rgb.rb - About 7 hrs to fix

    Method initialize has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

      def initialize(palette)
        @colors     = []
        @names      = {}
        @statistics = Hash.new(0)
        @lost       = []
    Severity: Minor
    Found in lib/color/palette/adobecolor.rb - About 6 hrs to fix

    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
    Severity: Minor
    Found in lib/color/rgb.rb - About 5 hrs to fix

      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
      Severity: Minor
      Found in lib/color/cmyk.rb - About 4 hrs to fix

        Method initialize has 113 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def initialize(palette)
            @colors     = []
            @names      = {}
            @statistics = Hash.new(0)
            @lost       = []
        Severity: Major
        Found in lib/color/palette/adobecolor.rb - About 4 hrs to fix

          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.
          Severity: Minor
          Found in lib/color/hsl.rb - About 4 hrs to fix

            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
            Severity: Minor
            Found in lib/color/grayscale.rb - About 3 hrs to fix

              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
              
              
              Severity: Minor
              Found in lib/color/rgb.rb - About 2 hrs to fix

              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)"
              Severity: Minor
              Found in lib/color/palette/gimp.rb - About 1 hr to fix

              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")
              
              
              Severity: Minor
              Found in lib/color/palette/adobecolor.rb - About 1 hr to fix

                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
                Severity: Minor
                Found in lib/color/rgb.rb - About 1 hr to fix

                  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
                  
                  
                  Severity: Minor
                  Found in lib/color/palette/monocontrast.rb - About 1 hr to fix

                    Method initialize has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def initialize(palette)
                        @colors   = []
                        @names    = {}
                        @valid    = false
                        @name     = "(unnamed)"
                    Severity: Minor
                    Found in lib/color/palette/gimp.rb - About 1 hr to fix

                      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
                      
                      
                      Severity: Minor
                      Found in lib/color/rgb.rb - About 1 hr to fix

                        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:
                        Severity: Minor
                        Found in lib/color/hsl.rb - About 45 mins to fix

                          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")
                          
                          
                          Severity: Minor
                          Found in lib/color/palette/adobecolor.rb - About 45 mins to fix

                          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:
                          Severity: Minor
                          Found in lib/color/cmyk.rb - About 45 mins to fix

                            Method from_percent has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def from_percent(c = 0, m = 0, y = 0, k = 0, &block)
                            Severity: Minor
                            Found in lib/color/cmyk.rb - About 35 mins to fix

                              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:
                              Severity: Minor
                              Found in lib/color/rgb.rb - About 35 mins to fix

                                Method from_fraction has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    def from_fraction(c = 0, m = 0, y = 0, k = 0, &block)
                                Severity: Minor
                                Found in lib/color/cmyk.rb - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language