Function __init__
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, dirname, factory=None, create=True, access=0o700,
uid=None, gid=None):
"""Like the parent but allows specification of permission, uid, and
gid if creating."""
# pylint: disable=W0233, W0231
- 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 size
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def size(self):
"""Get the size of the folder (bytes, number of messages)."""
if not os.path.exists(self.size_fn):
return self.recalculate()
size_stat = os.stat(self.size_fn)
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, dirname, factory=None, create=True, access=0o700,
Function get_quota
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_quota(self):
"""Load the size_quota and count_quota for this folder."""
self.size_quota = None
self.count_quota = None
if not os.path.exists(self.size_fn):
- 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 e.errno != 17:
raise
os.chmod(path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXG |
Consider simplifying this complex logical expression. Open
if (((self.count_quota and total_count > self.count_quota) or
(self.size_quota and total_size > self.size_quota)) and
(i == 0 or (time.time() - size_stat.st_mtime) > 15 * 60)):
return self.recalculate()
return total_size, total_count
Function recalculate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def recalculate(self):
"""Recalculate the space used by this folder, and store in the
maildirsize cache."""
# We are meant to look for a "maildirfolder" file in the current
# directory, and if there is one, then this is a subfolder and we
- 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"