zhmcclient/python-zhmcclient

View on GitHub

Showing 303 of 336 total issues

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

    def get(cls, method, hmc, uri, uri_parms, logon_required):
        # pylint: disable=unused-argument
        """Operation: List Permitted LPARs."""
        uri, query_parms = parse_query_parms(method, uri)
        check_invalid_query_parms(
Severity: Minor
Found in zhmcclient_mock/_urihandler.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 matches_prop has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

def matches_prop(obj, prop_name, prop_match, case_insensitive):
    """
    Return a boolean indicating whether a resource object matches with
    a single property against a property match value.

Severity: Minor
Found in zhmcclient/_utils.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 _nic.py has 293 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2016,2021 IBM Corp. All Rights Reserved.
#
# 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 zhmcclient/_nic.py - About 3 hrs to fix

    File _client.py has 291 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # Copyright 2016,2021 IBM Corp. All Rights Reserved.
    #
    # 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 zhmcclient/_client.py - About 3 hrs to fix

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

          def _matches_prop(self, obj, prop_name, prop_match, case_insensitive):
              """
              Return a boolean indicating whether a faked resource object matches
              with a single property against a property match value.
              This is used for implementing filtering in the faked resource managers.
      Severity: Minor
      Found in zhmcclient_mock/_hmc.py - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          def get(cls, method, hmc, uri, uri_parms, logon_required):
              # pylint: disable=unused-argument
              """Operation: List Permitted Partitions."""
              uri, query_parms = parse_query_parms(method, uri)
              check_invalid_query_parms(
      Severity: Minor
      Found in zhmcclient_mock/_urihandler.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 _propagate_group has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def _propagate_group(self, group_name, group_dict, parent_hosts):
              """
              Propagate host properties of a group to its hosts.
      
              Parameters:
      Severity: Minor
      Found in zhmcclient/testutils/_hmc_definitions.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 _list_with_parent_array has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def _list_with_parent_array(
                  self, parent_obj, uris_prop, full_properties, filter_args):
              """
              List resource objects by using an array of URIs in the parent object.
      
      
      Severity: Minor
      Found in zhmcclient/_manager.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

      Console has 25 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Console(BaseResource):
          """
          Representation of a :term:`Console`.
      
          Derived from :class:`~zhmcclient.BaseResource`; see there for common
      Severity: Minor
      Found in zhmcclient/_console.py - About 2 hrs to fix

        Function _convert_to_config has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def _convert_to_config(self, inventory_list, include_unused_adapters):
                """
                Convert the inventory list to a DPM configuration dict.
        
                Important: In order to support export of DPM configs with zhmcclient
        Severity: Major
        Found in zhmcclient/_cpc.py - About 2 hrs to fix

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

              def post(method, hmc, uri, uri_parms, body, logon_required,
                       wait_for_completion):
                  # pylint: disable=unused-argument
                  """Operation: Remove Temporary Capacity."""
                  assert wait_for_completion is True  # no async
          Severity: Minor
          Found in zhmcclient_mock/_urihandler.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 _log_http_request has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def _log_http_request(
                      method, url, resource, headers=None, content=None,
                      content_len=None):
                  """
                  Log the HTTP request of an HMC REST API call, at the debug level.
          Severity: Minor
          Found in zhmcclient/_session.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 list_permitted_partitions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def list_permitted_partitions(
                      self, full_properties=False, filter_args=None,
                      additional_properties=None):
                  """
                  List the permitted partitions of CPCs in DPM mode managed by this HMC.
          Severity: Minor
          Found in zhmcclient/_console.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

          BaseResource has 22 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class BaseResource(object):
              """
              Abstract base class for resource classes (e.g. :class:`~zhmcclient.Cpc`)
              representing manageable resources.
          
          
          Severity: Minor
          Found in zhmcclient/_resource.py - About 2 hrs to fix

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

            def _result_object(result):
                """
                Return the JSON payload in the HTTP response as a Python dict.
            
                Parameters:
            Severity: Minor
            Found in zhmcclient/_session.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 notifications has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def notifications(self):
                    """
                    Generator method that yields all HMC notifications (= JMS messages)
                    received by this notification receiver.
            
            
            Severity: Minor
            Found in zhmcclient/_notification.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

            Lpar has 21 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Lpar(BaseResource):
                """
                Representation of an :term:`LPAR`.
            
                Derived from :class:`~zhmcclient.BaseResource`; see there for common
            Severity: Minor
            Found in zhmcclient/_lpar.py - About 2 hrs to fix

              Function list_hmcs has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  def list_hmcs(self, name=None):
                      """
                      Return a list of :class:`HMCDefinition` objects in the HMC inventory
                      file, for the specified HMC group or single HMC nickname.
              
              
              Severity: Minor
              Found in zhmcclient/testutils/_hmc_definitions.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 _try_optimized_lookup has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _try_optimized_lookup(self, filter_args):
                      """
                      Try to find a resource in an optimized way when the filter arguments
                      allow for that.
              
              
              Severity: Minor
              Found in zhmcclient/_manager.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 setup_hmc_session has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

              def setup_hmc_session(hd):
                  """
                  Setup an HMC session and return a new session object for it.
              
                  If the HMC definition represents a real HMC, log on to an HMC and return
              Severity: Minor
              Found in zhmcclient/testutils/_hmc_definition_fixtures.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

              Severity
              Category
              Status
              Source
              Language