iterative/dvc

View on GitHub

Showing 529 of 589 total issues

Function split_file_meta_from_cloud has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def split_file_meta_from_cloud(entry: dict) -> dict:
    if remote_name := entry.pop(Meta.PARAM_REMOTE, None):
        remote_meta = {}
        for key in (S3_PARAM_CHECKSUM, HDFS_PARAM_CHECKSUM, Meta.PARAM_VERSION_ID):
            if value := entry.pop(key, None):
Severity: Minor
Found in dvc/output.py - About 45 mins 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 _log_exceptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def _log_exceptions(exc: Exception) -> Optional[int]:
    """Try to log some known exceptions, that are not DVCExceptions."""
    from dvc.utils import error_link, format_link

    if isinstance(exc, OSError):
Severity: Minor
Found in dvc/cli/__init__.py - About 45 mins 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 _build_tree_structure has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def _build_tree_structure(
Severity: Minor
Found in dvc/commands/ls/__init__.py - About 45 mins to fix

    Function get_obj has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_obj(
            self, filter_info: Optional[str] = None, **kwargs
        ) -> Optional["HashFile"]:
            obj: Optional[HashFile] = None
            if self.obj:
    Severity: Minor
    Found in dvc/output.py - About 45 mins 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

    Consider simplifying this complex logical expression.
    Open

            if (change.old and change.old.isdir and not change.old.hash_info) or (
                change.new and change.new.isdir and not change.new.hash_info
            ):
                continue
    
    
    Severity: Major
    Found in dvc/repo/diff.py - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

                  if exc.context_mark is not None and (
                      exc.problem is None
                      or exc.problem_mark is None
                      or exc.context_mark.name != exc.problem_mark.name
                      or exc.context_mark.line != exc.problem_mark.line
      Severity: Major
      Found in dvc/utils/strictyaml.py - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

            if remote is not None and remote_config is not None:
                conf = erepo.get("config") or {}
        
                core = conf.get("core") or {}
                core["remote"] = remote
        Severity: Major
        Found in dvc/repo/imp.py - About 40 mins to fix

          Function sync_import has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def sync_import(stage, dry=False, force=False, jobs=None, no_download=False):
          Severity: Minor
          Found in dvc/stage/imports.py - About 35 mins to fix

            Function run_stage has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def run_stage(stage, dry=False, force=False, run_env=None, **kwargs):
            Severity: Minor
            Found in dvc/stage/run.py - About 35 mins to fix

              Function init_executor has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def init_executor(
              Severity: Minor
              Found in dvc/repo/experiments/queue/base.py - About 35 mins to fix

                Function _push has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def _push(
                Severity: Minor
                Found in dvc/data_cloud.py - About 35 mins to fix

                  Function status has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def status(
                  Severity: Minor
                  Found in dvc/data_cloud.py - About 35 mins to fix

                    Function rename has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def rename(
                    Severity: Minor
                    Found in dvc/repo/experiments/rename.py - About 35 mins to fix

                      Function line has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def line(self, x0, y0, x1, y1, char):  # noqa: C901, PLR0912
                      Severity: Minor
                      Found in dvc/dagascii.py - About 35 mins to fix

                        Function _repro_commit has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def _repro_commit(
                        Severity: Minor
                        Found in dvc/repo/experiments/executor/base.py - About 35 mins to fix

                          Function ls has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def ls(
                          Severity: Minor
                          Found in dvc/repo/experiments/ls.py - About 35 mins to fix

                            Function transfer has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def transfer(
                            Severity: Minor
                            Found in dvc/stage/__init__.py - About 35 mins to fix

                              Function transfer has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  def transfer(
                              Severity: Minor
                              Found in dvc/data_cloud.py - About 35 mins to fix

                                Function _pull_cache has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                def _pull_cache(
                                Severity: Minor
                                Found in dvc/repo/experiments/pull.py - About 35 mins to fix

                                  Function _reproduce_entry has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      def _reproduce_entry(
                                  Severity: Minor
                                  Found in dvc/repo/experiments/queue/tempdir.py - About 35 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language