errbotio/errbot

View on GitHub
errbot/botplugin.py

Summary

Maintainability
D
2 days
Test Coverage

File botplugin.py has 705 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logging
import re
import shlex
from io import IOBase
from threading import Timer, current_thread
Severity: Major
Found in errbot/botplugin.py - About 1 day to fix

    Function recurse_check_structure has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def recurse_check_structure(sample: Any, to_check: Any) -> None:
        sample_type = type(sample)
        to_check_type = type(to_check)
    
        # Skip this check if the sample is None because it will always be something
    Severity: Minor
    Found in errbot/botplugin.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 send_card has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def send_card(
    Severity: Major
    Found in errbot/botplugin.py - About 1 hr to fix

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

          def send_templated(
      Severity: Minor
      Found in errbot/botplugin.py - About 45 mins to fix

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

            def program_next_poll(
        Severity: Minor
        Found in errbot/botplugin.py - About 45 mins to fix

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

              def send_stream_request(
          Severity: Minor
          Found in errbot/botplugin.py - About 45 mins to fix

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

                def __init__(
            Severity: Minor
            Found in errbot/botplugin.py - About 45 mins to fix

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

                  def start_poller(
              Severity: Minor
              Found in errbot/botplugin.py - About 45 mins to fix

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

                    def poller(
                Severity: Minor
                Found in errbot/botplugin.py - About 45 mins to fix

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

                      def start_poller(
                  Severity: Minor
                  Found in errbot/botplugin.py - About 35 mins to fix

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

                        def send(
                    Severity: Minor
                    Found in errbot/botplugin.py - About 35 mins to fix

                      Function __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def __init__(
                              self,
                              function: Callable,
                              cmd_type: Optional[Callable] = None,
                              cmd_args=None,
                      Severity: Minor
                      Found in errbot/botplugin.py - About 35 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 poller has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def poller(
                              self,
                              interval: float,
                              method: Callable[..., None],
                              times: int = None,
                      Severity: Minor
                      Found in errbot/botplugin.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