Function __init__
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, indicator=None, version=PROTOCOL_VERSION, **kwargs):
self.version = version
if 'lowercase' in kwargs:
self._lowercase = kwargs.get('lowercase')
# indicate lowercase arg was explicitly passed by user rather than just a default 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
Indicator
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
class Indicator(object):
def __init__(self, indicator=None, version=PROTOCOL_VERSION, **kwargs):
self.version = version
if 'lowercase' in kwargs:
Function __repr__
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def __repr__(self):
i = {}
for k in FIELDS:
v = getattr(self, k)
- 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
File indicator.py
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
from pprint import pprint
import uuid
import logging
from .constants import PYVERSION, IPV4_PRIVATE_NETS, PROTOCOL_VERSION, FIELDS, FIELDS_TIME, LOG_FORMAT
Function format_keys
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def format_keys(self):
d = self.__dict__()
for k in d:
if PYVERSION == 2:
if not isinstance(d[k], unicode):
- 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 indicator
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def indicator(self, i):
if not i:
self._indicator = None
return
- 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 ',' in x:
tmp_list.extend([y.strip() for y in x.split(',') if y])
else:
tmp_list.append(x.strip())
kwargs[k] = tmp_list