iterative/dvc

View on GitHub
dvc/commands/experiments/show.py

Summary

Maintainability
F
3 days
Test Coverage

File show.py has 571 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import argparse
import logging
import os
import re
from collections import Counter, OrderedDict, defaultdict
Severity: Major
Found in dvc/commands/experiments/show.py - About 1 day to fix

    Function _collect_rows has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

    def _collect_rows(
        base_rev,
        experiments,
        all_headers,
        metric_headers,
    Severity: Minor
    Found in dvc/commands/experiments/show.py - About 5 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 show_experiments has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def show_experiments(
        all_experiments,
        keep=None,
        drop=None,
        pager=True,
    Severity: Minor
    Found in dvc/commands/experiments/show.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 _sort_column has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def _sort_column(sort_by, metric_names, param_names):
        path, _, sort_name = sort_by.rpartition(":")
        matches = set()
    
        if path:
    Severity: Minor
    Found in dvc/commands/experiments/show.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 _collect_rows has 13 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def _collect_rows(
    Severity: Major
    Found in dvc/commands/experiments/show.py - About 1 hr to fix

      Function experiments_table has 12 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def experiments_table(
      Severity: Major
      Found in dvc/commands/experiments/show.py - About 1 hr to fix

        Function _extend_row has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        def _extend_row(row, names, headers, items, precision, fill_value=FILL_VALUE):
            from dvc.compare import _format_field, with_value
        
            for fname, data in items:
                item = data.get("data", {})
        Severity: Minor
        Found in dvc/commands/experiments/show.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 run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def run(self):
                try:
                    all_experiments = self.repo.experiments.show(
                        all_branches=self.args.all_branches,
                        all_tags=self.args.all_tags,
        Severity: Minor
        Found in dvc/commands/experiments/show.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 show_experiments has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def show_experiments(
        Severity: Major
        Found in dvc/commands/experiments/show.py - About 1 hr to fix

          Function _extend_row has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def _extend_row(row, names, headers, items, precision, fill_value=FILL_VALUE):
          Severity: Minor
          Found in dvc/commands/experiments/show.py - About 45 mins to fix

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

            def _sort_exp(experiments, sort_path, sort_name, typ, reverse):
            Severity: Minor
            Found in dvc/commands/experiments/show.py - About 35 mins to fix

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

              def _collect_names(all_experiments, **kwargs):
                  metric_names = defaultdict(dict)
                  param_names = defaultdict(dict)
                  deps_names = set()
              
              
              Severity: Minor
              Found in dvc/commands/experiments/show.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