iterative/dvc

View on GitHub

Showing 522 of 583 total issues

File plots.py has 337 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import argparse
import os
from typing import TYPE_CHECKING, Optional

from funcy import compact, first, get_in
Severity: Minor
Found in dvc/commands/plots.py - About 4 hrs to fix

    File config_schema.py has 336 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import os
    from urllib.parse import urlparse
    
    from funcy import once, walk_values
    from voluptuous import (
    Severity: Minor
    Found in dvc/config_schema.py - About 4 hrs to fix

      _DVCFileSystem has 32 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class _DVCFileSystem(AbstractFileSystem):
          cachable = False
          root_marker = "/"
      
          def __init__(  # noqa: PLR0913
      Severity: Minor
      Found in dvc/fs/dvc.py - About 4 hrs to fix

        TabularData has 32 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class TabularData(MutableSequence[Sequence["CellT"]]):
            def __init__(self, columns: Sequence[str], fill_value: Optional[str] = ""):
                self._columns: dict[str, Column] = {name: Column() for name in columns}
                self._keys: list[str] = list(columns)
                self._fill_value = fill_value
        Severity: Minor
        Found in dvc/compare.py - About 4 hrs to fix

          File dvcfile.py has 333 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import contextlib
          import os
          from typing import TYPE_CHECKING, Any, Callable, ClassVar, Optional, TypeVar, Union
          
          from dvc.exceptions import DvcException
          Severity: Minor
          Found in dvc/dvcfile.py - About 4 hrs to fix

            File show.py has 330 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import typing
            from collections import Counter
            from collections.abc import Iterable
            from typing import Optional, Union
            
            
            Severity: Minor
            Found in dvc/api/show.py - About 3 hrs to fix

              Function format has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
              Open

                  def format(self, record) -> str:  # noqa: C901
                      record.message = record.getMessage()
                      msg = self.formatMessage(record)
              
                      if record.levelno == logging.INFO:
              Severity: Minor
              Found in dvc/logger.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

              Function _check_blockers has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
              Open

              def _check_blockers(tmp_dir, lock, info, *, mode, waiters):  # noqa: C901, PLR0912
                  from .lock import LockError
              
                  non_existing_pid = set()
              
              
              Severity: Minor
              Found in dvc/rwlock.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

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

              def run(  # noqa: C901, PLR0912
                  repo,
                  targets: Optional[Iterable[str]] = None,
                  params: Optional[Iterable[str]] = None,
                  run_all: bool = False,
              Severity: Minor
              Found in dvc/repo/experiments/run.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 datasets.py has 328 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import os
              from collections.abc import Iterator, Mapping
              from datetime import datetime
              from functools import cached_property
              from pathlib import Path
              Severity: Minor
              Found in dvc/repo/datasets.py - About 3 hrs to fix

                File remote_tests.py has 323 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import os
                import shutil
                
                import pytest
                
                
                Severity: Minor
                Found in dvc/testing/remote_tests.py - About 3 hrs to fix

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

                  def gc(  # noqa: C901, PLR0912, PLR0913
                      self: "Repo",
                      all_branches: bool = False,
                      cloud: bool = False,
                      remote: Optional[str] = None,
                  Severity: Minor
                  Found in dvc/repo/gc.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

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

                      def ls(self, path, detail=True, dvc_only=False, **kwargs):  # noqa: C901, PLR0912
                          key = self._get_key_from_relative(path)
                          repo, dvc_fs, subkey = self._get_subrepo_info(key)
                  
                          dvc_infos = {}
                  Severity: Minor
                  Found in dvc/fs/dvc.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

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

                      def drop_duplicates(  # noqa: C901
                          self,
                          axis: str = "rows",
                          subset: Optional[Iterable[str]] = None,
                          ignore_empty: bool = True,
                  Severity: Minor
                  Found in dvc/compare.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 show.py has 321 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  from collections import Counter, defaultdict
                  from collections.abc import Iterable, Iterator, Mapping
                  from datetime import date, datetime
                  from typing import TYPE_CHECKING, Any, Literal, NamedTuple, Optional, Union
                  
                  
                  Severity: Minor
                  Found in dvc/repo/experiments/show.py - About 3 hrs to fix

                    File artifacts.py has 317 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import os
                    import posixpath
                    from pathlib import Path
                    from typing import TYPE_CHECKING, Any, Optional, Union
                    
                    
                    Severity: Minor
                    Found in dvc/repo/artifacts.py - About 3 hrs to fix

                      Function dropna has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def dropna(  # noqa: C901, PLR0912
                              self,
                              axis: str = "rows",
                              how="any",
                              subset: Optional[Iterable[str]] = None,
                      Severity: Minor
                      Found in dvc/compare.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 data_cloud.py has 310 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      """Manages dvc remotes that user can use with push/pull/status commands."""
                      
                      from collections.abc import Iterable
                      from typing import TYPE_CHECKING, Optional
                      
                      
                      Severity: Minor
                      Found in dvc/data_cloud.py - About 3 hrs to fix

                        Function remove has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def remove(  # noqa: C901, PLR0912
                            repo: "Repo",
                            exp_names: Union[None, str, list[str]] = None,
                            rev: Optional[Union[list[str], str]] = None,
                            all_commits: bool = False,
                        Severity: Minor
                        Found in dvc/repo/experiments/remove.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

                        Function _clone_default_branch has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def _clone_default_branch(url, rev):
                            """Get or create a clean clone of the url.
                        
                            The cloned is reactualized with git pull unless rev is a known sha.
                            """
                        Severity: Minor
                        Found in dvc/repo/open_repo.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

                        Severity
                        Category
                        Status
                        Source
                        Language