File lv_utils.py
has 581 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright (C) IBM 2016 - Harish <harisrir@linux.vnet.ibm.com>
# Copyright (C) Red Hat 2016 - Lukas Doktor <ldoktor@redhat.com>
# Copyright (C) Intra2net AG 2018 - Plamen Dimitrov <pdimitrov@pevogam.com>
#
# This program is free software; you can redistribute it and/or modify it
Function vg_ramdisk_cleanup
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def vg_ramdisk_cleanup(
ramdisk_filename=None,
vg_ramdisk_dir=None,
vg_name=None,
loop_device=None,
- 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 lv_create
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def lv_create(
vg_name, lv_name, lv_size, force_flag=True, pool_name=None, pool_size="1G"
):
"""
Create a (possibly thin) logical volume in a volume group.
- 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 vg_ramdisk
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def vg_ramdisk(
disk,
vg_name,
ramdisk_vg_size,
ramdisk_basedir,
- 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 vg_list
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def vg_list(vg_name=None):
"""
List all info about available volume groups.
:param vg_name: name of the volume group to list or or None to list all
- 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 vg_ramdisk
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def vg_ramdisk(
Function lv_create
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def lv_create(
Avoid deeply nested control flow statements. Open
if result.exit_status != 0:
errs.append("remove loop device")
LOGGER.error(
"Unexpected failure when removing loop"
"device %s, check the log",
Function lv_take_snapshot
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def lv_take_snapshot(
Function vg_ramdisk_cleanup
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def vg_ramdisk_cleanup(
Function lv_list
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def lv_list(vg_name=None):
"""
List all info about available logical volumes.
:param str vg_name: name of the volume group or None to list all
- 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"