dvc/commands/plots.py
File plots.py
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import argparse
import os
from typing import TYPE_CHECKING, Optional
from funcy import compact, first, get_in
Function run
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
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
- Read upRead up
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_parser
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def add_parser(subparsers, parent_parser):
PLOTS_HELP = "Commands to visualize and compare plot data."
plots_parser = subparsers.add_parser(
"plots",
Function run
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def run(self):
from dvc.exceptions import InvalidArgumentError
from dvc_render.vega_templates import TEMPLATES
try:
- Read upRead up
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
Avoid too many return
statements within this function. Open
Open
return 0
Avoid too many return
statements within this function. Open
Open
return 1
Avoid too many return
statements within this function. Open
Open
return ui.open_browser(output_file)
Avoid too many return
statements within this function. Open
Open
return 0