Showing 29 of 29 total issues
Method validate_data
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def validate_data(data = nil)
unless data
fail Errors::ValidationError, 'Skipping a malformed record. '\
'No data available to validate'
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 validate_data
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def validate_data(data = nil)
unless data
fail Errors::ValidationError, 'Skipping a malformed record. '\
'No data available to validate'
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 validate_data
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def validate_data(data = nil)
unless data
fail Errors::ValidationError, 'Skipping a malformed record. '\
'No data available to validate'
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 parse
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.parse(args)
options = OpenStruct.new
opt_parser = OptionParser.new do |opts|
opts.banner = 'Usage oneacct-export [options]'
Method perform
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def perform(vms, file_number)
OneacctExporter::Log.setup_log_level(logger)
vms = vms.split('|')
- 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 want?
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def want?(vm, range, groups)
if vm.nil?
@log.warn('Obtained nil vm from vm pool.')
return false
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 default
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def default(value, condition_method, default_value)
return string?(value) ? value : default_value if condition_method == :string
return number?(value) ? value : default_value if condition_method == :number
return decimal?(value) ? value : default_value if condition_method == :decimal
return non_zero_number?(value) ? value : default_value if condition_method == :nzn
- 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 validate_data
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_data(data = nil)
unless data
fail Errors::ValidationError, 'Skipping a malformed record. '\
'No data available to validate'
end
Method validate_data
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_data(data = nil)
unless data
fail Errors::ValidationError, 'Skipping a malformed record. '\
'No data available to validate'
end
Method sum_rstime
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def sum_rstime(history_records, completed, vm_id)
return nil unless history_records
rstime = 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 check_output_type_specific_settings
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.check_output_type_specific_settings
if APEL_OT.include?(Settings.output['output_type'])
unless Settings.output['apel'] && Settings.output.apel['site_name'] &&
Settings.output.apel['cloud_type'] && Settings.output.apel['endpoint']
fail ArgumentError, 'Missing some mandatory parameters for APEL output type. Check your configuration file.'
- 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 load_vm_pool
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def load_vm_pool
@log.debug("Loading vm pool from id: #{start_vm_id}.")
from = @start_vm_id
how_many = @batch_size
to = from + how_many - 1
- 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 validate_data
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_data(data = nil)
unless data
fail Errors::ValidationError, 'Skipping a malformed record. '\
'No data available to validate'
end
Method check_options_restrictions
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.check_options_restrictions(options)
# make sure only one time option is used
if (options.records_from || options.records_to) && options.records_for
fail ArgumentError, 'Cannot use both time period and time range options.'
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 process_vm
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_vm(vm, user_map, image_map, cluster_map, benchmark_map)
data = common_data
data.merge! output_type_specific_data
data['vm_uuid'] = vm['ID']
Method perform
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform(vms, file_number)
OneacctExporter::Log.setup_log_level(logger)
vms = vms.split('|')
Method options
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.options
options = {}
if Settings['redis']
options[:namespace] = Settings.redis['namespace']
options[:url] = Settings.redis['url']
- 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 export
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def export
@log.debug('Starting export...')
clean_output_dir
- 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 vms
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def vms(range, groups)
vms = []
# load specific batch
vm_pool = load_vm_pool
return nil if vm_pool.count == 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 parse
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(args)
options = OpenStruct.new
opt_parser = OptionParser.new do |opts|
opts.banner = 'Usage oneacct-export [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"