CiscoUcs/ucsmsdk

View on GitHub

Showing 492 of 492 total issues

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

        def _get_transaction_impact(self, rsp):
            """
            Outputs a json object, that can have the following keys,
                "failure", "warning", "reboot_user_ack", "reboot_immediate",
                "reboot_maintenance", "misc"
    Severity: Minor
    Found in ucsmsdk/ucshandle.py - About 2 days 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

    File ucshandle.py has 812 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 at
    Severity: Major
    Found in ucsmsdk/ucshandle.py - About 1 day to fix

      Function ucs_kvm_launch has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
      Open

      def ucs_kvm_launch(handle, service_profile=None, blade=None, rack_unit=None,
                         frame_title=None, need_url=False):
          """
          ucs_kvm_launch launches the kvm session for a specified server.
      
      
      Severity: Minor
      Found in ucsmsdk/utils/ucskvmlaunch.py - About 1 day 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

      File ucsmo.py has 550 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/ucsmo.py - About 1 day to fix

        File ucssession.py has 531 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 at
        Severity: Major
        Found in ucsmsdk/ucssession.py - About 1 day to fix

          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

            Cyclomatic complexity is too high in method _get_transaction_impact. (45)
            Open

                def _get_transaction_impact(self, rsp):
                    """
                    Outputs a json object, that can have the following keys,
                        "failure", "warning", "reboot_user_ack", "reboot_immediate",
                        "reboot_maintenance", "misc"
            Severity: Minor
            Found in ucsmsdk/ucshandle.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 ucs_kvm_launch. (45)
            Open

            def ucs_kvm_launch(handle, service_profile=None, blade=None, rack_unit=None,
                               frame_title=None, need_url=False):
                """
                ucs_kvm_launch launches the kvm session for a specified server.
            
            
            Severity: Minor
            Found in ucsmsdk/utils/ucskvmlaunch.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

            File ucseventhandler.py has 500 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: Minor
            Found in ucsmsdk/ucseventhandler.py - About 1 day to fix

              File ucstechsupport.py has 459 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: Minor
              Found in ucsmsdk/utils/ucstechsupport.py - About 7 hrs to fix

                UcsSession has 48 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class UcsSession(object):
                    """
                    UcsSession class is session interface for any Ucs related communication.
                    Parent class of UcsHandle, used internally by UcsHandle class.
                    """
                Severity: Minor
                Found in ucsmsdk/ucssession.py - About 6 hrs to fix

                  Function sync_ucs_mo has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def sync_ucs_mo(ref_handle, difference,
                                  delete_not_present=False,
                                  version_filter=True):
                      """
                      syncs the difference object on reference ucsm.
                  Severity: Minor
                  Found in ucsmsdk/utils/comparesyncmo.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 get_ucs_cco_image_list has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def get_ucs_cco_image_list(username=None, password=None, mdf_id_list=None,
                                             proxy=None):
                      """
                      Gets the list of images available on CCO
                  
                  
                  Severity: Minor
                  Found in ucsmsdk/utils/ccoimage.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_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 validate_property_value has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def validate_property_value(self, input_value):
                          """validate property value of mo."""
                          error_msg = None
                  
                          if input_value is None:
                  Severity: Minor
                  Found in ucsmsdk/ucscoremeta.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

                  File comparesyncmo.py has 419 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 at
                  Severity: Minor
                  Found in ucsmsdk/utils/comparesyncmo.py - About 6 hrs to fix

                    File inventory.py has 413 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # Copyright 2017 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: Minor
                    Found in ucsmsdk/utils/inventory.py - About 5 hrs to fix

                      File ucscoremeta.py has 412 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 at
                      Severity: Minor
                      Found in ucsmsdk/ucscoremeta.py - About 5 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language