File rbmysql.rb
has 686 lines of code (exceeds 250 allowed). Consider refactoring. Open
class RbMysql
require "rbmysql/constants"
require "rbmysql/error"
require "rbmysql/charset"
Class RbMysql
has 51 methods (exceeds 20 allowed). Consider refactoring. Open
class RbMysql
require "rbmysql/constants"
require "rbmysql/error"
require "rbmysql/charset"
Method fetch
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def fetch
row = @result.fetch
return row unless @bind_result
row.zip(@bind_result).map do |col, type|
if col.nil?
- 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 query
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def query(str, &block)
check_connection
@fields = nil
begin
nfields = @protocol.query_command str
- 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 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fetch
row = @result.fetch
return row unless @bind_result
row.zip(@bind_result).map do |col, type|
if col.nil?
Method connect
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def connect(host=nil, user=nil, passwd=nil, db=nil, port=nil, socket=nil, flag=0)
if flag & CLIENT_COMPRESS != 0
warn 'unsupported flag: CLIENT_COMPRESS' if $VERBOSE
flag &= ~CLIENT_COMPRESS
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 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(year=0, month=0, day=0, hour=0, minute=0, second=0, neg=false, second_part=0)
Method connect
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def connect(host=nil, user=nil, passwd=nil, db=nil, port=nil, socket=nil, flag=0)
Method fetch_hash
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def fetch_hash(with_table=nil)
row = fetch
return nil unless row
if with_table and @fieldname_with_table.nil?
@fieldname_with_table = @fields.map{|f| [f.table, f.name].join(".")}
- 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 to_s
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def to_s
if @date_flag
sprintf "%04d-%02d-%02d", year, mon, day
elsif year == 0 and mon == 0 and day == 0
h = neg ? hour * -1 : hour
- 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 calculate_field_max_length
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def calculate_field_max_length
max_length = Array.new(@fields.size, 0)
@records.each_with_index do |rec, i|
rec = @records[i] = rec.to_a if rec.is_a? RawRecord
max_length.each_index do |j|
- 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 execute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def execute(*values)
raise ClientError, "not prepared" unless @param_count
raise ClientError, "parameter count mismatch" if values.length != @param_count
values = values.map{|v| @charset.convert v}
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"