iterative/dvc

View on GitHub

Showing 129 of 261 total issues

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

    def graph(self, stages=None, from_directory=None):
        import networkx as nx
        from dvc.exceptions import (
            OutputDuplicationError,
            StagePathAsOutputError,
Severity: Minor
Found in dvc/repo/__init__.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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

Severity: Major
Found in dvc/repo/push.py and 1 other location - About 5 hrs to fix
dvc/repo/fetch.py on lines 0..27

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 91.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

Severity: Major
Found in dvc/repo/fetch.py and 1 other location - About 5 hrs to fix
dvc/repo/push.py on lines 0..27

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 91.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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 364 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import unicode_literals

import os
import logging

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

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

        def run(self, dry=False, resume=False, no_commit=False, force=False):
            if (self.cmd or self.is_import) and not self.locked and not dry:
                self.remove_outs(ignore_remove=False, force=False)
    
            if self.locked:
    Severity: Minor
    Found in dvc/stage.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

    Git has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Git(Base):
        """Class for managing Git."""
    
        GITIGNORE = ".gitignore"
        GIT_DIR = ".git"
    Severity: Minor
    Found in dvc/scm/git/__init__.py - About 3 hrs to fix

      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 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 23 (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

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

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

        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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        def add_parser(subparsers, parent_parser):
            INSTALL_HELP = "Install DVC git hooks into the repository."
            install_parser = subparsers.add_parser(
                "install",
                parents=[parent_parser],
        Severity: Major
        Found in dvc/command/install.py and 1 other location - About 2 hrs to fix
        dvc/command/root.py on lines 22..31

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 56.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        def add_parser(subparsers, parent_parser):
            ROOT_HELP = "Relative path to the repository's directory."
            root_parser = subparsers.add_parser(
                "root",
                parents=[parent_parser],
        Severity: Major
        Found in dvc/command/root.py and 1 other location - About 2 hrs to fix
        dvc/command/install.py on lines 22..31

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 56.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

        """Helpers for other modules."""
        
        from __future__ import unicode_literals
        
        import yaml
        Severity: Minor
        Found in dvc/utils/__init__.py - About 2 hrs to fix

          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

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

          def _makedirs(name, mode=0o777, exist_ok=False):
              """Source: https://github.com/python/cpython/blob/
                  3ce3dea60646d8a5a1c952469a2eb65f937875b3/Lib/os.py#L196-L226
              """
              head, tail = os.path.split(name)
          Severity: Minor
          Found in dvc/utils/compat.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 run has 17 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def run(
          Severity: Major
          Found in dvc/repo/run.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

            Severity
            Category
            Status
            Source
            Language