iterative/dvc

View on GitHub

Showing 313 of 429 total issues

File experiments.py has 982 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import argparse
import io
import logging
from collections import OrderedDict
from collections.abc import Mapping
Severity: Major
Found in dvc/command/experiments.py - About 2 days to fix

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

    import logging
    import os
    import re
    import signal
    from collections import defaultdict, namedtuple
    Severity: Major
    Found in dvc/repo/experiments/__init__.py - About 1 day to fix

      File template.py has 541 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import json
      import os
      from typing import Any, Dict, Optional
      
      from funcy import cached_property
      Severity: Major
      Found in dvc/repo/plots/template.py - About 1 day to fix

        File dulwich.py has 432 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import fnmatch
        import locale
        import logging
        import os
        import stat
        Severity: Minor
        Found in dvc/scm/git/backend/dulwich.py - About 6 hrs to fix

          File context.py has 430 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import logging
          import os
          from abc import ABC, abstractmethod
          from collections import defaultdict
          from collections.abc import Mapping, MutableMapping, MutableSequence, Sequence
          Severity: Minor
          Found in dvc/parsing/context.py - About 6 hrs to fix

            DulwichBackend has 45 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class DulwichBackend(BaseGitBackend):  # pylint:disable=abstract-method
                """Dulwich Git backend."""
            
                # Dulwich progress will return messages equivalent to git CLI,
                # our pbars should just display the messages as formatted by dulwich
            Severity: Minor
            Found in dvc/scm/git/backend/dulwich.py - About 6 hrs to fix

              CloudCache has 44 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class CloudCache:
                  """Cloud cache class."""
              
                  DEFAULT_CACHE_TYPES = ["copy"]
                  CACHE_MODE: Optional[int] = None
              Severity: Minor
              Found in dvc/cache/base.py - About 6 hrs to fix

                GitPythonBackend has 43 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class GitPythonBackend(BaseGitBackend):  # pylint:disable=abstract-method
                    """git-python Git backend."""
                
                    def __init__(  # pylint:disable=W0231
                        self, root_dir=os.curdir, search_parent_directories=True
                Severity: Minor
                Found in dvc/scm/git/backend/gitpython.py - About 5 hrs to fix

                  Pygit2Backend has 43 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Pygit2Backend(BaseGitBackend):  # pylint:disable=abstract-method
                      def __init__(  # pylint:disable=W0231
                          self, root_dir=os.curdir, search_parent_directories=True
                      ):
                          import pygit2
                  Severity: Minor
                  Found in dvc/scm/git/backend/pygit2.py - About 5 hrs to fix

                    File gitpython.py has 403 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import io
                    import locale
                    import logging
                    import os
                    from functools import partial
                    Severity: Minor
                    Found in dvc/scm/git/backend/gitpython.py - About 5 hrs to fix

                      BaseGitBackend has 42 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class BaseGitBackend(ABC):
                          """Base Git backend class."""
                      
                          @abstractmethod
                          def __init__(self, root_dir=os.curdir, search_parent_directories=True):
                      Severity: Minor
                      Found in dvc/scm/git/backend/base.py - About 5 hrs to fix

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

                        import argparse
                        import logging
                        
                        from dvc.command import completion
                        from dvc.command.base import CmdBase, append_doc_link
                        Severity: Minor
                        Found in dvc/command/data_sync.py - About 4 hrs to fix

                          File repo.py has 357 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import logging
                          import os
                          import stat
                          import threading
                          from contextlib import suppress
                          Severity: Minor
                          Found in dvc/tree/repo.py - About 4 hrs to fix

                            Function _collect_experiment_commit has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def _collect_experiment_commit(repo, rev, stash=False, sha_only=True):
                                res = defaultdict(dict)
                                for rev in repo.brancher(revs=[rev]):
                                    if rev == "workspace":
                                        res["timestamp"] = None
                            Severity: Minor
                            Found in dvc/repo/experiments/show.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

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

                            """Manages Git."""
                            
                            import logging
                            import os
                            import shlex
                            Severity: Minor
                            Found in dvc/scm/git/__init__.py - About 4 hrs to fix

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

                                  def _process(
                                      self,
                                      cache,
                                      named_cache,
                                      jobs=None,
                              Severity: Minor
                              Found in dvc/remote/base.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 push_refspec has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def push_refspec(
                                      self,
                                      url: str,
                                      src: Optional[str],
                                      dest: str,
                              Severity: Minor
                              Found in dvc/scm/git/backend/dulwich.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

                              File base.py has 325 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import logging
                              import os
                              import pickle
                              from abc import ABC, abstractmethod
                              from functools import partial
                              Severity: Minor
                              Found in dvc/repo/experiments/executor/base.py - About 3 hrs to fix

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

                                def _show_metrics(
                                    metrics,
                                    all_branches=False,
                                    all_tags=False,
                                    all_commits=False,
                                Severity: Minor
                                Found in dvc/command/metrics.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 309 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import logging
                                from collections.abc import Mapping, Sequence
                                from copy import deepcopy
                                from typing import TYPE_CHECKING, Any, Dict, NamedTuple, Union
                                
                                
                                Severity: Minor
                                Found in dvc/parsing/__init__.py - About 3 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language