debatelab/deepa2

View on GitHub
deepa2/builder/core.py

Summary

Maintainability
C
7 hrs
Test Coverage
B
84%

File core.py has 297 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Defines core abstract classes and data structures for DeepA2 datasets.

This module defines core abstract classes and data structures for building
DeepA2 datasets. The core classess follow the director-builder design pattern.
The `Director` sets up a universal pipeline for transforming a raw dataset.
Severity: Minor
Found in deepa2/builder/core.py - About 3 hrs to fix

    Function transform has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def transform(
            self,
            export_path: Optional[str] = None,
            active_features: Optional[List[str]] = None,
            debug_size: Optional[int] = None,
    Severity: Minor
    Found in deepa2/builder/core.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 process has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def process(self, batched_input: Dict[str, List]) -> Dict[str, List]:
            """
            The Director provides a function that can be mapped over a dataset
            (requiring batches of size 1).
            """
    Severity: Minor
    Found in deepa2/builder/core.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 transform has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def transform(
    Severity: Minor
    Found in deepa2/builder/core.py - About 35 mins to fix

      There are no issues that match your filters.

      Category
      Status