cyberarm/rewrite-gameoverseer

View on GitHub
lib/gameoverseer/console/console.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method update_ui has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def update_ui
      PENDING_LOG.each do |log_message|
        submit_text(log_message, false) if log_message.strip.length > 0
        PENDING_LOG.delete(log_message)
      end
Severity: Minor
Found in lib/gameoverseer/console/console.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 submit_text has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def submit_text(text, from_console = true, color = Gosu::Color::WHITE)
      if text.strip.length > 0
        clean_messages(300)
        text = "Console> #{text}" if from_console
        GameOverseer::Console.log_it(text)
Severity: Minor
Found in lib/gameoverseer/console/console.rb - About 1 hr to fix

    Method log_it has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.log_it(string)
          puts string
          retry_limit = 0
          begin
            @log_file = File.open("#{Dir.pwd}/logs/log-#{Time.now.strftime('%B-%d-%Y')}.txt", 'a+') unless defined? @log_file
    Severity: Minor
    Found in lib/gameoverseer/console/console.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 submit_text has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def submit_text(text, from_console = true, color = Gosu::Color::WHITE)
          if text.strip.length > 0
            clean_messages(300)
            text = "Console> #{text}" if from_console
            GameOverseer::Console.log_it(text)
    Severity: Minor
    Found in lib/gameoverseer/console/console.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 draw_rect has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def draw_rect(x1,y1, x2,y2, color = Gosu::Color::GRAY, z = 2)
    Severity: Minor
    Found in lib/gameoverseer/console/console.rb - About 45 mins to fix

      There are no issues that match your filters.

      Category
      Status