Showing 74 of 134 total issues
Method import_keypair
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def import_keypair(options)
#validate if the file exists
private_key_path = if options[:private_key_path]
File.expand_path(options[:private_key_path])
else
- 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 generate_password
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def generate_password(username)
tries ||= 3
password = ((33..126).map { |i| i.chr }).to_a.shuffle[0..14].join
@conn.create_login_profile(username, password)
rescue Fog::AWS::IAM::NotFound, Fog::AWS::IAM::ValidationError
- 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_policy_document
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_policy_document(options)
document = options[:policy_document]
policyname = options[:policy_name]
#validate json document
doc_path = File.expand_path(document)
- 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 put
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def put
unless options[:table_name] and options[:item]
abort 'required options --table-name, --item'
end
if options[:expected_exists]
- 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_hbase_backup
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_hbase_backup(backup_step, consistent=false)
#parse frequency*,frequency_unit*(Days|Hrs|Mins),path(s3)*,start_time*(now|iso-format)
frequency, frequency_unit, path, start_time = backup_step.split(',')
abort 'Invalid backup step pattern, expecting frequency,frequency_unit(days|hrs|mins),path(s3),start_time(now|iso-format)' unless backup_step =~ /(.*),(.*),(.*),(.*)/
if frequency.empty? or frequency_unit.empty? or path.empty? or start_time.empty?
- 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_role
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_role(rolename, document, path)
#TODO: Build document in line from options use iam-rolecreate as reference
doc_path = File.expand_path(document)
abort "Invalid file path: #{file_path}" unless File.exist?(doc_path)
json_string = File.read(doc_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 parse_hive_steps
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_hive_steps(step)
#parse script_path(s3)*,input_path(s3),output_path(s3),'-d','args1','-d','args2','-d','arg3'
path, input_path, output_path, *args = step.split(',')
abort 'path to the hive script is required' if path.empty?
hive_step = {
- 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_pig_steps
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_pig_steps(step)
#parse script_path(s3)*,input_path(s3),output_path(s3),'-p','args1','-p','args2','-p','arg3'
path, input_path, output_path, *args = step.split(',')
abort 'path to the hive script is required' if path.empty?
pig_step = {
- 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 associate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def associate(options)
abort "Invalid IP Format" unless options[:eip] =~ /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/
eip = @conn.addresses.get(options[:eip])
abort "Cannot find eip: #{options[:eip]}" unless eip
server = @conn.servers.get(options[:instance_id])
- 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 delete
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def delete
unless options[:table_name] and options[:hash_key]
abort 'required options --table-name, --hash-key'
end
if options[:expected_exists]
- 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 authorize_securitygroup
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def authorize_securitygroup(options)
# => Ingress regular traffic -> this action applies to both EC2 and VPC Security Groups
# Each rule consists of the protocol, plus cidr range or a source group,
#for TCP/UDP protocols you must also specify the dest port or port range
#for ICMP, you must specify the icmp type and code (-1 means all types/codes)
- 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 update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update
unless options[:table_name] and options[:hash_key] and options[:attr_updates]
abort 'required options --table-name, --hash-kye, --attr-updates'
end
if options[:expected_exists]
- 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 upload_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def upload_file(dir_name, file_path, dest_path=nil)
dir = @conn.directories.get(dir_name)
abort "cannot find bucket: #{dir_name}" unless dir
file = File.expand_path(file_path)
abort "Invalid file path: #{file_path}" unless File.exist?(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 download_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def download_file(dir_name, file_name, path)
dir = @conn.directories.get(dir_name)
abort "cannot find bucket: #{dir_name}" unless dir
local_path = File.expand_path(path)
abort "Invalid file path: #{path}" unless File.exist?(local_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"