iterative/dvc

View on GitHub
dvc/repo/__init__.py

Summary

Maintainability
D
2 days
Test Coverage

Function graph has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

    def graph(self, stages=None, from_directory=None):
        """Generate a graph by using the given stages on the given directory

        The nodes of the graph are the stage's path relative to the root.

Severity: Minor
Found in dvc/repo/__init__.py - About 6 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

File __init__.py has 383 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import unicode_literals

import os
import logging
from contextlib import contextmanager
Severity: Minor
Found in dvc/repo/__init__.py - About 5 hrs to fix

    Function used_cache has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def used_cache(
            self,
            targets=None,
            all_branches=False,
            active=True,
    Severity: Minor
    Found in dvc/repo/__init__.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

    Repo has 23 functions (exceeds 20 allowed). Consider refactoring.
    Wontfix

    class Repo(object):
        DVC_DIR = ".dvc"
    
        from dvc.repo.destroy import destroy
        from dvc.repo.install import install
    Severity: Minor
    Found in dvc/repo/__init__.py - About 2 hrs to fix

      Function stages has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def stages(self, from_directory=None, check_dag=True):
              """
              Walks down the root directory looking for Dvcfiles,
              skipping the directories that are related with
              any SCM (e.g. `.git`), DVC itself (`.dvc`), or directories
      Severity: Minor
      Found in dvc/repo/__init__.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 used_cache has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def used_cache(
      Severity: Major
      Found in dvc/repo/__init__.py - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                                if not stage.locked:
                                    G_active.add_node(dep_node, stage=dep_stage)
                                    G_active.add_edge(node, dep_node)
        
        
        Severity: Major
        Found in dvc/repo/__init__.py - About 45 mins to fix

          Function find_root has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def find_root(cls, root=None):
                  if root is None:
                      root = os.getcwd()
                  else:
                      root = os.path.abspath(os.path.realpath(root))
          Severity: Minor
          Found in dvc/repo/__init__.py - About 35 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 find_outs_by_path has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def find_outs_by_path(self, path, outs=None, recursive=False):
                  if not outs:
                      # there is no `from_directory=path` argument because some data
                      # files might be generated to an upper level, and so it is
                      # needed to look at all the files (project root_dir)
          Severity: Minor
          Found in dvc/repo/__init__.py - About 35 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