CiscoUcs/imcsdk

View on GitHub

Showing 440 of 1,826 total issues

Function __dequeue_function has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    def __dequeue_function(self):
        """
        Internal method to dequeue to events.
        """

Severity: Minor
Found in imcsdk/imceventhandler.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 _get_inventory_html has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

def _get_inventory_html(inventory, file_name, spec=inventory_spec):
    if file_name is None:
        raise ImcOperationError("Inventory collection",
                                "file_name is a required parameter")
    f = open(file_name, "w")
Severity: Minor
Found in imcsdk/apis/v2/server/inventory.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

File certificate.py has 366 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2016 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 imcsdk/apis/admin/certificate.py - About 4 hrs to fix

    File certificate.py has 366 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # Copyright 2016 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 imcsdk/apis/v2/admin/certificate.py - About 4 hrs to fix

      Function _get_inventory has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

      def _get_inventory(handle, comp, spec, inventory):
          component = spec[comp]
          class_id = component["class_id"]
          mos = handle.query_classid(class_id)
      
      
      Severity: Minor
      Found in imcsdk/apis/server/inventory.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 _get_inventory has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

      def _get_inventory(handle, comp, spec, inventory):
          component = spec[comp]
          class_id = component["class_id"]
          mos = handle.query_classid(class_id)
      
      
      Severity: Minor
      Found in imcsdk/apis/v2/server/inventory.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 from_xml has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          def from_xml(self, elem, handle=None):
              """
              Method updates the object from the xml representation of the managed
              object.
              """
      Severity: Minor
      Found in imcsdk/imcmo.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 from_xml has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          def from_xml(self, elem, handle=None):
              """Method updates/fills the object from the xml representation
              of the external method object. """
      
              self._handle = handle
      Severity: Minor
      Found in imcsdk/imcmethod.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

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

      # Copyright 2016 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 imcsdk/apis/server/inventory.py - About 4 hrs to fix

        File boot.py has 352 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # Copyright 2016 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 imcsdk/apis/server/boot.py - About 4 hrs to fix

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

          # Copyright 2016 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 imcsdk/apis/v2/server/inventory.py - About 4 hrs to fix

            File imcgenutils.py has 341 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 imcsdk/imcgenutils.py - About 4 hrs to fix

              Function _enable_pxe_boot_mac has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

              def _enable_pxe_boot_mac(handle, mac_address_map, ep_mac_map):
                  # if pxe device mac address matches endpoint vnic
                  # then enable pxe boot for resp vnic
              
                  log.debug("enabling pxe boot on vnics using mac address")
              Severity: Minor
              Found in imcsdk/apis/v2/server/pxe.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

              File vmedia.py has 334 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # Copyright 2016 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 imcsdk/apis/server/vmedia.py - About 4 hrs to fix

                File StorageControllerProps.py has 331 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                """This module contains the general information for StorageControllerProps ManagedObject."""
                
                from ...imcmo import ManagedObject
                from ...imccoremeta import MoPropertyMeta, MoMeta
                from ...imcmeta import VersionMeta
                Severity: Minor
                Found in imcsdk/mometa/storage/StorageControllerProps.py - About 3 hrs to fix

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

                  def _create_vic_object(adaptor_mo, vic_name, vic_type, api_error_msg,
                                         **kwargs):
                      from imcsdk.imccoreutils import load_class
                      from imcsdk.imccoreutils import find_class_id_in_mo_meta_ignore_case
                  
                  
                  Severity: Minor
                  Found in imcsdk/apis/v2/server/vic.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

                  File MemoryPersistentMemoryUnit.py has 326 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  """This module contains the general information for MemoryPersistentMemoryUnit ManagedObject."""
                  
                  from ...imcmo import ManagedObject
                  from ...imccoremeta import MoPropertyMeta, MoMeta
                  from ...imcmeta import VersionMeta
                  Severity: Minor
                  Found in imcsdk/mometa/memory/MemoryPersistentMemoryUnit.py - About 3 hrs to fix

                    File MgmtIf.py has 325 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    """This module contains the general information for MgmtIf ManagedObject."""
                    
                    from ...imcmo import ManagedObject
                    from ...imccoremeta import MoPropertyMeta, MoMeta
                    from ...imcmeta import VersionMeta
                    Severity: Minor
                    Found in imcsdk/mometa/mgmt/MgmtIf.py - About 3 hrs to fix

                      File snmp.py has 320 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      # Copyright 2016 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 imcsdk/apis/admin/snmp.py - About 3 hrs to fix

                        Function extract_molist_from_method_response has a Cognitive Complexity of 25 (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 imc server i.e.
                            external method object
                        Severity: Minor
                        Found in imcsdk/imccoreutils.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

                        Severity
                        Category
                        Status
                        Source
                        Language