Showing 6 of 6 total issues
Method meme
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def meme(input, text_poss, options={})
img = Magick::ImageList.new
if input.respond_to?(:read)
img.from_blob(input.read)
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 meme
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
def meme(input, text_poss, options={})
img = Magick::ImageList.new
if input.respond_to?(:read)
img.from_blob(input.read)
else
Method wrap
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def wrap(num_lines)
cleaned = gsub(/\s+/, ' ').strip
chars_per_line = cleaned.size / num_lines.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 calc_pointsize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def calc_pointsize(width, height, text, min_pointsize)
current_pointsize = min_pointsize
metrics = nil
- 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 initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(text, x, y, width, height, options = {})
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(pointsize, metrics, text, bound_width, bound_height)