SpamExperts/OrangeAssassin

View on GitHub

Showing 287 of 802 total issues

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

Function finish_parsing_end has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def finish_parsing_end(self, ruleset):
        """Go through the list of rules defined in the
        configuration and shortcircuit them.
        """
        super(ShortCircuit, self).finish_parsing_end(ruleset)
Severity: Minor
Found in oa/plugins/short_circuit.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_dkim_signature has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def check_dkim_signature(self, msg):
        self.dkim_checked_signature = 1
        self.dkim_signed = 1
        self.dkim_valid = 1
        self.dkim_signatures_dependable = 1
Severity: Minor
Found in oa/plugins/dkim.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_ruleset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def get_ruleset(self):
        """Create and return the corresponding ruleset for the parsed files."""
        self.ctxt.hook_parsing_start(self.results)
        for name, data in self.results.items():
            try:
Severity: Minor
Found in oa/rules/parser.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_from_addresses has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def get_from_addresses(self, msg):
        """Get addresses from 'Resent-From' header,
        and if there are no addresses, get from
        all FROM_HEADERS.
        """
Severity: Minor
Found in oa/plugins/dkim.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 image_size_range has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def image_size_range(self, msg, img_type, min_height, min_width,
Severity: Major
Found in oa/plugins/image_info.py - About 50 mins to fix

    Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, name, pattern=None, header_name=None, score=None,
    Severity: Major
    Found in oa/rules/header.py - About 50 mins to fix

      Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, name, eval_rule, score=None, desc=None, target=None,
      Severity: Major
      Found in oa/rules/eval_.py - About 50 mins to fix

        Function plugin_tags_sqlalch has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def plugin_tags_sqlalch(self, msg, origin_ip, addr, signed_by, score,
        Severity: Major
        Found in oa/plugins/awl.py - About 50 mins to fix

          Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(self, name, pattern=None, header_name=None, score=None,
          Severity: Major
          Found in oa/rules/header.py - About 50 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if not token:
                                        break
                                    rettokens.add("8:" + token)
            Severity: Major
            Found in oa/plugins/bayes.py - About 45 mins to fix

              Function _get_received_header_times has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

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

              Avoid deeply nested control flow statements.
              Open

                                      if not in_trusted and not has_auth:
                                          is_trusted = False
                                          is_internal = False
              
                                      else:
              Severity: Major
              Found in oa/message.py - About 45 mins to fix

                Function replace_tags has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def replace_tags(self, rule_value):
                        """Replace a single rule result."""
                        pre_replace, rule_value = self.get_metatags(rule_value, "pre")
                        inter_replace, rule_value = self.get_metatags(rule_value, "inter")
                        post_replace, rule_value = self.get_metatags(rule_value, "post")
                Severity: Minor
                Found in oa/plugins/replace_tags.py - About 45 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_uri_host_listed has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def check_uri_host_listed(self, msg, list_name, target=None):
                        """Check if the message has URIs that are listed
                        in the specified hostname
                        """
                        parsed_list = 'parsed_enlist_uri_host'
                Severity: Minor
                Found in oa/plugins/wlbl_eval.py - About 45 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

                Avoid deeply nested control flow statements.
                Open

                                        if not bit:
                                            break
                                        rettokens.add("UD:" + bit)  # UD = URL domain
                Severity: Major
                Found in oa/plugins/bayes.py - About 45 mins to fix

                  Function check_mailfrom_matches_rcvd has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def check_mailfrom_matches_rcvd(self, msg, target=None):
                          """ If there is an EnvelopeFrom address, get it's domain.
                          If there are untrusted relays, get the first one,
                          else if there are trusted relays get them all.
                          For each non empty relay rdns verify if the last part
                  Severity: Minor
                  Found in oa/plugins/wlbl_eval.py - About 45 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_forged_gw05_received_headers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def check_for_forged_gw05_received_headers(self, msg, target=None):
                          gw05_re = Regex(r"from\s(\S+)\sby\s(\S+)\swith\sESMTP\;\s+\S\S\S,"
                                          r"\s+\d+\s+\S\S\S\s+\d{4}\s+\d\d:\d\d:\d\d\s+[-+]*"
                                          r"\d{4}", re.X | re.I)
                          for rcv in msg.get_decoded_header("Received"):
                  Severity: Minor
                  Found in oa/plugins/header_eval.py - About 45 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_all_from_headers_addr has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def get_all_from_headers_addr(self):
                          all_from_headers = ['From', 'Envelope-Sender',
                                              'Resent-Sender', 'X-Envelope-From',
                                              'EnvelopeFrom', 'Resent-From']
                          sender_addr = self.sender_address
                  Severity: Minor
                  Found in oa/message.py - About 45 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 learner_is_scan_available has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def learner_is_scan_available(self, params=None):
                          """Check to make sure we can tie() the DB, and we have enough entries 
                          to do a scan. If we're told the caller will untie(), go ahead and 
                          leave the db tied. """
                          if not self["use_bayes"]:
                  Severity: Minor
                  Found in oa/plugins/bayes.py - About 45 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