File config.rb
has 459 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'uri'
require 'socket'
require 'kconv'
require 'ndk/logger'
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 log_format_message
has 43 lines of code (exceeds 25 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
Method load_bots
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def load_bots
# for compatibility
return load_bots_old if @config[:botconfig].kind_of? Hash
@bots = @config[:botconfig].map{|bot|
if bot.kind_of? Hash
- 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 load_bots_old
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def load_bots_old
(@config[:botfiles] + (@config[:defaultbotfiles]||[])).each{|file|
load_botfile 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 channel_setting
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def channel_setting
# treat with channel information
if chs = @config[:channel_info]
dchs = []
lchs = []
- 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 remove_previous_setting
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def remove_previous_setting
# remove setting class
base_klass = ConfigClass.shift
while klass = ConfigClass.shift
Object.module_eval{
Method make_logwriter
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def make_logwriter log
return unless log
case log
when Hash
Method load_bots_old
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_bots_old
(@config[:botfiles] + (@config[:defaultbotfiles]||[])).each{|file|
load_botfile file
}
Method make_logwriter
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def make_logwriter log
return unless log
case log
when Hash
- 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 load_botfile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def load_botfile file
loaded = false
if @config[:plugins_dir].respond_to? :each
@config[:plugins_dir].each{|dir|
- 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_setting
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def server_setting
if svrs = @config[:servers]
svl = []
svrs.each{|si|
ports = si[:port] || 6667
- 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 make_default_logwriter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def make_default_logwriter
if @config[:default_log].kind_of? Hash
dl = @config[:default_log]
else
# defult_log must be Hash
- 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"