zhmcclient/python-zhmcclient

View on GitHub

Showing 303 of 336 total issues

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

    def post(self, uri, resource=None, body=None, logon_required=True,
             wait_for_completion=False, operation_timeout=None,
             renew_session=True):
        """
        Perform the HTTP POST method against the resource identified by a URI,
Severity: Minor
Found in zhmcclient/_session.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 _hmc_definitions.py has 364 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2019,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/testutils/_hmc_definitions.py - About 4 hrs to fix

    File _notification.py has 362 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/usr/bin/env python
    # Copyright 2017,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.
    Severity: Minor
    Found in zhmcclient/_notification.py - About 4 hrs to fix

      Session has 35 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Session(object):
          """
          A session to the HMC, optionally in context of an HMC user.
      
          The session supports operations that require to be authenticated, as well
      Severity: Minor
      Found in zhmcclient/_session.py - About 4 hrs to fix

        File _auto_updater.py has 354 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        #!/usr/bin/env python
        # Copyright 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.
        Severity: Minor
        Found in zhmcclient/_auto_updater.py - About 4 hrs to fix

          Function _list_with_operation has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

              def _list_with_operation(
                      self, list_uri, result_prop, full_properties, filter_args,
                      additional_properties):
                  """
                  List resource objects by using a List operation.
          Severity: Minor
          Found in zhmcclient/_manager.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 list_permitted_adapters has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
          Open

              def list_permitted_adapters(
                      self, full_properties=False, filter_args=None,
                      additional_properties=None):
                  """
                  List the permitted adapters of all CPCs managed by this HMC.
          Severity: Minor
          Found in zhmcclient/_console.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 _setup_metric_group_values has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              def _setup_metric_group_values(self):
                  """
                  Return the list of MetricGroupValues objects for this metrics response,
                  by processing its metrics response string.
          
          
          Severity: Minor
          Found in zhmcclient/_metrics.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 resource has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

              def resource(self):
                  """
                  :class:`~zhmcclient.BaseResource`: The Python resource object of the
                    resource these metric values apply to.
          
          
          Severity: Minor
          Found in zhmcclient/_metrics.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_free_crypto_domains has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

              def get_free_crypto_domains(self, crypto_adapters=None):
                  """
                  Return a list of crypto domains that are free for usage on a list of
                  crypto adapters in this CPC.
          
          
          Severity: Minor
          Found in zhmcclient/_cpc.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 _log_http_response has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

              def _log_http_response(
                      method, url, resource, status, headers=None, content=None):
                  """
                  Log the HTTP response of an HMC REST API call, at the debug level.
          
          
          Severity: Minor
          Found in zhmcclient/_session.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 post has 96 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def post(method, hmc, uri, uri_parms, body, logon_required,
                       wait_for_completion):
                  # pylint: disable=unused-argument
                  """Operation: Create Partition (requires DPM mode)."""
          
          
          Severity: Major
          Found in zhmcclient_mock/_urihandler.py - About 3 hrs to fix

            BaseManager has 31 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class BaseManager(object):
                """
                Abstract base class for manager classes (e.g.
                :class:`~zhmcclient.CpcManager`).
            
            
            Severity: Minor
            Found in zhmcclient/_manager.py - About 3 hrs to fix

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

                  def __init__(self, manager, properties):
                      self._manager = manager  # May be None
                      if properties is not None:
                          self._properties = copy.deepcopy(properties)
                      else:
              Severity: Minor
              Found in zhmcclient_mock/_hmc.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

              Partition has 29 functions (exceeds 20 allowed). Consider refactoring.
              Open

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

                Function _convert_to_config has a Cognitive Complexity of 24 (exceeds 5 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: Minor
                Found in zhmcclient/_cpc.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 _user_role.py has 306 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # Copyright 2017,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/_user_role.py - About 3 hrs to fix

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

                      def __init__(self, manager, properties):
                          super(FakedAdapter, self).__init__(
                              manager=manager,
                              properties=properties)
                          # Initial values to be prepared for raising InputError
                  Severity: Minor
                  Found in zhmcclient_mock/_hmc.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 pull_properties has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def pull_properties(self, properties):
                          """
                          Retrieve the specified set of resource properties from the HMC and
                          cache them in this Python object.
                  
                  
                  Severity: Minor
                  Found in zhmcclient/_resource.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 _activation_profile.py has 298 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/_activation_profile.py - About 3 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language