SpamExperts/OrangeAssassin

View on GitHub

Showing 287 of 802 total issues

Function _format_network_str has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def _format_network_str(network, mask):
    padding = ""
    if not network.endswith("."):
        length = len(network.split("."))
        if length == 3 or length == 7:
Severity: Minor
Found in oa/networks.py - About 1 hr 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 _configure_dns has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def _configure_dns(self):
        """Configure the DNS resolver based on the user
        settings.
        """

Severity: Minor
Found in oa/context.py - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
Open

    def match(self, msg):
        """Match the message against all the rules in this ruleset."""
        try:
            for name, rule in self.checked.items():
                try:
Severity: Minor
Found in oa/rules/ruleset.py - About 1 hr 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 plugin_report has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def plugin_report(self, msg):
        """
        Report spam to "spamcop_to_address". If the message is larger than
        "spamcop_max_report_size", then it will be truncated in report
        message.
Severity: Minor
Found in oa/plugins/spam_cop.py - About 1 hr to fix

    Function parse_input has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_input(self, list_name):
            """Parse the list into a dictionary with the regex as key and the
            domain as value.
            """
            parsed_list = defaultdict(list)
    Severity: Minor
    Found in oa/plugins/wlbl_eval.py - About 1 hr 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_no_rdns_dotcom_helo has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_for_no_rdns_dotcom_helo(self, msg, option=None, target=None):
            """Check untrusted relays and verify if latest relay it has helo from
            a big email provider like lycos, hotmail, excite, caramail, cs, aol,
            msn, yahoo, drizzle"""
            no_rdns_dotcom_helo = False
    Severity: Minor
    Found in oa/plugins/relay_eval.py - About 1 hr 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 image_size_range has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def image_size_range(self, msg, img_type, min_height, min_width,
                             max_height=None, max_width=None, target=None):
            """Minimum/ranged dimensions matches"""
            sizes = self._get_sizes(msg, img_type)
            for img in sizes:
    Severity: Minor
    Found in oa/plugins/image_info.py - About 1 hr 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 parse_delist_uri has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_delist_uri(self):
            """Parse 'delist_uri_host'. If there is no list name,
                then apply for all lists.
            """
            parsed_list = defaultdict(list)
    Severity: Minor
    Found in oa/plugins/wlbl_eval.py - About 1 hr 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 finish_parsing_end has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def finish_parsing_end(self, ruleset):
            """Configure any multi results RBL checks."""
            super(DNSEval, self).finish_parsing_end(ruleset)
            # This is one annoying workaround because SA has a
            # very strange way of defining these.
    Severity: Minor
    Found in oa/plugins/dns_eval.py - About 1 hr 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 call_postparsing has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def call_postparsing(self):
            """Call postparsing on ALL loaded rules."""
            for rule_list in (self.checked, self.not_checked):
                for name, rule in list(rule_list.items()):
                    try:
    Severity: Minor
    Found in oa/rules/ruleset.py - About 1 hr 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_plugin has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def load_plugin(self, name, path=None):
            """Load the specified plugin from the given path."""
            self.log.debug("Loading plugin %s from %s", name, path)
            class_name = name.rsplit(".", 1)[-1]
            if class_name in self.plugins:
    Severity: Minor
    Found in oa/context.py - About 1 hr 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_authres_header has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_authres_header(self, authres_header):
            self.ctxt.log.debug("PLUGIN::SPF: %s",
                                "found an Authentication-Results header "
                                "added by an internal host")
    
    
    Severity: Minor
    Found in oa/plugins/spf.py - About 1 hr 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_in_list has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_in_list(self, msg, addresses, list_name):
            """Check if addresses match the regexes from list_name and modify
            "from_in_whitelist" msg value based on the list name
            """
            param = "from_in_whitelist"
    Severity: Minor
    Found in oa/plugins/wlbl_eval.py - About 55 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_to_addresses has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_to_addresses(self):
            """Get addresses from 'Resent-To' and 'Resent-Cc'
            headers, ad if there are no addresses, get from
            all TO_HEADERS.
            """
    Severity: Minor
    Found in oa/message.py - About 55 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 _tokenise_headers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def _tokenise_headers(self, msg):
            """Tokenise the headers of the message.
            
            Return a dictionary that maps the case-sensitive header name to
            a normalised value.
    Severity: Minor
    Found in oa/plugins/bayes.py - About 55 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_rcvd has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_rcvd(self, domain, relays):
            """Check if it is a match by IP address or is a subnet.
            If is not a valid IP address, try to match by rdns
            """
            match = -1
    Severity: Minor
    Found in oa/plugins/wlbl_eval.py - About 55 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 finish_parsing_end has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def finish_parsing_end(self, ruleset):
            """Called when the configuration parsing has finished, but before the
            post-parsing. This hook can be used for e.g. to add rules to the
            ruleset.
    
    
    Severity: Minor
    Found in oa/plugins/base.py - About 55 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_shifted_date has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_for_shifted_date(self, msg, min=None, max=None, target=None):
            """Check if the difference between Date header and date from received
            headers its between min,max interval
    
            * min: minimum time express in hours
    Severity: Minor
    Found in oa/plugins/header_eval.py - About 55 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_date_header_time has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_date_header_time(self, msg):
            try:
                return self.get_local(msg, "date_header_time")
            except KeyError:
                pass
    Severity: Minor
    Found in oa/plugins/header_eval.py - About 55 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 _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."""
    Severity: Minor
    Found in oa/plugins/bayes.py - About 55 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