Showing 9 of 9 total issues
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
- 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 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)
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
- 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 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(host, port, packet_handler, encryption_handler, max_clients = 4, channels = 4, download_bandwidth = 0, upload_bandwidth = 0)
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)
- 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 draw_rect
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def draw_rect(x1,y1, x2,y2, color = Gosu::Color::GRAY, z = 2)
Method activate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.activate(host, port, use_inbuilt_console = false, packet_handler = JsonPacketHandler, encryption_handler = nil)
begin
if use_inbuilt_console
require "gosu"
GameOverseer::Console.log "Using inbuilt console"
- 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 activate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.activate(host, port, use_inbuilt_console = false, packet_handler = JsonPacketHandler, encryption_handler = nil)
Method forward_to_channel_manager
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.forward_to_channel_manager
count = 0
begin
channel_manager = GameOverseer::ChannelManager.instance
channel_manager.send_to_service(@client_id, @data)
- 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"