Showing 5 of 5 total issues
Class Controller
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Controller
# Pio::FlowMod.new argument
class FlowModAddOption
def initialize(user_options)
@user_options = user_options
- Create a ticketCreate a ticket
Class Command
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Command
def self.unix_domain_socket(name, check = false)
path = File.expand_path(File.join(Phut.socket_dir, "#{name}.ctl"))
if check && !FileTest.socket?(path)
raise "Socket file #{path} does not exist."
- Create a ticketCreate a ticket
Method handle_openflow_message
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def handle_openflow_message(datapath_id)
begin
message = SWITCH.fetch(datapath_id).read
rescue KeyError
logger.debug "Switch #{datapath_id} is disconnected."
- Create a ticketCreate a ticket
Method start_phut
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def start_phut(config_file)
return unless config_file
system 'sudo -v'
@phut = Phut::Parser.new(@controller.logger).parse(config_file)
@phut_run_thread = Thread.start { @phut.run }
- Read upRead up
- Create a ticketCreate a ticket
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 killall
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def killall
@controller.logger.debug 'Shutting down...' if @controller
@controller.stop
@controller_thread.kill if @controller_thread
@phut_run_thread.kill if @phut_run_thread
- Read upRead up
- Create a ticketCreate a ticket
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"