Showing 287 of 802 total issues
Function scan
has a Cognitive Complexity of 17 (exceeds 5 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.
- 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
Conf
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Conf(object):
"""Parses and stores values for options in the global
context. The options must be defined in the `options`
class attribute in the following format::
Function should_learn
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def should_learn(self, msg):
"""Checks if the necessary conditions for learning are met"""
body_points = self.get_local(msg, "body_points")
header_points = self.get_local(msg, "header_points")
learned_points = self.get_local(msg, "learned_points")
- 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_skip
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def check_for_skip(header):
"""STUFF TO IGNORE
# Received headers which doesn't start with 'from'
# Skip fetchmail handovers
- 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 set_timevalue_option
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def set_timevalue_option(self, global_key, value):
"""Parse and set a timevalue option."""
unit = ""
try:
if value:
- 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_faraway_charset_in_headers
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def check_for_faraway_charset_in_headers(self, msg, target=None):
"""Check if the Subject/From header is in a NOT ok locale.
This eval rule requires the ok_locales setting configured,
and not set to ALL.
- 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_rbl_addr
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _check_rbl_addr(self, addresses, rbl_server, subtest=None):
"""Checks the specified addresses on the specified list.
:param addresses: A list of addresses to check
:param rbl_server: The RBL list to check
- 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_yahoo_received_headers
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def check_for_forged_yahoo_received_headers(self, msg, target=None):
"""Check for forged yahoo received headers"""
from_addr = ''.join(msg.get_all_addr_header("From"))
rcvd = ''.join(msg.get_decoded_header("Received"))
if "yahoo.com" not in from_addr:
- 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 _iter_parts
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _iter_parts(msg):
"""Extract and decode the text parts from the parsed email message.
For non-text parts the payload will be None.
Yields (payload, 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_multi_rbl
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _check_multi_rbl(self, msg, rbl_server, mask=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 _interpolate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _interpolate(self, text, msg):
if msg.interpolate_data:
return text % msg.interpolate_data
spam = msg.score >= self.conf["required_score"]
- 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_prob_for_all_tokens
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _compute_prob_for_all_tokens(self, tokensdata, ns, nn):
"""Compute the probability that a token is spammy for each
token."""
if not ns or not nn:
return
- 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 _save_stats
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _save_stats(self, msg, payload):
"""Extracts and saves the PDF stats once per unique file"""
# Use the md5 as ID to avoid duplicated PDFs
pdf_id = md5(payload).hexdigest()
self._update_pdf_hashes(msg, pdf_id)
- 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 handle_starttag
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def handle_starttag(self, tag, attrs):
'''
Handle the start of a tag.
'''
if tag in ('a', 'link'):
- 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_signed_by
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _check_dkim_signed_by(self, msg, must_be_valid,
must_be_author_domain_signature,
acceptable_domains=None):
result = 0
signature = msg.msg.get('DKIM-Signature', "")
- 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_input
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def parse_input(self, list_name):
parsed_list = defaultdict(list)
for addr in self[list_name]:
line = addr.split(None, 1)
if line[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
Function check_spf_header
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def check_spf_header(self, msg):
authres_header = msg.msg["authentication-results"]
received_spf_headers = msg.get_decoded_header("received-spf")
if not self["use_newest_received_spf_header"]:
received_spf_headers.reverse()
- 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_helo
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def get_helo(header):
"""Parsing the helo server from Received header
:param header: The received header without the 'from ' at the begin
:return: helo 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 check_whitelist_rcvd
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def check_whitelist_rcvd(self, msg, list_name, address):
"""Look up address and trusted relays in a whitelist with rcvd
"""
if len(msg.untrusted_relays) + len(msg.trusted_relays) == 0:
return 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
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"