Use of insecure MD2, MD4, MD5, or SHA1 hash function. Open
device_hash = hashlib.sha1(self.device.encode("utf-8")).hexdigest()
- Exclude checks
Function call with shell=True parameter identified, possible security issue. Open
process.system_output(f"yes | {mkfs_cmd}", shell=True)
- Exclude checks
File partition.py
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
Function get_mountpoint
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def get_mountpoint(self, filename=None):
"""
Find the mount point of this partition object.
:param filename: where to look for the mounted partitions information
- 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 mkfs
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def mkfs(self, fstype=None, args=""):
"""
Format a partition to filesystem type
:param fstype: the filesystem type, such as "ext3", "ext2". Defaults
- 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 mount
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def mount(self, mountpoint=None, fstype=None, args="", mnt_check=True):
"""
Mount this partition to a mount point
:param mountpoint: If you have not provided a mountpoint to partition
- 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 unmount
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def unmount(self, force=True):
"""
Umount this partition.
It's easier said than done to umount a partition.
- 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 parts[1] == self.mountpoint:
return parts[1] # The mountpoint where it's mounted
return None
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _unmount_force
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _unmount_force(self, mountpoint):
"""
Kill all other jobs accessing this partition and force unmount it.
:return: 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"