Showing 145 of 177 total issues
Method type
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def type
unless @type
if (match = @data.fetch(:type).match(/^([A-z]+)$/))
@maxlength = false
type = match[0].downcase.to_sym
- 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 add_order_sql
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def add_order_sql
return if @args.nil?
if @args[:orderby]
@sql << " ORDER BY"
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
def initialize(args)
@args = {}
args.each do |key, value|
@args[key.to_sym] = value
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 execute
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def execute
sql = ""
@io.each_line do |line|
next if line.strip.blank?
- 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 select_sql
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def select_sql
sql = "SELECT"
if @count
sql << " COUNT(*) AS 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 clone
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def clone(newname, args = {})
raise "Invalid name." if newname.to_s.strip.empty?
sql = "CREATE TABLE #{@db.quote_table(newname)} ("
first = true
Method change
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def change(data)
newdata = data.clone
newdata[:name] = name unless newdata.key?(:name)
newdata[:type] = type unless newdata.key?(:type)
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def indexes
@db.indexes
ret = [] unless block_given?
@db.query("PRAGMA index_list(#{@db.quote_table(name)})") do |d_indexes|
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def fetch
if @enum
begin
ret = @enum.next
rescue StopIteration
- 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_or_handle_duplicate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def insert_or_handle_duplicate
@db.insert(@table_name, @updates)
return @db.last_id if @return_id
rescue => e
if (match = e.message.match(/UNIQUE constraint failed: #{Regexp.escape(@table_name)}\.(.+?)(:|\Z|\))/))
- 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 change
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def change(data)
newdata = data.clone
newdata[:name] = name unless newdata.key?(:name)
newdata[:type] = type unless newdata.key?(:type)
- 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 save_model!
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def save_model!(model, args = {})
raise ActiveRecord::InvalidRecord, model if (!args.key?(:validate) || args[:validate]) && !model.valid?
attributes = {}
model.changes.each do |column_name, value_array|
- 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_sql
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def create_sql(index_data, args)
sql = ""
sql << "CREATE" if args[:create] || !args.key?(:create)
if index_data.is_a?(String) || index_data.is_a?(Symbol)
- 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
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def copy(args = {})
temp_name = "temptable_#{Time.now.to_f.to_s.hash}"
clone(temp_name)
cols_cur = columns
@db.query("DROP TABLE `#{name}`")
Method change
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def change(data)
if data.key?(:name) && data.fetch(:name).to_s != name
@db.query("#{alter_table_sql} RENAME #{@db.quote_column(name)} TO #{@db.quote_column(data.fetch(:name))}")
@name = data.fetch(:name).to_s
end
Method create_indexes
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.create_indexes(index_arr, args = {})
db = args[:db]
if args[:return_sql]
sql = ""
Method clone
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def clone(newname, args = nil)
raise "Invalid name." if newname.to_s.strip.empty?
sql = "CREATE TABLE `#{newname}` ("
first = true
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
def query(str)
str = str.to_s
str = str.force_encoding("UTF-8") if encoding == "utf8" && str.respond_to?(:force_encoding)
tries = 0
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
def query(str)
str = str.to_s
str = str.force_encoding("UTF-8") if @encoding == "utf8" && str.respond_to?(:force_encoding)
tries = 0
- 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 34 lines of code (exceeds 25 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