SpamExperts/OrangeAssassin

View on GitHub
oa/plugins/bayes.py

Summary

Maintainability
F
1 wk
Test Coverage

File bayes.py has 960 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Bayes - determine spam likelihood using a Bayesian classifier.

This is a Bayesian-style probabilistic classifier, using an algorithm
based on the one detailed in Paul Graham's "A Plan For Spam" paper at:

Severity: Major
Found in oa/plugins/bayes.py - About 2 days to fix

    Function _tokenise_line has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
    Open

        def _tokenise_line(self, line, tokprefix, region):
            # Include quotes, .'s and -'s for URIs, and [$,]'s for Nigerian-scam
            # strings, and ISO-8859-15 alphas. Do not split on @'s; better
            # results keeping it.
            # Some useful tokens: "$31,000,000" "www.clock-speed.net" "f*ck" "Hits!"
    Severity: Minor
    Found in oa/plugins/bayes.py - About 7 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

    Cyclomatic complexity is too high in method _tokenise_line. (30)
    Open

        def _tokenise_line(self, line, tokprefix, region):
            # Include quotes, .'s and -'s for URIs, and [$,]'s for Nigerian-scam
            # strings, and ISO-8859-15 alphas. Do not split on @'s; better
            # results keeping it.
            # Some useful tokens: "$31,000,000" "www.clock-speed.net" "f*ck" "Hits!"
    Severity: Minor
    Found in oa/plugins/bayes.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    BayesPlugin has 38 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class BayesPlugin(oa.plugins.base.BasePlugin):
        """Implement a somewhat Bayesian plug-in."""
    
        learn_caller_will_untie = False
        learn_no_relearn = False
    Severity: Minor
    Found in oa/plugins/bayes.py - About 5 hrs to fix

      Cyclomatic complexity is too high in method scan. (20)
      Open

          def scan(self, msg):
              if not self["use_learner"]:
                  return
              # When we're doing a scan, we'll guarantee that we'll do the untie,
              # so override the global setting until we're done.
      Severity: Minor
      Found in oa/plugins/bayes.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method _parse_special_header. (15)
      Open

          def _parse_special_header(self, header, l_header, parsed, val):
              if l_header in (u"message-id", u"x-message-id", u"resent-message-id"):
                  val = self._pre_chew_message_id(val)
              elif PRE_CHEW_ADDR_HEADERS and l_header in ADDR_HEADERS:
                  val = self._pre_chew_addr_header(val)
      Severity: Minor
      Found in oa/plugins/bayes.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method _compute_declassification_distance. (14)
      Open

          def _compute_declassification_distance(self, Ns, Nn, ns, nn, prob):
              """If a token is neither hammy nor spammy, return 0.
              For a spammy token, return the minimum number of additional ham
              messages it would have had to appear in to no longer be spammy.
              Hammy tokens are handled similarly.
      Severity: Minor
      Found in oa/plugins/bayes.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method _learn_trapped. (12)
      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 by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method _tokenise_headers. (10)
      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 by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method tokenise. (9)
      Open

          def tokenise(self, msg):
              """Convert the message to a sequence of tokens."""
              tokens = []
              for line in self["bayes_token_body"]:
                  tokens.extend(self._tokenise_line(line, "", 1))
      Severity: Minor
      Found in oa/plugins/bayes.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method _compute_prob_for_all_tokens. (9)
      Open

          def _compute_prob_for_all_tokens(self, tokensdata, ns, nn):
              """Compute the probability that a token is spammy for each
              token."""
              if not ns or not nn:
                  return
      Severity: Minor
      Found in oa/plugins/bayes.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      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

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

          def scan(self, msg):
              if not self["use_learner"]:
                  return
              # When we're doing a scan, we'll guarantee that we'll do the untie,
              # so override the global setting until we're done.
      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

      Cyclomatic complexity is too high in method bayes_report_make_list. (7)
      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(",")
      Severity: Minor
      Found in oa/plugins/bayes.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method learner_is_scan_available. (7)
      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 by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method check_bayes. (7)
      Open

          def check_bayes(self, msg, min_score, max_score=float('inf'), target=None):
              """Check the message against the active Bayes classifier."""
              min_score = float(min_score)
              max_score = float(max_score)
              if not self["use_learner"]:
      Severity: Minor
      Found in oa/plugins/bayes.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method parse_list. (6)
      Open

          def parse_list(self, list_name):
              parsed_list = []
              characters = ["?", "@", ".", "*@"]
              for addr in self[list_name]:
                  if len([e for e in characters if e in addr]):
      Severity: Minor
      Found in oa/plugins/bayes.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method _forget_trapped. (6)
      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 by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Function _compute_prob_for_all_tokens has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def _compute_prob_for_all_tokens(self, tokensdata, ns, nn):
              """Compute the probability that a token is spammy for each
              token."""
              if not ns or not nn:
                  return
      Severity: Minor
      Found in oa/plugins/bayes.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 scan has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def scan(self, msg):
              if not self["use_learner"]:
                  return
              # When we're doing a scan, we'll guarantee that we'll do the untie,
              # so override the global setting until we're done.
      Severity: Minor
      Found in oa/plugins/bayes.py - About 1 hr to fix

        Function _parse_special_header has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def _parse_special_header(self, header, l_header, parsed, val):
                if l_header in (u"message-id", u"x-message-id", u"resent-message-id"):
                    val = self._pre_chew_message_id(val)
                elif PRE_CHEW_ADDR_HEADERS and l_header in ADDR_HEADERS:
                    val = self._pre_chew_addr_header(val)
        Severity: Minor
        Found in oa/plugins/bayes.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 tokenise has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def tokenise(self, msg):
                """Convert the message to a sequence of tokens."""
                tokens = []
                for line in self["bayes_token_body"]:
                    tokens.extend(self._tokenise_line(line, "", 1))
        Severity: Minor
        Found in oa/plugins/bayes.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 _compute_declassification_distance has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def _compute_declassification_distance(self, Ns, Nn, ns, nn, prob):
                """If a token is neither hammy nor spammy, return 0.
                For a spammy token, return the minimum number of additional ham
                messages it would have had to appear in to no longer be spammy.
                Hammy tokens are handled similarly.
        Severity: Minor
        Found in oa/plugins/bayes.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 _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 _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 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(",")
        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

        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

        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

          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

            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]
            Severity: Major
            Found in oa/plugins/bayes.py - About 40 mins to fix

              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):
              Severity: Minor
              Found in oa/plugins/bayes.py - About 35 mins to fix

                Function _compute_declassification_distance has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def _compute_declassification_distance(self, Ns, Nn, ns, nn, prob):
                Severity: Minor
                Found in oa/plugins/bayes.py - About 35 mins to fix

                  Function check_bayes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def check_bayes(self, msg, min_score, max_score=float('inf'), target=None):
                          """Check the message against the active Bayes classifier."""
                          min_score = float(min_score)
                          max_score = float(max_score)
                          if not self["use_learner"]:
                  Severity: Minor
                  Found in oa/plugins/bayes.py - About 35 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 parse_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def parse_list(self, list_name):
                          parsed_list = []
                          characters = ["?", "@", ".", "*@"]
                          for addr in self[list_name]:
                              if len([e for e in characters if e in addr]):
                  Severity: Minor
                  Found in oa/plugins/bayes.py - About 35 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 too many return statements within this function.
                  Open

                          return True
                  Severity: Major
                  Found in oa/plugins/bayes.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return self._skip_scan(msg, score, caller_untie)
                    Severity: Major
                    Found in oa/plugins/bayes.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return self._skip_scan(msg, score, caller_untie)
                      Severity: Major
                      Found in oa/plugins/bayes.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return 0
                        Severity: Major
                        Found in oa/plugins/bayes.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return False
                          Severity: Major
                          Found in oa/plugins/bayes.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return int(1.0 - 1e-6 + nb * Na * p / (Nb * (1 - p))) - na
                            Severity: Major
                            Found in oa/plugins/bayes.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return 1 if dd_exact < 1 else int(dd_exact)
                              Severity: Major
                              Found in oa/plugins/bayes.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return self._skip_scan(msg, None, caller_untie)
                                Severity: Major
                                Found in oa/plugins/bayes.py - About 30 mins to fix

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

                                      def combine(cls, ns, nn, sortedref):
                                          """Return best-guess probability that sortedref is spam.
                                          
                                          ns is nspam (the number of spam messages).
                                          nn is nham (the number of ham messages).
                                  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 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

                                  XXX found
                                  Open

                                          # XXX If x2 is very large, exp(-m) will underflow to 0.
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                  # XXX complex to understand and get right.
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                  # XXX This could use a lot of modernisation.
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                          # XXX need to figure out what's the deal with override username
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                      # XXX This needs a regular expression, but it doesn't seem worth having this
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                  # XXX Should some of these options be controllable in the configuration
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                      # XXX This needs a regular expression, but it doesn't seem worth having this
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                      # XXX This needs a regular expression, but it doesn't seem worth having this
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                      # XXX whole check work with regular expressions just for this.
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                      # XXX whole check work with regular expressions just for this.
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                      # XXX whole check work with regular expressions just for this.
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                  # XXX file? I don't think SA allows that, and they are generally quite
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                              "BAYESTC": count or '',  # XXX This is still different than SA
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                                  # XXX complexity of doing this.
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                              # XXX SA parses these and checks for [in]visible content
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                          # XXX yielded tokens as they were generated.
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                          # XXX depend on it, or even better move the code somewhere common
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                          # XXX In SA, there is a time limit set here.
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                                  # XXX when the -t parameter is given
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                          # XXX Although it is possible to do this by calling the wlbleval plugin
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                          # XXX SA wraps this in a timer.
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                                  # XXX expression. We should evaluate whether it's worth the
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                          # XXX This has a timer in SA.
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                          # XXX It's complicated to do this with a regular expression in Python.
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  TODO found
                                  Open

                                              # TODO: Find test_log implementation.
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                                  # XXX I don't think this can be done in a Python regular
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  TODO found
                                  Open

                                          # TODO: SA adds in all of the message's metadata as additional
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                          # XXX This is really inefficient.
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                                  # XXX This seems to append to the report output
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                                  # XXX when the -t parameter is given
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                          # XXX It would probably be better to use ipaddress or similar to do
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                          # XXX SA puts this in a timer.
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                                  # XXX This seems to append to the report output
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                          # XXX check
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                          # XXX It would be better if we could refactor all of this so that we
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                          # XXX it instead.
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                          # XXX SA has a timer here.
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  XXX found
                                  Open

                                          # XXX I think it's better if we copy that small function and not
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by fixme

                                  Identical blocks of code found in 3 locations. Consider refactoring.
                                  Open

                                      def parse_list(self, list_name):
                                          parsed_list = []
                                          characters = ["?", "@", ".", "*@"]
                                          for addr in self[list_name]:
                                              if len([e for e in characters if e in addr]):
                                  Severity: Major
                                  Found in oa/plugins/bayes.py and 2 other locations - About 7 hrs to fix
                                  oa/plugins/spf.py on lines 148..159
                                  oa/plugins/wlbl_eval.py on lines 117..127

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 121.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      def learn_message(self, msg, isspam):
                                          """Learn the message has spam or ham."""
                                          if not self["use_bayes"]:
                                              return
                                          # XXX In SA, there is a time limit set here.
                                  Severity: Major
                                  Found in oa/plugins/bayes.py and 1 other location - About 3 hrs to fix
                                  oa/plugins/bayes.py on lines 692..702

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 73.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      def forget_message(self, msg, msgid):
                                          """Unlearn a message."""
                                          if not self["use_bayes"]:
                                              return
                                          # XXX SA wraps this in a timer.
                                  Severity: Major
                                  Found in oa/plugins/bayes.py and 1 other location - About 3 hrs to fix
                                  oa/plugins/bayes.py on lines 612..622

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 73.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                          if nn < self["bayes_min_ham_num"]:
                                              self.ctxt.log.debug(
                                                  "bayes: not available for scanning, only %s ham(s) "
                                                  "in bayes DB < %s", nn, self["bayes_min_ham_num"])
                                              if not self.learn_caller_will_untie:
                                  Severity: Major
                                  Found in oa/plugins/bayes.py and 1 other location - About 2 hrs to fix
                                  oa/plugins/bayes.py on lines 748..755

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 59.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                          if ns < self["bayes_min_spam_num"]:
                                              self.ctxt.log.debug(
                                                  "bayes: not available for scanning, only %s spam(s) in "
                                                  "bayes DB < %s", ns, self["bayes_min_spam_num"]
                                              )
                                  Severity: Major
                                  Found in oa/plugins/bayes.py and 1 other location - About 2 hrs to fix
                                  oa/plugins/bayes.py on lines 756..762

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 59.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Identical blocks of code found in 2 locations. 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: Major
                                  Found in oa/plugins/bayes.py and 1 other location - About 1 hr to fix
                                  oa/plugins/wlbl_eval.py on lines 212..219

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 49.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                                      while True:
                                                          token = re.sub(r"^(..?)", "", token)
                                                          if not token:
                                                              break
                                                          rettokens.add("8:" + token)
                                  Severity: Major
                                  Found in oa/plugins/bayes.py and 1 other location - About 1 hr to fix
                                  oa/plugins/bayes.py on lines 852..856

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 41.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                                      while True:
                                                          bit = re.sub(r"^[^\.]+\.(.+)$", "\1", bit)
                                                          if not bit:
                                                              break
                                                          rettokens.add("UD:" + bit)  # UD = URL domain
                                  Severity: Major
                                  Found in oa/plugins/bayes.py and 1 other location - About 1 hr to fix
                                  oa/plugins/bayes.py on lines 866..870

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 41.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 4 locations. Consider refactoring.
                                  Open

                                      def plugin_revoke(self, msg):
                                          """Train the message as ham."""
                                          super(BayesPlugin, self).plugin_revoke(msg)
                                          self.learn_message(msg, False)
                                  Severity: Major
                                  Found in oa/plugins/bayes.py and 3 other locations - About 40 mins to fix
                                  oa/plugins/bayes.py on lines 602..605
                                  oa/plugins/pyzor.py on lines 56..59
                                  oa/plugins/pyzor.py on lines 61..64

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 34.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 4 locations. Consider refactoring.
                                  Open

                                      def plugin_report(self, msg):
                                          """Train the message as spam."""
                                          super(BayesPlugin, self).plugin_report(msg)
                                          self.learn_message(msg, True)
                                  Severity: Major
                                  Found in oa/plugins/bayes.py and 3 other locations - About 40 mins to fix
                                  oa/plugins/bayes.py on lines 607..610
                                  oa/plugins/pyzor.py on lines 56..59
                                  oa/plugins/pyzor.py on lines 61..64

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 34.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Line too long (113 > 79 characters)
                                  Open

                                              r"(?:mailto:)?\s([-a-z0-9_\+\:\=\!\#\$\%\&\*\^\?\{\}\|\~\/\.]+\@[-a-z0-9_\+\:\/]+)[-a-z0-9_\+\:\/]+",
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Missing whitespace after ','
                                  Open

                                              D,S,H,C,O,N = (float(x) for x in (d,spam_count,ham_count,c,o,n))
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Each comma, semicolon or colon should be followed by whitespace.

                                  Okay: [a, b]
                                  Okay: (3,)
                                  Okay: a[1:4]
                                  Okay: a[:4]
                                  Okay: a[1:]
                                  Okay: a[1:4:2]
                                  E231: ['a','b']
                                  E231: foo(bar,baz)
                                  E231: [{'a':'b'}]

                                  Line too long (80 > 79 characters)
                                  Open

                                      # XXX This needs a regular expression, but it doesn't seem worth having this
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (85 > 79 characters)
                                  Open

                                          self[u"bayes_token_body"] = self.get_body_text_array_common(self["rendered"])
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (109 > 79 characters)
                                  Open

                                              "SPAMMYTOKENS": self.bayes_report_make_list(msg, self.get_local(msg, "bayes_token_info_spammy")),
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (187 > 79 characters)
                                  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):
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Blank line contains whitespace
                                  Open

                                          
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Trailing whitespace is superfluous.

                                  The warning returned varies on whether the line itself is blank,
                                  for easier filtering for those who want to indent their blank lines.
                                  
                                  Okay: spam(1)\n#
                                  W291: spam(1) \n#
                                  W293: class Foo(object):\n    \n    bang = 12

                                  Line too long (92 > 79 characters)
                                  Open

                                                  if TOKENIZE_LONG_8BIT_SEQS_AS_TUPLES and re.match(r"[\xa0-\xff]{2}", token):
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (81 > 79 characters)
                                  Open

                                              # Break up blocks of separator chars so they become their own tokens.
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (92 > 79 characters)
                                  Open

                                              d = self._compute_declassification_distance(ns, nh, spam_count, ham_count, prob)
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Missing whitespace after ','
                                  Open

                                              D,S,H,C,O,N = (float(x) for x in (d,spam_count,ham_count,c,o,n))
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Each comma, semicolon or colon should be followed by whitespace.

                                  Okay: [a, b]
                                  Okay: (3,)
                                  Okay: a[1:4]
                                  Okay: a[:4]
                                  Okay: a[1:]
                                  Okay: a[1:4:2]
                                  E231: ['a','b']
                                  E231: foo(bar,baz)
                                  E231: [{'a':'b'}]

                                  Line too long (80 > 79 characters)
                                  Open

                                          # Outlook message-ids seem to contain a server identifier ID in the last
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Blank line contains whitespace
                                  Open

                                          
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Trailing whitespace is superfluous.

                                  The warning returned varies on whether the line itself is blank,
                                  for easier filtering for those who want to indent their blank lines.
                                  
                                  Okay: spam(1)\n#
                                  W291: spam(1) \n#
                                  W293: class Foo(object):\n    \n    bang = 12

                                  Trailing whitespace
                                  Open

                                          """Check to make sure we can tie() the DB, and we have enough entries 
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Trailing whitespace is superfluous.

                                  The warning returned varies on whether the line itself is blank,
                                  for easier filtering for those who want to indent their blank lines.
                                  
                                  Okay: spam(1)\n#
                                  W291: spam(1) \n#
                                  W293: class Foo(object):\n    \n    bang = 12

                                  Missing whitespace after ','
                                  Open

                                              D,S,H,C,O,N = (float(x) for x in (d,spam_count,ham_count,c,o,n))
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Each comma, semicolon or colon should be followed by whitespace.

                                  Okay: [a, b]
                                  Okay: (3,)
                                  Okay: a[1:4]
                                  Okay: a[:4]
                                  Okay: a[1:]
                                  Okay: a[1:4:2]
                                  E231: ['a','b']
                                  E231: foo(bar,baz)
                                  E231: [{'a':'b'}]

                                  Blank line contains whitespace
                                  Open

                                          
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Trailing whitespace is superfluous.

                                  The warning returned varies on whether the line itself is blank,
                                  for easier filtering for those who want to indent their blank lines.
                                  
                                  Okay: spam(1)\n#
                                  W291: spam(1) \n#
                                  W293: class Foo(object):\n    \n    bang = 12

                                  Line too long (80 > 79 characters)
                                  Open

                                                          "bayes: %s already learnt as opposite, not re-learning",
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (82 > 79 characters)
                                  Open

                                          val = re.sub(r"\swith\sSMTP\sid\sg[\dA-Z]{10,12}\s", " ", val)  # Sendmail
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (80 > 79 characters)
                                  Open

                                          self.ctxt.log.debug("bayes: corpus size: nspam = %s, nham = %s", ns, nn)
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (96 > 79 characters)
                                  Open

                                          if not sorted_tokens or (0 < len(sorted_tokens) <= REQUIRE_SIGNIFICANT_TOKENS_TO_SCORE):
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Missing whitespace after ','
                                  Open

                                              D,S,H,C,O,N = (float(x) for x in (d,spam_count,ham_count,c,o,n))
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Each comma, semicolon or colon should be followed by whitespace.

                                  Okay: [a, b]
                                  Okay: (3,)
                                  Okay: a[1:4]
                                  Okay: a[:4]
                                  Okay: a[1:]
                                  Okay: a[1:4:2]
                                  E231: ['a','b']
                                  E231: foo(bar,baz)
                                  E231: [{'a':'b'}]

                                  Missing whitespace after ','
                                  Open

                                              D,S,H,C,O,N = (float(x) for x in (d,spam_count,ham_count,c,o,n))
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Each comma, semicolon or colon should be followed by whitespace.

                                  Okay: [a, b]
                                  Okay: (3,)
                                  Okay: a[1:4]
                                  Okay: a[:4]
                                  Okay: a[1:]
                                  Okay: a[1:4:2]
                                  E231: ['a','b']
                                  E231: foo(bar,baz)
                                  E231: [{'a':'b'}]

                                  Line too long (80 > 79 characters)
                                  Open

                                      # XXX This needs a regular expression, but it doesn't seem worth having this
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (80 > 79 characters)
                                  Open

                                      # XXX This needs a regular expression, but it doesn't seem worth having this
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (80 > 79 characters)
                                  Open

                                                                      "is neither ham nor spam but '%s', ignored",
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Missing whitespace after ','
                                  Open

                                              D,S,H,C,O,N = (float(x) for x in (d,spam_count,ham_count,c,o,n))
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Each comma, semicolon or colon should be followed by whitespace.

                                  Okay: [a, b]
                                  Okay: (3,)
                                  Okay: a[1:4]
                                  Okay: a[:4]
                                  Okay: a[1:]
                                  Okay: a[1:4:2]
                                  E231: ['a','b']
                                  E231: foo(bar,baz)
                                  E231: [{'a':'b'}]

                                  Line too long (107 > 79 characters)
                                  Open

                                              "HAMMYTOKENS": self.bayes_report_make_list(msg, self.get_local(msg, "bayes_token_info_hammy")),
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Blank line contains whitespace
                                  Open

                                          
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Trailing whitespace is superfluous.

                                  The warning returned varies on whether the line itself is blank,
                                  for easier filtering for those who want to indent their blank lines.
                                  
                                  Okay: spam(1)\n#
                                  W291: spam(1) \n#
                                  W293: class Foo(object):\n    \n    bang = 12

                                  Line too long (80 > 79 characters)
                                  Open

                                              r"(?:\s*\(|\)|\s*(?:[+-][0-9]{4})|\s*(?:UT|[A-Z]{2,3}T))*", "", val)
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (80 > 79 characters)
                                  Open

                                          # IPs in the 10 and 192.168 ranges, they gets lots of significant tokens
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Trailing whitespace
                                  Open

                                          """Common method for rendered, visible_rendered, 
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Trailing whitespace is superfluous.

                                  The warning returned varies on whether the line itself is blank,
                                  for easier filtering for those who want to indent their blank lines.
                                  
                                  Okay: spam(1)\n#
                                  W291: spam(1) \n#
                                  W293: class Foo(object):\n    \n    bang = 12

                                  Line too long (80 > 79 characters)
                                  Open

                                          # Some useful tokens: "$31,000,000" "www.clock-speed.net" "f*ck" "Hits!"
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (116 > 79 characters)
                                  Open

                                              if header.lower() not in IGNORED_HEADERS and (not IGNORE_MSGID_TOKENS or header.lower() != "message-id")
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Missing whitespace after ','
                                  Open

                                              D,S,H,C,O,N = (float(x) for x in (d,spam_count,ham_count,c,o,n))
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Each comma, semicolon or colon should be followed by whitespace.

                                  Okay: [a, b]
                                  Okay: (3,)
                                  Okay: a[1:4]
                                  Okay: a[:4]
                                  Okay: a[1:]
                                  Okay: a[1:4:2]
                                  E231: ['a','b']
                                  E231: foo(bar,baz)
                                  E231: [{'a':'b'}]

                                  Line too long (84 > 79 characters)
                                  Open

                                                          prob = (FW_S_DOT_X + (robn * prob)) / (FW_S_CONSTANT + robn)
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Missing whitespace after ','
                                  Open

                                              D,S,H,C,O,N = (float(x) for x in (d,spam_count,ham_count,c,o,n))
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Each comma, semicolon or colon should be followed by whitespace.

                                  Okay: [a, b]
                                  Okay: (3,)
                                  Okay: a[1:4]
                                  Okay: a[:4]
                                  Okay: a[1:]
                                  Okay: a[1:4:2]
                                  E231: ['a','b']
                                  E231: foo(bar,baz)
                                  E231: [{'a':'b'}]

                                  Blank line contains whitespace
                                  Open

                                          
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Trailing whitespace is superfluous.

                                  The warning returned varies on whether the line itself is blank,
                                  for easier filtering for those who want to indent their blank lines.
                                  
                                  Okay: spam(1)\n#
                                  W291: spam(1) \n#
                                  W293: class Foo(object):\n    \n    bang = 12

                                  Trailing whitespace
                                  Open

                                          to do a scan. If we're told the caller will untie(), go ahead and 
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Trailing whitespace is superfluous.

                                  The warning returned varies on whether the line itself is blank,
                                  for easier filtering for those who want to indent their blank lines.
                                  
                                  Okay: spam(1)\n#
                                  W291: spam(1) \n#
                                  W293: class Foo(object):\n    \n    bang = 12

                                  Line too long (96 > 79 characters)
                                  Open

                                          self[u'bayes_token_inviz'] = self.get_body_text_array_common(self["invisible_rendered"])
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (117 > 79 characters)
                                  Open

                                          probabilities_ref = (ref for ref in self._compute_prob_for_all_tokens(tokensdata, ns, nn) if ref is not None)
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (80 > 79 characters)
                                  Open

                                                  # test_log("score: %3.4f, hits: %s" % (bayes_score, bayes_hits))
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (80 > 79 characters)
                                  Open

                                                                  "none of the tokens were found in the database")
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Missing whitespace after ','
                                  Open

                                              D,S,H,C,O,N = (float(x) for x in (d,spam_count,ham_count,c,o,n))
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Each comma, semicolon or colon should be followed by whitespace.

                                  Okay: [a, b]
                                  Okay: (3,)
                                  Okay: a[1:4]
                                  Okay: a[:4]
                                  Okay: a[1:]
                                  Okay: a[1:4:2]
                                  E231: ['a','b']
                                  E231: foo(bar,baz)
                                  E231: [{'a':'b'}]

                                  Line too long (82 > 79 characters)
                                  Open

                                          val = re.sub(r"\swith\sESMTP\sid\s[\dA-F]{10,12}\s", " ", val)  # Sendmail
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (88 > 79 characters)
                                  Open

                                          tokensdata = list(d for d in self.store.tok_get_all(msgtokens) if d is not None)
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Missing whitespace after ','
                                  Open

                                              D,S,H,C,O,N = (float(x) for x in (d,spam_count,ham_count,c,o,n))
                                  Severity: Minor
                                  Found in oa/plugins/bayes.py by pep8

                                  Each comma, semicolon or colon should be followed by whitespace.

                                  Okay: [a, b]
                                  Okay: (3,)
                                  Okay: a[1:4]
                                  Okay: a[:4]
                                  Okay: a[1:]
                                  Okay: a[1:4:2]
                                  E231: ['a','b']
                                  E231: foo(bar,baz)
                                  E231: [{'a':'b'}]

                                  There are no issues that match your filters.

                                  Category
                                  Status