Showing 26 of 37 total issues
Class AwsProviderClient
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Cyoi::Providers::Clients::AwsProviderClient < Cyoi::Providers::Clients::FogProviderClient
include Cyoi::Providers::Constants::AwsConstants
# Creates a bucket and makes it publicly read-only
def create_blobstore(blobstore_name)
Method create_security_group
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def create_security_group(security_group_name, description, defns, extra_attributes={})
security_groups = fog_compute.security_groups
sg = security_groups.find do |s|
if extra_attributes[:vpc_id]
s.name == security_group_name && s.vpc_id == extra_attributes[:vpc_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 setup_vcenter
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def setup_vcenter
puts "\n"
attributes.set_default("datacenter", {})
datacenter = attributes.datacenter
datacenter["name"] = hl.ask("Datacenter: ").to_s unless datacenter.exists?("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 create_security_group
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_security_group(security_group_name, description, defns, extra_attributes={})
security_groups = fog_compute.security_groups
sg = security_groups.find do |s|
if extra_attributes[:vpc_id]
s.name == security_group_name && s.vpc_id == extra_attributes[:vpc_id]
Method bootstrap
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def bootstrap(new_attributes = {})
new_attributes[:image_id] ||= trusty_image_id(fog_compute.region)
vpc = new_attributes[:subnet_id]
server = fog_compute.servers.new(new_attributes)
- 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 setup_credentials
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def setup_credentials
attributes.set_default("credentials", {})
credentials = attributes.credentials
credentials["openstack_username"] = hl.ask("Username: ").to_s unless credentials.exists?("openstack_username")
credentials["openstack_api_key"] = (hl.ask("Password (API Key): ") { |q| q.echo = 'x' }).to_s unless credentials.exists?("openstack_api_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
Method auto_detection_choices
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def auto_detection_choices
fog_choices = {}
# Prepare menu options:
# each provider/profile name gets a menu choice option
fog_config.inject({}) do |iaas_options, fog_profile|
Method extract_port_definition
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def extract_port_definition(port_defn)
protocol = "tcp"
ip_range = "0.0.0.0/0"
if port_defn.is_a? Integer
port_range = (port_defn..port_defn)
- 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 bootstrap
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def bootstrap(new_attributes = {})
new_attributes[:image_id] ||= trusty_image_id(fog_compute.region)
vpc = new_attributes[:subnet_id]
server = fog_compute.servers.new(new_attributes)
Method perform_and_return_attributes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def perform_and_return_attributes
unless valid_address?
if networks?
if vpc = select_vpc
subnet = select_subnet_for_vpc(vpc)
- 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 trusty_image_id
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def trusty_image_id(region=nil)
region = fog_compute.region
# http://cloud-images.ubuntu.com/locator/ec2/
# version: 14.04 LTS
# arch: amd64
Method execute!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def execute!
unless valid_infrastructure?
settings["provider"] ||= {}
auto_detection unless settings.exists?("provider.name")
choose_provider unless settings.exists?("provider.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 auto_detection_choices
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def auto_detection_choices
fog_choices = {}
# Prepare menu options:
# each provider/profile name gets a menu choice option
fog_config.inject({}) do |iaas_options, fog_profile|
- 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 setup_credentials
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def setup_credentials
puts "\n"
attributes.set_default("credentials", {})
credentials = attributes.credentials
credentials["vsphere_username"] = hl.ask("Username: ").to_s unless credentials.exists?("vsphere_username")
- 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 setup_resources
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def setup_resources
puts "\n"
attributes.set_default("resources", {})
resources = attributes.resources
resources["persistent_disk"] = hl.ask("Size of Persistent Volume (MB): ", Integer) unless resources.exists?("persistent_disk")
- 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 setup_networking
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def setup_networking
puts "\n"
attributes.set_default("network", {})
network = attributes.network
network["netmask"] = hl.ask("Netmask: ").to_s unless network.exists?("netmask")
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(argv, stdin=STDIN, stdout=STDOUT, stderr=STDERR, kernel=Kernel)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(argv, stdin=STDIN, stdout=STDOUT, stderr=STDERR, kernel=Kernel)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(argv, stdin=STDIN, stdout=STDOUT, stderr=STDERR, kernel=Kernel)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(argv, stdin=STDIN, stdout=STDOUT, stderr=STDERR, kernel=Kernel)