Method populate_realms
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def populate_realms
reload
# if the provider is not running, mark as unavailable and don't refresh its
# realms
- 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 populate_realms
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def populate_realms
reload
# if the provider is not running, mark as unavailable and don't refresh its
# realms
Method imagefactory_info
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def imagefactory_info
if provider_type.deltacloud_driver == 'openstack'
# TODO: We might want to pull this up to the Provider, really
acct = provider_accounts.first
uri = URI.parse(acct.credentials_hash['glance_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 disable
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def disable(user)
res = {}
if valid_framework?
# if we can connect to the provider, try to stop running instances
# TODO: now provider is disabled even if stop request fails, is it ok?
- 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 valid_provider?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def valid_provider?
if deltacloud_provider.present?
client = connect
return false if client.nil?
return false unless client.driver(provider_type.deltacloud_driver).valid_provider? deltacloud_provider
- 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"