iterative/dvc

View on GitHub
dvc/commands/plots.py

Summary

Maintainability
C
1 day
Test Coverage

File plots.py has 331 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import argparse
import json
import logging
import os

Severity: Minor
Found in dvc/commands/plots.py - About 3 hrs to fix

    Function run has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def run(self):
            from pathlib import Path
    
            from dvc.render.match import match_renderers
            from dvc_render import render_html
    Severity: Minor
    Found in dvc/commands/plots.py - About 3 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 add_parser has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def add_parser(subparsers, parent_parser):
        PLOTS_HELP = (
            "Commands to visualize and compare plot metrics in structured files "
            "(JSON, YAML, CSV, TSV)."
        )
    Severity: Minor
    Found in dvc/commands/plots.py - About 1 hr to fix

      Avoid too many return statements within this function.
      Open

                      return 0
      Severity: Major
      Found in dvc/commands/plots.py - About 30 mins to fix

        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 0
          Severity: Major
          Found in dvc/commands/plots.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return 1
            Severity: Major
            Found in dvc/commands/plots.py - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status