Method copy_to
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def copy_to(db, args = {})
debug = args[:debug]
raise "No tables given." unless data[:tables]
data[:tables].each do |table|
- 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 Db
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class Baza::Db
include SimpleDelegate
delegate :last_id, :upsert, :upsert_duplicate_key, to: :commands
delegate :current_database, :current_database_name, :with_database, to: :databases
File db.rb
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Baza::Db
include SimpleDelegate
delegate :last_id, :upsert, :upsert_duplicate_key, to: :commands
delegate :current_database, :current_database_name, :with_database, to: :databases
Method from_object
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def self.from_object(args)
args = {object: args} unless args.is_a?(Hash)
raise "No :object was given." unless args[:object]
Baza::Db.drivers.each do |driver|
- 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 insert_multi
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def insert_multi(tablename, arr_hashes, args = {})
return false if arr_hashes.empty?
if @driver.respond_to?(:insert_multi)
if args && args[:return_sql]
- 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 copy_to
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def copy_to(db, args = {})
debug = args[:debug]
raise "No tables given." unless data[:tables]
data[:tables].each do |table|
Method query
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def query(string, args = nil, &block)
if @debug
print "SQL: #{string}\n"
if @debug.class.name == "Fixnum" && @debug >= 2
- 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 register_thread
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def register_thread
raise "Baza-object is not in threadding mode" unless @conns
thread_cur = Thread.current
tid = __id__
- 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 drivers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.drivers
path = "#{File.dirname(__FILE__)}/driver"
drivers = []
Dir.foreach(path) do |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 optimize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def optimize(args = nil)
STDOUT.puts "Beginning optimization of database." if @debug || (args && args[:debug])
tables.list do |table|
STDOUT.puts "Optimizing table: '#{table.name}'." if @debug || (args && args[:debug])
table.optimize
- 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 opts=
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def opts=(arr_opts)
@opts = {}
arr_opts.each do |key, val|
@opts[key.to_sym] = val
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"