iterative/dvc

View on GitHub
dvc/fs/dvc.py

Summary

Maintainability
D
2 days
Test Coverage

File dvc.py has 453 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import errno
import functools
import ntpath
import os
import posixpath
Severity: Minor
Found in dvc/fs/dvc.py - About 6 hrs to fix

    Function ls has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        def ls(self, path, detail=True, dvc_only=False, **kwargs):  # noqa: C901
            key = self._get_key_from_relative(path)
            repo, dvc_fs, subkey = self._get_subrepo_info(key)
    
            dvc_infos = {}
    Severity: Minor
    Found in dvc/fs/dvc.py - About 3 hrs 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

    _DVCFileSystem has 30 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class _DVCFileSystem(AbstractFileSystem):
        cachable = False
        root_marker = "/"
    
        def __init__(  # noqa: PLR0913
    Severity: Minor
    Found in dvc/fs/dvc.py - About 3 hrs to fix

      Function _info has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def _info(  # noqa: C901, PLR0912
              self, key, path, ignore_subrepos=True, check_ignored=True
          ):
              repo, dvc_fs, subkey = self._get_subrepo_info(key)
      
      
      Severity: Minor
      Found in dvc/fs/dvc.py - About 2 hrs 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 15 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(  # noqa: PLR0913
      Severity: Major
      Found in dvc/fs/dvc.py - About 1 hr to fix

        Function du has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def du(self, path, total=True, maxdepth=None, withdirs=False, **kwargs):
                if maxdepth is not None:
                    raise NotImplementedError
        
                sizes = {}
        Severity: Minor
        Found in dvc/fs/dvc.py - About 1 hr 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 _merge_info has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def _merge_info(repo, key, fs_info, dvc_info):
            from . import utils
        
            ret = {"repo": repo}
        
        
        Severity: Minor
        Found in dvc/fs/dvc.py - About 55 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 _info has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def _info(  # noqa: C901, PLR0912
        Severity: Minor
        Found in dvc/fs/dvc.py - About 35 mins to fix

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

              def du(self, path, total=True, maxdepth=None, withdirs=False, **kwargs):
          Severity: Minor
          Found in dvc/fs/dvc.py - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status