zhmcclient/zhmccli

View on GitHub

Showing 139 of 191 total issues

Avoid deeply nested control flow statements.
Open

                    if not filter_lpar:
                        included = True
                    elif ov.resource_uri == filter_lpar.uri:
                        included = True
            elif resource_class == 'adapter':
Severity: Major
Found in zhmccli/_cmd_metrics.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if not filter_partition:
                            included = True
                        elif ov.resource.manager.partition.uri == \
                                filter_partition.uri:
                            if not filter_nic:
    Severity: Major
    Found in zhmccli/_cmd_metrics.py - About 45 mins to fix

      Function set_vlan_id_type has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def set_vlan_id_type(cmd_ctx, properties, org_options):
          """
          Set the 'vlan-id' and 'vlan-type' properties from the options.
          """
          vlan_id = org_options['vlan-id']
      Severity: Minor
      Found in zhmccli/_cmd_nic.py - About 45 mins 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_cpc_update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def cmd_cpc_update(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 45 mins 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 has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def print_dicts(
      Severity: Minor
      Found in zhmccli/_helper.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if not filter_partition:
                                included = True
                            elif ov.resource_uri == filter_partition.uri:
                                included = True
                    elif resource_class == 'logical-partition':
        Severity: Major
        Found in zhmccli/_cmd_metrics.py - About 45 mins to fix

          Function cmd_vfunction_update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def cmd_vfunction_update(cmd_ctx, cpc_name, partition_name, vfunction_name,
                                   options):
              # pylint: disable=missing-function-docstring
          
              client = zhmcclient.Client(cmd_ctx.session)
          Severity: Minor
          Found in zhmccli/_cmd_vfunction.py - About 45 mins 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_ldapdef_create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def cmd_ldapdef_create(cmd_ctx, options):
              # pylint: disable=missing-function-docstring
          
              client = zhmcclient.Client(cmd_ctx.session)
              console = client.consoles.console
          Severity: Minor
          Found in zhmccli/_cmd_ldap_server_definition.py - About 45 mins 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_show_crypto has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def cmd_adapter_show_crypto(cmd_ctx, cpc_name, adapter_name):
              # 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_adapter.py - About 45 mins 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_hba_list has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def cmd_hba_list(cmd_ctx, cpc_name, partition_name, options):
              # pylint: disable=missing-function-docstring
          
              client = zhmcclient.Client(cmd_ctx.session)
              partition = find_partition(cmd_ctx, client, cpc_name, partition_name)
          Severity: Minor
          Found in zhmccli/_cmd_hba.py - About 45 mins 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 _add_special_name_option has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def _add_special_name_option(
          Severity: Minor
          Found in zhmccli/_cmd_user_pattern.py - About 45 mins to fix

            Function cmd_ldapdef_update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def cmd_ldapdef_update(cmd_ctx, ldapdef_name, options):
                # pylint: disable=missing-function-docstring
            
                client = zhmcclient.Client(cmd_ctx.session)
                console = client.consoles.console
            Severity: Minor
            Found in zhmccli/_cmd_ldap_server_definition.py - About 45 mins 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_vswitch_list has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def cmd_vswitch_list(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_vswitch.py - About 45 mins 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_console_upgrade has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

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

            Avoid deeply nested control flow statements.
            Open

                                if not filter_adapter:
                                    included = True
                                elif ov.resource_uri == filter_adapter.uri:
                                    included = True
                        elif resource_class == 'nic':
            Severity: Major
            Found in zhmccli/_cmd_metrics.py - About 45 mins to fix

              Function cmd_session_create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def cmd_session_create(cmd_ctx):
                  """Create an HMC session."""
                  session = cmd_ctx.session
                  try:
                      # We need to first log off, to make the logon really create a new
              Severity: Minor
              Found in zhmccli/_cmd_session.py - About 45 mins 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_object_values_as_table has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def print_object_values_as_table(
              Severity: Minor
              Found in zhmccli/_cmd_metrics.py - About 45 mins to fix

                Consider simplifying this complex logical expression.
                Open

                            if r_class == 'cpc' and r_name:
                                filter_cpc = client.cpcs.find(name=r_name)
                            elif r_class == 'partition' and r_name:
                                assert filter_cpc
                                filter_partition = filter_cpc.partitions.find(name=r_name)
                Severity: Major
                Found in zhmccli/_cmd_metrics.py - About 40 mins to fix

                  Function print_dicts_as_json has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def print_dicts_as_json(
                  Severity: Minor
                  Found in zhmccli/_helper.py - About 35 mins to fix

                    Function console_log has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def console_log(logger, prefix, message, *args, **kwargs):
                    Severity: Minor
                    Found in zhmccli/_helper.py - About 35 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language