r3w0p/bobocep

View on GitHub

Showing 69 of 69 total issues

Function _tcp_outgoing has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
Open

    def _tcp_outgoing(self):
        """
        Executed within a thread. It sends internal Decider state updates,
        stored in the outgoing queue, to external `BoboCEP` instances.
        """
Severity: Minor
Found in bobocep/dist/tcp.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

File tcp.py has 616 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright (c) 2019-2023 r3w0p
# The following code can be redistributed and/or
# modified under the terms of the MIT License.

"""
Severity: Major
Found in bobocep/dist/tcp.py - About 1 day to fix

    File decider.py has 512 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # Copyright (c) 2019-2023 r3w0p
    # The following code can be redistributed and/or
    # modified under the terms of the MIT License.
    
    """
    Severity: Major
    Found in bobocep/cep/engine/decider/decider.py - About 1 day to fix

      Function on_distributed_update has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
      Open

          def on_distributed_update(
                  self,
                  completed: List[BoboRunSerial],
                  halted: List[BoboRunSerial],
                  updated: List[BoboRunSerial]) -> None:
      Severity: Minor
      Found in bobocep/cep/engine/decider/decider.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 _tcp_incoming_handle_client has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

          def _tcp_incoming_handle_client(
                  self, client_s, client_addr, client_accepted: int) -> None:
              """
              Handles an incoming client request.
              :param client_s: The client socket.
      Severity: Minor
      Found in bobocep/dist/tcp.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_against_patterns has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          def _check_against_patterns(self, event: BoboEvent) -> \
                  Tuple[List[BoboRun], List[BoboRun]]:
              """
              :param event: An event.
      
      
      Severity: Minor
      Found in bobocep/cep/engine/decider/decider.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_against_runs has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          def _check_against_runs(self, event: BoboEvent) -> \
                  Tuple[List[BoboRun], List[BoboRun], List[BoboRun]]:
              """
              :param event: An event.
      
      
      Severity: Minor
      Found in bobocep/cep/engine/decider/decider.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 _process_not_loop has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          def _process_not_loop(self,
                                event: BoboEvent,
                                block: BoboPatternBlock,
                                temp_index: int) -> bool:
              """
      Severity: Minor
      Found in bobocep/cep/engine/decider/run.py - About 3 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 __init__ has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, events: Dict[str, List[BoboEvent]]):
              """
              :param events: The history of events.
                  Keys are group names.
                  Values are lists of BoboEvent instances associated with a group.
      Severity: Minor
      Found in bobocep/cep/event/history.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

      File handler.py has 265 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # Copyright (c) 2019-2023 r3w0p
      # The following code can be redistributed and/or
      # modified under the terms of the MIT License.
      
      """
      Severity: Minor
      Found in bobocep/cep/action/handler.py - About 2 hrs to fix

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

            def __init__(self,
        Severity: Major
        Found in bobocep/dist/tcp.py - About 2 hrs to fix

          File run.py has 258 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # Copyright (c) 2019-2023 r3w0p
          # The following code can be redistributed and/or
          # modified under the terms of the MIT License.
          
          """
          Severity: Minor
          Found in bobocep/cep/engine/decider/run.py - About 2 hrs to fix

            BoboDecider has 21 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class BoboDecider(BoboEngineTask,
                              BoboDeciderPublisher,
                              BoboReceiverSubscriber,
                              BoboDistributedSubscriber):
                """
            Severity: Minor
            Found in bobocep/cep/engine/decider/decider.py - About 2 hrs to fix

              Function update has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  def update(self) -> bool:
                      """
                      Updates the receiver, then the decider, then the producer, and
                      finally to the forwarder.
                      It updates each task `n` times, depending on how many times were
              Severity: Minor
              Found in bobocep/cep/engine/engine.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 snapshot has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  def snapshot(self) -> Tuple[
                      List[BoboRunSerial], List[BoboRunSerial], List[BoboRunSerial]
                  ]:
                      """
                      A snapshot of the current state of the Decider.
              Severity: Minor
              Found in bobocep/cep/engine/decider/decider.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 evaluate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  def evaluate(self, event: BoboEvent, history: BoboHistory) -> bool:
                      """
                      :param event: The event used for evaluation.
                      :param history: The history of currently accepted events.
                      :return: `True` if predicate is satisfied; `False` otherwise.
              Severity: Minor
              Found in bobocep/cep/phenom/pattern/predicate.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 __init__ has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def __init__(self,
                               urn: str,
                               decider: BoboDeciderPublisher,
                               devices: List[BoboDevice],
                               crypto: BoboDistributedCrypto,
              Severity: Minor
              Found in bobocep/dist/tcp.py - About 1 hr to fix

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

                    def __init__(self,
                Severity: Major
                Found in bobocep/cep/engine/engine.py - About 1 hr to fix

                  Function _process_loop has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _process_loop(self,
                                        event: BoboEvent,
                                        block: BoboPatternBlock,
                                        temp_index: int) -> bool:
                          """
                  Severity: Minor
                  Found in bobocep/cep/engine/decider/run.py - About 55 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 process has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def process(self, event: BoboEvent) -> bool:
                          """
                          :param event: An event for the run to process.
                          :return: `True` if the event caused a state change in the run;
                              `False` otherwise.
                  Severity: Minor
                  Found in bobocep/cep/engine/decider/run.py - About 55 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

                  Severity
                  Category
                  Status
                  Source
                  Language