SpamExperts/OrangeAssassin

View on GitHub

Showing 287 of 802 total issues

Function check_freemail_replyto has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def check_freemail_replyto(self, msg, option=None, target=None):
        """Checks/compares freemail addresses found from headers and body
        Possible options:
            - replyto    From: or body address is different than Reply-To
                        (this is the default)
Severity: Minor
Found in oa/plugins/free_mail.py - About 3 hrs 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

File context.py has 325 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Defines global and per-message context."""

from builtins import dict
from builtins import object

Severity: Minor
Found in oa/context.py - About 3 hrs to fix

    Function _parse_sender has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        def _parse_sender(self):
            """Extract the envelope sender from the message."""
    
            always_trust_envelope_from = self.ctxt.conf[
                'always_trust_envelope_sender']
    Severity: Minor
    Found in oa/message.py - About 3 hrs 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

    File ruleset.py has 306 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """A set of rules."""
    
    from builtins import dict
    from builtins import object
    from builtins import str
    Severity: Minor
    Found in oa/rules/ruleset.py - About 3 hrs to fix

      Function check_freemail_body has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_freemail_body(self, msg, regex=None, target=None):
              """
              Check if there are free emails in body parts
              of the message
              """
      Severity: Minor
      Found in oa/plugins/free_mail.py - About 3 hrs 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

      PDFInfoPlugin has 27 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class PDFInfoPlugin(oa.plugins.base.BasePlugin):
          """PDFInfoPlugin"""
      
          eval_rules = (
              "pdf_count",
      Severity: Minor
      Found in oa/plugins/pdf_info.py - About 3 hrs to fix

        Function get_rule has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_rule(cls, name, data):
                kwargs = cls.get_rule_kwargs(data)
                value = data["value"]
        
                match_op = None
        Severity: Minor
        Found in oa/rules/header.py - About 3 hrs 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_freemail_header has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            def check_freemail_header(self, msg, header, regex=None, target=None):
                """Check all possible 'from' headers to see if sender
                is freemail. It is possible to provide a regex
                rule to match against too.
        
        
        Severity: Minor
        Found in oa/plugins/free_mail.py - About 3 hrs 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

        Message has 26 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Message(oa.context.MessageContext):
            """Internal representation of an email message. Used for rule matching."""
        
            def __init__(self, global_context, raw_msg):
                """Parse the message, extracts and decode all headers and all
        Severity: Minor
        Found in oa/message.py - About 3 hrs to fix

          Function _parse_message has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              def _parse_message(self):
                  """Parse the message."""
                  self._hook_check_start()
                  # Dump the message raw headers
          
          
          Severity: Minor
          Found in oa/message.py - About 2 hrs 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

          File pdf_info.py has 286 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """ PDFInfo Plugin. """
          
          from __future__ import absolute_import
          
          import collections
          Severity: Minor
          Found in oa/plugins/pdf_info.py - About 2 hrs to fix

            Function check_freemail_from has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                def check_freemail_from(self, msg, regex=None, target=None):
                    """Check if in specified header gave as parameter
                    is a freemail or no. It is possible to provide a regex
                    rule to match against too.
            
            
            Severity: Minor
            Found in oa/plugins/free_mail.py - About 2 hrs 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

            File awl.py has 280 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            """
            
            CREATE TABLE `awl` (
              `username` varchar(255) NOT NULL DEFAULT '',
              `email` varchar(200) NOT NULL DEFAULT '',
            Severity: Minor
            Found in oa/plugins/awl.py - About 2 hrs to fix

              SpfPlugin has 24 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class SpfPlugin(oa.plugins.base.BasePlugin):
                  spf_check = False
                  spf_check_helo = False
                  no_valid_identity = False
                  eval_rules = (
              Severity: Minor
              Found in oa/plugins/spf.py - About 2 hrs to fix

                Function check_https_ip_mismatch has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                    def check_https_ip_mismatch(self, msg, target=None):
                        """Checks if in <a> or <link> tags we have an ip and
                        if in anchor text we have an uri without ip.
                        """
                        if not hasattr(msg, "uri_detail_links"):
                Severity: Minor
                Found in oa/plugins/uri_eval.py - About 2 hrs 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

                File dkim.py has 274 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                """DKIM Plugin."""
                
                from __future__ import absolute_import
                
                import re
                Severity: Minor
                Found in oa/plugins/dkim.py - About 2 hrs to fix

                  File parser.py has 268 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  """Parse OA rule sets.
                  
                  The general syntax for OA rules is (on one line):
                  
                  <type> <name> <value>
                  Severity: Minor
                  Found in oa/rules/parser.py - About 2 hrs to fix

                    MIMEEval has 22 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class MIMEEval(oa.plugins.base.BasePlugin):
                        """Reimplementation of the awl spamassassin plugin"""
                    
                        eval_rules = (
                            "check_for_mime",
                    Severity: Minor
                    Found in oa/plugins/mime_eval.py - About 2 hrs to fix

                      File dns_eval.py has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      """Expose some eval rules that do checks on DNS lists."""
                      
                      from __future__ import division
                      from __future__ import absolute_import
                      
                      
                      Severity: Minor
                      Found in oa/plugins/dns_eval.py - About 2 hrs to fix

                        Function _learn_trapped has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def _learn_trapped(self, isspam, msg):
                                """Do the actual training 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 2 hrs 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