iterative/dvc

View on GitHub

Showing 517 of 578 total issues

Function _load_data_from_tree has a Cognitive Complexity of 322 (exceeds 5 allowed). Consider refactoring.
Open

def _load_data_from_tree(index, prefix, ws, key, tree, hash_name):
    from dvc_data.index import DataIndexEntry, Meta

    parents = set()

Severity: Minor
Found in dvc/repo/index.py - About 6 days 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 output.py has 1212 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import errno
import os
import posixpath
from collections import defaultdict
from contextlib import suppress
Severity: Major
Found in dvc/output.py - About 3 days to fix

    File index.py has 737 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import logging
    import time
    from collections import defaultdict
    from collections.abc import Iterable, Iterator
    from functools import partial
    Severity: Major
    Found in dvc/repo/index.py - About 1 day to fix

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

      import logging
      import os
      import pickle
      import shutil
      from abc import ABC, abstractmethod
      Severity: Major
      Found in dvc/repo/experiments/executor/base.py - About 1 day to fix

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

        import os
        from abc import ABC, abstractmethod
        from collections.abc import Collection, Generator, Iterable, Mapping
        from dataclasses import asdict, dataclass
        from typing import TYPE_CHECKING, Any, NamedTuple, Optional, Union
        Severity: Major
        Found in dvc/repo/experiments/queue/base.py - About 1 day to fix

          File celery.py has 531 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import hashlib
          import locale
          import logging
          import os
          from collections import defaultdict
          Severity: Major
          Found in dvc/repo/experiments/queue/celery.py - About 1 day to fix

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

            import logging
            import os
            from collections.abc import Mapping, Sequence
            from copy import deepcopy
            from itertools import product
            Severity: Minor
            Found in dvc/parsing/__init__.py - About 7 hrs to fix

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

              import csv
              import io
              import os
              from collections import defaultdict
              from collections.abc import Iterator
              Severity: Minor
              Found in dvc/repo/plots/__init__.py - About 7 hrs to fix

                File dvc.py has 453 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import errno
                import functools
                import ntpath
                import os
                import posixpath
                Severity: Minor
                Found in dvc/fs/dvc.py - About 6 hrs to fix

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

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

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

                    import argparse
                    
                    from dvc.cli import completion, formatter
                    from dvc.cli.command import CmdBase
                    from dvc.cli.utils import append_doc_link
                    Severity: Minor
                    Found in dvc/commands/data_sync.py - About 5 hrs to fix

                      LocalCeleryQueue has 39 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class LocalCeleryQueue(BaseStashQueue):
                          """DVC experiment queue.
                      
                          Maps queued experiments to (Git) stash reflog entries.
                          """
                      Severity: Minor
                      Found in dvc/repo/experiments/queue/celery.py - About 5 hrs to fix

                        Function match_defs_renderers has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def match_defs_renderers(  # noqa: C901, PLR0912
                            data,
                            out=None,
                            templates_dir: Optional["StrPath"] = None,
                        ) -> list[RendererWithErrors]:
                        Severity: Minor
                        Found in dvc/render/match.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 dumpd has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def dumpd(self, **kwargs):  # noqa: C901, PLR0912
                                from dvc.cachemgr import LEGACY_HASH_NAMES
                        
                                ret: dict[str, Any] = {}
                                with_files = (
                        Severity: Minor
                        Found in dvc/output.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

                        File compare.py has 350 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        from collections import abc
                        from collections.abc import (
                            ItemsView,
                            Iterable,
                            Iterator,
                        Severity: Minor
                        Found in dvc/compare.py - About 4 hrs to fix

                          File ignore.py has 348 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import os
                          import re
                          from collections import namedtuple
                          from itertools import chain, groupby, takewhile
                          from typing import TYPE_CHECKING, Optional
                          Severity: Minor
                          Found in dvc/ignore.py - About 4 hrs to fix

                            Experiments has 34 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            class Experiments:
                                """Class that manages experiments in a DVC repo.
                            
                                Args:
                                    repo (dvc.repo.Repo): repo instance that these experiments belong to.
                            Severity: Minor
                            Found in dvc/repo/experiments/__init__.py - About 4 hrs to fix

                              Output has 34 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 4 hrs to fix

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

                                def _(obj: dict, config=None):  # noqa: C901
                                    config = config or {}
                                
                                    result = ""
                                    for k, v in flatten(obj).items():
                                Severity: Minor
                                Found in dvc/parsing/interpolate.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 stage.py has 338 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import fnmatch
                                import typing
                                from collections.abc import Iterable
                                from contextlib import suppress
                                from functools import wraps
                                Severity: Minor
                                Found in dvc/repo/stage.py - About 4 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language