LucaCappelletti94/histograms

View on GitHub
barplots/utils/plot_bar_labels.py

Summary

Maintainability
C
1 day
Test Coverage
A
100%

Function plot_bar_labels has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

def plot_bar_labels(
    axes: Axes,
    figure: Figure,
    df: pd.DataFrame,
    vertical: bool,
Severity: Minor
Found in barplots/utils/plot_bar_labels.py - About 1 day 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 plot_bar_labels has 16 arguments (exceeds 4 allowed). Consider refactoring.
Open

def plot_bar_labels(
Severity: Major
Found in barplots/utils/plot_bar_labels.py - About 2 hrs to fix

    Function sanitize_digits has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def sanitize_digits(digit: float, unit: Optional[str], normalized: bool):
        unit = "" if unit is None else unit
        absolute_digit = abs(digit)
        if not normalized and digit != 0.0 and (absolute_digit <= 1e-3 or absolute_digit >= 1e3):
            for (lower_factor, lower_value), (higher_factor, higher_value) in zip(
    Severity: Minor
    Found in barplots/utils/plot_bar_labels.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

    There are no issues that match your filters.

    Category
    Status