iterative/dvc

View on GitHub

Showing 158 of 275 total issues

Function _collect_graph has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Confirmed

    def _collect_graph(self, stages=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 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

Function __build_graph has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Confirmed

    def __build_graph(self, target, commands, outs):
        import networkx
        from dvc.stage import Stage
        from dvc.repo.graph import get_pipeline

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.
Confirmed

    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

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

"""Helpers for other modules."""
from __future__ import unicode_literals

import hashlib
import json
Severity: Minor
Found in dvc/utils/__init__.py - About 2 hrs to fix

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

        def copy(self, from_info, to_info):
            if not from_info.scheme == to_info.scheme == self.scheme:
                raise NotImplementedError
    
            with self.ssh(from_info) as ssh:
    Severity: Major
    Found in dvc/remote/ssh/__init__.py and 1 other location - About 2 hrs to fix
    dvc/remote/ssh/__init__.py on lines 183..188

    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 59.

    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 symlink(self, from_info, to_info):
            if not from_info.scheme == to_info.scheme == self.scheme:
                raise NotImplementedError
    
            with self.ssh(from_info) as ssh:
    Severity: Major
    Found in dvc/remote/ssh/__init__.py and 1 other location - About 2 hrs to fix
    dvc/remote/ssh/__init__.py on lines 176..181

    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 59.

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

    """Manages Git."""
    from __future__ import unicode_literals
    
    import logging
    import os
    Severity: Minor
    Found in dvc/scm/git/__init__.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=False,
          pipeline=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 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def used_cache(
              self,
              targets=None,
              all_branches=False,
              with_deps=False,
      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

      Similar blocks of code found in 3 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 2 other locations - About 2 hrs to fix
      dvc/command/root.py on lines 21..30
      dvc/command/version.py on lines 130..140

      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 3 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 2 other locations - About 2 hrs to fix
      dvc/command/install.py on lines 23..32
      dvc/command/version.py on lines 130..140

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

      from __future__ import unicode_literals
      
      import errno
      import getpass
      import io
      Severity: Minor
      Found in dvc/remote/ssh/__init__.py - About 2 hrs to fix

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

            def _download(
                self, from_info, to_file, name=None, no_progress_bar=False, **_kwargs
            ):
                with Tqdm(desc=name, disable=no_progress_bar, bytes=True) as pbar:
                    self.blob_service.get_blob_to_path(
        Severity: Major
        Found in dvc/remote/azure.py and 1 other location - About 2 hrs to fix
        dvc/remote/azure.py on lines 113..121

        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 54.

        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 _upload(
                self, from_file, to_info, name=None, no_progress_bar=False, **_kwargs
            ):
                with Tqdm(desc=name, disable=no_progress_bar, bytes=True) as pbar:
                    self.blob_service.create_blob_from_path(
        Severity: Major
        Found in dvc/remote/azure.py and 1 other location - About 2 hrs to fix
        dvc/remote/azure.py on lines 124..132

        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 54.

        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 data_sync.py has 263 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

          File exceptions.py has 260 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """Exceptions raised by the dvc."""
          from __future__ import unicode_literals
          
          import traceback
          
          
          Severity: Minor
          Found in dvc/exceptions.py - About 2 hrs to fix

            URLInfo has 21 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class URLInfo(_BasePath):
                DEFAULT_PORTS = {"http": 80, "https": 443, "ssh": 22, "hdfs": 0}
            
                def __init__(self, url):
                    p = urlparse(url)
            Severity: Minor
            Found in dvc/path_info.py - About 2 hrs to fix

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

              def iter_url(url, chunk_size=io.DEFAULT_BUFFER_SIZE):
                  """Iterate over chunks requested from url."""
                  import requests
              
                  def request(headers=None):
              Severity: Minor
              Found in dvc/utils/http.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 _upload(
                      self, from_file, to_info, name=None, no_progress_bar=False, **_kwargs
                  ):
                      with Tqdm(desc=name, disable=no_progress_bar, bytes=True) as pbar:
                          self.oss_service.put_object_from_file(
              Severity: Major
              Found in dvc/remote/oss.py and 1 other location - About 2 hrs to fix
              dvc/remote/oss.py on lines 115..120

              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 51.

              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 _download(
                      self, from_info, to_file, name=None, no_progress_bar=False, **_kwargs
                  ):
                      with Tqdm(desc=name, disable=no_progress_bar, bytes=True) as pbar:
                          self.oss_service.get_object_to_file(
              Severity: Major
              Found in dvc/remote/oss.py and 1 other location - About 2 hrs to fix
              dvc/remote/oss.py on lines 107..112

              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 51.

              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

              Severity
              Category
              Status
              Source
              Language