Showing 145 of 177 total issues
Method list
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list(database: nil, name: nil)
ret = [] unless block_given?
where_args = {}
where_args["TABLE_NAME"] = name if name
Method tables
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def tables(args = {})
tables_list = [] unless block_given?
where_args = {
table_catalog: 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 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 translate_values_with_types
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def translate_values_with_types(values)
values.collect!.with_index do |value, count|
type_sym = types[count]
if type_sym == :int
- 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 foreign_keys
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def foreign_keys(args = {})
sql = "
SELECT
tc.constraint_name,
tc.table_name,
Method create
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create(table_name, columns:, indexes: nil, return_sql: false, temp: false)
table_name = table_name.to_s
raise "Invalid table name: #{table_name}" if table_name.strip.empty?
raise "No columns was given for '#{table_name}'." if !columns || columns.empty?
Method create
has 31 lines of code (exceeds 25 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}` ("
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 types
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def types
unless @types
@types = []
@result.fields.length.times do |count|
type_num = @result.ftype(count)
Method from_active_record_connection
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.from_active_record_connection(connection)
if connection.class.name.include?("Mysql2Adapter")
connection = connection.instance_variable_get(:@connection)
config = connection.instance_variable_get(:@query_options)
Method referenced_foreign_keys
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def referenced_foreign_keys(args = {})
sql = "
SELECT
tc.constraint_name,
tc.table_name,
Method clone
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def clone(newname, args = nil)
raise "Invalid name." if newname.to_s.strip.empty?
sql = "CREATE TABLE `#{newname}` ("
first = true
Method create_indexes
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_indexes(index_arr, args = nil)
ret = [] if args && args[:return_sql]
index_arr.each do |index_data|
if index_data.is_a?(String) || index_data.is_a?(Symbol)
Method sql
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sql
sql = ""
first = true
@indexes.each do |index_data|
Method sql
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sql
sql = "CREATE"
sql << " TEMPORARY" if @temporary
sql << " TABLE #{Baza::Driver::Mysql.quote_table(@name)} ("
Method indexes
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def indexes
@db.indexes
ret = [] unless block_given?
@db.query("PRAGMA index_list(#{@db.quote_table(name)})") do |d_indexes|
Method initialize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(args)
@args = args
@db = args.fetch(:db)
@queries = []
@inserts = {}
Method list
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list(args = {})
ret = [] unless block_given?
@list_mutex.synchronize do
tables_args = {type: "table"}
Method foreign_keys
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def foreign_keys(args = {})
sql = "
SELECT
TABLE_NAME,
COLUMN_NAME,
Method referenced_foreign_keys
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def referenced_foreign_keys(args = {})
sql = "
SELECT
TABLE_NAME,
COLUMN_NAME,