iterative/dvc

View on GitHub

Showing 517 of 578 total issues

Avoid too many return statements within this function.
Open

                    return ui.open_browser(output_file)
Severity: Major
Found in dvc/commands/plots.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return _val
    Severity: Major
    Found in dvc/compare.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return self.fs.relpath(self.fs_path, self.repo.root_dir)
      Severity: Major
      Found in dvc/output.py - About 30 mins to fix

        Function write_json has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def write_json(  # noqa: PLR0913
                self,
                data: Any,
                indent: Optional[int] = None,
                highlight: Optional[bool] = None,
        Severity: Minor
        Found in dvc/ui/__init__.py - About 25 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 table has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def table(
                self,
                data: "TableData",
                headers: Optional["Headers"] = None,
                markdown: bool = False,
        Severity: Minor
        Found in dvc/ui/__init__.py - About 25 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 collect_failed_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def collect_failed_data(
                self,
                baseline_revs: Optional[Collection[str]],
                **kwargs,
            ) -> dict[str, list["ExpRange"]]:
        Severity: Minor
        Found in dvc/repo/experiments/queue/celery.py - About 25 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 wait has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def wait(self, revs: Collection[str], **kwargs) -> None:
                """Block until the specified tasks have completed."""
                revs = [revs] if isinstance(revs, str) else revs
                results = self.match_queue_entry_by_name(
                    revs, self.iter_queued(), self.iter_done(), self.iter_failed()
        Severity: Minor
        Found in dvc/repo/experiments/queue/celery.py - About 25 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 _try_to_kill_tasks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _try_to_kill_tasks(
                self, to_kill: dict[QueueEntry, str], force: bool
            ) -> dict[QueueEntry, str]:
                fail_to_kill_entries: dict[QueueEntry, str] = {}
                for queue_entry, rev in to_kill.items():
        Severity: Minor
        Found in dvc/repo/experiments/queue/celery.py - About 25 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 init_git has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def init_git(
                self,
                repo: "Repo",
                scm: "Git",
                stash_rev: str,
        Severity: Minor
        Found in dvc/repo/experiments/executor/local.py - About 25 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 changed_outs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def changed_outs(self, allow_missing: bool = False) -> bool:
                for out in self.outs:
                    status = out.status()
                    if status:
                        if allow_missing and status[str(out)] == "not in cache":
        Severity: Minor
        Found in dvc/stage/__init__.py - About 25 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 kill has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def kill(self, revs: Collection[str], force: bool = False) -> None:
                name_dict: dict[str, Optional[QueueEntry]] = self.match_queue_entry_by_name(
                    set(revs), self.iter_active()
                )
        
        
        Severity: Minor
        Found in dvc/repo/experiments/queue/celery.py - About 25 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 shutdown has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def shutdown(self, kill: bool = False):
                self.celery.control.shutdown()
                if kill:
                    to_kill: dict[QueueEntry, str] = {}
                    for entry in self.iter_active():
        Severity: Minor
        Found in dvc/repo/experiments/queue/celery.py - About 25 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 merge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def merge(self, ancestor, other, allowed=None) -> None:
                assert other
        
                if not other.outs:
                    return
        Severity: Minor
        Found in dvc/stage/__init__.py - About 25 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 _infer_y_from_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _infer_y_from_data(self):
                if self.plot_id in self.data:
                    for lst in _lists(self.data[self.plot_id]):
                        if all(isinstance(item, dict) for item in lst):
                            datapoint = first(lst)
        Severity: Minor
        Found in dvc/render/converter/vega.py - About 25 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 _get_flags has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def _get_flags(out):
            annot = out.annot.to_dict()
            yield from annot.items()
        
            if not out.use_cache:
        Severity: Minor
        Found in dvc/stage/serialize.py - About 25 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 celery_remove has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def celery_remove(self: "LocalCeleryQueue", revs: Collection[str]) -> list[str]:
            """Remove the specified entries from the queue.
        
            Arguments:
                revs: Stash revisions or queued exp names to be removed.
        Severity: Minor
        Found in dvc/repo/experiments/queue/remove.py - About 25 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 get_definition_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_definition_data(self, target_files, rev):
                result = {}
                for definition_file in target_files:
                    if os.name == "nt":
                        source_file = _normpath(definition_file).replace("\\", "/")
        Severity: Minor
        Found in dvc/render/match.py - About 25 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 save_deps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def save_deps(self, allow_missing=False):
                from dvc.dependency.base import DependencyDoesNotExistError
        
                for dep in self.deps:
                    try:
        Severity: Minor
        Found in dvc/stage/__init__.py - About 25 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 prepare_default_pager has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def prepare_default_pager(
            clear_screen: bool = False,
            quit_if_one_screen: bool = True,
            ansi_escapes: bool = True,
            chop_long_lines: bool = True,
        Severity: Minor
        Found in dvc/ui/pager.py - About 25 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_dataset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _build_dataset(
                cls,
                manifest_path: str,
                spec_data: dict[str, Any],
                lock_data: Optional[dict[str, Any]] = None,
        Severity: Minor
        Found in dvc/repo/datasets.py - About 25 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

        Severity
        Category
        Status
        Source
        Language