CiscoUcs/ucsmsdk

View on GitHub
ucsmsdk/utils/converttopython.py

Summary

Maintainability
F
2 wks
Test Coverage

File converttopython.py has 1202 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2013 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Severity: Major
Found in ucsmsdk/utils/converttopython.py - About 3 days to fix

    Function _generate_config_resolve_cmdlet has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

    def _generate_config_resolve_cmdlet(xml_string, method):
        """
        Internal method which takes xmlstring, and generate script for
        configResolveDn, configResolveDns, configResolveClass and
        configResolveClasses methods.
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py - About 6 hrs to fix

    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_property_map_from_node has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

    def _create_property_map_from_node(class_node, class_status):
        gmo_flag = False
        property_map = {}
    
        if ucscoreutils.find_class_id_in_mo_meta_ignore_case(
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py - About 6 hrs to fix

    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 _generate_multiple_clone_cmdlets has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    def _generate_multiple_clone_cmdlets(xml_string, is_prefix_based):
        """
        Internal method which takes xmlstring, and generate script for
        lsInstantiateNTemplate and  lsInstantiateNNamedTemplate methods.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py - About 5 hrs to fix

    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 convert_to_ucs_python has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

    def convert_to_ucs_python(log_path=None, xml=False, request=None,
                              gui_log=False, path=None, literal_path=None,
                              dump_to_file=False, dump_file_path=None,
                              dump_xml=False):
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py - About 5 hrs to fix

    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

    Cyclomatic complexity is too high in function convert_to_ucs_python. (24)
    Open

    def convert_to_ucs_python(log_path=None, xml=False, request=None,
                              gui_log=False, path=None, literal_path=None,
                              dump_to_file=False, dump_file_path=None,
                              dump_xml=False):
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function _get_config_conf_cmdlet. (23)
    Open

    def _get_config_conf_cmdlet(node, is_pair_node):
        """
        Internal method to process configConf request.
        """
    
    
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function _generate_config_resolve_cmdlet. (23)
    Open

    def _generate_config_resolve_cmdlet(xml_string, method):
        """
        Internal method which takes xmlstring, and generate script for
        configResolveDn, configResolveDns, configResolveClass and
        configResolveClasses methods.
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function _form_configconf_cmdlet. (23)
    Open

    def _form_configconf_cmdlet(class_node, key, tag, import_list, parent_tag=None,
                                sub_cmdlet=False):
        """
        Internal method to process configConf request.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function _create_python_filter_code has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    def _create_python_filter_code(parent_node, parent_filter_name):
        """
        Internal method to provide filter support.
        """
    
    
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py - About 4 hrs to fix

    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 _form_configconf_cmdlet has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    def _form_configconf_cmdlet(class_node, key, tag, import_list, parent_tag=None,
                                sub_cmdlet=False):
        """
        Internal method to process configConf request.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py - About 4 hrs to fix

    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

    Cyclomatic complexity is too high in function _generate_multiple_clone_cmdlets. (20)
    Open

    def _generate_multiple_clone_cmdlets(xml_string, is_prefix_based):
        """
        Internal method which takes xmlstring, and generate script for
        lsInstantiateNTemplate and  lsInstantiateNNamedTemplate methods.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function _create_property_map_from_node. (19)
    Open

    def _create_property_map_from_node(class_node, class_status):
        gmo_flag = False
        property_map = {}
    
        if ucscoreutils.find_class_id_in_mo_meta_ignore_case(
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function _get_config_conf_cmdlet has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_config_conf_cmdlet(node, is_pair_node):
        """
        Internal method to process configConf request.
        """
    
    
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py - About 3 hrs to fix

    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_class_id_for_rn has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_class_id_for_rn(rn, prev_class_id=None):
        """
        Internal method to get the class id for a given rn
        """
    
    
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py - About 3 hrs to fix

    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 _generate_config_conf_cmdlets has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    def _generate_config_conf_cmdlets(xml_string):
        """
        Internal method which takes xmlstring, and generate script for configConfMo
        and configConfMos methods.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py - About 3 hrs to fix

    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

    Cyclomatic complexity is too high in function _get_config_conf_sub_cmdlet. (15)
    Open

    def _get_config_conf_sub_cmdlet(class_node, parent_dn, parent_mo_tag,
                                    parent_call_count, import_list, obj_flag):
        """
        Internal method to process configConf request.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function _create_python_filter_code. (15)
    Open

    def _create_python_filter_code(parent_node, parent_filter_name):
        """
        Internal method to provide filter support.
        """
    
    
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function _get_class_id_for_rn. (14)
    Open

    def _get_class_id_for_rn(rn, prev_class_id=None):
        """
        Internal method to get the class id for a given rn
        """
    
    
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function _generate_cmdlets. (14)
    Open

    def _generate_cmdlets(xml_string):
        """
        Internal method which takes xmlstring, and identify which method to call
        for a specific method.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function _generate_config_conf_cmdlets. (13)
    Open

    def _generate_config_conf_cmdlets(xml_string):
        """
        Internal method which takes xmlstring, and generate script for configConfMo
        and configConfMos methods.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function _generate_single_clone_cmdlets. (13)
    Open

    def _generate_single_clone_cmdlets(xml_string, is_template):
        """
        Internal method which takes xmlstring, and generate script for
        lsClone and lsInstantiateTemplate methods.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function _generate_single_clone_cmdlets has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def _generate_single_clone_cmdlets(xml_string, is_template):
        """
        Internal method which takes xmlstring, and generate script for
        lsClone and lsInstantiateTemplate methods.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py - About 2 hrs to fix

    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

    Cyclomatic complexity is too high in function _generate_ls_templatise_cmdlets. (11)
    Open

    def _generate_ls_templatise_cmdlets(xml_string):
        """
        Internal method which takes xmlstring, and generate script for
        lsTemplatise method.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function _extract_xml. (9)
    Open

    def _extract_xml(file_stream, line):
        """
        Internal method which extracts xmlstring from the file stream and calls the
        _generate_cmdlets() on this xmlstring.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function _generate_ls_templatise_cmdlets has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def _generate_ls_templatise_cmdlets(xml_string):
        """
        Internal method which takes xmlstring, and generate script for
        lsTemplatise method.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py - About 2 hrs to fix

    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_config_conf_sub_cmdlet has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_config_conf_sub_cmdlet(class_node, parent_dn, parent_mo_tag,
                                    parent_call_count, import_list, obj_flag):
        """
        Internal method to process configConf request.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py - About 2 hrs to fix

    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

    Cyclomatic complexity is too high in function _find_xml_requests_in_file. (6)
    Open

    def _find_xml_requests_in_file(file_stream, gui_log):
        """
        Internal method which depending on gui_log flag, calls the _extract_xml()
        internally.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function _generate_config_conf_rename_cmdlet. (6)
    Open

    def _generate_config_conf_rename_cmdlet(xml_string):
        """
        Internal method which takes xmlstring, and generate script for
        configConfRename method.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function _generate_clear_interval_cmdlet. (6)
    Open

    def _generate_clear_interval_cmdlet(xml_string):
        """
        Internal method which takes xmlstring, and generate script for
        statsClearInterval method.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function _generate_cmdlets has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def _generate_cmdlets(xml_string):
        """
        Internal method which takes xmlstring, and identify which method to call
        for a specific method.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py - About 1 hr to fix

    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 _extract_xml has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def _extract_xml(file_stream, line):
        """
        Internal method which extracts xmlstring from the file stream and calls the
        _generate_cmdlets() on this xmlstring.
        """
    Severity: Minor
    Found in ucsmsdk/utils/converttopython.py - About 1 hr to fix

    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 convert_to_ucs_python has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def convert_to_ucs_python(log_path=None, xml=False, request=None,
    Severity: Major
    Found in ucsmsdk/utils/converttopython.py - About 1 hr to fix

      Function _form_configconf_cmdlet has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def _form_configconf_cmdlet(class_node, key, tag, import_list, parent_tag=None,
      Severity: Minor
      Found in ucsmsdk/utils/converttopython.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if "\\" in val:
                                value = 'r"' + str(val) + '"'
                            else:
                                value = '"' + str(val) + '"'
        
        
        Severity: Major
        Found in ucsmsdk/utils/converttopython.py - About 45 mins to fix

          Function _get_config_conf_sub_cmdlet has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def _get_config_conf_sub_cmdlet(class_node, parent_dn, parent_mo_tag,
          Severity: Minor
          Found in ucsmsdk/utils/converttopython.py - About 45 mins to fix

            Function _find_xml_requests_in_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def _find_xml_requests_in_file(file_stream, gui_log):
                """
                Internal method which depending on gui_log flag, calls the _extract_xml()
                internally.
                """
            Severity: Minor
            Found in ucsmsdk/utils/converttopython.py - About 35 mins to fix

            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 too many return statements within this function.
            Open

                            return
            Severity: Major
            Found in ucsmsdk/utils/converttopython.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return cmdlet
              Severity: Major
              Found in ucsmsdk/utils/converttopython.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return
                Severity: Major
                Found in ucsmsdk/utils/converttopython.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return
                  Severity: Major
                  Found in ucsmsdk/utils/converttopython.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return cmdlet
                    Severity: Major
                    Found in ucsmsdk/utils/converttopython.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return
                      Severity: Major
                      Found in ucsmsdk/utils/converttopython.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return
                        Severity: Major
                        Found in ucsmsdk/utils/converttopython.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return cmdlet
                          Severity: Major
                          Found in ucsmsdk/utils/converttopython.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return
                            Severity: Major
                            Found in ucsmsdk/utils/converttopython.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return cmdlet
                              Severity: Major
                              Found in ucsmsdk/utils/converttopython.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return
                                Severity: Major
                                Found in ucsmsdk/utils/converttopython.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return
                                  Severity: Major
                                  Found in ucsmsdk/utils/converttopython.py - About 30 mins to fix

                                    Function _generate_config_conf_rename_cmdlet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    def _generate_config_conf_rename_cmdlet(xml_string):
                                        """
                                        Internal method which takes xmlstring, and generate script for
                                        configConfRename method.
                                        """
                                    Severity: Minor
                                    Found in ucsmsdk/utils/converttopython.py - About 25 mins to fix

                                    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

                                    Refactor this function to reduce its Cognitive Complexity from 20 to the 15 allowed.
                                    Open

                                    def _generate_single_clone_cmdlets(xml_string, is_template):
                                    Severity: Critical
                                    Found in ucsmsdk/utils/converttopython.py by sonar-python

                                    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                    See

                                    Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed.
                                    Open

                                    def _get_config_conf_sub_cmdlet(class_node, parent_dn, parent_mo_tag,
                                    Severity: Critical
                                    Found in ucsmsdk/utils/converttopython.py by sonar-python

                                    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                    See

                                    Refactor this function to reduce its Cognitive Complexity from 24 to the 15 allowed.
                                    Open

                                    def _generate_config_conf_cmdlets(xml_string):
                                    Severity: Critical
                                    Found in ucsmsdk/utils/converttopython.py by sonar-python

                                    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                    See

                                    Refactor this function to reduce its Cognitive Complexity from 42 to the 15 allowed.
                                    Open

                                    def _generate_config_resolve_cmdlet(xml_string, method):
                                    Severity: Critical
                                    Found in ucsmsdk/utils/converttopython.py by sonar-python

                                    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                    See

                                    Refactor this function to reduce its Cognitive Complexity from 27 to the 15 allowed.
                                    Open

                                    def _create_python_filter_code(parent_node, parent_filter_name):
                                    Severity: Critical
                                    Found in ucsmsdk/utils/converttopython.py by sonar-python

                                    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                    See

                                    Refactor this function to reduce its Cognitive Complexity from 39 to the 15 allowed.
                                    Open

                                    def _generate_multiple_clone_cmdlets(xml_string, is_prefix_based):
                                    Severity: Critical
                                    Found in ucsmsdk/utils/converttopython.py by sonar-python

                                    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                    See

                                    Function "convert_to_ucs_python" has 9 parameters, which is greater than the 7 authorized.
                                    Open

                                    def convert_to_ucs_python(log_path=None, xml=False, request=None,
                                                              gui_log=False, path=None, literal_path=None,
                                                              dump_to_file=False, dump_file_path=None,
                                                              dump_xml=False):

                                    A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

                                    Noncompliant Code Example

                                    With a maximum number of 4 parameters:

                                    def do_something(param1, param2, param3, param4, param5):
                                        ...
                                    

                                    Compliant Solution

                                    def do_something(param1, param2, param3, param4):
                                        ...
                                    

                                    Refactor this function to reduce its Cognitive Complexity from 41 to the 15 allowed.
                                    Open

                                    def _create_property_map_from_node(class_node, class_status):
                                    Severity: Critical
                                    Found in ucsmsdk/utils/converttopython.py by sonar-python

                                    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                    See

                                    Refactor this function to reduce its Cognitive Complexity from 25 to the 15 allowed.
                                    Open

                                    def _get_class_id_for_rn(rn, prev_class_id=None):
                                    Severity: Critical
                                    Found in ucsmsdk/utils/converttopython.py by sonar-python

                                    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                    See

                                    Refactor this function to reduce its Cognitive Complexity from 40 to the 15 allowed.
                                    Open

                                    def convert_to_ucs_python(log_path=None, xml=False, request=None,
                                    Severity: Critical
                                    Found in ucsmsdk/utils/converttopython.py by sonar-python

                                    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                    See

                                    Refactor this function to reduce its Cognitive Complexity from 32 to the 15 allowed.
                                    Open

                                    def _get_config_conf_cmdlet(node, is_pair_node):
                                    Severity: Critical
                                    Found in ucsmsdk/utils/converttopython.py by sonar-python

                                    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                    See

                                    Refactor this function to reduce its Cognitive Complexity from 32 to the 15 allowed.
                                    Open

                                    def _form_configconf_cmdlet(class_node, key, tag, import_list, parent_tag=None,
                                    Severity: Critical
                                    Found in ucsmsdk/utils/converttopython.py by sonar-python

                                    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                    See

                                    Refactor this function to reduce its Cognitive Complexity from 17 to the 15 allowed.
                                    Open

                                    def _generate_ls_templatise_cmdlets(xml_string):
                                    Severity: Critical
                                    Found in ucsmsdk/utils/converttopython.py by sonar-python

                                    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                    See

                                    Either merge this branch with the identical one on line "376" or change one of the implementations.
                                    Open

                                                mo_tag = "mo"

                                    Having two branches in the same if structure with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then they should be combined.

                                    Noncompliant Code Example

                                    if 0 <= a < 10:
                                        do_the_thing()
                                    elif 10 <= a < 20:
                                        do_the_other_thing()
                                    elif 20 <= a < 50:
                                        do_the_thing()  # Noncompliant; duplicates first condition
                                    else:
                                        do_the_rest()
                                    
                                    b = 4 if a > 12 else 4
                                    

                                    Compliant Solution

                                    if (0 <= a < 10) or (20 <= a < 50):
                                        do_the_thing()
                                    elif 10 <= a < 20:
                                        do_the_other_thing()
                                    else:
                                        do_the_rest()
                                    
                                    b = 4
                                    

                                    or

                                    if 0 <= a < 10:
                                        do_the_thing()
                                    elif 10 <= a < 20:
                                        do_the_other_thing()
                                    elif 20 <= a < 50:
                                        do_the_third_thing()
                                    else:
                                        do_the_rest()
                                    
                                    b = 8 if a > 12 else 4
                                    

                                    Either merge this branch with the identical one on line "533" or change one of the implementations.
                                    Open

                                                    class_status = _ClassStatus.CREATED | _ClassStatus.MODIFIED

                                    Having two branches in the same if structure with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then they should be combined.

                                    Noncompliant Code Example

                                    if 0 <= a < 10:
                                        do_the_thing()
                                    elif 10 <= a < 20:
                                        do_the_other_thing()
                                    elif 20 <= a < 50:
                                        do_the_thing()  # Noncompliant; duplicates first condition
                                    else:
                                        do_the_rest()
                                    
                                    b = 4 if a > 12 else 4
                                    

                                    Compliant Solution

                                    if (0 <= a < 10) or (20 <= a < 50):
                                        do_the_thing()
                                    elif 10 <= a < 20:
                                        do_the_other_thing()
                                    else:
                                        do_the_rest()
                                    
                                    b = 4
                                    

                                    or

                                    if 0 <= a < 10:
                                        do_the_thing()
                                    elif 10 <= a < 20:
                                        do_the_other_thing()
                                    elif 20 <= a < 50:
                                        do_the_third_thing()
                                    else:
                                        do_the_rest()
                                    
                                    b = 8 if a > 12 else 4
                                    

                                    TODO found
                                    Open

                                        # TODO:
                                    Severity: Minor
                                    Found in ucsmsdk/utils/converttopython.py by fixme

                                    Remove this commented out code.
                                    Open

                                            # cmdlet = "handle.start_ucs_transaction()" + "\n"

                                    Programmers should not comment out code as it bloats programs and reduces readability.

                                    Unused code should be deleted and can be retrieved from source control history if required.

                                    See

                                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                    Remove this commented out code.
                                    Open

                                                # prefix = node.getAttribute("inServerNamePrefixOrEmpty")

                                    Programmers should not comment out code as it bloats programs and reduces readability.

                                    Unused code should be deleted and can be retrieved from source control history if required.

                                    See

                                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                    Remove this commented out code.
                                    Open

                                        # use_parent_mo = False ##if the parent mo should be used at this level

                                    Programmers should not comment out code as it bloats programs and reduces readability.

                                    Unused code should be deleted and can be retrieved from source control history if required.

                                    See

                                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                    Remove this commented out code.
                                    Open

                                                # _outfile = open(r"c:\work.txt", 'w+')

                                    Programmers should not comment out code as it bloats programs and reduces readability.

                                    Unused code should be deleted and can be retrieved from source control history if required.

                                    See

                                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                    Remove this commented out code.
                                    Open

                                                    # print "[%s]" %(line)

                                    Programmers should not comment out code as it bloats programs and reduces readability.

                                    Unused code should be deleted and can be retrieved from source control history if required.

                                    See

                                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                    Remove this commented out code.
                                    Open

                                        # log_file_path += r"/Library/Caches/Java/log/.ucsm"

                                    Programmers should not comment out code as it bloats programs and reduces readability.

                                    Unused code should be deleted and can be retrieved from source control history if required.

                                    See

                                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                    Merge this if statement with the enclosing one.
                                    Open

                                                    if class_status & _ClassStatus.CREATED != \

                                    Merging collapsible if statements increases the code's readability.

                                    Noncompliant Code Example

                                    if condition1:
                                        if condition2:
                                            # ...
                                    

                                    Compliant Solution

                                    if condition1 and condition2:
                                        # ...
                                    

                                    Remove this commented out code.
                                    Open

                                            # source_org = match_object.group(0)

                                    Programmers should not comment out code as it bloats programs and reduces readability.

                                    Unused code should be deleted and can be retrieved from source control history if required.

                                    See

                                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                    Remove this commented out code.
                                    Open

                                        # source_org = ""

                                    Programmers should not comment out code as it bloats programs and reduces readability.

                                    Unused code should be deleted and can be retrieved from source control history if required.

                                    See

                                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                    Remove this commented out code.
                                    Open

                                                # line = file_stream.readline()

                                    Programmers should not comment out code as it bloats programs and reduces readability.

                                    Unused code should be deleted and can be retrieved from source control history if required.

                                    See

                                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                    Merge this if statement with the enclosing one.
                                    Open

                                            if parent_mo_tag == "obj" and op_flag in ["add", "addmodify", "set"]:

                                    Merging collapsible if statements increases the code's readability.

                                    Noncompliant Code Example

                                    if condition1:
                                        if condition2:
                                            # ...
                                    

                                    Compliant Solution

                                    if condition1 and condition2:
                                        # ...
                                    

                                    Remove this commented out code.
                                    Open

                                                # cmdlet += "handle.complete_ucs_transaction()"

                                    Programmers should not comment out code as it bloats programs and reduces readability.

                                    Unused code should be deleted and can be retrieved from source control history if required.

                                    See

                                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                    Remove this commented out code.
                                    Open

                                            # source_org = match_object.group(0)

                                    Programmers should not comment out code as it bloats programs and reduces readability.

                                    Unused code should be deleted and can be retrieved from source control history if required.

                                    See

                                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                    Remove this commented out code.
                                    Open

                                            # source_org = match_object.group(0)

                                    Programmers should not comment out code as it bloats programs and reduces readability.

                                    Unused code should be deleted and can be retrieved from source control history if required.

                                    See

                                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                    Remove this commented out code.
                                    Open

                                            # prefix = ""

                                    Programmers should not comment out code as it bloats programs and reduces readability.

                                    Unused code should be deleted and can be retrieved from source control history if required.

                                    See

                                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                    Remove this commented out code.
                                    Open

                                            # child_class_id = "orgorg"

                                    Programmers should not comment out code as it bloats programs and reduces readability.

                                    Unused code should be deleted and can be retrieved from source control history if required.

                                    See

                                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                    Remove this commented out code.
                                    Open

                                            # doc = xml.dom.minidom.parseString(xml_string)

                                    Programmers should not comment out code as it bloats programs and reduces readability.

                                    Unused code should be deleted and can be retrieved from source control history if required.

                                    See

                                    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                    Similar blocks of code found in 3 locations. Consider refactoring.
                                    Open

                                            if node.localName == "not":
                                                temp_name = "notFilter" + str(_not_count)
                                                _not_count += 1
                                                cmdlet = temp_name
                                                cmdlet += " = NotFilter()\n"
                                    Severity: Major
                                    Found in ucsmsdk/utils/converttopython.py and 2 other locations - About 4 hrs to fix
                                    ucsmsdk/utils/converttopython.py on lines 781..789
                                    ucsmsdk/utils/converttopython.py on lines 791..799

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 85.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 3 locations. Consider refactoring.
                                    Open

                                            if node.localName == "or":
                                                temp_name = "orFilter" + str(_or_count)
                                                _or_count += 1
                                                cmdlet = temp_name
                                                cmdlet += " = OrFilter()\n"
                                    Severity: Major
                                    Found in ucsmsdk/utils/converttopython.py and 2 other locations - About 4 hrs to fix
                                    ucsmsdk/utils/converttopython.py on lines 781..789
                                    ucsmsdk/utils/converttopython.py on lines 801..809

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 85.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 3 locations. Consider refactoring.
                                    Open

                                            if node.localName == "and":
                                                temp_name = "andFilter" + str(_and_count)
                                                _and_count += 1
                                                cmdlet = temp_name
                                                cmdlet += " = AndFilter()\n"
                                    Severity: Major
                                    Found in ucsmsdk/utils/converttopython.py and 2 other locations - About 4 hrs to fix
                                    ucsmsdk/utils/converttopython.py on lines 791..799
                                    ucsmsdk/utils/converttopython.py on lines 801..809

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 85.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                        for child_node in _get_elem_child_nodes(class_node):
                                            sub_cmdlet, import_list, obj_flag = _get_config_conf_sub_cmdlet(
                                                child_node,
                                                dn,
                                                tag,
                                    Severity: Major
                                    Found in ucsmsdk/utils/converttopython.py and 1 other location - About 3 hrs to fix
                                    ucsmsdk/utils/converttopython.py on lines 397..409

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 66.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                            for child_node in _get_elem_child_nodes(class_node):
                                                sub_cmdlet, import_list, obj_flag = _get_config_conf_sub_cmdlet(
                                                    child_node,
                                                    dn, mo_tag,
                                                    call_count,
                                    Severity: Major
                                    Found in ucsmsdk/utils/converttopython.py and 1 other location - About 3 hrs to fix
                                    ucsmsdk/utils/converttopython.py on lines 469..481

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 66.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Identical blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                            if "\\" in val:
                                                value = 'r"' + str(val) + '"'
                                            else:
                                                value = '"' + str(val) + '"'
                                    Severity: Major
                                    Found in ucsmsdk/utils/converttopython.py and 1 other location - About 2 hrs to fix
                                    ucsmsdk/utils/converttopython.py on lines 334..337

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 53.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Identical blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                                        if "\\" in val:
                                                            value = 'r"' + str(val) + '"'
                                                        else:
                                                            value = '"' + str(val) + '"'
                                    Severity: Major
                                    Found in ucsmsdk/utils/converttopython.py and 1 other location - About 2 hrs to fix
                                    ucsmsdk/utils/converttopython.py on lines 320..323

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 53.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Identical blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                                add_prop_map = ", ".join(
                                                    [k + "=" + v for k, v in ucsgenutils.iteritems(property_map)])
                                    Severity: Major
                                    Found in ucsmsdk/utils/converttopython.py and 1 other location - About 1 hr to fix
                                    ucsmsdk/utils/converttopython.py on lines 562..563

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 40.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Identical blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                                add_prop_map = ", ".join(
                                                    [k + "=" + v for k, v in ucsgenutils.iteritems(property_map)])
                                    Severity: Major
                                    Found in ucsmsdk/utils/converttopython.py and 1 other location - About 1 hr to fix
                                    ucsmsdk/utils/converttopython.py on lines 567..568

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 40.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                        if is_prefix_based:
                                            if top_node.localName == "lsInstantiateNTemplate":
                                                node = top_node
                                        else:
                                            if top_node.localName == "lsInstantiateNNamedTemplate":
                                    Severity: Major
                                    Found in ucsmsdk/utils/converttopython.py and 1 other location - About 1 hr to fix
                                    ucsmsdk/utils/converttopython.py on lines 853..858

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 39.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                        if is_template:
                                            if top_node.localName == "lsInstantiateTemplate":
                                                node = top_node
                                        else:
                                            if top_node.localName == "lsClone":
                                    Severity: Major
                                    Found in ucsmsdk/utils/converttopython.py and 1 other location - About 1 hr to fix
                                    ucsmsdk/utils/converttopython.py on lines 1024..1029

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 39.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                        if op_flag == "add" and tag == "mo":
                                            cmdlet += "\n" + "handle.add_mo(mo)\n"
                                    Severity: Minor
                                    Found in ucsmsdk/utils/converttopython.py and 1 other location - About 40 mins to fix
                                    ucsmsdk/utils/converttopython.py on lines 486..487

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 34.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Identical blocks of code found in 3 locations. Consider refactoring.
                                    Open

                                        if node.hasAttribute(NamingPropertyId.DN):
                                            dn = node.getAttribute(NamingPropertyId.DN)
                                        else:
                                            print("Attribute 'Dn' not available")  # writewarning in dotnet
                                            return
                                    Severity: Major
                                    Found in ucsmsdk/utils/converttopython.py and 2 other locations - About 40 mins to fix
                                    ucsmsdk/utils/converttopython.py on lines 945..949
                                    ucsmsdk/utils/converttopython.py on lines 1032..1036

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 34.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Identical blocks of code found in 3 locations. Consider refactoring.
                                    Open

                                        if node.hasAttribute(NamingPropertyId.DN):
                                            dn = node.getAttribute(NamingPropertyId.DN)
                                        else:
                                            print("Attribute 'Dn' not available")  # writewarning in dotnet
                                            return
                                    Severity: Major
                                    Found in ucsmsdk/utils/converttopython.py and 2 other locations - About 40 mins to fix
                                    ucsmsdk/utils/converttopython.py on lines 861..865
                                    ucsmsdk/utils/converttopython.py on lines 1032..1036

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 34.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Identical blocks of code found in 3 locations. Consider refactoring.
                                    Open

                                        if node.hasAttribute(NamingPropertyId.DN):
                                            dn = node.getAttribute(NamingPropertyId.DN)
                                        else:
                                            print("Attribute 'Dn' not available")  # writewarning in dotnet
                                            return
                                    Severity: Major
                                    Found in ucsmsdk/utils/converttopython.py and 2 other locations - About 40 mins to fix
                                    ucsmsdk/utils/converttopython.py on lines 861..865
                                    ucsmsdk/utils/converttopython.py on lines 945..949

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 34.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                        if op_flag == "addmodify" and tag == "mo":
                                            cmdlet += "\n" + "handle.add_mo(mo, True)\n"
                                    Severity: Minor
                                    Found in ucsmsdk/utils/converttopython.py and 1 other location - About 40 mins to fix
                                    ucsmsdk/utils/converttopython.py on lines 484..485

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 34.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 3 locations. Consider refactoring.
                                    Open

                                        for dn_node in dn_nodes:
                                            temp_dn = dn_node.getAttribute(NamingPropertyId.VALUE)
                                            cmdlet += "dn = Dn()\ndn.attr_set(\"value\", " \
                                    Severity: Minor
                                    Found in ucsmsdk/utils/converttopython.py and 2 other locations - About 30 mins to fix
                                    ucsmsdk/utils/converttopython.py on lines 698..700
                                    ucsmsdk/utils/converttopython.py on lines 755..757

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 32.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 3 locations. Consider refactoring.
                                    Open

                                            for node in class_id_nodes:
                                                temp_class_id = node.getAttribute(NamingPropertyId.VALUE)
                                                cmdlet += "class_id = ClassId()\nclass_id.attr_set(\"value\"," \
                                    Severity: Minor
                                    Found in ucsmsdk/utils/converttopython.py and 2 other locations - About 30 mins to fix
                                    ucsmsdk/utils/converttopython.py on lines 698..700
                                    ucsmsdk/utils/converttopython.py on lines 1170..1172

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 32.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 3 locations. Consider refactoring.
                                    Open

                                            for node in dn_nodes:
                                                temp_dn = node.getAttribute(NamingPropertyId.VALUE)
                                                cmdlet += "dn = Dn()\ndn.attr_set(\"value\"," \
                                    Severity: Minor
                                    Found in ucsmsdk/utils/converttopython.py and 2 other locations - About 30 mins to fix
                                    ucsmsdk/utils/converttopython.py on lines 755..757
                                    ucsmsdk/utils/converttopython.py on lines 1170..1172

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 32.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                        if is_template:
                                            cmdlet = '\nfrom ucsmsdk.ucsmethodfactory ' \
                                                     'import ls_instantiate_template\n'
                                            cmdlet += 'elem = ls_instantiate_template(cookie=' \
                                                      'handle.cookie, dn="%s", in_error_on_existing=' \
                                    Severity: Minor
                                    Found in ucsmsdk/utils/converttopython.py and 1 other location - About 30 mins to fix
                                    ucsmsdk/utils/converttopython.py on lines 987..996

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 32.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                        if dest_org is not None:
                                            cmdlet = '\nfrom ucsmsdk.ucsmethodfactory import ls_templatise\n'
                                            cmdlet += 'elem = ls_templatise(cookie=handle.cookie,' \
                                                      'dn="%s", in_target_org="%s", in_template_name="%s", ' \
                                                      'in_template_type="%s", in_hierarchical="%s")' % (dn,
                                    Severity: Minor
                                    Found in ucsmsdk/utils/converttopython.py and 1 other location - About 30 mins to fix
                                    ucsmsdk/utils/converttopython.py on lines 901..912

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 32.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    There are no issues that match your filters.

                                    Category
                                    Status