Showing 287 of 802 total issues
Function _check_rbl
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _check_rbl(self, msg, rbl_server, qtype="A", subtest=None):
"""Checks all the IPs of this message on the specified
list.
:param msg: The message that we perform the check on.
- 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_hotmail_received_headers
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _check_for_forged_hotmail_received_headers(self, msg):
self.hotmail_addr_but_no_hotmail_received = 0
self.hotmail_addr_with_forged_hotmail_received = 0
rcvd = msg.msg.get("Received")
if not rcvd:
- 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_whitelist
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _check_dkim_whitelist(self, msg, list_name):
if not self.dkim_checked_signature:
self.check_dkim_signature(msg)
if not self.dkim_valid:
return False
- 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 scan
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scan(self, msg):
if not self["use_learner"]:
return
# When we're doing a scan, we'll guarantee that we'll do the untie,
# so override the global setting until we're done.
Function check_for_forged_juno_received_headers
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def check_for_forged_juno_received_headers(self, msg, target=None):
from_addr = ''.join(msg.get_all_addr_header("From"))
if not from_addr.rsplit("@", 1)[-1].endswith("juno.com"):
return False
if self.gated_through_received_hdr_remover(msg):
- 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_recipients
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _check_recipients(self, msg):
"""Check for similar recipients addresses.
Return the ratio of possibly similar recipient of
the total number of possible combinations.
- 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 prepare_learning_metadata
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def prepare_learning_metadata(self, msg, tests):
"""Iterates through the tests and extracts necessary information
* l:bayes_thinks_spam if the bayes plugin test BAYES_99 is present
* l:bayes_thinks_ham if the bayes plugin test BAYES_00 is present
* l:header_points total score for header rules
- 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_msg_parse_flags
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def check_msg_parse_flags(self, msg, flag, target=None):
"""Checks the value of flags added when parsing the msssage.
The following flags are allowed
- missing_mime_head_body_separator: There is no newline after the header
- missing_mime_headers: if the line after the opening boundary isn't a
- 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_special_header
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _parse_special_header(self, header, l_header, parsed, val):
if l_header in (u"message-id", u"x-message-id", u"resent-message-id"):
val = self._pre_chew_message_id(val)
elif PRE_CHEW_ADDR_HEADERS and l_header in ADDR_HEADERS:
val = self._pre_chew_addr_header(val)
- 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_message
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_message(self, options):
"""Retrieve the message from the client.
The data is read in chunks and returned as a joined string.
"""
- 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_auth
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_auth(header):
"""Parsing the authentication from Received header
:param header: The received header without the 'from ' at the begin
:return: auth if is found if not it returns an empty string
- 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 a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, name, score=None, desc=None, priority=0, tflags=None):
self.name = name
if name.startswith("__"):
score = [0.0]
elif score is None:
- 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 preprocess
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def preprocess(self, ruleset):
"""Adjust the score for this rule taking into consideration
the advanced scoring, if there are 4 scores provided.
"""
if self.tflags:
- 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 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self, global_context, raw_msg):
"""Parse the message, extracts and decode all headers and all
text parts.
"""
self.missing_boundary_header = False
Function _decode_header
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _decode_header(header):
"""Decodes an email header and returns it as a string. Any parts of
the header that cannot be decoded are simply ignored.
"""
parts = 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
Function received_within_months
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def received_within_months(self, msg, min, max, target=None):
"""Check if the date from received is in past"""
if min == "undef":
min = None
if max == "undef":
- 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 tokenise
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def tokenise(self, msg):
"""Convert the message to a sequence of tokens."""
tokens = []
for line in self["bayes_token_body"]:
tokens.extend(self._tokenise_line(line, "", 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 _compute_declassification_distance
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _compute_declassification_distance(self, Ns, Nn, ns, nn, prob):
"""If a token is neither hammy nor spammy, return 0.
For a spammy token, return the minimum number of additional ham
messages it would have had to appear in to no longer be spammy.
Hammy tokens are handled similarly.
- 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_truncated
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def check_uri_truncated(self, msg, target=None):
"""Checks if the uri length is greater than MAX_URI_LENGTH.
"""
if not hasattr(msg, "uri_detail_links"):
oa.html_parser.parsed_metadata(msg, self.ctxt)
- 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 _update_mime_text_info
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _update_mime_text_info(self, msg, payload, part, text):
charset = part.get_charset()
text_count = self.get_local(msg, "mime_body_text_count")
self.set_local(msg, "mime_body_text_count", text_count + 1)
if part.get_content_subtype() == "plain":
- 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"