Cyclomatic complexity is too high in method _write_messages. (7) Open
def _write_messages(self, record_type, table_name, query, ur):
'''
Write messsages for all the records found in the specified table,
according to the logic contained in the query object.
'''
- Read upRead up
- Exclude checks
Cyclomatic Complexity
Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.
Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:
Construct | Effect on CC | Reasoning |
---|---|---|
if | +1 | An if statement is a single decision. |
elif | +1 | The elif statement adds another decision. |
else | +0 | The else statement does not cause a new decision. The decision is at the if. |
for | +1 | There is a decision at the start of the loop. |
while | +1 | There is a decision at the while statement. |
except | +1 | Each except branch adds a new conditional path of execution. |
finally | +0 | The finally block is unconditionally executed. |
with | +1 | The with statement roughly corresponds to a try/except block (see PEP 343 for details). |
assert | +1 | The assert statement internally roughly equals a conditional statement. |
Comprehension | +1 | A list/set/dict comprehension of generator expression is equivalent to a for loop. |
Boolean Operator | +1 | Every boolean operator (and, or) adds a decision point. |
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, db, qpath, inc_vos=None, exc_vos=None, local=False, withhold_dns=False):
Function _write_messages
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _write_messages(self, record_type, table_name, query, ur):
'''
Write messsages for all the records found in the specified table,
according to the logic contained in the query object.
'''
- 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_base_query
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _get_base_query(self, record_type):
'''
Set up a query object containing the logic which is common for
all users of this DbUnloader.
'''
- 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
Class 'DbUnloader' inherits from object, can be safely removed from bases in python3 Open
class DbUnloader(object):
- Read upRead up
- Exclude checks
Used when a class inherit from object, which under python3 is implicit, hence can be safely removed from bases.
Too many arguments (7/5) Open
def __init__(self, db, qpath, inc_vos=None, exc_vos=None, local=False, withhold_dns=False):
- Read upRead up
- Exclude checks
Used when a function or method takes too many arguments.
Unable to import 'dirq.QueueSimple' Open
from dirq.QueueSimple import QueueSimple
- Read upRead up
- Exclude checks
Used when pylint has been unable to import a module.
Whitespace after '[' Open
start_tuple = [ int(x) for x in start.split('-') ]
- Read upRead up
- Exclude checks
Avoid extraneous whitespace.
Avoid extraneous whitespace in these situations:
- Immediately inside parentheses, brackets or braces.
- Immediately before a comma, semicolon, or colon.
Okay: spam(ham[1], {eggs: 2})
E201: spam( ham[1], {eggs: 2})
E201: spam(ham[ 1], {eggs: 2})
E201: spam(ham[1], { eggs: 2})
E202: spam(ham[1], {eggs: 2} )
E202: spam(ham[1 ], {eggs: 2})
E202: spam(ham[1], {eggs: 2 })
E203: if x == 4: print x, y; x, y = y , x
E203: if x == 4: print x, y ; x, y = y, x
E203: if x == 4 : print x, y; x, y = y, x
Whitespace before ')' Open
buf.write('\n'.join( [ record.get_ur(self._withhold_dns) for record in records ] ))
- Read upRead up
- Exclude checks
Avoid extraneous whitespace.
Avoid extraneous whitespace in these situations:
- Immediately inside parentheses, brackets or braces.
- Immediately before a comma, semicolon, or colon.
Okay: spam(ham[1], {eggs: 2})
E201: spam( ham[1], {eggs: 2})
E201: spam(ham[ 1], {eggs: 2})
E201: spam(ham[1], { eggs: 2})
E202: spam(ham[1], {eggs: 2} )
E202: spam(ham[1 ], {eggs: 2})
E202: spam(ham[1], {eggs: 2 })
E203: if x == 4: print x, y; x, y = y , x
E203: if x == 4: print x, y ; x, y = y, x
E203: if x == 4 : print x, y; x, y = y, x
Line too long (81 > 79 characters) Open
msgs, records = self._write_messages(record_type, table_name, query, car)
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Line too long (80 > 79 characters) Open
raise ApelDbException('Cannot unload StorageRecords in APEL format')
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Line too long (91 > 79 characters) Open
buf.write('\n'.join( [ record.get_ur(self._withhold_dns) for record in records ] ))
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Line too long (94 > 79 characters) Open
buf.write('%%\n'.join( [ record.get_msg(self._withhold_dns) for record in records ] ))
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Line too long (106 > 79 characters) Open
for batch in self._db.get_sync_records(query=query, records_per_message=self.records_per_message):
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Line too long (80 > 79 characters) Open
msgs, records = self._write_messages(record_type, table_name, query, ur)
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Line too long (84 > 79 characters) Open
msgs, records = self._write_messages(record_type, table_name, query, ur)
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Whitespace before ']' Open
buf.write('\n'.join( [ record.get_ur(self._withhold_dns) for record in records ] ))
- Read upRead up
- Exclude checks
Avoid extraneous whitespace.
Avoid extraneous whitespace in these situations:
- Immediately inside parentheses, brackets or braces.
- Immediately before a comma, semicolon, or colon.
Okay: spam(ham[1], {eggs: 2})
E201: spam( ham[1], {eggs: 2})
E201: spam(ham[ 1], {eggs: 2})
E201: spam(ham[1], { eggs: 2})
E202: spam(ham[1], {eggs: 2} )
E202: spam(ham[1 ], {eggs: 2})
E202: spam(ham[1], {eggs: 2 })
E203: if x == 4: print x, y; x, y = y , x
E203: if x == 4: print x, y ; x, y = y, x
E203: if x == 4 : print x, y; x, y = y, x
Whitespace before ']' Open
buf.write('%%\n'.join( [ record.get_msg(self._withhold_dns) for record in records ] ))
- Read upRead up
- Exclude checks
Avoid extraneous whitespace.
Avoid extraneous whitespace in these situations:
- Immediately inside parentheses, brackets or braces.
- Immediately before a comma, semicolon, or colon.
Okay: spam(ham[1], {eggs: 2})
E201: spam( ham[1], {eggs: 2})
E201: spam(ham[ 1], {eggs: 2})
E201: spam(ham[1], { eggs: 2})
E202: spam(ham[1], {eggs: 2} )
E202: spam(ham[1 ], {eggs: 2})
E202: spam(ham[1], {eggs: 2 })
E203: if x == 4: print x, y; x, y = y , x
E203: if x == 4: print x, y ; x, y = y, x
E203: if x == 4 : print x, y; x, y = y, x
Line too long (80 > 79 characters) Open
from apel.db import (Query, ApelDbException, JOB_MSG_HEADER, SUMMARY_MSG_HEADER,
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Line too long (80 > 79 characters) Open
# 'paces/2012/11/aggregatedcomputerecord" xmlns:urf="htt'
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Expected 2 blank lines, found 1 Open
def get_start_of_previous_month(dt):
- Read upRead up
- Exclude checks
Separate top-level function and class definitions with two blank lines.
Method definitions inside a class are separated by a single blank
line.
Extra blank lines may be used (sparingly) to separate groups of
related functions. Blank lines may be omitted between a bunch of
related one-liners (e.g. a set of dummy implementations).
Use blank lines in functions, sparingly, to indicate logical
sections.
Okay: def a():\n pass\n\n\ndef b():\n pass
Okay: def a():\n pass\n\n\nasync def b():\n pass
Okay: def a():\n pass\n\n\n# Foo\n# Bar\n\ndef b():\n pass
Okay: default = 1\nfoo = 1
Okay: classify = 1\nfoo = 1
E301: class Foo:\n b = 0\n def bar():\n pass
E302: def a():\n pass\n\ndef b(n):\n pass
E302: def a():\n pass\n\nasync def b(n):\n pass
E303: def a():\n pass\n\n\n\ndef b(n):\n pass
E303: def a():\n\n\n\n pass
E304: @decorator\n\ndef a():\n pass
E305: def a():\n pass\na()
E306: def a():\n def b():\n pass\n def c():\n pass
Line too long (111 > 79 characters) Open
UR_OPEN = ('<sr:StorageUsageRecords xmlns:sr="http://eu-emi.eu/namespaces/2011/02/storagerecord">')
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Line too long (86 > 79 characters) Open
# get into the previous month by subtracting a day from the first day of the month
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Line too long (126 > 79 characters) Open
for batch in self._db.get_records(record_type, table_name, query=query, records_per_message=self.records_per_message):
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Line too long (80 > 79 characters) Open
'001/XMLSchema-instance" xsi:schemaLocation="http://eu-e'
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Line too long (95 > 79 characters) Open
def __init__(self, db, qpath, inc_vos=None, exc_vos=None, local=False, withhold_dns=False):
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Line too long (80 > 79 characters) Open
# UR_OPEN = ('<aur:SummaryRecords xmlns:aur="http://eu-emi.eu/names'
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Whitespace after '(' Open
buf.write('\n'.join( [ record.get_ur(self._withhold_dns) for record in records ] ))
- Read upRead up
- Exclude checks
Avoid extraneous whitespace.
Avoid extraneous whitespace in these situations:
- Immediately inside parentheses, brackets or braces.
- Immediately before a comma, semicolon, or colon.
Okay: spam(ham[1], {eggs: 2})
E201: spam( ham[1], {eggs: 2})
E201: spam(ham[ 1], {eggs: 2})
E201: spam(ham[1], { eggs: 2})
E202: spam(ham[1], {eggs: 2} )
E202: spam(ham[1 ], {eggs: 2})
E202: spam(ham[1], {eggs: 2 })
E203: if x == 4: print x, y; x, y = y , x
E203: if x == 4: print x, y ; x, y = y, x
E203: if x == 4 : print x, y; x, y = y, x
Whitespace after '[' Open
buf.write('\n'.join( [ record.get_ur(self._withhold_dns) for record in records ] ))
- Read upRead up
- Exclude checks
Avoid extraneous whitespace.
Avoid extraneous whitespace in these situations:
- Immediately inside parentheses, brackets or braces.
- Immediately before a comma, semicolon, or colon.
Okay: spam(ham[1], {eggs: 2})
E201: spam( ham[1], {eggs: 2})
E201: spam(ham[ 1], {eggs: 2})
E201: spam(ham[1], { eggs: 2})
E202: spam(ham[1], {eggs: 2} )
E202: spam(ham[1 ], {eggs: 2})
E202: spam(ham[1], {eggs: 2 })
E203: if x == 4: print x, y; x, y = y , x
E203: if x == 4: print x, y ; x, y = y, x
E203: if x == 4 : print x, y; x, y = y, x
Line too long (80 > 79 characters) Open
msgs, records = self._write_messages(record_type, table_name, query, ur)
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Line too long (86 > 79 characters) Open
raise ApelDbException('Cannot withhold DNs for %s' % record_type.__name__)
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Line too long (80 > 79 characters) Open
# 'p://eu-emi.eu/namespaces/2012/11/computerecord" xmlns'
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Line too long (88 > 79 characters) Open
SyncRecord, CloudRecord, CloudSummaryRecord, StorageRecord)
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Whitespace before ']' Open
start_tuple = [ int(x) for x in start.split('-') ]
- Read upRead up
- Exclude checks
Avoid extraneous whitespace.
Avoid extraneous whitespace in these situations:
- Immediately inside parentheses, brackets or braces.
- Immediately before a comma, semicolon, or colon.
Okay: spam(ham[1], {eggs: 2})
E201: spam( ham[1], {eggs: 2})
E201: spam(ham[ 1], {eggs: 2})
E201: spam(ham[1], { eggs: 2})
E202: spam(ham[1], {eggs: 2} )
E202: spam(ham[1 ], {eggs: 2})
E202: spam(ham[1], {eggs: 2 })
E203: if x == 4: print x, y; x, y = y , x
E203: if x == 4: print x, y ; x, y = y, x
E203: if x == 4 : print x, y; x, y = y, x
Whitespace after '[' Open
end_tuple = [ int(x) for x in end.split('-') ]
- Read upRead up
- Exclude checks
Avoid extraneous whitespace.
Avoid extraneous whitespace in these situations:
- Immediately inside parentheses, brackets or braces.
- Immediately before a comma, semicolon, or colon.
Okay: spam(ham[1], {eggs: 2})
E201: spam( ham[1], {eggs: 2})
E201: spam(ham[ 1], {eggs: 2})
E201: spam(ham[1], { eggs: 2})
E202: spam(ham[1], {eggs: 2} )
E202: spam(ham[1 ], {eggs: 2})
E202: spam(ham[1], {eggs: 2 })
E203: if x == 4: print x, y; x, y = y , x
E203: if x == 4: print x, y ; x, y = y, x
E203: if x == 4 : print x, y; x, y = y, x
Line too long (80 > 79 characters) Open
# ':xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:'
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Whitespace after '[' Open
buf.write('%%\n'.join( [ record.get_msg(self._withhold_dns) for record in records ] ))
- Read upRead up
- Exclude checks
Avoid extraneous whitespace.
Avoid extraneous whitespace in these situations:
- Immediately inside parentheses, brackets or braces.
- Immediately before a comma, semicolon, or colon.
Okay: spam(ham[1], {eggs: 2})
E201: spam( ham[1], {eggs: 2})
E201: spam(ham[ 1], {eggs: 2})
E201: spam(ham[1], { eggs: 2})
E202: spam(ham[1], {eggs: 2} )
E202: spam(ham[1 ], {eggs: 2})
E202: spam(ham[1], {eggs: 2 })
E203: if x == 4: print x, y; x, y = y , x
E203: if x == 4: print x, y ; x, y = y, x
E203: if x == 4 : print x, y; x, y = y, x
Line too long (80 > 79 characters) Open
's/2012/11/computerecord" xmlns:xsi="http://www.w3.org/2'
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Line too long (89 > 79 characters) Open
raise ApelDbException('Can only send URs for JobRecords and StorageRecords.')
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Whitespace after '(' Open
buf.write('%%\n'.join( [ record.get_msg(self._withhold_dns) for record in records ] ))
- Read upRead up
- Exclude checks
Avoid extraneous whitespace.
Avoid extraneous whitespace in these situations:
- Immediately inside parentheses, brackets or braces.
- Immediately before a comma, semicolon, or colon.
Okay: spam(ham[1], {eggs: 2})
E201: spam( ham[1], {eggs: 2})
E201: spam(ham[ 1], {eggs: 2})
E201: spam(ham[1], { eggs: 2})
E202: spam(ham[1], {eggs: 2} )
E202: spam(ham[1 ], {eggs: 2})
E202: spam(ham[1], {eggs: 2 })
E203: if x == 4: print x, y; x, y = y , x
E203: if x == 4: print x, y ; x, y = y, x
E203: if x == 4 : print x, y; x, y = y, x
Whitespace before ')' Open
buf.write('%%\n'.join( [ record.get_msg(self._withhold_dns) for record in records ] ))
- Read upRead up
- Exclude checks
Avoid extraneous whitespace.
Avoid extraneous whitespace in these situations:
- Immediately inside parentheses, brackets or braces.
- Immediately before a comma, semicolon, or colon.
Okay: spam(ham[1], {eggs: 2})
E201: spam( ham[1], {eggs: 2})
E201: spam(ham[ 1], {eggs: 2})
E201: spam(ham[1], { eggs: 2})
E202: spam(ham[1], {eggs: 2} )
E202: spam(ham[1 ], {eggs: 2})
E202: spam(ham[1], {eggs: 2 })
E203: if x == 4: print x, y; x, y = y , x
E203: if x == 4: print x, y ; x, y = y, x
E203: if x == 4 : print x, y; x, y = y, x
Whitespace before ']' Open
end_tuple = [ int(x) for x in end.split('-') ]
- Read upRead up
- Exclude checks
Avoid extraneous whitespace.
Avoid extraneous whitespace in these situations:
- Immediately inside parentheses, brackets or braces.
- Immediately before a comma, semicolon, or colon.
Okay: spam(ham[1], {eggs: 2})
E201: spam( ham[1], {eggs: 2})
E201: spam(ham[ 1], {eggs: 2})
E201: spam(ham[1], { eggs: 2})
E202: spam(ham[1], {eggs: 2} )
E202: spam(ham[1 ], {eggs: 2})
E202: spam(ham[1], {eggs: 2 })
E203: if x == 4: print x, y; x, y = y , x
E203: if x == 4: print x, y ; x, y = y, x
E203: if x == 4 : print x, y; x, y = y, x
Line too long (80 > 79 characters) Open
UR_OPEN = ('<urf:UsageRecords xmlns:urf="http://eu-emi.eu/namespace'
- Read upRead up
- Exclude checks
Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to
have several windows side-by-side. The default wrapping on such
devices looks ugly. Therefore, please limit all lines to a maximum
of 79 characters. For flowing long blocks of text (docstrings or
comments), limiting the length to 72 characters is recommended.
Reports error E501.
Argument name ur
doesn't conform to snake_case naming style Open
def unload_latest(self, table_name, ur=False):
- Read upRead up
- Exclude checks
Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).
Argument name ur
doesn't conform to snake_case naming style Open
def unload_latest_super_summaries(self, table_name, ur=False,):
- Read upRead up
- Exclude checks
Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).
No space allowed after bracket Open
end_tuple = [ int(x) for x in end.split('-') ]
- Read upRead up
- Exclude checks
Used when a wrong number of spaces is used around an operator, bracket or block opener. end_tuple = [ int(x) for x in end.split('-') ] ^
No space allowed after bracket Open
buf.write('%%\n'.join( [ record.get_msg(self._withhold_dns) for record in records ] ))
- Read upRead up
- Exclude checks
Used when a wrong number of spaces is used around an operator, bracket or block opener. buf.write('%%n'.join( [ record.getmsg(self.withhold_dns) for record in records ] )) ^
Variable name UR_OPEN
doesn't conform to snake_case naming style Open
UR_OPEN = ('<urf:UsageRecords xmlns:urf="http://eu-emi.eu/namespace'
- Read upRead up
- Exclude checks
Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).
Constant name log
doesn't conform to UPPER_CASE naming style Open
log = logging.getLogger(__name__)
- Read upRead up
- Exclude checks
Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).
Variable name UR_CLOSE
doesn't conform to snake_case naming style Open
UR_CLOSE = '</urf:UsageRecords>'
- Read upRead up
- Exclude checks
Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).
Variable name XML_HEADER
doesn't conform to snake_case naming style Open
XML_HEADER = '<?xml version="1.0" ?>'
- Read upRead up
- Exclude checks
Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).
standard import import datetime
should be placed before from apel.db import Query, ApelDbException, JOB_MSG_HEADER, SUMMARY_MSG_HEADER, NORMALISED_SUMMARY_MSG_HEADER, SYNC_MSG_HEADER, CLOUD_MSG_HEADER, CLOUD_SUMMARY_MSG_HEADER
Open
import datetime
- Read upRead up
- Exclude checks
Used when PEP8 import order is not respected (standard imports first, then third-party libraries, then local imports)
standard import import logging
should be placed before from apel.db import Query, ApelDbException, JOB_MSG_HEADER, SUMMARY_MSG_HEADER, NORMALISED_SUMMARY_MSG_HEADER, SYNC_MSG_HEADER, CLOUD_MSG_HEADER, CLOUD_SUMMARY_MSG_HEADER
Open
import logging
- Read upRead up
- Exclude checks
Used when PEP8 import order is not respected (standard imports first, then third-party libraries, then local imports)
No space allowed before bracket Open
buf.write('%%\n'.join( [ record.get_msg(self._withhold_dns) for record in records ] ))
- Read upRead up
- Exclude checks
Used when a wrong number of spaces is used around an operator, bracket or block opener. buf.write('%%n'.join( [ record.getmsg(self.withhold_dns) for record in records ] )) ^
Using type() instead of isinstance() for a typecheck. Open
if type(records[0]) == JobRecord:
- Read upRead up
- Exclude checks
The idiomatic way to perform an explicit typecheck in Python is to use isinstance(x, Y) rather than type(x) == Y, type(x) is Y. Though there are unusual situations where these give different results.
Using type() instead of isinstance() for a typecheck. Open
elif type(records[0]) == StorageRecord:
- Read upRead up
- Exclude checks
The idiomatic way to perform an explicit typecheck in Python is to use isinstance(x, Y) rather than type(x) == Y, type(x) is Y. Though there are unusual situations where these give different results.
No space allowed before bracket Open
end_tuple = [ int(x) for x in end.split('-') ]
- Read upRead up
- Exclude checks
Used when a wrong number of spaces is used around an operator, bracket or block opener. end_tuple = [ int(x) for x in end.split('-') ] ^
No space allowed after bracket Open
buf.write('\n'.join( [ record.get_ur(self._withhold_dns) for record in records ] ))
- Read upRead up
- Exclude checks
Used when a wrong number of spaces is used around an operator, bracket or block opener. buf.write('n'.join( [ record.getur(self.withhold_dns) for record in records ] )) ^
Argument name ur
doesn't conform to snake_case naming style Open
def unload_gap(self, table_name, start, end, ur=False):
- Read upRead up
- Exclude checks
Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).
Argument name dt
doesn't conform to snake_case naming style Open
def get_start_of_previous_month(dt):
- Read upRead up
- Exclude checks
Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).
standard import import os
should be placed before from apel.db import Query, ApelDbException, JOB_MSG_HEADER, SUMMARY_MSG_HEADER, NORMALISED_SUMMARY_MSG_HEADER, SYNC_MSG_HEADER, CLOUD_MSG_HEADER, CLOUD_SUMMARY_MSG_HEADER
Open
import os
- Read upRead up
- Exclude checks
Used when PEP8 import order is not respected (standard imports first, then third-party libraries, then local imports)
Variable name UR_OPEN
doesn't conform to snake_case naming style Open
UR_OPEN = ('<sr:StorageUsageRecords xmlns:sr="http://eu-emi.eu/namespaces/2011/02/storagerecord">')
- Read upRead up
- Exclude checks
Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).
No space allowed before bracket Open
start_tuple = [ int(x) for x in start.split('-') ]
- Read upRead up
- Exclude checks
Used when a wrong number of spaces is used around an operator, bracket or block opener. start_tuple = [ int(x) for x in start.split('-') ] ^
Line too long (111/100) Open
UR_OPEN = ('<sr:StorageUsageRecords xmlns:sr="http://eu-emi.eu/namespaces/2011/02/storagerecord">')
- Read upRead up
- Exclude checks
Used when a line is longer than a given number of characters.
Variable name UR_CLOSE
doesn't conform to snake_case naming style Open
UR_CLOSE = '</sr:StorageUsageRecords>'
- Read upRead up
- Exclude checks
Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).
Line too long (106/100) Open
for batch in self._db.get_sync_records(query=query, records_per_message=self.records_per_message):
- Read upRead up
- Exclude checks
Used when a line is longer than a given number of characters.
Line too long (126/100) Open
for batch in self._db.get_records(record_type, table_name, query=query, records_per_message=self.records_per_message):
- Read upRead up
- Exclude checks
Used when a line is longer than a given number of characters.
No space allowed before bracket Open
buf.write('%%\n'.join( [ record.get_msg(self._withhold_dns) for record in records ] ))
- Read upRead up
- Exclude checks
Used when a wrong number of spaces is used around an operator, bracket or block opener. buf.write('%%n'.join( [ record.getmsg(self.withhold_dns) for record in records ] )) ^
Variable name XML_HEADER
doesn't conform to snake_case naming style Open
XML_HEADER = '<?xml version="1.0" ?>'
- Read upRead up
- Exclude checks
Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).
No space allowed before bracket Open
buf.write('\n'.join( [ record.get_ur(self._withhold_dns) for record in records ] ))
- Read upRead up
- Exclude checks
Used when a wrong number of spaces is used around an operator, bracket or block opener. buf.write('n'.join( [ record.getur(self.withhold_dns) for record in records ] )) ^
No space allowed after bracket Open
start_tuple = [ int(x) for x in start.split('-') ]
- Read upRead up
- Exclude checks
Used when a wrong number of spaces is used around an operator, bracket or block opener. start_tuple = [ int(x) for x in start.split('-') ] ^
No space allowed before bracket Open
buf.write('\n'.join( [ record.get_ur(self._withhold_dns) for record in records ] ))
- Read upRead up
- Exclude checks
Used when a wrong number of spaces is used around an operator, bracket or block opener. buf.write('n'.join( [ record.getur(self.withhold_dns) for record in records ] )) ^
Argument name ur
doesn't conform to snake_case naming style Open
def _write_messages(self, record_type, table_name, query, ur):
- Read upRead up
- Exclude checks
Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).
No space allowed after bracket Open
buf.write('\n'.join( [ record.get_ur(self._withhold_dns) for record in records ] ))
- Read upRead up
- Exclude checks
Used when a wrong number of spaces is used around an operator, bracket or block opener. buf.write('n'.join( [ record.getur(self.withhold_dns) for record in records ] )) ^
No space allowed after bracket Open
buf.write('%%\n'.join( [ record.get_msg(self._withhold_dns) for record in records ] ))
- Read upRead up
- Exclude checks
Used when a wrong number of spaces is used around an operator, bracket or block opener. buf.write('%%n'.join( [ record.getmsg(self.withhold_dns) for record in records ] )) ^
Missing class docstring Open
class DbUnloader(object):
- Read upRead up
- Exclude checks
Used when a class has no docstring.Even an empty class must have a docstring.