minimagick/minimagick

View on GitHub

Showing 7 of 7 total issues

Class Image has 29 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 open has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.open(path_or_url, ext = nil, options = {})
          options, ext = ext, nil if ext.is_a?(Hash)
    
          # Don't use Kernel#open, but reuse its logic
          openable =
    Severity: Minor
    Found in lib/mini_magick/image.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 execute_open3 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def execute_open3(command, options = {})
          require "open3"
    
          # We would ideally use Open3.capture3, but it wouldn't allow us to
          # terminate the command after timing out.
    Severity: Minor
    Found in lib/mini_magick/shell.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 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, mime_type)
        Severity: Minor
        Found in lib/mini_magick/image.rb - About 35 mins to fix
          Severity
          Category
          Status
          Source
          Language