Showing 20 of 84 total issues
File states.py
has 402 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""This module contains the state machine for the communication class.
Click on this image to go to the states from the diagram:
.. image:: ../../../_static/CommunicationStateDiagram.svg
File hardware_messages.py
has 355 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""This modue contains all the messages taht are received."""
from ..utils import next_line
from collections import namedtuple
from .carriages import id_to_carriage_type
import struct
State
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class State(object):
"""The base class for states."""
def __init__(self, communication):
Function colors_to_needle_positions
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def colors_to_needle_positions(rows):
"""Convert rows to needle positions.
:return:
:rtype: list
- 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
Communication
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Communication(object):
"""This class comunicates with the AYAB shield."""
def __init__(self, file, get_needle_positions, machine,
File test_hardware_messages.py
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Test the received messages."""
from AYABInterface.communication.host_messages import LineConfirmation
from AYABInterface.communication.hardware_messages import read_message_type, \
UnknownMessage, SuccessConfirmation, StartConfirmation, LineRequest, \
InformationConfirmation, TestConfirmation, StateIndication, Debug, \
Function assert_identify
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def assert_identify(message, expected_true=[]):
"""Make sure the messages "is_*" are True or False."""
true = set()
false = set()
expected_false = 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"
Further reading
Function test_versions
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_versions(self, ready, valid, left_hall, left_bytes, right_hall,
Function needle_positions_to_bytes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def needle_positions_to_bytes(self, needle_positions):
"""Convert the needle positions to the wire format.
This conversion is used for :ref:`cnfline`.
- 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__(self, file, get_needle_positions, machine,
Function test_line_number
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_line_number(self, last_line, next_line, byte, monkeypatch, file,
Function test_get_normal_line
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_get_normal_line(self, cache, machine, machine_bytes, last_line,
Function list_serial_port_strings
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def list_serial_port_strings():
"""Lists serial port names.
:raises EnvironmentError:
On unsupported or unknown platforms
- 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 check
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check(self):
"""Check for validity.
:raises ValueError:
- 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 communication
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def communication(file, on_message_received, monkeypatch, create_message,
Function test_bytes
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_bytes(self, line_number, communication, file, line_bytes,
Function test_communication_creation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_communication_creation(self, interaction, communication, machine,
Function test_cache_works_only_for_specific_line
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_cache_works_only_for_specific_line(
Function test_last
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_last(self, get_line, cache, number, line, truth):
Function sum_all
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sum_all(iterable, start):
"""Sum up an iterable starting with a start value.
In contrast to :func:`sum`, this also works on other types like
:class:`lists <list>` and :class:`sets <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"