iterative/dvc

View on GitHub

Showing 406 of 497 total issues

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

import argparse
import logging
from collections import Counter, OrderedDict, defaultdict
from datetime import date, datetime
from fnmatch import fnmatch
Severity: Major
Found in dvc/command/experiments.py - About 2 days to fix

    File output.py has 754 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import logging
    import os
    from collections import defaultdict
    from copy import copy
    from typing import TYPE_CHECKING, Dict, Optional, Set, Type
    Severity: Major
    Found in dvc/output.py - About 1 day to fix

      File __init__.py has 739 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 526 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import fnmatch
          import locale
          import logging
          import os
          import stat
          Severity: Major
          Found in dvc/scm/git/backend/dulwich.py - About 1 day to fix

            File gdrive.py has 524 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import io
            import logging
            import os
            import posixpath
            import re
            Severity: Major
            Found in dvc/fs/gdrive.py - About 1 day to fix

              File gitpython.py has 496 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 7 hrs to fix

                File pygit2.py has 448 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import locale
                import logging
                import os
                import stat
                from contextlib import contextmanager
                Severity: Minor
                Found in dvc/scm/git/backend/pygit2.py - About 6 hrs to fix

                  File context.py has 440 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 47 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

                      Pygit2Backend has 46 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 6 hrs to fix

                        Output has 46 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class Output:
                            IS_DEPENDENCY = False
                        
                            PARAM_PATH = "path"
                            PARAM_CACHE = "cache"
                        Severity: Minor
                        Found in dvc/output.py - About 6 hrs to fix

                          GitPythonBackend has 44 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 6 hrs to fix

                            BaseGitBackend has 43 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 stage.py has 401 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import fnmatch
                              import logging
                              import os
                              import typing
                              from contextlib import suppress
                              Severity: Minor
                              Found in dvc/repo/stage.py - About 5 hrs to fix

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

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

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

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

                                    Function collect has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def collect(
                                            self,
                                            targets: List[str] = None,
                                            revs: List[str] = None,
                                            recursive: bool = False,
                                    Severity: Minor
                                    Found in dvc/repo/plots/__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

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

                                    import itertools
                                    import logging
                                    import os
                                    from concurrent.futures import ThreadPoolExecutor
                                    from copy import copy
                                    Severity: Minor
                                    Found in dvc/objects/db/base.py - About 4 hrs to fix

                                      File data_sync.py has 365 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
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language