Showing 6 of 6 total issues
Class Image
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Image
##
# This is the primary loading method used by all of the other class
# methods.
Method format
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
Open
def format(format, page = 0, read_opts={})
if @tempfile
new_tempfile = MiniMagick::Utilities.tempfile(".#{format}")
new_path = new_tempfile.path
else
- 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 format
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def format(format, page = 0, read_opts={})
if @tempfile
new_tempfile = MiniMagick::Utilities.tempfile(".#{format}")
new_path = new_tempfile.path
else
Method import_pixels
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def self.import_pixels(blob, columns, rows, depth, map, format = 'png')
Method get_image_from_pixels
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def self.get_image_from_pixels(pixels, dimension, map, depth, format)
Method mogrify
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
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"
- 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"