Showing 20 of 57 total issues
File XLDeployClient.py
has 430 lines of code (exceeds 250 allowed). Consider refactoring. Open
#
# Copyright 2019 XEBIALABS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
XLDeployClient
has 41 functions (exceeds 20 allowed). Consider refactoring. Open
class XLDeployClient(object):
def __init__(self, http_connection, username=None, password=None):
self.http_request = HttpRequest(http_connection, username, password)
@staticmethod
Function XLDVersionsTileViewController
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
var XLDVersionsTileViewController = function ($scope, XLDVersionsService, XlrTileHelper) {
var vm = this;
var tile;
if ($scope.xlrTile) {
Function delete
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def delete(self, ci_id):
infrastructure_list = self.xldClient.get_ci_tree(ci_id)
environment_list = self.xldClient.get_ci_tree('Environments')
for env in environment_list:
env_ci = self.xldClient.get_ci(env, 'xml')
- 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 display_step_logs
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def display_step_logs(self, task_id):
get_task_steps = '/deployit/task/' + task_id + '/step'
get_task_steps_response = self.http_request.get(get_task_steps, contentType='application/xml')
task_steps_root = ET.fromstring(get_task_steps_response.getResponse())
for child in task_steps_root:
- 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 set_deployed_properties
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def set_deployed_properties(deployment_xml, deployed_properties):
root = ET.fromstring(deployment_xml)
if deployed_properties:
deployeds_properties_dict = dict(ast.literal_eval(deployed_properties))
for key in deployeds_properties_dict:
- 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 invoke_task_and_wait_for_result
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def invoke_task_and_wait_for_result(self, task_id, polling_interval=10, number_of_trials=None,
continue_if_step_fails=False, number_of_continue_retrials=0,
fail_on_pause=True, display_step_logs = False):
start_task_url = "/deployit/task/%s/start" % task_id
self.http_request.post(start_task_url, '', contentType='application/xml')
- 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 get_deployed_applications_for_environment
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get_deployed_applications_for_environment(self, environment, date=None):
archived_tasks = self.query_archived_tasks(date)
deployed_apps = {}
if archived_tasks:
tasks = json.loads(archived_tasks)
- 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 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, cliHome, xldHost, xldPort, xldSecure, xldContext, xldProxyHost, xldProxyPort, xldSocketTimeout, xldUserName, xldPassword, script, cliExecutable, options):
Function __init__
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, cliHome, xldHost, xldPort, xldSecure, xldContext, xldProxyHost, xldProxyPort, xldSocketTimeout, xldUserName, xldPassword, script, cliExecutable, options):
self.cmdLine = CmdLine()
self.osname = System.getProperty('os.name').lower()
if self.osname.startswith('win'):
cliExecutable = "%s\\bin\\%s.cmd" % ( cliHome, cliExecutable )
- 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 remove_ci_from_environment
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def remove_ci_from_environment(self, env_id, ci_id):
get_env_response = self.get_ci(env_id, 'xml')
print get_env_response
env_root = ET.fromstring(get_env_response)
member_to_remove = 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 set_deployed_application_properties
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def set_deployed_application_properties(deployment_xml, deployed_application_properties):
root = ET.fromstring(deployment_xml)
if deployed_application_properties:
deployeds_application_properties_dict = dict(ast.literal_eval(deployed_application_properties))
for key in deployeds_application_properties_dict:
- 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 invoke_task_and_wait_for_result
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def invoke_task_and_wait_for_result(self, task_id, polling_interval=10, number_of_trials=None,
Avoid deeply nested control flow statements. Open
for pkey in deployed_properties_dict:
pkey_xml = xlr_tag_deployed.find(pkey)
if not pkey_xml:
pkey_xml = ET.SubElement(xlr_tag_deployed, pkey)
pkey_xml.text = deployed_properties_dict[pkey]
Avoid deeply nested control flow statements. Open
for item in grandchild:
if item.tag in ('description', 'startDate', 'completionDate'):
print '%s %s\n' % (item.tag, item.text)
else:
print "%s\n" % item.tag
Avoid deeply nested control flow statements. Open
if ci.get('ref') in infrastructure_list:
print "Need to un-deploy %s from %s." % (app, deployed_env_ref)
self.undeploy(self.xldClient, app, deployed_env_ref)
# Check if env references anything from tree, remove it if it does.
for member in root.findall('members'):
Function deployment_prepare_deployeds
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def deployment_prepare_deployeds(self, deployment, orchestrators=None, deployed_application_properties=None,
Function add_parameter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_parameter(root, parameter_type_id, parameter, parameters):
params = root.find("parameters")
if params and parameters:
property_dict = dict(ast.literal_eval(parameters))
for child in params:
- 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 prepare_control_task
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def prepare_control_task(self, control_task_name, target_ci_id, parameters=None):
prepare_control_task_url = "/deployit/control/prepare/%s/%s" % (control_task_name, target_ci_id)
prepare_response = self.http_request.get(prepare_control_task_url, contentType='application/xml')
check_response(prepare_response,
"Failed to prepare control task [%s]. Server return [%s], with content [%s]" % (
- 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 override_deployed_properties
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def override_deployed_properties(deployment_xml, deployed_properties):
root = ET.fromstring(deployment_xml)
if deployed_properties:
deployeds_properties_dict = dict(ast.literal_eval(deployed_properties))
for key in deployeds_properties_dict:
- 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"