minimagick/minimagick

View on GitHub

Showing 6 of 6 total issues

Class Image has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Image

    ##
    # This is the primary loading method used by all of the other class
    # methods.
Severity: Minor
Found in lib/mini_magick/image.rb - About 3 hrs to fix

    Method format has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def format(format, page = 0, read_opts={})
          if @tempfile
            new_tempfile = MiniMagick::Utilities.tempfile(".#{format}")
            new_path = new_tempfile.path
          else
    Severity: Minor
    Found in lib/mini_magick/image.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 format has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def format(format, page = 0, read_opts={})
          if @tempfile
            new_tempfile = MiniMagick::Utilities.tempfile(".#{format}")
            new_path = new_tempfile.path
          else
    Severity: Minor
    Found in lib/mini_magick/image.rb - About 1 hr to fix

      Method import_pixels has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def self.import_pixels(blob, columns, rows, depth, map, format = 'png')
      Severity: Minor
      Found in lib/mini_magick/image.rb - About 45 mins to fix

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

            def self.get_image_from_pixels(pixels, dimension, map, depth, format)
        Severity: Minor
        Found in lib/mini_magick/image.rb - About 35 mins to fix

          Method mogrify has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def mogrify(page = nil)
                MiniMagick.mogrify do |builder|
                  yield builder if block_given?
                  if builder.args.include?("-format")
                    fail MiniMagick::Error, "you must call #format on a MiniMagick::Image directly"
          Severity: Minor
          Found in lib/mini_magick/image.rb - About 35 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

          Severity
          Category
          Status
          Source
          Language