Showing 287 of 802 total issues
Function check_ratware_envelope_from
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_ratware_envelope_from(self, msg, target=None):
"""Check if envelope-from address is ratware or not."""
to_header = msg.msg.get("To")
envelope_from = msg.sender_address
if not to_header or not envelope_from:
- 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 bayes_report_make_list
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def bayes_report_make_list(self, msg, info, param=None):
if not info:
return "Tokens not available."
limit, ftm_arg, more = (param or "5,,").split(",")
- 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_accreditor
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def check_rbl_accreditor(self, msg, zone_set, rbl_server, subtest,
Function extract_metadata
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def extract_metadata(self, msg, payload, text, part):
content = part.get_payload(decode=True)
if content:
low = len(content.decode("ascii", errors="ignore"))
high = len(content)
- 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 post_parsing
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def post_parsing(self):
"""Run all post processing hooks."""
self.checked = collections.OrderedDict(
sorted(self.checked.items(), key=itemgetter(1), reverse=False))
self.call_postparsing()
- 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, name, rule, score=None, desc=None, priority=0,
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, pattern, score=None, desc=None, priority=0,
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, pattern, score=None, desc=None, priority=0,
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, header_name, score=None, desc=None, priority=0,
Function _is_freemail
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _is_freemail(self, email):
"""Check if the email is in freemail_domains list
If the email is whitelisted than we skip the check
"""
if not email:
- 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 available
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def available(self):
"""Checks whether the dns is available. Depending on how it is
configured a test may be performed to determine the result"""
if self.test and self.next_test <= datetime.datetime.now():
for qname in random.sample(
- 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_body
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _parse_body(self):
"""Parse all the emails from body and check
if all conditions are accepted
"""
get_global = self.get_global
- 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, name, pattern, score=None, desc=None, priority=0,
Function plugin_tags_mysql
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def plugin_tags_mysql(self, msg, origin_ip, addr, signed_by, score, factor):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, pattern, score=None, desc=None, priority=0,
Function setup_logging
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def setup_logging(log_name, debug=False, filepath=None, sentry_dsn=None,
Function charset_ok_for_locales
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def charset_ok_for_locales(charset, locales):
if not charset:
charset = ""
clean_charset = charset.upper()
clean_charset = INVALID_CHARACTERS_RE.sub("", clean_charset)
- 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, name, pattern, score=None, desc=None, priority=0,
Consider simplifying this complex logical expression. Open
if (region == 0 and HEADERS_TOKENIZE_LONG_TOKENS_AS_SKIPS) or (region == 1 and BODY_TOKENIZE_LONG_TOKENS_AS_SKIPS) or (region == 2 and URIS_TOKENIZE_LONG_TOKENS_AS_SKIPS):
# SpamBayes trick via Matt: Just retain 7 chars. Do not
# retain the length, it does not help; see my mail to
# -devel of Nov 20 2002. "sk:" stands for "skip".
token = "sk:" + token[:7]
Function _compute_prob_for_token
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _compute_prob_for_token(self, token, ns, nn, s, n):