iterative/dvc

View on GitHub

Showing 83 of 216 total issues

Function _do_draw has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    def _do_draw(self, screen):  # pragma: no cover
        # pylint: disable=too-many-locals
        # pylint: disable=too-many-branches, too-many-statements
        from dvc.system import System
        from asciimatics.event import KeyboardEvent
Severity: Minor
Found in dvc/dagascii.py - About 5 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 343 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import unicode_literals

from dvc.utils.compat import str, builtin_str, open

import collections
Severity: Minor
Found in dvc/repo/__init__.py - About 4 hrs to fix

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

        def graph(self, stages=None, from_directory=None):
            import networkx as nx
            from dvc.exceptions import (
                OutputDuplicationError,
                WorkingDirectoryAsOutputError,
    Severity: Minor
    Found in dvc/repo/__init__.py - About 4 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 __build_graph has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        def __build_graph(self, target, commands, outs):
            import networkx
            from dvc.stage import Stage
    
            stage = Stage.load(self.repo, target)
    Severity: Minor
    Found in dvc/command/pipeline.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

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

    def add(self, fname, recursive=False):
        from dvc.stage import Stage
    
        fnames = []
        if recursive and os.path.isdir(fname):
    Severity: Minor
    Found in dvc/repo/add.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

    Function line has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        def line(self, x0, y0, x1, y1, char):
            """Create a line on ASCII canvas.
    
            Args:
                x0 (int): x coordinate where the line should start.
    Severity: Minor
    Found in dvc/dagascii.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

    Function stages has a Cognitive Complexity of 22 (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 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

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

        def run(self, dry=False, resume=False):
            if self.locked:
                logger.info(
                    "Verifying outputs in locked stage '{stage}'".format(
                        stage=self.relpath
    Severity: Minor
    Found in dvc/stage.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 reproduce has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def reproduce(
        self,
        target=None,
        recursive=True,
        force=False,
    Severity: Minor
    Found in dvc/repo/reproduce.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 a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def used_cache(
            self,
            target=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

    File data_sync.py has 267 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from __future__ import unicode_literals
    
    import argparse
    
    import dvc.logger as logger
    Severity: Minor
    Found in dvc/command/data_sync.py - About 2 hrs to fix

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

          def download(
              self,
              from_infos,
              to_infos,
              no_progress_bar=False,
      Severity: Minor
      Found in dvc/remote/s3.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 gc has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      def gc(
          self,
          all_branches=False,
          cloud=False,
          remote=None,
      Severity: Minor
      Found in dvc/repo/gc.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 download has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def download(
              self,
              from_infos,
              to_infos,
              no_progress_bar=False,
      Severity: Minor
      Found in dvc/remote/gs.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 save has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def save(self):
              if not os.path.exists(self.path):
                  raise self.DoesNotExistError(self.rel_path)
      
              if not os.path.isfile(self.path) and not os.path.isdir(self.path):
      Severity: Minor
      Found in dvc/output/local.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 _exec has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def _exec(self, ssh, cmd):
              stdin, stdout, stderr = ssh.exec_command(cmd)
              channel = stdout.channel
      
              stdin.close()
      Severity: Minor
      Found in dvc/remote/ssh.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 download has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def download(
              self,
              from_infos,
              to_infos,
              no_progress_bar=False,
      Severity: Minor
      Found in dvc/remote/azure.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 run has 13 arguments (exceeds 4 allowed). Consider refactoring.
      Open

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

        Function pull has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

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

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

              def collect_dir_cache(self, dname):
                  dir_info = []
          
                  for root, dirs, files in os.walk(str(dname)):
                      bar = False
          Severity: Minor
          Found in dvc/remote/local.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

          Severity
          Category
          Status
          Source
          Language