iterative/dvc

View on GitHub
dvc/repo/experiments/__init__.py

Summary

Maintainability
C
1 day
Test Coverage

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

    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

      Function get_exact_name has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_exact_name(self, revs: Iterable[str]) -> dict[str, Optional[str]]:
              """Returns preferred name for the specified revision.
      
              Prefers tags, branches (heads), experiments in that order.
              """
      Severity: Minor
      Found in dvc/repo/experiments/__init__.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 reproduce_celery has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def reproduce_celery(
              self, entries: Optional[Iterable["QueueEntry"]] = None, **kwargs
          ) -> dict[str, str]:
              results: dict[str, str] = {}
              if entries is None:
      Severity: Minor
      Found in dvc/repo/experiments/__init__.py - About 1 hr 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_branch_by_rev has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_branch_by_rev(
              self, rev: str, allow_multiple: bool = False
          ) -> Optional[str]:
              """Returns full refname for the experiment branch containing rev."""
              ref_infos = list(exp_refs_by_rev(self.scm, rev))
      Severity: Minor
      Found in dvc/repo/experiments/__init__.py - About 35 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

      There are no issues that match your filters.

      Category
      Status