iterative/dvc

View on GitHub
dvc/repo/plots/template.py

Summary

Maintainability
C
1 day
Test Coverage

File template.py has 541 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import json
import os
from typing import Any, Dict, Optional

from funcy import cached_property
Severity: Major
Found in dvc/repo/plots/template.py - About 1 day to fix

    Function get_template has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_template(self, path):
            if os.path.exists(path):
                return path
    
            if self.dvc_dir and os.path.exists(self.dvc_dir):
    Severity: Minor
    Found in dvc/repo/plots/template.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

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

        def load(self, name):
            try:
                path = self.get_template(name)
    
                with open(path) as fd:
    Severity: Minor
    Found in dvc/repo/plots/template.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