errbotio/errbot

View on GitHub
errbot/flow.py

Summary

Maintainability
C
1 day
Test Coverage

File flow.py has 417 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import atexit
import logging
from multiprocessing.pool import ThreadPool
from threading import RLock
from typing import Any, Callable, List, Mapping, Optional, Tuple, Union
Severity: Minor
Found in errbot/flow.py - About 6 hrs to fix

    Function execute has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

        def execute(self, flow: Flow) -> None:
            """
            This is where the flow execution happens from one of the thread of the pool.
            """
            while True:
    Severity: Minor
    Found in errbot/flow.py - About 4 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 check_inflight_flow_triggered has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_inflight_flow_triggered(
            self, cmd: str, user: Identifier
        ) -> Tuple[Optional[Flow], Optional[FlowNode]]:
            """
            Check if a command from a specific user was expected in one of the running flow.
    Severity: Minor
    Found in errbot/flow.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

    Avoid deeply nested control flow statements.
    Open

                            if next_step.command == cmd:
                                log.debug(
                                    "Requestor has a flow in flight waiting for this command!"
                                )
                                return flow, next_step
    Severity: Major
    Found in errbot/flow.py - About 45 mins to fix

      There are no issues that match your filters.

      Category
      Status