zhmcclient/zhmccli

View on GitHub

Showing 139 of 191 total issues

File _cmd_storagevolume.py has 360 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2020 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 zhmccli/_cmd_storagevolume.py - About 4 hrs to fix

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

    def print_resources_as_table(
            cmd_ctx, resources, table_format, show_list=None, additions=None,
            all=False):
        # pylint: disable=redefined-builtin
        """
    Severity: Minor
    Found in zhmccli/_helper.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 cmd_adapter_update has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    def cmd_adapter_update(cmd_ctx, cpc_name, adapter_name, options):
        # pylint: disable=missing-function-docstring
    
        client = zhmcclient.Client(cmd_ctx.session)
        adapter = find_adapter(cmd_ctx, client, cpc_name, adapter_name)
    Severity: Minor
    Found in zhmccli/_cmd_adapter.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 _cmd_capacitygroup.py has 348 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # 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.
    # You may obtain a copy of the License at
    Severity: Minor
    Found in zhmccli/_cmd_capacitygroup.py - About 4 hrs to fix

      Function print_dicts_as_table has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

      def print_dicts_as_table(
              cmd_ctx, dicts, table_format, show_list=None, additions=None,
              all=False):
          # pylint: disable=redefined-builtin
          """
      Severity: Minor
      Found in zhmccli/_helper.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 print_resources_as_json has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

      def print_resources_as_json(
              cmd_ctx, resources, show_list=None, additions=None, all=False):
          # pylint: disable=redefined-builtin
          """
          Print resources in JSON output format.
      Severity: Minor
      Found in zhmccli/_helper.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 part_console has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

      def part_console(session, part, refresh, logger):
          """
          Establish an interactive shell to the console of the operating system
          running in a partition or LPAR.
      
      
      Severity: Minor
      Found in zhmccli/_helper.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 print_dicts_as_json has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

      def print_dicts_as_json(
              cmd_ctx, dicts, show_list=None, additions=None, all=False):
          # pylint: disable=redefined-builtin
          """
          Print dicts in JSON output format.
      Severity: Minor
      Found in zhmccli/_helper.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 zhmccli.py has 325 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # Copyright 2016,2019 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 zhmccli/zhmccli.py - About 3 hrs to fix

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

        # Copyright 2023 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 zhmccli/_cmd_resetprofile.py - About 3 hrs to fix

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

          def backing_uri(cmd_ctx, cpc, org_options, required=False):
              """
              Determine the backing adapter port or vswitch to be used from the
              --adapter, --port, and --virtual-switch options, and return a dict with the
              correct property for the URI of the backing port or vswitch to be used for
          Severity: Minor
          Found in zhmccli/_cmd_nic.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 handle_special_imageprofile_options has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

          def handle_special_imageprofile_options(cmd_ctx, org_options, properties):
              """
              Handle special create and update options (i.e. those that are set to
              None in the name_map). The options are taken from org_options and
              put into properties.
          Severity: Minor
          Found in zhmccli/_cmd_imageprofile.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 _cmd_character_rule.py has 300 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # 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.
          # You may obtain a copy of the License at
          Severity: Minor
          Found in zhmccli/_cmd_character_rule.py - About 3 hrs to fix

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

            def convert_ec_mcl_description(ec_mcl):
                """
                Convert an 'ec-mcl-description' object into a firmware list ready for
                output:
            
            
            Severity: Minor
            Found in zhmccli/_helper.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 cmd_dpm_import has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

            def cmd_dpm_import(cmd_ctx, cpc_name, options):
                # pylint: disable=missing-function-docstring
            
                client = zhmcclient.Client(cmd_ctx.session)
                cpc = find_cpc(cmd_ctx, client, cpc_name)
            Severity: Minor
            Found in zhmccli/_cmd_cpc.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 execute_cmd has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                def execute_cmd(self, cmd, logoff=True):
                    """
                    Execute the command.
                    """
                    if self._session is None:
            Severity: Minor
            Found in zhmccli/_helper.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 _cmd_ldap_server_definition.py has 288 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # Copyright 2023 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 zhmccli/_cmd_ldap_server_definition.py - About 2 hrs to fix

              Function handle_special_lpar_options has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

              def handle_special_lpar_options(cmd_ctx, org_options, properties):
                  """
                  Handle special update options (i.e. those that are set to
                  None in the name_map). The options are taken from org_options and
                  put into properties.
              Severity: Minor
              Found in zhmccli/_cmd_lpar.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 cmd_adapter_list_nics has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

              def cmd_adapter_list_nics(cmd_ctx, cpc_name, adapter_name, options):
                  # pylint: disable=missing-function-docstring
              
                  client = zhmcclient.Client(cmd_ctx.session)
                  adapter = find_adapter(cmd_ctx, client, cpc_name, adapter_name)
              Severity: Minor
              Found in zhmccli/_cmd_adapter.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 cmd_user_list has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

              def cmd_user_list(cmd_ctx, options):
                  # pylint: disable=missing-function-docstring
              
                  client = zhmcclient.Client(cmd_ctx.session)
                  console = client.consoles.console
              Severity: Minor
              Found in zhmccli/_cmd_user.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