localstack-core/localstack/utils/kinesis/kinesis_connector.py
File kinesis_connector.py
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
#!/usr/bin/env python
import json
import logging
import os
import re
Function process_records
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
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)
- Read upRead up
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
Open
def listen_to_kinesis(
Function _start_kcl_client_process
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _start_kcl_client_process(
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function retrieve_loop
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
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()
- Read upRead up
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"