SpamExperts/OrangeAssassin

View on GitHub

Showing 287 of 802 total issues

Function get_addr_header has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_addr_header(self, header_name):
        """Get a list of the first addresses from this header."""
        values = list()
        for value in self.get_decoded_header(header_name):
            for dummy, addr in email.utils.getaddresses([value]):
Severity: Minor
Found in oa/message.py - About 25 mins to fix

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_found_forged has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_found_forged(self, address, found_forged):
        """If it is forged, check the address in list """
        if found_forged:
            wlist = self['parsed_whitelist_allow_relays']
            for addr in wlist:
Severity: Minor
Found in oa/plugins/wlbl_eval.py - About 25 mins to fix

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_http_redirector has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_for_http_redirector(self, msg, target=None):
        """Checks if the uri has been redirected.
            -use HTTP_REDIR regex in order to extract the
            destination domain and compare it with source
            domain
Severity: Minor
Found in oa/plugins/uri_eval.py - About 25 mins to fix

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_address_in_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_address_in_list(self, addresses, list_name):
        """Check if addresses match the regexes from list_name.
        """
        for address in addresses:
            for regex in self[list_name]:
Severity: Minor
Found in oa/plugins/bayes.py - About 25 mins to fix

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 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _save_stats(self, msg, payload, subtype):
        """Extracts and saves image stats once per unique image."""

        image_id = md5(payload).hexdigest()

Severity: Minor
Found in oa/plugins/image_info.py - About 25 mins to fix

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 extract_url_from_text has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def extract_url_from_text(self, anchor_text):
        """Parses anchor text from html tags in order to extract
        a list with uri.
        """
        urls_list = []
Severity: Minor
Found in oa/plugins/uri_eval.py - About 25 mins to fix

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 match has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def match(self, msg):
        for key in msg.uri_detail_links:
            for type in msg.uri_detail_links[key]:
                value = msg.uri_detail_links[key][type]
                result = self.check_single_item(value)
Severity: Minor
Found in oa/plugins/uri_detail.py - About 25 mins to fix

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 valid_tests has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def valid_tests(self, tests):
        """Yields valid tests for autolearning.
         Exclude all tests flagged with noautolearn, userconf or have a 0 score
        """
        for name, rule in tests.items():
Severity: Minor
Found in oa/plugins/auto_learn_threshold.py - About 25 mins to fix

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_address_in_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_address_in_list(self, addresses, list_name):
        """Check if addresses match the regexes from list_name.
        """
        for address in addresses:
            for regex in self[list_name]:
Severity: Minor
Found in oa/plugins/wlbl_eval.py - About 25 mins to fix

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_unique_subject_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_for_unique_subject_id(self, msg, target=None):
        """Check if in subject appears an unique id"""
        subject = "".join(msg.get_decoded_header("Subject"))
        id = None
        unique_id_re_list = [
Severity: Minor
Found in oa/plugins/header_eval.py - About 25 mins to fix

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_tags has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def prepare_tags(self, which="tag"):
        """Prepare the configured tags for easy replacement.
        Valid options for which are: pre, intern, post, tag.

        This converts the list of defined TAG to a dictionary
Severity: Minor
Found in oa/plugins/replace_tags.py - About 25 mins to fix

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_faraway_charset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _update_faraway_charset(self, msg, charset):
        locales = self.ctxt.conf.get_global("ok_locales").split()
        if charset and re.match("[a-z]", charset, re.IGNORECASE):
            faraway_charset = self.get_local(msg, "mime_faraway_charset")
            if not faraway_charset:
Severity: Minor
Found in oa/plugins/mime_eval.py - About 25 mins to fix

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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_dkim_signed(self, msg, *args, **kwargs):
        """Check if message has a DKIM signature, not necessarily valid.
        """
        if not self.dkim_checked_signature:
            self.check_dkim_signature(msg)
Severity: Minor
Found in oa/plugins/dkim.py - About 25 mins to fix

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_origin_ip has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_origin_ip(self, msg):
        relays = []
        relays.extend(msg.trusted_relays)
        relays.extend(msg.untrusted_relays)
        relays.reverse()
Severity: Minor
Found in oa/plugins/awl.py - About 25 mins to fix

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_valid_author_sig has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_dkim_valid_author_sig(self, msg, *args, **kwargs):
        """Check if message has a valid DKIM signature from author's domain.
        """
        if not self.dkim_checked_signature:
            self.check_dkim_signature(msg)
Severity: Minor
Found in oa/plugins/dkim.py - About 25 mins to fix

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 _load_cmds has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _load_cmds(self, plugin, class_name):
        """Load any new RULES that are handled by this plugin. These
        must inherit from oa.rules.base.BaseRule.
        """
        if not plugin.cmds:
Severity: Minor
Found in oa/context.py - About 25 mins to fix

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_summary_report has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_summary_report(self, msg):
        """Get summary report."""
        summary = []
        for name, result in msg.rules_checked.items():
            if not result:
Severity: Minor
Found in oa/rules/ruleset.py - About 25 mins to fix

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 _pyzor_report has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _pyzor_report(self, msg, spam=True):
        """Does the actual work for reporting digests to pyzor."""
        if not self["use_pyzor"]:
            return
        try:
Severity: Minor
Found in oa/plugins/pyzor.py - About 25 mins to fix

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_start has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_start(self, msg):
        """Verify that the domains are valid and separate wildcard
        domains from the rest."""
        domain_re = Regex(r'^[a-z0-9.*?-]+$')
        freemail_domains = self.get_global('freemail_domains')
Severity: Minor
Found in oa/plugins/free_mail.py - About 25 mins to fix

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_valid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_dkim_valid(self, msg, *args, **kwargs):
        """Check if message has at least one valid DKIM signature.
        """
        if not self.dkim_checked_signature:
            self.check_dkim_signature(msg)
Severity: Minor
Found in oa/plugins/dkim.py - About 25 mins to fix

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

Severity
Category
Status
Source
Language