zhmcclient/zhmccli

View on GitHub

Showing 139 of 191 total issues

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

def parse_crypto_domains(cmd_ctx, option_name, option_value):
    """
    Parse a list of crypto domain index numbers specified in a command line
    option as a list in YAML Flow Collection style, where the list items can be
    single domain index numbers or ranges thereof (with '-').
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 print_object_values_as_table has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def print_object_values_as_table(
        cmd_ctx, object_values_list, metric_group_definition, resource_classes,
        table_format, transposed):
    """
    Print a list of object values in a tabular output format.
Severity: Minor
Found in zhmccli/_cmd_metrics.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_partition_create has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def cmd_partition_create(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_partition.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_show has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def cmd_user_show(cmd_ctx, user_name):
    # 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

Function parse_volume_with_sm has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def parse_volume_with_sm(volume_specifier, partition, where, error_format):
    """
    Parse a volume specifier for a CPC with the storage management feature
    (i.e. z14 or later) and return its StorageVolume resource object.

Severity: Minor
Found in zhmccli/_cmd_partition.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_vfunction.py has 254 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/_cmd_vfunction.py - About 2 hrs to fix

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

    def cmd_cpc_install_firmware(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 cmd_storagegroup_show has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def cmd_storagegroup_show(cmd_ctx, stogrp_name):
        # pylint: disable=missing-function-docstring
    
        client = zhmcclient.Client(cmd_ctx.session)
        console = client.consoles.console
    Severity: Minor
    Found in zhmccli/_cmd_storagegroup.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_show has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def cmd_adapter_show(cmd_ctx, cpc_name, adapter_name):
        # 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 1 hr 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 domain_config_to_props_list has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def domain_config_to_props_list(objects, object_key, domain_configs):
        """
        Return a list of property dicts ready for displaying crypto config,
        from a list of objects (partitions or crypto adapters) and a list of
        domain-config objects.
    Severity: Minor
    Found in zhmccli/_helper.py - About 1 hr 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 wait_for_metrics has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def wait_for_metrics(metric_context, metric_groups):
        """
        Repeat the retrieval of the metrics of a metrics context until at least one
        of the specified metric group names has data.
    
    
    Severity: Minor
    Found in zhmccli/_cmd_metrics.py - About 1 hr 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 cli has 14 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def cli(ctx, host, userid, password, no_verify, ca_certs, output_format,
    Severity: Major
    Found in zhmccli/zhmccli.py - About 1 hr to fix

      Function cmd_partition_update has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def cmd_partition_update(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_partition.py - About 1 hr to fix

        Function cmd_character_rule_add has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        def cmd_character_rule_add(cmd_ctx, password_rule_name, options):
            # pylint: disable=missing-function-docstring
        
            client = zhmcclient.Client(cmd_ctx.session)
            console = client.consoles.console
        Severity: Minor
        Found in zhmccli/_cmd_character_rule.py - About 1 hr 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_autostart_delete has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        def cmd_cpc_autostart_delete(cmd_ctx, cpc_name, partition_or_group):
            # 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 1 hr 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 12 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, host, userid, password, no_verify, ca_certs,
        Severity: Major
        Found in zhmccli/_helper.py - About 1 hr to fix

          Function permission_str has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          def permission_str(obj_cache, permission_info):
              """
              Return a permission-info item as a string for displaying
              """
              obj = permission_info['permitted-object']
          Severity: Minor
          Found in zhmccli/_cmd_user_role.py - About 1 hr 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 display_messages has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          def display_messages(receiver, logger, prefix):
              """
              Receive the OS message notifications in the specified receiver and
              print them to stdout. The function returns when the receiver is
              exhausted (which happens when it is closed).
          Severity: Minor
          Found in zhmccli/_helper.py - About 1 hr 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_resetprofile_list has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          def cmd_resetprofile_list(cmd_ctx, cpc_name, options):
              # pylint: disable=missing-function-docstring
          
              client = zhmcclient.Client(cmd_ctx.session)
          
          
          Severity: Minor
          Found in zhmccli/_cmd_resetprofile.py - About 1 hr 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_imageprofile_list has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          def cmd_imageprofile_list(cmd_ctx, cpc_name, options):
              # pylint: disable=missing-function-docstring
          
              client = zhmcclient.Client(cmd_ctx.session)
          
          
          Severity: Minor
          Found in zhmccli/_cmd_imageprofile.py - About 1 hr 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