Showing 41 of 43 total issues
File firmware_updater.py
has 1435 lines of code (exceeds 250 allowed). Consider refactoring. Open
import io
import sys
import time
import json
import serial
File inspection_util.py
has 355 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
import time
import threading as th
File tutorial_util.py
has 303 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
import time
from textwrap import fill
from textwrap import dedent
File usage_util.py
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
from textwrap import fill
from textwrap import dedent
Function parse_data
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def parse_data(values, data_type: str) -> Tuple:
data = []
if data_type == 'int':
for value in values:
if value >= 0:
- 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 update_module_firmware
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. 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 run
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(self):
width, height = 930, 790
window = Tk()
window.title(f"GUI Debugger for PyMODI (v{modi.__version__})")
window.geometry(f"{width}x{height}")
Function __init_task
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def __init_task(
self, conn_type, verbose, port, network_uuid,
):
if not conn_type:
is_can = not is_network_module_connected() and is_on_pi()
- 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 __update_health
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def __update_health(self, message):
""" Update information by health message
:param message: Dictionary format message of the module
:type message: Dictionary
- 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 __update_topology
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def __update_topology(self, message):
"""Update the topology of the connected modules
:param message: Dictionary format message of the module
:return: None
- 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 inspect_button
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def inspect_button(self, button, i, nb_modules):
self.print_wrap(
"""
Button module has cliked, double_clicked, pressed, toggled as its
property.
Function run_lesson3
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_lesson3(self):
led = self.led
led.rgb = 0, 0, 0
self.clear()
self.print_lesson(3, "Controlling modules")
Function run_lesson4
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_lesson4(self):
button = self.button
led = self.led
self.clear()
Consider simplifying this complex logical expression. Open
if ('recv' not in line and 'send' not in line) or \
(self.__curr_module and str(self.__curr_module.id) not in line
and self.__curr_module.module_type != 'network') \
or (self.__curr_cmd and f'"c":{self.__curr_cmd},' not in line):
return False
Function __trim_map
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __trim_map(self, raw_map: List):
"""
Trims the matrix to get rid of empty spaces, containing zeros only
"""
x, y, w, h = -1, -1, 1, 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 __parse_set_message
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __parse_set_message(destination_id: int,
property_type: int,
property_values: Tuple,
property_data_type: int) -> List[str]:
"""Generate set_property json serialized message
- 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 __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function get_firmware_command
has 6 arguments (exceeds 4 allowed). Consider refactoring. 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
def send_firmware_command(self, oper_type: str, module_id: int,
Function __update_map
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __update_map(self, module_id: int, x: int, y: int, prev_id: int,