mmb/meme_captain

View on GitHub

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
Severity: Minor
Found in lib/meme_captain/meme.rb - About 3 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 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
Severity: Major
Found in lib/meme_captain/meme.rb - About 2 hrs to fix

    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
    
    
    Severity: Minor
    Found in lib/meme_captain/caption.rb - About 55 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 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
    
    
    Severity: Minor
    Found in lib/meme_captain/draw.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(text, x, y, width, height, options = {})
    Severity: Minor
    Found in lib/meme_captain/text_pos.rb - About 45 mins to fix

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

          def initialize(pointsize, metrics, text, bound_width, bound_height)
      Severity: Minor
      Found in lib/meme_captain/caption_choice.rb - About 35 mins to fix
        Severity
        Category
        Status
        Source
        Language