zhmcclient/zhmccli

View on GitHub
zhmccli/_cmd_user_pattern.py

Summary

Maintainability
C
1 day
Test Coverage

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

    Function add_special_options has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def add_special_options(cmd_ctx, console, properties, org_options):
        """
        Add properties from options that need special handling.
        """
        _add_special_name_option(
    Severity: Minor
    Found in zhmccli/_cmd_user_pattern.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 _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_user_pattern_show has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

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

      There are no issues that match your filters.

      Category
      Status