iterative/dvc

View on GitHub

Showing 411 of 491 total issues

File experiments.py has 1105 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 742 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, 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 524 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 519 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 485 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 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

                    File pygit2.py has 437 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

                      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

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

                                    if args.path:
                                        pkg = pathlib.Path(args.path)
                                    else:
                                        pkgs = list(path.glob("*.pkg"))
                                        if not pkgs:
                                    Severity: Major
                                    Found in scripts/fpm/sign.py and 1 other location - About 4 hrs to fix
                                    scripts/fpm/notarize.py on lines 33..45

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

                                    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

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

                                    if args.path:
                                        pkg = pathlib.Path(args.path)
                                    else:
                                        pkgs = list(path.glob("*.pkg"))
                                        if not pkgs:
                                    Severity: Major
                                    Found in scripts/fpm/notarize.py and 1 other location - About 4 hrs to fix
                                    scripts/fpm/sign.py on lines 25..37

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

                                    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