iterative/dvc

View on GitHub
dvc/repo/stage.py

Summary

Maintainability
C
1 day
Test Coverage

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

import fnmatch
import typing
from collections.abc import Iterable
from contextlib import suppress
from functools import wraps
Severity: Minor
Found in dvc/repo/stage.py - About 4 hrs to fix

    Function collect_granular has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def collect_granular(
            self,
            target: Optional[str] = None,
            with_deps: bool = False,
            recursive: bool = False,
    Severity: Minor
    Found in dvc/repo/stage.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 create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def create(
            self,
            single_stage: bool = False,
            validate: bool = True,
            fname: Optional[str] = None,
    Severity: Minor
    Found in dvc/repo/stage.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 add has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def add(
    Severity: Minor
    Found in dvc/repo/stage.py - About 45 mins to fix

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

      def _collect_specific_target(
          loader: "StageLoad",
          target: str,
          with_deps: bool,
          recursive: bool,
      Severity: Minor
      Found in dvc/repo/stage.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 collect has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

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

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

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

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

              def collect(
                  self,
                  target: Optional[str] = None,
                  with_deps: bool = False,
                  recursive: bool = False,
          Severity: Minor
          Found in dvc/repo/stage.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

          There are no issues that match your filters.

          Category
          Status