Showing 12 of 12 total issues
Class Abstract
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Abstract
attr_reader :config
def initialize(config)
@config = config
Method encode_www_form
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def URI.encode_www_form(enum)
enum.map do |k, v|
if v.nil?
encode_www_form_component(k)
elsif v.respond_to?(:to_ary)
- 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 log_connection_yield
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def log_connection_yield(sql, conn, args=nil)
sql_for_log = "#{connection_info(conn) if conn && log_connection_info}#{sql}#{"; #{args.inspect}" if args}"
start = Time.now
begin
::ActiveSupport::Notifications.instrument(
- 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 normalize_repository_config
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def normalize_repository_config(hash)
config = DbConfig.new hash, :root => root
config['max_connections'] = max_connections if max_connections
config['search_path'] = search_path if search_path
- 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 build_url
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_url(cfg)
if (adapter = cfg['adapter']) =~ /sqlite/ &&
(database = cfg['database']) =~ /^:/
# magic sqlite databases
return URI::Generic.build(:scheme => adapter, :opaque => database)
- 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 with_local_repositories
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.with_local_repositories
::SequelRails.configuration.environments.each_value do |config|
uri = parse_url(config['url'])
database = extract_database(config, uri)
- 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_connection_settings
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_connection_settings(commands)
add_option commands, '--username', username unless username.blank?
add_option commands, '--host', host unless host.blank?
add_option commands, '--port', port.to_s unless port.to_s.blank? || port.to_s == '0'
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 sql
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def sql(event)
self.class.runtime += event.duration
self.class.count += 1
return unless logger.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 normalize_db
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def normalize_db(root)
return unless include? :adapter
return unless root
return unless adapter.include?('sqlite') && database != ':memory:'
# sqlite expects path as the database 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 connect
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def connect(environment)
normalized_config = environment_for environment
unless (normalized_config.keys & %w[adapter url]).any?
raise "Database not configured.\n" \
- 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 _drop
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _drop
if _is_sqlite?
return if in_memory?
FileUtils.rm db_name if File.exist? db_name
elsif _is_mysql?
- 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 set_local_assigns!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_local_assigns!
if file_name =~ /^(add|drop|remove)_.*_(?:to|from)_(.*)/
column_action = Regexp.last_match[1]
set_alter!(
Regexp.last_match[2].pluralize,
- 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"