SpamExperts/OrangeAssassin

View on GitHub
oa/plugins/mime_eval.py

Summary

Maintainability
D
2 days
Test Coverage

File mime_eval.py has 343 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Expose some eval rules that do checks on the MIME headers."""

import re

import oa.locales
Severity: Minor
Found in oa/plugins/mime_eval.py - About 4 hrs to fix

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

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

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

          def extract_metadata(self, msg, payload, text, part):
              content = part.get_payload(decode=True)
              if content:
                  low = len(content.decode("ascii", errors="ignore"))
                  high = len(content)
      Severity: Minor
      Found in oa/plugins/mime_eval.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_msg_parse_flags. (9)
      Open

          def check_msg_parse_flags(self, msg, flag, target=None):
              """Checks the value of flags added when parsing the msssage.
              The following flags are allowed
               - missing_mime_head_body_separator: There is no newline after the header
               - missing_mime_headers: if the line after the opening boundary isn't a
      Severity: Minor
      Found in oa/plugins/mime_eval.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_for_uppercase. (8)
      Open

          def check_for_uppercase(self, msg, min_percent, max_percent, target=None):
              """Checks the percent of uppercase letters is between desired limits"""
      
              total_lower = 0
              total_upper = 0
      Severity: Minor
      Found in oa/plugins/mime_eval.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 _update_mime_text_info. (7)
      Open

          def _update_mime_text_info(self, msg, payload, part, text):
              charset = part.get_charset()
              text_count = self.get_local(msg, "mime_body_text_count")
              self.set_local(msg, "mime_body_text_count", text_count + 1)
              if part.get_content_subtype() == "plain":
      Severity: Minor
      Found in oa/plugins/mime_eval.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 _update_base64_text_stats. (6)
      Open

          def _update_base64_text_stats(self, msg, content_type,
                                        content_transfer_encoding,
                                        content_disposition, charset):
      
              text_charset_re = Regex(r"(us-ascii|ansi_x3\.4-1968|iso-ir-6|"
      Severity: Minor
      Found in oa/plugins/mime_eval.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 parsed_metadata. (6)
      Open

          def parsed_metadata(self, msg):
              html_count = self.get_local(msg, "html_characters_count")
              text_count = self.get_local(msg, "plain_characters_count")
              if html_count and text_count:
                  self.set_local(msg, "mime_multipart_ratio",
      Severity: Minor
      Found in oa/plugins/mime_eval.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 check_msg_parse_flags has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_msg_parse_flags(self, msg, flag, target=None):
              """Checks the value of flags added when parsing the msssage.
              The following flags are allowed
               - missing_mime_head_body_separator: There is no newline after the header
               - missing_mime_headers: if the line after the opening boundary isn't a
      Severity: Minor
      Found in oa/plugins/mime_eval.py - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          def _update_mime_text_info(self, msg, payload, part, text):
              charset = part.get_charset()
              text_count = self.get_local(msg, "mime_body_text_count")
              self.set_local(msg, "mime_body_text_count", text_count + 1)
              if part.get_content_subtype() == "plain":
      Severity: Minor
      Found in oa/plugins/mime_eval.py - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          def extract_metadata(self, msg, payload, text, part):
              content = part.get_payload(decode=True)
              if content:
                  low = len(content.decode("ascii", errors="ignore"))
                  high = len(content)
      Severity: Minor
      Found in oa/plugins/mime_eval.py - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          def _update_base64_text_stats(self, msg, content_type,
      Severity: Minor
      Found in oa/plugins/mime_eval.py - About 35 mins to fix

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

            def _update_mime_ma_non_text(self, msg, part):
                if not self.get_local(msg, "mime_ma_non_text"):
                    for ma_part in part.get_payload():
                        if(ma_part.get_content_maintype() != "text" and
                           ma_part.get_content_type not in (
        Severity: Minor
        Found in oa/plugins/mime_eval.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 False
        Severity: Major
        Found in oa/plugins/mime_eval.py - About 30 mins to fix

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

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

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          XXX found
          Open

                      # XXX This does not work properly anymore
          Severity: Minor
          Found in oa/plugins/mime_eval.py by fixme

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

              def check_base64_length(self, msg, min_length, max_length='inf',
                                      target=None):
                  """
                  Checks if there is any base64 encoded lines that above or below the
                  given parameters
          Severity: Major
          Found in oa/plugins/mime_eval.py and 2 other locations - About 1 hr to fix
          oa/plugins/mime_eval.py on lines 376..394
          oa/plugins/mime_eval.py on lines 396..404

          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 47.

          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 3 locations. Consider refactoring.
          Open

              def check_abundant_unicode_ratio(self, msg, min_ratio, max_ratio="inf",
                                               target=None):
                  """A MIME part claiming to be text/plain and containing Unicode
                  characters must be encoded as quoted-printable or base64, or use UTF
                  data coding (typically with 8bit encoding).  Any message in 7bit or
          Severity: Major
          Found in oa/plugins/mime_eval.py and 2 other locations - About 1 hr to fix
          oa/plugins/mime_eval.py on lines 347..357
          oa/plugins/mime_eval.py on lines 396..404

          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 47.

          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 3 locations. Consider refactoring.
          Open

              def check_qp_ratio(self, msg, min_ratio, max_ratio="inf", target=None):
                  """
                  Takes a min ratio to use in eval to see if there is an spamminess to
                  the ratio of quoted printable to total bytes in an email.
                  :param min_ratio:
          Severity: Major
          Found in oa/plugins/mime_eval.py and 2 other locations - About 1 hr to fix
          oa/plugins/mime_eval.py on lines 347..357
          oa/plugins/mime_eval.py on lines 376..394

          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 47.

          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

          Missing whitespace around operator
          Open

                      if high>low and high*2>3:
          Severity: Minor
          Found in oa/plugins/mime_eval.py by pep8

          Surround operators with a single space on either side.

          - Always surround these binary operators with a single space on
            either side: assignment (=), augmented assignment (+=, -= etc.),
            comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
            Booleans (and, or, not).
          
          - If operators with different priorities are used, consider adding
            whitespace around the operators with the lowest priorities.
          
          Okay: i = i + 1
          Okay: submitted += 1
          Okay: x = x * 2 - 1
          Okay: hypot2 = x * x + y * y
          Okay: c = (a + b) * (a - b)
          Okay: foo(bar, key='word', *args, **kwargs)
          Okay: alpha[:-i]
          
          E225: i=i+1
          E225: submitted +=1
          E225: x = x /2 - 1
          E225: z = x **y
          E225: z = 1and 1
          E226: c = (a+b) * (a-b)
          E226: hypot2 = x*x + y*y
          E227: c = a|b
          E228: msg = fmt%(errno, errmsg)

          Line too long (116 > 79 characters)
          Open

                      return float(min_percent) < (total_upper / float(total_lower + total_upper)) * 100 <= float(max_percent)
          Severity: Minor
          Found in oa/plugins/mime_eval.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 around operator
          Open

                      if high>low and high*2>3:
          Severity: Minor
          Found in oa/plugins/mime_eval.py by pep8

          Surround operators with a single space on either side.

          - Always surround these binary operators with a single space on
            either side: assignment (=), augmented assignment (+=, -= etc.),
            comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
            Booleans (and, or, not).
          
          - If operators with different priorities are used, consider adding
            whitespace around the operators with the lowest priorities.
          
          Okay: i = i + 1
          Okay: submitted += 1
          Okay: x = x * 2 - 1
          Okay: hypot2 = x * x + y * y
          Okay: c = (a + b) * (a - b)
          Okay: foo(bar, key='word', *args, **kwargs)
          Okay: alpha[:-i]
          
          E225: i=i+1
          E225: submitted +=1
          E225: x = x /2 - 1
          E225: z = x **y
          E225: z = 1and 1
          E226: c = (a+b) * (a-b)
          E226: hypot2 = x*x + y*y
          E227: c = a|b
          E228: msg = fmt%(errno, errmsg)

          Line too long (81 > 79 characters)
          Open

                    mime_text_unicode_ratio": number of unicode encoded chars / total chars
          Severity: Minor
          Found in oa/plugins/mime_eval.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

                      html_characters_count = self.get_local(msg, "html_characters_count")
          Severity: Minor
          Found in oa/plugins/mime_eval.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 around operator
          Open

                          if len(key) > MAX_HEADER_KEY or len(value)> MAX_HEADER_VALUE:
          Severity: Minor
          Found in oa/plugins/mime_eval.py by pep8

          Surround operators with a single space on either side.

          - Always surround these binary operators with a single space on
            either side: assignment (=), augmented assignment (+=, -= etc.),
            comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
            Booleans (and, or, not).
          
          - If operators with different priorities are used, consider adding
            whitespace around the operators with the lowest priorities.
          
          Okay: i = i + 1
          Okay: submitted += 1
          Okay: x = x * 2 - 1
          Okay: hypot2 = x * x + y * y
          Okay: c = (a + b) * (a - b)
          Okay: foo(bar, key='word', *args, **kwargs)
          Okay: alpha[:-i]
          
          E225: i=i+1
          E225: submitted +=1
          E225: x = x /2 - 1
          E225: z = x **y
          E225: z = 1and 1
          E226: c = (a+b) * (a-b)
          E226: hypot2 = x*x + y*y
          E227: c = a|b
          E228: msg = fmt%(errno, errmsg)

          Too many blank lines (2)
          Open

                  ratio = self.get_local(msg, "mime_text_unicode_ratio")
          Severity: Minor
          Found in oa/plugins/mime_eval.py by pep8

          Separate top-level function and class definitions with two blank lines.

          Method definitions inside a class are separated by a single blank
          line.
          
          Extra blank lines may be used (sparingly) to separate groups of
          related functions.  Blank lines may be omitted between a bunch of
          related one-liners (e.g. a set of dummy implementations).
          
          Use blank lines in functions, sparingly, to indicate logical
          sections.
          
          Okay: def a():\n    pass\n\n\ndef b():\n    pass
          Okay: def a():\n    pass\n\n\nasync def b():\n    pass
          Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
          Okay: default = 1\nfoo = 1
          Okay: classify = 1\nfoo = 1
          
          E301: class Foo:\n    b = 0\n    def bar():\n        pass
          E302: def a():\n    pass\n\ndef b(n):\n    pass
          E302: def a():\n    pass\n\nasync def b(n):\n    pass
          E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
          E303: def a():\n\n\n\n    pass
          E304: @decorator\n\ndef a():\n    pass
          E305: def a():\n    pass\na()
          E306: def a():\n    def b():\n        pass\n    def c():\n        pass

          Line too long (81 > 79 characters)
          Open

                   - missing_mime_head_body_separator: There is no newline after the header
          Severity: Minor
          Found in oa/plugins/mime_eval.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.

          Too many blank lines (3)
          Open

              def check_for_mime(self, msg, test, target=None):
          Severity: Minor
          Found in oa/plugins/mime_eval.py by pep8

          Separate top-level function and class definitions with two blank lines.

          Method definitions inside a class are separated by a single blank
          line.
          
          Extra blank lines may be used (sparingly) to separate groups of
          related functions.  Blank lines may be omitted between a bunch of
          related one-liners (e.g. a set of dummy implementations).
          
          Use blank lines in functions, sparingly, to indicate logical
          sections.
          
          Okay: def a():\n    pass\n\n\ndef b():\n    pass
          Okay: def a():\n    pass\n\n\nasync def b():\n    pass
          Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
          Okay: default = 1\nfoo = 1
          Okay: classify = 1\nfoo = 1
          
          E301: class Foo:\n    b = 0\n    def bar():\n        pass
          E302: def a():\n    pass\n\ndef b(n):\n    pass
          E302: def a():\n    pass\n\nasync def b(n):\n    pass
          E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
          E303: def a():\n\n\n\n    pass
          E304: @decorator\n\ndef a():\n    pass
          E305: def a():\n    pass\na()
          E306: def a():\n    def b():\n        pass\n    def c():\n        pass

          Line too long (82 > 79 characters)
          Open

                      plain_characters_count = self.get_local(msg, "plain_characters_count")
          Severity: Minor
          Found in oa/plugins/mime_eval.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.

          Expected 2 blank lines, found 1
          Open

          class MIMEEval(oa.plugins.base.BasePlugin):
          Severity: Minor
          Found in oa/plugins/mime_eval.py by pep8

          Separate top-level function and class definitions with two blank lines.

          Method definitions inside a class are separated by a single blank
          line.
          
          Extra blank lines may be used (sparingly) to separate groups of
          related functions.  Blank lines may be omitted between a bunch of
          related one-liners (e.g. a set of dummy implementations).
          
          Use blank lines in functions, sparingly, to indicate logical
          sections.
          
          Okay: def a():\n    pass\n\n\ndef b():\n    pass
          Okay: def a():\n    pass\n\n\nasync def b():\n    pass
          Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
          Okay: default = 1\nfoo = 1
          Okay: classify = 1\nfoo = 1
          
          E301: class Foo:\n    b = 0\n    def bar():\n        pass
          E302: def a():\n    pass\n\ndef b(n):\n    pass
          E302: def a():\n    pass\n\nasync def b(n):\n    pass
          E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
          E303: def a():\n\n\n\n    pass
          E304: @decorator\n\ndef a():\n    pass
          E305: def a():\n    pass\na()
          E306: def a():\n    def b():\n        pass\n    def c():\n        pass

          There are no issues that match your filters.

          Category
          Status