iterative/dvc

View on GitHub

Showing 517 of 578 total issues

File utils.py has 308 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import os
import random
import sys
from collections import defaultdict
from collections.abc import Generator, Iterable, Mapping
Severity: Minor
Found in dvc/repo/experiments/utils.py - About 3 hrs to fix

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

    import os
    import re
    from collections.abc import Iterable
    from typing import TYPE_CHECKING, Optional
    
    
    Severity: Minor
    Found in dvc/repo/experiments/__init__.py - About 3 hrs to fix

      File stage.py has 304 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import argparse
      import logging
      from collections.abc import Iterable
      from contextlib import contextmanager
      from itertools import chain, filterfalse
      Severity: Minor
      Found in dvc/commands/stage.py - About 3 hrs to fix

        Function match_queue_entry_by_name has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            def match_queue_entry_by_name(
                self,
                exp_names: Collection[str],
                *entries: Iterable[Union[QueueEntry, QueueDoneResult]],
            ) -> dict[str, Optional[QueueEntry]]:
        Severity: Minor
        Found in dvc/repo/experiments/queue/base.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 _show_status has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            def _show_status(cls, status: "DataStatus") -> int:  # noqa: C901
                git_info = status.pop("git")  # type: ignore[misc]
                result = dict(cls._process_status(status))
                if not result:
                    no_changes = "No changes"
        Severity: Minor
        Found in dvc/commands/data.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 __init__.py has 299 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        from collections.abc import Iterable, Iterator, Sequence
        from contextlib import contextmanager, nullcontext
        from typing import TYPE_CHECKING, Any, Callable, Optional, TextIO, Union
        
        import colorama
        Severity: Minor
        Found in dvc/ui/__init__.py - About 3 hrs to fix

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

              def run(self) -> int:  # noqa: C901, PLR0911, PLR0912
                  from pathlib import Path
          
                  from dvc.render.match import match_defs_renderers
                  from dvc_render import render_html
          Severity: Minor
          Found in dvc/commands/plots.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 collect.py has 294 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import itertools
          import os
          from collections.abc import Collection, Iterable, Iterator
          from dataclasses import fields
          from datetime import datetime
          Severity: Minor
          Found in dvc/repo/experiments/collect.py - About 3 hrs to fix

            BaseStashQueue has 26 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class BaseStashQueue(ABC):
                """Naive Git-stash based experiment queue.
            
                Maps queued experiments to (Git) stash reflog entries.
                """
            Severity: Minor
            Found in dvc/repo/experiments/queue/base.py - About 3 hrs to fix

              File artifacts.py has 291 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 _data_cells has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                def _data_cells(
                    exp: "ExpState",
                    *,
                    metrics_headers: Iterable[str],
                    params_headers: Iterable[str],
                Severity: Minor
                Found in dvc/repo/experiments/show.py - About 2 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 _sort_column has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                def _sort_column(  # noqa: C901
                    sort_by: str,
                    metric_names: Mapping[str, Iterable[str]],
                    param_names: Mapping[str, Iterable[str]],
                ) -> tuple[str, str, str]:
                Severity: Minor
                Found in dvc/repo/experiments/show.py - About 2 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 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    def run(self):  # noqa: C901, PLR0912
                        from dvc.repo.gc import _validate_args
                
                        _validate_args(
                            all_branches=self.args.all_branches,
                Severity: Minor
                Found in dvc/commands/gc.py - About 2 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 286 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import argparse
                import re
                from collections.abc import Iterable
                from datetime import date, datetime
                from typing import TYPE_CHECKING
                Severity: Minor
                Found in dvc/commands/experiments/show.py - About 2 hrs to fix

                  File workspace_tests.py has 282 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import os
                  from typing import Union
                  
                  import pytest
                  from funcy import first
                  Severity: Minor
                  Found in dvc/testing/workspace_tests.py - About 2 hrs to fix

                    Function _diff has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def _diff(
                        old: "DataIndex",
                        new: "DataIndex",
                        *,
                        granular: bool = False,
                    Severity: Minor
                    Found in dvc/repo/data.py - About 2 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 pull has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def pull(  # noqa: C901
                        repo,
                        git_remote: str,
                        exp_names: Optional[Union[Iterable[str], str]] = None,
                        all_commits=False,
                    Severity: Minor
                    Found in dvc/repo/experiments/pull.py - About 2 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 remove_tasks has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def remove_tasks(  # noqa: C901, PLR0912
                        celery_queue: "LocalCeleryQueue",
                        queue_entries: Iterable["QueueEntry"],
                    ):
                        """Remove tasks from task queue.
                    Severity: Minor
                    Found in dvc/repo/experiments/queue/remove.py - About 2 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 describe has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def describe(
                        scm: "Git",
                        revs: Iterable[str],
                        logger,
                        refs: Optional[Iterable[str]] = None,
                    Severity: Minor
                    Found in dvc/repo/experiments/utils.py - About 2 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 yappi_profile has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def yappi_profile(
                        path: Optional[Union[Callable[[], str], str]] = None,
                        wall_clock: Optional[bool] = True,
                        separate_threads: Optional[bool] = False,
                    ):
                    Severity: Minor
                    Found in dvc/_debug.py - About 2 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