waterbutler/core/path.py
WaterButlerPath
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class WaterButlerPath:
""" A standardized and validated immutable WaterButler path. This is our abstraction around
file paths in storage providers. A WaterButlerPath is an array of WaterButlerPathPart objects.
Each PathPart has two important attributes, `value` and `_id`. `value` is always the
human-readable component of the path. If the provider assigns ids to entities (see: Box, Google
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self,
Function generic_path_validation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def generic_path_validation(cls, path: str) -> None:
"""Validates a WaterButler specific path, e.g. /folder/file.txt, /folder/
:param str path: WaterButler path
"""
if not path:
- 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def __init__(self,
path: str,
_ids: typing.Sequence=(),
prepend: str=None,
folder: bool=None, **kwargs) -> 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"