Showing 30 of 94 total issues
File PyArubaAPI.py
has 442 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import sys
from pprint import pprint
from ArubaCloud.base import Auth, JsonInterfaceBase
Function get_hypervisors
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def get_hypervisors(self):
"""
Initialize the internal list containing each template available for each
hypervisor.
- 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
CloudInterface
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class CloudInterface(JsonInterface):
templates = []
vmlist = VMList()
iplist = IpList()
json_templates = None
Function get_servers
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def get_servers(self):
"""
Create the list of Server object inside the Datacenter objects.
Build an internal list of VM Objects (pro or smart) as iterator.
:return: bool
- 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
Function find_ip
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def find_ip(self, ip):
f = None
if ip.__class__ is 'base.Ip.Ip':
# logger.debug('DEBUG: matched IP Object: %s' % ip.__class__)
pattern = ip.ip_addr
- 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
Function create
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def create(self, healthCheckNotification, instance, ipAddressResourceId, name, notificationContacts, rules,
Function __init__
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, healthCheckNotification, instance, ipAddressResourceId, loadBalancerClassOfServiceID, name,
Function find_job
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def find_job(self, vm_name):
jobs_list = self.get_jobs()
if jobs_list['Value'] is None:
_i = 0
while jobs_list['Value'] is not None:
- 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
Function find
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def find(self, vm_name=None, ip_addr=None, resid=None):
# more defensive checks, just to have fun...
params = locals()
pattern = {}
ip = None
- 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
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, serverid, operationtype, start, end, DC, auth_obj):
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, logger=None, Username=str(), Password=str(), SessionId=None, ApplicationId=None, RequestId=None,
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, balancerType, certificate, creationDate, id, instancePort, loadBalancerPort, protocol):
Avoid deeply nested control flow statements. Open
if resource_type == 1:
o.resource_bounds.max_cpu = rb['Max']
if resource_type == 2:
Avoid deeply nested control flow statements. Open
if resource_type == 8:
o.resource_bounds.hdd2 = rb['Max']
if resource_type == 9:
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, startDate, endDate, loadBalancerID, loadBalancerRuleID, *args, **kwargs):
Avoid deeply nested control flow statements. Open
if resource_type == 3:
o.resource_bounds.hdd0 = rb['Max']
if resource_type == 7:
Function find_template
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_template(self, name=None, hv=None):
"""
Return a list of templates that could have one or more elements.
Args:
name: name of the template to find.
- 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
Avoid deeply nested control flow statements. Open
if server_detail['ServerStatus'] == 3:
break
else:
print('Waiting power on for other %s seconds' % sleep_for)
time.sleep(sleep_for)
Avoid deeply nested control flow statements. Open
if resource_type == 2:
o.resource_bounds.max_memory = rb['Max']
if resource_type == 3:
Function _log_request
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _log_request(logger, data=None, headers=None):
if logger is not None:
if headers is not None:
for header in headers:
logger.debug('request header: %s: %s', header, headers[header])
- 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"