CiscoUcs/imcsdk

View on GitHub

Showing 440 of 1,826 total issues

Function handle_filter_max_component_limit has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

def handle_filter_max_component_limit(handle, l_filter):
    """
    Method checks the filter count and if the filter count exceeds
    the max_components(number of filters), then the given filter
    objects get distributed among small groups and then again binded
Severity: Minor
Found in imcsdk/imcfilter.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 bios.py has 312 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/bios.py - About 3 hrs 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 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

    Function _get_inventory_csv has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_inventory_csv(inventory, file_name, spec=inventory_spec):
        import csv
        if file_name is None:
            raise ImcOperationError("Inventory collection",
                                    "file_name is a required parameter")
    Severity: Minor
    Found in imcsdk/apis/server/inventory.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 vmedia_mount_iso_uri has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def vmedia_mount_iso_uri(handle, uri, volume_name=None, user_id=None,
                             password=None, timeout=60, interval=5, server_id=1):
        """
        This method will setup the vmedia mapping
        Args:
    Severity: Minor
    Found in imcsdk/apis/server/vmedia.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 inventory_get has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def inventory_get(handle,
                      component="all",
                      file_format="json",
                      file_name=None,
                      spec=inventory_spec):
    Severity: Minor
    Found in imcsdk/apis/server/inventory.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 sanitize_input_from_intersight has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def sanitize_input_from_intersight(handle, boot_devices):
        """
            Intersight always sends boot devices in the right order. For this
            reason the order propery is not populated by intersight policy
            service. We populate the order property here.
    Severity: Minor
    Found in imcsdk/apis/v2/server/boot.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_inventory_csv has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_inventory_csv(inventory, file_name, spec=inventory_spec):
        import csv
        if file_name is None:
            raise ImcOperationError("Inventory collection",
                                    "file_name is a required parameter")
    Severity: Minor
    Found in imcsdk/apis/v2/server/inventory.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 inventory_get has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def inventory_get(handle,
                      component="all",
                      file_format="json",
                      file_name=None,
                      spec=inventory_spec):
    Severity: Minor
    Found in imcsdk/apis/v2/server/inventory.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

    ImcHandle has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ImcHandle(ImcSession):
        """
        ImcHandle class is the user interface point for any Imc communication.
    
        Args:
    Severity: Minor
    Found in imcsdk/imchandle.py - About 3 hrs to fix

      Function __get_mo_elem has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def __get_mo_elem(self, xml_str):
              """
              Internal method to extract mo elements from xml string
              """
      
      
      Severity: Minor
      Found in imcsdk/imceventhandler.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 vmedia_mount_iso_uri has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      def vmedia_mount_iso_uri(handle, uri, user_id=None, password=None,
                               timeout=60, interval=5, server_id=1):
          """
          This method will setup the vmedia mapping
          Args:
      Severity: Minor
      Found in imcsdk/apis/v2/server/vmedia.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 snmp_user_add has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      def snmp_user_add(handle, name, security_level,
                        auth=None, auth_pwd=None, change_auth_pwd=False,
                        privacy=None, privacy_pwd=None, change_privacy_pwd=False,
                        **kwargs):
          """
      Severity: Minor
      Found in imcsdk/apis/v2/admin/snmp.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 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 imcsdk/imccoreutils.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

      File pxe.py has 279 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # Copyright 2019 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/pxe.py - About 2 hrs to fix

        Function ldap_enable has 21 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def ldap_enable(handle,
        Severity: Major
        Found in imcsdk/apis/admin/ldap.py - About 2 hrs to fix

          Function ldap_enable has 21 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def ldap_enable(handle,
          Severity: Major
          Found in imcsdk/apis/v2/admin/ldap.py - About 2 hrs to fix

            Function to_xml has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                def to_xml(self, xml_doc=None, option=None, elem_name=None):
                    """ Method writes the xml representation of the external
                    method object. """
                    xml_obj = self.elem_create(
                        class_tag=self.__method_meta.xml_attribute, xml_doc=xml_doc,
            Severity: Minor
            Found in imcsdk/imcmethod.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 from_xml has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                def from_xml(self, elem, handle=None):
                    """
                    This method is form objects out of xml element.
                    This is called internally from imcxmlcode.from_xml_str
                    method.
            Severity: Minor
            Found in imcsdk/imcmo.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 __init__ has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def __init__(self, parent_mo_or_dn, **kwargs):
                    self._dirty_mask = 0
                    self.backend_port_count = None
                    self.battery_status = None
                    self.bbu_present = None
            Severity: Major
            Found in imcsdk/mometa/storage/StorageControllerProps.py - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language