Showing 287 of 802 total issues
Function _forget_trapped
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _forget_trapped(self, msg, msgid):
"""Do the actual unlearning work.
In SA this is "trapped", in that it is wrapped inside of a timeout.
Here, it is not currently, but we may add that in the future."""
- 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 finish_parsing_end
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def finish_parsing_end(self, ruleset):
"""Go through the list of rules defined in the
configuration and shortcircuit them.
"""
super(ShortCircuit, self).finish_parsing_end(ruleset)
- 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 check_dkim_signature
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check_dkim_signature(self, msg):
self.dkim_checked_signature = 1
self.dkim_signed = 1
self.dkim_valid = 1
self.dkim_signatures_dependable = 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 get_ruleset
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_ruleset(self):
"""Create and return the corresponding ruleset for the parsed files."""
self.ctxt.hook_parsing_start(self.results)
for name, data in self.results.items():
try:
- 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_from_addresses
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_from_addresses(self, msg):
"""Get addresses from 'Resent-From' header,
and if there are no addresses, get from
all FROM_HEADERS.
"""
- 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 image_size_range
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def image_size_range(self, msg, img_type, min_height, min_width,
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, pattern=None, header_name=None, score=None,
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, eval_rule, score=None, desc=None, target=None,
Function plugin_tags_sqlalch
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def plugin_tags_sqlalch(self, msg, origin_ip, addr, signed_by, score,
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, pattern=None, header_name=None, score=None,
Avoid deeply nested control flow statements. Open
if not token:
break
rettokens.add("8:" + token)
Function _get_received_header_times
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _get_received_header_times(self, msg):
try:
return self.get_local(msg, "received_header_times")
except KeyError:
pass
- 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 not in_trusted and not has_auth:
is_trusted = False
is_internal = False
else:
Function replace_tags
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def replace_tags(self, rule_value):
"""Replace a single rule result."""
pre_replace, rule_value = self.get_metatags(rule_value, "pre")
inter_replace, rule_value = self.get_metatags(rule_value, "inter")
post_replace, rule_value = self.get_metatags(rule_value, "post")
- 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 check_uri_host_listed
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_uri_host_listed(self, msg, list_name, target=None):
"""Check if the message has URIs that are listed
in the specified hostname
"""
parsed_list = 'parsed_enlist_uri_host'
- 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 not bit:
break
rettokens.add("UD:" + bit) # UD = URL domain
Function check_mailfrom_matches_rcvd
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_mailfrom_matches_rcvd(self, msg, target=None):
""" If there is an EnvelopeFrom address, get it's domain.
If there are untrusted relays, get the first one,
else if there are trusted relays get them all.
For each non empty relay rdns verify if the last part
- 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 check_for_forged_gw05_received_headers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_for_forged_gw05_received_headers(self, msg, target=None):
gw05_re = Regex(r"from\s(\S+)\sby\s(\S+)\swith\sESMTP\;\s+\S\S\S,"
r"\s+\d+\s+\S\S\S\s+\d{4}\s+\d\d:\d\d:\d\d\s+[-+]*"
r"\d{4}", re.X | re.I)
for rcv in msg.get_decoded_header("Received"):
- 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_all_from_headers_addr
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_all_from_headers_addr(self):
all_from_headers = ['From', 'Envelope-Sender',
'Resent-Sender', 'X-Envelope-From',
'EnvelopeFrom', 'Resent-From']
sender_addr = self.sender_address
- 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 learner_is_scan_available
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def learner_is_scan_available(self, params=None):
"""Check to make sure we can tie() the DB, and we have enough entries
to do a scan. If we're told the caller will untie(), go ahead and
leave the db tied. """
if not self["use_bayes"]:
- 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"