iterative/dvc

View on GitHub

Showing 143 of 233 total issues

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

    def _process(
Severity: Minor
Found in dvc/remote/local/__init__.py - About 35 mins to fix

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

    def loads_from(stage, s_list, use_cache=True, metric=False, persist=False):
    Severity: Minor
    Found in dvc/output/__init__.py - About 35 mins to fix

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

          def _download(
      Severity: Minor
      Found in dvc/remote/local/__init__.py - About 35 mins to fix

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

            def _download(
        Severity: Minor
        Found in dvc/remote/oss.py - About 35 mins to fix

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

          def dvc_walk(top, dvcignore, topdown=True, onerror=None, followlinks=False):
          Severity: Minor
          Found in dvc/utils/__init__.py - About 35 mins to fix

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

                def run(self):
                    indent = 1 if self.args.cloud else 0
                    try:
                        st = self.repo.status(
                            targets=self.args.targets,
            Severity: Minor
            Found in dvc/command/status.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 main has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def main(argv=None):
                """Run dvc CLI command.
            
                Args:
                    argv: optional list of arguments to parse. sys.argv is used by default.
            Severity: Minor
            Found in dvc/main.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

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

                def get_checksum(self, path_info):
                    if not self.exists(path_info):
                        return None
            
                    checksum = self.state.get(path_info)
            Severity: Minor
            Found in dvc/remote/base.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_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 load has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def load(self):
                    """Loads state database."""
                    retries = 1
                    while True:
                        assert self.database is None
            Severity: Minor
            Found in dvc/state.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

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

                def pull(self, checksum_infos, remote, jobs=None, show_checksums=False):
                    return self._process(
                        checksum_infos,
                        remote,
            Severity: Minor
            Found in dvc/remote/local/__init__.py and 1 other location - About 35 mins to fix
            dvc/remote/local/__init__.py on lines 428..431

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

            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 push(self, checksum_infos, remote, jobs=None, show_checksums=False):
                    return self._process(
                        checksum_infos,
                        remote,
            Severity: Minor
            Found in dvc/remote/local/__init__.py and 1 other location - About 35 mins to fix
            dvc/remote/local/__init__.py on lines 437..440

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

            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

            Avoid too many return statements within this function.
            Open

                    return ret
            Severity: Major
            Found in dvc/output/base.py - About 30 mins to fix

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

                          if isinstance(types, str):
                              types = [t.strip() for t in types.split(",")]
              Severity: Minor
              Found in dvc/remote/local/__init__.py and 1 other location - About 30 mins to fix
              dvc/config.py on lines 40..41

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

              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 _run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _run(self, unlock):
                      for target in self.args.targets:
                          try:
                              self.repo.lock_stage(target, unlock=unlock)
                          except DvcException:
              Severity: Minor
              Found in dvc/command/lock.py - About 25 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 _get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def _get(stage, p, info):
                  from dvc.utils.compat import urlparse
              
                  parsed = urlparse(p)
              
              
              Severity: Minor
              Found in dvc/dependency/__init__.py - About 25 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 csv_reader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def csv_reader(unicode_csv_data, dialect=None, **kwargs):
                  """csv.reader doesn't support Unicode input, so need to use some tricks
                  to work around this.
              
                  Source: https://docs.python.org/2/library/csv.html#csv-examples
              Severity: Minor
              Found in dvc/utils/compat.py - About 25 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 brancher has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def brancher(  # noqa: E302
                  self, branches=None, all_branches=False, tags=None, all_tags=False
              ):
                  """Generator that iterates over specified revisions.
              
              
              Severity: Minor
              Found in dvc/repo/brancher.py - About 25 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 git_object_by_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def git_object_by_path(self, path):
                      import git
              
                      path = relpath(os.path.realpath(path), self.git.working_dir)
                      assert path.split(os.sep, 1)[0] != ".."
              Severity: Minor
              Found in dvc/scm/git/tree.py - About 25 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

              Severity
              Category
              Status
              Source
              Language