CenterForOpenScience/waterbutler

View on GitHub
waterbutler/core/path.py

Summary

Maintainability
B
4 hrs
Test Coverage

WaterButlerPath has 27 functions (exceeds 20 allowed). Consider refactoring.
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
Severity: Minor
Found in waterbutler/core/path.py - About 3 hrs to fix

    Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self,
    Severity: Minor
    Found in waterbutler/core/path.py - About 35 mins to fix

      Function generic_path_validation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      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:
      Severity: Minor
      Found in waterbutler/core/path.py - About 25 mins to fix

      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

          def __init__(self,
                       path: str,
                       _ids: typing.Sequence=(),
                       prepend: str=None,
                       folder: bool=None, **kwargs) -> None:
      Severity: Minor
      Found in waterbutler/core/path.py - About 25 mins to fix

      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

      There are no issues that match your filters.

      Category
      Status