modi/util/firmware_updater.py
File firmware_updater.py
has 1435 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import io
import sys
import time
import json
import serial
Function update_module_firmware
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def update_module_firmware(self, update_network_base=False):
if update_network_base:
self.update_network_base = True
# Retrieve the network id only and update it accordingly
timeout, delay = 3, 0.1
- 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 send_firmware_command
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def send_firmware_command(self, oper_type: str, module_id: int,
Function get_firmware_command
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def get_firmware_command(self, module_id: int, rot_stype: int,
Function get_firmware_command
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def get_firmware_command(self, module_id: int, rot_stype: int,
Function send_firmware_command
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def send_firmware_command(self, oper_type: str, module_id: int,
Function __send_pkt
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __send_pkt(self, pkt, wait=True, timeout=None, continuous=False):
Function send_firmware_data
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def send_firmware_data(self, module_id: int, seq_num: int, bin_data: bytes,
Function send_firmware_data
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def send_firmware_data(self, module_id: int, seq_num: int, bin_data: bytes,
Function __write_chunk
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __write_chunk(self, chunk, curr_seq, total_seq, manager):