File _manager.py
has 1108 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2016,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
Function _list_with_operation
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def _list_with_operation(
self, list_uri, result_prop, full_properties, filter_args,
additional_properties):
"""
List resource objects by using a List operation.
- Read upRead up
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
BaseManager
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class BaseManager(object):
"""
Abstract base class for manager classes (e.g.
:class:`~zhmcclient.CpcManager`).
Function _list_with_parent_array
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def _list_with_parent_array(
self, parent_obj, uris_prop, full_properties, filter_args):
"""
List resource objects by using an array of URIs in the parent object.
- Read upRead up
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 _try_optimized_lookup
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def _try_optimized_lookup(self, filter_args):
"""
Try to find a resource in an optimized way when the filter arguments
allow for that.
- Read upRead up
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, resource_class, class_name, session, parent, base_uri,
Function _get_properties_bulk
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _get_properties_bulk(self, props_list, client_filters):
"""
Get resource properties using a bulk operation.
Parameters:
- Read upRead up
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 resource_object
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def resource_object(self, uri_or_oid, props=None):
"""
Return a minimalistic Python resource object for this resource class,
that is scoped to this manager.
- Read upRead up
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 matches_filters(resource_obj, client_filters):
resource_obj_list.append(resource_obj)
Avoid deeply nested control flow statements. Open
if full_properties:
resource_obj.pull_full_properties()
Function _list_with_operation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _list_with_operation(
Avoid too many return
statements within this function. Open
return resource_obj
Avoid too many return
statements within this function. Open
return None
Avoid too many return
statements within this function. Open
return None
Avoid too many return
statements within this function. Open
return None