Showing 145 of 177 total issues
Method create
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def create(name, columns:, indexes: nil, return_sql: false)
raise "No columns given" if !columns || columns.empty?
sql = "CREATE TABLE `#{name}` ("
- 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 sql
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def sql # rubocop:disable Metrics/AbcSize
data.each_key do |key|
raise "Invalid key: '#{key}' (#{key.class.name})." unless DATA_SQL_ALLOWED_KEYS.include?(key)
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 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
Class Tiny
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Baza::Driver::Tiny < Baza::BaseSqlDriver
SEPARATOR_DATABASE = "]".freeze
SEPARATOR_TABLE = "]".freeze
SEPARATOR_COLUMN = "]".freeze
SEPARATOR_INDEX = "]".freeze
Class Table
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Baza::Driver::Mysql::Table < Baza::Table
attr_reader :list, :name
def initialize(args)
@db = args.fetch(:db)
Method flush_real
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def flush_real(db = nil)
return nil if @queries_count <= 0
db = @db if db == nil
@lock.synchronize do
- 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 data_sql
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def data_sql(data)
data.each_key do |key|
raise "Invalid key: '#{key}' (#{key.class.name})." unless DATA_SQL_ALLOWED_KEYS.include?(key)
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 initialize
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def initialize(db)
@db = db
@conn = @db.opts.fetch(:conn)
raise "No conn given" unless @conn
- 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 list
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def list(args = {})
ret = [] unless block_given?
@list_mutex.synchronize do
tables_args = {type: "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
Method insert_multi
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def insert_multi(tablename, arr_hashes, args = {})
sql = "INSERT INTO `#{tablename}` ("
first = true
if args && args[:keys]
Method insert_multi
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def insert_multi(tablename, arr_hashes, args = {})
sql = "INSERT INTO `#{tablename}` ("
first = true
if args && args[:keys]
Method initialize
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def initialize(args, &block)
@args = args
@db = args.fetch(:db)
@ids = []
@debug = @args[:debug]
- 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 indexes
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def indexes(args = nil, &blk)
ret = {}
sql = "SHOW INDEX FROM #{@db.quote_table(name)}"
sql << " WHERE #{@db.quote_column("Key_name")} = #{@db.quote_value(args.fetch(:name))}" if args && args.key?(:name)
- 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 types
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def types
unless @types
@types = []
@result.fields.length.times do |count|
type_num = @result.ftype(count)
- 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 reconnect
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def reconnect
@mutex.synchronize do
require "mysql2" unless ::Object.const_defined?(:Mysql2)
args = {
- 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 fetch
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def fetch
return nil unless @args
if @res
data = @res.fetch if @res
- 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 create_column_programmatic
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def create_column_programmatic(col_data)
temp_name = "temptable_#{Time.now.to_f.to_s.hash}"
clone(temp_name)
cols_cur = columns
@db.query("DROP TABLE `#{name}`")
- 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 sql
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def sql
sql = "CREATE"
sql << " TEMPORARY" if @temporary
sql << " TABLE #{Baza::Driver::Mysql.quote_table(@name)} ("
- 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 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(db)
@db = db
@conn = @db.opts.fetch(:conn)
raise "No conn given" unless @conn
Method list
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def list(database: nil, name: nil)
ret = [] unless block_given?
where_args = {}
where_args["TABLE_NAME"] = name if name
- 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"