Showing 69 of 69 total issues
File server.rb
has 644 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rice/irc'
require 'ndk/error'
require 'ndk/config'
require 'ndk/server_state'
require 'ndk/client'
File irc.rb
has 591 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'socket'
require 'thread'
require 'monitor'
begin
require "openssl"
File config.rb
has 459 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'uri'
require 'socket'
require 'kconv'
require 'ndk/logger'
Method start_clients_thread
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def start_clients_thread
return unless @config.client_server_port
@clients_thread = Thread.new{
begin
@cserver = TCPServer.new(@config.client_server_host,
- 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 server_main_proc
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def server_main_proc
## login
# send passwd
if @server_passwd
- 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 server_main_proc
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
def server_main_proc
## login
# send passwd
if @server_passwd
Method log_format_message
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def log_format_message msgfmts, msgobj
type = msgobj[:type]
format = msgfmts.fetch(type, @config[:default_log][:message_format][type])
if format.kind_of? Proc
- 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 start
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def start
start_server_thread
start_clients_thread
timer_thread = Thread.new{
begin
- 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
Class NDK_Server
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class NDK_Server
TimerIntervalSec = 60
MAX_PONG_FAIL = 5
def initialize rc
Method start_server_thread
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def start_server_thread
@server_thread = Thread.new{
begin
@server = make_server()
@logger.slog "Server connection to #{@server.server}:#{@server.port}."
- 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 read_thread
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def read_thread(read_q, eol)
begin
read_q.clear
Thread.stop
- 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 close
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def close(restart = false)
begin
unless restart
@main_th.exit if alive?
@read_th.exit if @read_th.alive?
- 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 recv_from_server
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def recv_from_server
while q = @rq.pop
# Event
if q.kind_of? Array
- 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 ssl_params=
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def ssl_params=(ssl_params)
raise RuntimeError,
"Already connected to #{@server}:#{@port}" unless @conn.empty?
unless ssl_params
@ssl_params = false
- 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 send_to_bot
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def send_to_bot msg, *arg
selector = 'on_' +
if msg.respond_to? :command
if /^\d+$/ =~ msg.command
- 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
Class NDK_State
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class NDK_State
class ChannelState
def initialize name
@name = name
@topic = nil
Method start_clients_thread
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start_clients_thread
return unless @config.client_server_port
@clients_thread = Thread.new{
begin
@cserver = TCPServer.new(@config.client_server_host,
Method start
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start
start_server_thread
start_clients_thread
timer_thread = Thread.new{
begin
Method daemon
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def Process.daemon(nochdir = nil, noclose = nil)
exit!(0) if fork
Process.setsid
exit!(0) if fork
Dir.chdir('/') unless nochdir
- 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 push
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def push(message)
conn = @conn[0]
if conn
conn.synchronize do
cmd = message.command
- 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"