zhmcclient/zhmccli

View on GitHub

Showing 191 of 191 total issues

File _cmd_partition.py has 1945 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: Major
Found in zhmccli/_cmd_partition.py - About 5 days to fix

    File _cmd_imageprofile.py has 1698 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: Major
    Found in zhmccli/_cmd_imageprofile.py - About 4 days to fix

      File _helper.py has 1594 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: Major
      Found in zhmccli/_helper.py - About 4 days to fix

        File _cmd_cpc.py has 1168 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: Major
        Found in zhmccli/_cmd_cpc.py - About 3 days to fix

          File _cmd_lpar.py has 989 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: Major
          Found in zhmccli/_cmd_lpar.py - About 2 days to fix

            File _cmd_user.py has 886 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: Major
            Found in zhmccli/_cmd_user.py - About 2 days to fix

              Function get_metric_values has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
              Open

              def get_metric_values(client, metric_groups, resource_filter):
                  """
                  Retrieve and filter metric values of the specified metric groups.
              
                  Parameters:
              Severity: Minor
              Found in zhmccli/_cmd_metrics.py - About 1 day 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 a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
              Open

              def cli(ctx, host, userid, password, no_verify, ca_certs, output_format,
                      transpose, error_format, timestats, log, log_dest, syslog_facility,
                      pdb):
                  """
                  Command line interface for the IBM Z HMC.
              Severity: Minor
              Found in zhmccli/zhmccli.py - About 1 day 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_list has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
              Open

              def cmd_partition_list(cmd_ctx, cpc_name, options):
                  # pylint: disable=missing-function-docstring
              
                  if options['help_usage']:
                      help_lines = """
              Severity: Minor
              Found in zhmccli/_cmd_partition.py - About 1 day 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_storagegroup.py has 585 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: Major
              Found in zhmccli/_cmd_storagegroup.py - About 1 day to fix

                Cyclomatic complexity is too high in function cmd_partition_update. (59)
                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 by radon

                Cyclomatic Complexity

                Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

                Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

                Construct Effect on CC Reasoning
                if +1 An if statement is a single decision.
                elif +1 The elif statement adds another decision.
                else +0 The else statement does not cause a new decision. The decision is at the if.
                for +1 There is a decision at the start of the loop.
                while +1 There is a decision at the while statement.
                except +1 Each except branch adds a new conditional path of execution.
                finally +0 The finally block is unconditionally executed.
                with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
                assert +1 The assert statement internally roughly equals a conditional statement.
                Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
                Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

                Source: http://radon.readthedocs.org/en/latest/intro.html

                File _cmd_user_pattern.py has 545 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # Copyright 2024 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: Major
                Found in zhmccli/_cmd_user_pattern.py - About 1 day to fix

                  File _cmd_metrics.py has 531 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # Copyright 2017,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: Major
                  Found in zhmccli/_cmd_metrics.py - About 1 day to fix

                    File _cmd_adapter.py has 488 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_adapter.py - About 7 hrs to fix

                      Cyclomatic complexity is too high in function cli. (46)
                      Open

                      @click.group(invoke_without_command=True,
                                   context_settings=CLICK_CONTEXT_SETTINGS,
                                   options_metavar=GENERAL_OPTIONS_METAVAR)
                      @click.option('-h', '--host', type=str, envvar='ZHMC_HOST',
                                    help="Hostname or IP address of the HMC "
                      Severity: Minor
                      Found in zhmccli/zhmccli.py by radon

                      Cyclomatic Complexity

                      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

                      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

                      Construct Effect on CC Reasoning
                      if +1 An if statement is a single decision.
                      elif +1 The elif statement adds another decision.
                      else +0 The else statement does not cause a new decision. The decision is at the if.
                      for +1 There is a decision at the start of the loop.
                      while +1 There is a decision at the while statement.
                      except +1 Each except branch adds a new conditional path of execution.
                      finally +0 The finally block is unconditionally executed.
                      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
                      assert +1 The assert statement internally roughly equals a conditional statement.
                      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
                      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

                      Source: http://radon.readthedocs.org/en/latest/intro.html

                      File _cmd_loadprofile.py has 481 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_loadprofile.py - About 7 hrs to fix

                        Cyclomatic complexity is too high in function get_metric_values. (45)
                        Open

                        def get_metric_values(client, metric_groups, resource_filter):
                            """
                            Retrieve and filter metric values of the specified metric groups.
                        
                            Parameters:
                        Severity: Minor
                        Found in zhmccli/_cmd_metrics.py by radon

                        Cyclomatic Complexity

                        Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

                        Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

                        Construct Effect on CC Reasoning
                        if +1 An if statement is a single decision.
                        elif +1 The elif statement adds another decision.
                        else +0 The else statement does not cause a new decision. The decision is at the if.
                        for +1 There is a decision at the start of the loop.
                        while +1 There is a decision at the while statement.
                        except +1 Each except branch adds a new conditional path of execution.
                        finally +0 The finally block is unconditionally executed.
                        with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
                        assert +1 The assert statement internally roughly equals a conditional statement.
                        Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
                        Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

                        Source: http://radon.readthedocs.org/en/latest/intro.html

                        Function cmd_partition_update has a Cognitive Complexity of 47 (exceeds 5 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 7 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_create has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def cmd_user_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_user.py - About 7 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_nic.py has 457 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_nic.py - About 7 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language