Showing 31 of 31 total issues
File types.py
has 747 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Type Engine."""
import datetime
import re
from .util import repr_
File ebus.py
has 407 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Pythonic EBUS Representation."""
import asyncio
import collections
import logging
Function notify
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def notify(self, msg):
"""
Notify about received message.
Raise:
- 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 filter_msg
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def filter_msg(msg=None, msgdefs=None):
"""Strip Down Message according to `msgdefs`."""
if msg is not None:
ident = msg.msgdef.ident
if msgdefs is not 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 respond
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def respond(self, request):
"""Iterate over response for `request`."""
if request == "quit": # pragma: no cover
yield "connection closed"
yield ""
- 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 _decodefields
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _decodefields(msgdef, valuestr):
if valuestr not in ("no data stored", "nosignal"):
values = valuestr.split(";")
fields = []
for fielddef in msgdef.fields:
- 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 _resolve
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _resolve(self, pattern):
pat = Pattern.from_str(pattern)
circuit, name, setprio, fieldname = pat
for msgdef in self.find(circuit, name):
if fieldname is 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 print_msg
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def print_msg(msg, skipbroken=False):
"""Formatted output."""
if msg.valid:
for field in msg.fields:
# if isinstance(field.value, (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 iter_virtfielddefs
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def iter_virtfielddefs(fielddefs):
"""Iterate over Generic Field Definitions."""
typeclss = [fielddef.type_.__class__ for fielddef in fielddefs]
names = [fielddef.name for fielddef in fielddefs]
if DateType in typeclss and TimeType in typeclss:
- 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 _createfields
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _createfields(chunks):
if chunks:
# determine duplicate names
fields = []
dups = collections.defaultdict(lambda: -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 set_defaultprio
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def set_defaultprio(self, defaultprio):
"""Set Priorities of all messages without a priority value."""
msgdefs = self._msgdefs
for circuitmsgdefs in msgdefs.values():
for msgdefs in circuitmsgdefs.values():
- 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 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __new__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __new__(cls, circuit, name, children, read=False, prio=None, write=False, update=False, setprio=None):
Function _createfield
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _createfield(idx, name, _, __, datatype, dividervalues=None, unit=None, comment=None):
Function _createfield
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _createfield(idx, name, _, __, datatype, dividervalues=None, unit=None, comment=None):
if dividervalues and "=" in dividervalues:
type_ = EnumType(tuple(pair.split("=", 1)[1] for pair in dividervalues.split(";")))
else:
ebustype = datatype.split(",")[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 decode
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def decode(self, value):
"""Decode `value`."""
if value not in ("-", ""):
if self.divider and self.divider > 0:
value = float(value)
- 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 decode_type
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def decode_type(typecode, divider=None):
"""
Get :any:`Type` instance for `typecode`.
Args:
- 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 get_icon
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_icon(fielddef, state=None):
"""
Return Appropriate mdi-icon_ for `fielddef` at `state`.
.. _mdi-icon: https://materialdesignicons.com/
- 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 encode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def encode(self, value):
"""Encode `value`."""
if value is not None:
if self.divider and self.divider > 0:
value = float(value)
- 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
Avoid deeply nested control flow statements. Open
if msg.msgdef == msgdef or not msg.valid:
return msg