localstack/localstack

View on GitHub
localstack-core/localstack/utils/kinesis/kinesis_connector.py

Summary

Maintainability
C
7 hrs
Test Coverage

File kinesis_connector.py has 315 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
import json
import logging
import os
import re
Severity: Minor
Found in localstack-core/localstack/utils/kinesis/kinesis_connector.py - About 3 hrs to fix

    Function process_records has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def process_records(self, process_records_input):
            if self.processor_func:
                records = process_records_input.records
                checkpointer = process_records_input.checkpointer
                self.processor_func(records=records, checkpointer=checkpointer, shard_id=self.shard_id)
    Severity: Minor
    Found in localstack-core/localstack/utils/kinesis/kinesis_connector.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 listen_to_kinesis has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def listen_to_kinesis(
    Severity: Minor
    Found in localstack-core/localstack/utils/kinesis/kinesis_connector.py - About 45 mins to fix

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

      def _start_kcl_client_process(
      Severity: Minor
      Found in localstack-core/localstack/utils/kinesis/kinesis_connector.py - About 35 mins to fix

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

            def __init__(
        Severity: Minor
        Found in localstack-core/localstack/utils/kinesis/kinesis_connector.py - About 35 mins to fix

          Function retrieve_loop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def retrieve_loop(self, params):
                  self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
                  self.sock.bind(self.events_file)
                  self.sock.listen(1)
                  self.is_ready.set()
          Severity: Minor
          Found in localstack-core/localstack/utils/kinesis/kinesis_connector.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