CiscoUcs/ucsmsdk

View on GitHub
ucsmsdk/ucscoreutils.py

Summary

Maintainability
F
6 days
Test Coverage

File ucscoreutils.py has 518 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2015 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 prop
Severity: Major
Found in ucsmsdk/ucscoreutils.py - About 1 day to fix

    Function write_mo_tree has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def write_mo_tree(mo, level=0, depth=None, show_level=[],
                      print_tree=True, tree_dict={}, dn=None):
        """
        Prints tree structure of any managed object
    
    
    Severity: Minor
    Found in ucsmsdk/ucscoreutils.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 write_mo_tree. (13)
    Open

    def write_mo_tree(mo, level=0, depth=None, show_level=[],
                      print_tree=True, tree_dict={}, dn=None):
        """
        Prints tree structure of any managed object
    
    
    Severity: Minor
    Found in ucsmsdk/ucscoreutils.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 write_object has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def write_object(mo_or_list):
        """
        This prints the managed object on the standard output.
        """
    
    
    Severity: Minor
    Found in ucsmsdk/ucscoreutils.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 write_object. (12)
    Open

    def write_object(mo_or_list):
        """
        This prints the managed object on the standard output.
        """
    
    
    Severity: Minor
    Found in ucsmsdk/ucscoreutils.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_ucs_obj. (11)
    Open

    def get_ucs_obj(class_id, elem, mo_obj=None):
        """
        This creates object of type ExternalMethod or ManagedObject or GenericMo
        depending on element tag
    
    
    Severity: Minor
    Found in ucsmsdk/ucscoreutils.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 print_mo_hierarchy. (10)
    Open

    def print_mo_hierarchy(class_id, level=0, depth=None, show_level=[]):
        """
        print hierarchy of class_id
    
        Args:
    Severity: Minor
    Found in ucsmsdk/ucscoreutils.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 extract_molist_from_method_response has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def extract_molist_from_method_response(method_response,
                                            in_hierarchical=False):
        """
        Methods extracts mo list from response received from ucs server i.e.
        external method object
    Severity: Minor
    Found in ucsmsdk/ucscoreutils.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 _show_tree has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def _show_tree(class_id, depth=None, level=0, ancestor_str="",
                   ancestor=[], last_child=True):
    
        meta_class_id = ucsgenutils.word_u(class_id)
    
    
    Severity: Minor
    Found in ucsmsdk/ucscoreutils.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 _show_tree. (8)
    Open

    def _show_tree(class_id, depth=None, level=0, ancestor_str="",
                   ancestor=[], last_child=True):
    
        meta_class_id = ucsgenutils.word_u(class_id)
    
    
    Severity: Minor
    Found in ucsmsdk/ucscoreutils.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 load_module. (7)
    Open

    def load_module(module_name):
        """
        This loads the module into the current name space
    
        Args:
    Severity: Minor
    Found in ucsmsdk/ucscoreutils.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_molist_from_method_response. (7)
    Open

    def extract_molist_from_method_response(method_response,
                                            in_hierarchical=False):
        """
        Methods extracts mo list from response received from ucs server i.e.
        external method object
    Severity: Minor
    Found in ucsmsdk/ucscoreutils.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_ucs_obj has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_ucs_obj(class_id, elem, mo_obj=None):
        """
        This creates object of type ExternalMethod or ManagedObject or GenericMo
        depending on element tag
    
    
    Severity: Minor
    Found in ucsmsdk/ucscoreutils.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 print_mo_hierarchy has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def print_mo_hierarchy(class_id, level=0, depth=None, show_level=[]):
        """
        print hierarchy of class_id
    
        Args:
    Severity: Minor
    Found in ucsmsdk/ucscoreutils.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 write_mo_tree has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def write_mo_tree(mo, level=0, depth=None, show_level=[],
    Severity: Major
    Found in ucsmsdk/ucscoreutils.py - About 50 mins to fix

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

      def _show_tree(class_id, depth=None, level=0, ancestor_str="",
      Severity: Minor
      Found in ucsmsdk/ucscoreutils.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            for child in mo.child:
                                mo.child_remove(child)
                                child.mark_clean()
                                child_mo_list.append(child)
                                break
        Severity: Major
        Found in ucsmsdk/ucscoreutils.py - About 45 mins to fix

          Function extract_mo_tree_from_config_method_response has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def extract_mo_tree_from_config_method_response(method_response,
          Severity: Minor
          Found in ucsmsdk/ucscoreutils.py - About 35 mins to fix

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

            def write_mo_tree(mo, level=0, depth=None, show_level=[],
            Severity: Critical
            Found in ucsmsdk/ucscoreutils.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 16 to the 15 allowed.
            Open

            def _show_tree(class_id, depth=None, level=0, ancestor_str="",
            Severity: Critical
            Found in ucsmsdk/ucscoreutils.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 extract_molist_from_method_response(method_response,
            Severity: Critical
            Found in ucsmsdk/ucscoreutils.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 20 to the 15 allowed.
            Open

            def write_object(mo_or_list):
            Severity: Critical
            Found in ucsmsdk/ucscoreutils.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 "386" or change one of the implementations.
            Open

                        tree_dict = write_mo_tree(child, level, depth,
                                                  show_level, print_tree,
                                                  tree_dict, dn)
            Severity: Major
            Found in ucsmsdk/ucscoreutils.py by sonar-python

            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 "378" or change one of the implementations.
            Open

                        print("%s %s (%s)" % (level_indent, mo.dn, mo.class_id))
            Severity: Major
            Found in ucsmsdk/ucscoreutils.py by sonar-python

            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
            

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

                if key_all_mo not in tree_dict:
                    tree_dict[key_all_mo] = {mo.class_id: [mo]}
                else:
                    if mo.class_id not in tree_dict[key_all_mo]:
                        tree_dict[key_all_mo][mo.class_id] = [mo]
            Severity: Major
            Found in ucsmsdk/ucscoreutils.py and 1 other location - About 5 hrs to fix
            ucsmsdk/ucscoreutils.py on lines 358..364

            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 93.

            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 level_key_mo not in tree_dict:
                    tree_dict[level_key_mo] = {mo.class_id: [mo]}
                else:
                    if mo.class_id not in tree_dict[level_key_mo]:
                        tree_dict[level_key_mo][mo.class_id] = [mo]
            Severity: Major
            Found in ucsmsdk/ucscoreutils.py and 1 other location - About 5 hrs to fix
            ucsmsdk/ucscoreutils.py on lines 367..373

            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 93.

            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

                    out_str += ("-" * len("ClassId")).ljust(ts * 4) + "-" * len(
                        self.class_id) + "\n"
            Severity: Major
            Found in ucsmsdk/ucscoreutils.py and 1 other location - About 2 hrs to fix
            ucsmsdk/ucscoremeta.py on lines 340..341

            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

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

                    out_str += str("parents").ljust(ts * 4) + ':' + str(self.parents) + \
            Severity: Major
            Found in ucsmsdk/ucscoreutils.py and 17 other locations - About 1 hr to fix
            ucsmsdk/utils/ccoimage.py on lines 68..69
            ucsmsdk/utils/ccoimage.py on lines 70..71
            ucsmsdk/utils/ccoimage.py on lines 72..72
            ucsmsdk/utils/ccoimage.py on lines 73..74
            ucsmsdk/utils/ccoimage.py on lines 75..76
            ucsmsdk/utils/ccoimage.py on lines 77..78
            ucsmsdk/utils/ccoimage.py on lines 79..80
            ucsmsdk/utils/ccoimage.py on lines 81..82
            ucsmsdk/utils/ccoimage.py on lines 83..84
            ucsmsdk/ucscoremeta.py on lines 342..343
            ucsmsdk/ucscoremeta.py on lines 344..345
            ucsmsdk/ucscoremeta.py on lines 346..347
            ucsmsdk/ucscoreutils.py on lines 544..545
            ucsmsdk/ucscoreutils.py on lines 546..547
            ucsmsdk/ucscoreutils.py on lines 548..549
            ucsmsdk/ucscoreutils.py on lines 550..550
            ucsmsdk/ucscoreutils.py on lines 551..552

            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 47.

            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 18 locations. Consider refactoring.
            Open

                    out_str += str("access").ljust(ts * 4) + ':' + str(self.access) + "\n"
            Severity: Major
            Found in ucsmsdk/ucscoreutils.py and 17 other locations - About 1 hr to fix
            ucsmsdk/utils/ccoimage.py on lines 68..69
            ucsmsdk/utils/ccoimage.py on lines 70..71
            ucsmsdk/utils/ccoimage.py on lines 72..72
            ucsmsdk/utils/ccoimage.py on lines 73..74
            ucsmsdk/utils/ccoimage.py on lines 75..76
            ucsmsdk/utils/ccoimage.py on lines 77..78
            ucsmsdk/utils/ccoimage.py on lines 79..80
            ucsmsdk/utils/ccoimage.py on lines 81..82
            ucsmsdk/utils/ccoimage.py on lines 83..84
            ucsmsdk/ucscoremeta.py on lines 342..343
            ucsmsdk/ucscoremeta.py on lines 344..345
            ucsmsdk/ucscoremeta.py on lines 346..347
            ucsmsdk/ucscoreutils.py on lines 544..545
            ucsmsdk/ucscoreutils.py on lines 546..547
            ucsmsdk/ucscoreutils.py on lines 548..549
            ucsmsdk/ucscoreutils.py on lines 551..552
            ucsmsdk/ucscoreutils.py on lines 553..553

            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 47.

            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 18 locations. Consider refactoring.
            Open

                    out_str += str("xml_attribute").ljust(ts * 4) + ':' + str(
                        self.xml_attribute) + "\n"
            Severity: Major
            Found in ucsmsdk/ucscoreutils.py and 17 other locations - About 1 hr to fix
            ucsmsdk/utils/ccoimage.py on lines 68..69
            ucsmsdk/utils/ccoimage.py on lines 70..71
            ucsmsdk/utils/ccoimage.py on lines 72..72
            ucsmsdk/utils/ccoimage.py on lines 73..74
            ucsmsdk/utils/ccoimage.py on lines 75..76
            ucsmsdk/utils/ccoimage.py on lines 77..78
            ucsmsdk/utils/ccoimage.py on lines 79..80
            ucsmsdk/utils/ccoimage.py on lines 81..82
            ucsmsdk/utils/ccoimage.py on lines 83..84
            ucsmsdk/ucscoremeta.py on lines 342..343
            ucsmsdk/ucscoremeta.py on lines 344..345
            ucsmsdk/ucscoremeta.py on lines 346..347
            ucsmsdk/ucscoreutils.py on lines 546..547
            ucsmsdk/ucscoreutils.py on lines 548..549
            ucsmsdk/ucscoreutils.py on lines 550..550
            ucsmsdk/ucscoreutils.py on lines 551..552
            ucsmsdk/ucscoreutils.py on lines 553..553

            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 47.

            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 18 locations. Consider refactoring.
            Open

                    out_str += str("min_version").ljust(ts * 4) + ':' + str(
                        self.min_version) + "\n"
            Severity: Major
            Found in ucsmsdk/ucscoreutils.py and 17 other locations - About 1 hr to fix
            ucsmsdk/utils/ccoimage.py on lines 68..69
            ucsmsdk/utils/ccoimage.py on lines 70..71
            ucsmsdk/utils/ccoimage.py on lines 72..72
            ucsmsdk/utils/ccoimage.py on lines 73..74
            ucsmsdk/utils/ccoimage.py on lines 75..76
            ucsmsdk/utils/ccoimage.py on lines 77..78
            ucsmsdk/utils/ccoimage.py on lines 79..80
            ucsmsdk/utils/ccoimage.py on lines 81..82
            ucsmsdk/utils/ccoimage.py on lines 83..84
            ucsmsdk/ucscoremeta.py on lines 342..343
            ucsmsdk/ucscoremeta.py on lines 344..345
            ucsmsdk/ucscoremeta.py on lines 346..347
            ucsmsdk/ucscoreutils.py on lines 544..545
            ucsmsdk/ucscoreutils.py on lines 546..547
            ucsmsdk/ucscoreutils.py on lines 550..550
            ucsmsdk/ucscoreutils.py on lines 551..552
            ucsmsdk/ucscoreutils.py on lines 553..553

            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 47.

            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 18 locations. Consider refactoring.
            Open

                    out_str += str("rn").ljust(ts * 4) + ':' + str(
                        self.rn) + "\n"
            Severity: Major
            Found in ucsmsdk/ucscoreutils.py and 17 other locations - About 1 hr to fix
            ucsmsdk/utils/ccoimage.py on lines 68..69
            ucsmsdk/utils/ccoimage.py on lines 70..71
            ucsmsdk/utils/ccoimage.py on lines 72..72
            ucsmsdk/utils/ccoimage.py on lines 73..74
            ucsmsdk/utils/ccoimage.py on lines 75..76
            ucsmsdk/utils/ccoimage.py on lines 77..78
            ucsmsdk/utils/ccoimage.py on lines 79..80
            ucsmsdk/utils/ccoimage.py on lines 81..82
            ucsmsdk/utils/ccoimage.py on lines 83..84
            ucsmsdk/ucscoremeta.py on lines 342..343
            ucsmsdk/ucscoremeta.py on lines 344..345
            ucsmsdk/ucscoremeta.py on lines 346..347
            ucsmsdk/ucscoreutils.py on lines 544..545
            ucsmsdk/ucscoreutils.py on lines 548..549
            ucsmsdk/ucscoreutils.py on lines 550..550
            ucsmsdk/ucscoreutils.py on lines 551..552
            ucsmsdk/ucscoreutils.py on lines 553..553

            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 47.

            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 18 locations. Consider refactoring.
            Open

                    out_str += str("access_privilege").ljust(ts * 4) + ':' + str(
                        self.access_privilege) + "\n"
            Severity: Major
            Found in ucsmsdk/ucscoreutils.py and 17 other locations - About 1 hr to fix
            ucsmsdk/utils/ccoimage.py on lines 68..69
            ucsmsdk/utils/ccoimage.py on lines 70..71
            ucsmsdk/utils/ccoimage.py on lines 72..72
            ucsmsdk/utils/ccoimage.py on lines 73..74
            ucsmsdk/utils/ccoimage.py on lines 75..76
            ucsmsdk/utils/ccoimage.py on lines 77..78
            ucsmsdk/utils/ccoimage.py on lines 79..80
            ucsmsdk/utils/ccoimage.py on lines 81..82
            ucsmsdk/utils/ccoimage.py on lines 83..84
            ucsmsdk/ucscoremeta.py on lines 342..343
            ucsmsdk/ucscoremeta.py on lines 344..345
            ucsmsdk/ucscoremeta.py on lines 346..347
            ucsmsdk/ucscoreutils.py on lines 544..545
            ucsmsdk/ucscoreutils.py on lines 546..547
            ucsmsdk/ucscoreutils.py on lines 548..549
            ucsmsdk/ucscoreutils.py on lines 550..550
            ucsmsdk/ucscoreutils.py on lines 553..553

            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 47.

            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

                elif module_name and module_name in METHOD_CLASS_ID:
                    fq_module_name = methodmeta.__name__ + ".%sMeta" % module_name
                    module_import = __import__(fq_module_name, globals(), locals(),
                                               [module_name])
                    return module_import
            Severity: Major
            Found in ucsmsdk/ucscoreutils.py and 1 other location - About 1 hr to fix
            ucsmsdk/ucscoreutils.py on lines 106..110

            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 41.

            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 module_name and module_name in MO_CLASS_ID:
                    fq_module_name = mometa.__name__ + ".%s" % module_name
                    module_import = __import__(fq_module_name, globals(), locals(),
                                               [module_name])
                    return module_import
            Severity: Major
            Found in ucsmsdk/ucscoreutils.py and 1 other location - About 1 hr to fix
            ucsmsdk/ucscoreutils.py on lines 111..115

            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 41.

            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