Showing 6 of 6 total issues
Method command_flags
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def command_flags(options)
options.flat_map do |key, value|
next if key == 'execute'
flag_options = self.class.percona_flags[key]
- 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 PtOscMigration
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class PtOscMigration < Migration
# @TODO whitelist all valid pt-osc flags
PERCONA_FLAGS = {
'defaults-file' => {
mutator: :make_path_absolute,
Method migrate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def migrate(direction)
return unless respond_to?(direction)
run_mode = percona_config[:run_mode] || 'print'
raise ArgumentError.new('Invalid run_mode specified in database config') unless run_mode.in? %w(print execute)
- 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 migrate
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def migrate(direction)
return unless respond_to?(direction)
run_mode = percona_config[:run_mode] || 'print'
raise ArgumentError.new('Invalid run_mode specified in database config') unless run_mode.in? %w(print execute)
Method execute_sql_for_table
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def execute_sql_for_table(execute_sql, database_name, table_name, dry_run = true)
command = percona_command(execute_sql, database_name, table_name, execute: !dry_run)
logger.info "Command is #{self.class.sanitize_command(command)}"
success = Kernel.system command
- 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 percona_command
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def percona_command(execute_sql, database_name, table_name, options = {})
command = ['pt-online-schema-change', '--alter', execute_sql || '', "D=#{database_name},t=#{table_name}"]
# Whitelist
options = HashWithIndifferentAccess.new(options)
- 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"