Showing 66 of 1,425 total issues
Function __new__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __new__(cls, backend, host, port, username, pwd, db):
Function parse_fqan
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_fqan(fqan):
'''
We can get three pieces of information from a FQAN: role, group and VO.
We return this as a 3-tuple.
If it's not of the expected format, we put the whole string in the VO
- 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, db, qpath, inc_vos=None, exc_vos=None, local=False, withhold_dns=False):
Function _get_records
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _get_records(self, record_type, query_string, records_per_message=1000):
record_list = []
try:
# prevent MySQLdb from raising
- 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_db_tuple
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_db_tuple(self, source=None):
'''
Returns record content as a tuple. Appends the source of the record
(i.e. the sender's DN) if this is supplied. Includes exactly the
fields used in the DB by using the self._db_fields 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
Avoid deeply nested control flow statements. Open
if pf.get_field('Parsed') == 0:
unparsed = True
break # If we find a match, no need to keep checking.
Function scan_dir
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def scan_dir(parser, dirpath, reparse, expr, apel_db, processed):
Avoid deeply nested control flow statements. Open
if method == open:
raise
finally:
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, host, port, username, pwd, db):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, host, port, username, pwd, db):
Function _check_fields
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _check_fields(self):
'''
Add extra checks to those made in every record.
'''
# First, call the parent's version.
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse(self, line):
"""Parse single line from accounting log file."""
# Some sites will use TotalCPU rather than CPUTimeRAW
# sacct -P -n --format=JobID,JobName,User,Group,Start,End,Elapsed,
- 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 shutdown
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def shutdown(self):
"""
Unlock current messsage queue element and remove pidfile.
"""
# Check if self.current_msg is assigned as it may not have been before
- 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 _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 retrieve_rmem
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def retrieve_rmem(self, nodes):
'''
Given all the nodes from the XML document, retrieve the appropriate values
for virtual and physical memory.
- 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 too many return
statements within this function. Open
return datetime.utcfromtimestamp(value)
Avoid too many return
statements within this function. Open
return RECORDS_PER_MESSAGE_DEFAULT
Avoid too many return
statements within this function. Open
return value
Avoid too many return
statements within this function. Open
return dt
Function get_ur
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_ur(self):
'''
Returns the SummaryRecord in AUR format. See
https://twiki.cern.ch/twiki/bin/view/EMI/ComputeAccounting
- 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"