Showing 1,088 of 2,665 total issues
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, token_number, required, index, line, column, mark):
Function construct_yaml_float
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def construct_yaml_float(self, node):
value = self.construct_scalar(node)
value = value.replace('_', '').lower()
sign = +1
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
Avoid deeply nested control flow statements. Open
if self.encoding:
data = data.encode(self.encoding)
self.stream.write(data)
Function represent_float
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def represent_float(self, data):
if data != data or (data == 0.0 and data == 1.0):
value = '.nan'
elif data == self.inf_value:
value = '.inf'
- 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 br == '\n':
self.write_line_break()
else:
self.write_line_break(br)
self.write_indent()
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, stream, canonical=None, indent=None, width=None,
Function _dnsname_match
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _dnsname_match(dn, hostname, max_wildcards=1):
"""Matching according to RFC 6125, section 6.4.3
http://tools.ietf.org/html/rfc6125#section-6.4.3
"""
- 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 _connect2socket
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _connect2socket(self, res=None):
"""
Connect to a socket, passing the result of getaddrinfo()
:return: boolean
"""
- 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_data_
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_data_(data):
def is_backend(backend):
return backend.get('svname') == 'BACKEND' and backend.get('# pxname') != 'stats'
def is_frontend(frontend):
- 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_until_done
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _send_until_done(self, data):
while True:
try:
return self.connection.send(data)
except OpenSSL.SSL.WantWriteError:
- 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 close
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def close(self):
# TODO: should I do clean shutdown here? Do I have to?
if self._makefile_refs < 1:
self._closed = True
if self.context:
- 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 backport_makefile
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def backport_makefile(self, mode="r", buffering=None, encoding=None,
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, job_name, actual_job_name, priority, cleanup, get_update_every, module_name):
Avoid deeply nested control flow statements. Open
if recalc_timeout:
if "timeout" in kwargs:
kwargs["timeout"] = expires - current_time
continue
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, proxy_url, username=None, password=None,
Avoid deeply nested control flow statements. Open
if _dnsname_match(value, hostname):
return
dnsnames.append(value)
Function create_charts
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_charts(self):
for front in self.data['frontend']:
name, idx = front['# pxname'], front['# pxname'].replace('.', '_')
for metric in METRICS:
self.definitions['f' + metric]['lines'].append(['_'.join(['frontend', metric, idx]),
- 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 make_headers
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def make_headers(keep_alive=None, accept_encoding=None, user_agent=None,
Function check
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check(self):
"""ensure charts and dims all configured and that we can get data"""
if not HAS_REQUESTS:
self.warning('requests library could not be imported')
- 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 current_time > expires:
raise OSError(errno=errno.ETIMEDOUT)
if recalc_timeout: