SpamExperts/OrangeAssassin

View on GitHub
oa/plugins/free_mail.py

Summary

Maintainability
F
5 days
Test Coverage

File free_mail.py has 373 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""FreeMail Plugin

The FreeMail plugin checks the headers for indication that the sender's
domain is that of a site offering free email services.
"""
Severity: Minor
Found in oa/plugins/free_mail.py - About 4 hrs to fix

    Cyclomatic complexity is too high in method check_freemail_replyto. (24)
    Open

        def check_freemail_replyto(self, msg, option=None, target=None):
            """Checks/compares freemail addresses found from headers and body
            Possible options:
                - replyto    From: or body address is different than Reply-To
                            (this is the default)
    Severity: Minor
    Found in oa/plugins/free_mail.py 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_freemail_replyto has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

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

    Cognitive Complexity

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

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

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

    Further reading

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

        def check_freemail_header(self, msg, header, regex=None, target=None):
            """Check all possible 'from' headers to see if sender
            is freemail. It is possible to provide a regex
            rule to match against too.
    
    
    Severity: Minor
    Found in oa/plugins/free_mail.py 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_freemail_body has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

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

    Cognitive Complexity

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

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

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

    Further reading

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

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

    Cognitive Complexity

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

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

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

    Further reading

    Cyclomatic complexity is too high in method check_freemail_from. (13)
    Open

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

        def check_freemail_body(self, msg, regex=None, target=None):
            """
            Check if there are free emails in body parts
            of the message
            """
    Severity: Minor
    Found in oa/plugins/free_mail.py 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_freemail_from has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

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

    Cognitive Complexity

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

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

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

    Further reading

    Cyclomatic complexity is too high in class FreeMail. (11)
    Open

    class FreeMail(oa.plugins.base.BasePlugin):
        eval_rules = (
            "check_freemail_replyto",
            "check_freemail_from",
            "check_freemail_header",
    Severity: Minor
    Found in oa/plugins/free_mail.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 _is_freemail. (9)
    Open

        def _is_freemail(self, email):
            """Check if the email is in freemail_domains list
            If the email is whitelisted than we skip the check
            """
            if not email:
    Severity: Minor
    Found in oa/plugins/free_mail.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_body. (7)
    Open

        def _parse_body(self):
            """Parse all the emails from body and check
            if all conditions are accepted
            """
            get_global = self.get_global
    Severity: Minor
    Found in oa/plugins/free_mail.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 _parse_body has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def _parse_body(self):
            """Parse all the emails from body and check
            if all conditions are accepted
            """
            get_global = self.get_global
    Severity: Minor
    Found in oa/plugins/free_mail.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 _is_freemail has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def _is_freemail(self, email):
            """Check if the email is in freemail_domains list
            If the email is whitelisted than we skip the check
            """
            if not email:
    Severity: Minor
    Found in oa/plugins/free_mail.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 too many return statements within this function.
    Open

                    return str(result)
    Severity: Major
    Found in oa/plugins/free_mail.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

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

        Avoid too many return statements within this function.
        Open

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

          Avoid too many return statements within this function.
          Open

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

            Avoid too many return statements within this function.
            Open

                            return str(result)
            Severity: Major
            Found in oa/plugins/free_mail.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

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

                  Avoid too many return statements within this function.
                  Open

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

                    Avoid too many return statements within this function.
                    Open

                                        return str(result)
                    Severity: Major
                    Found in oa/plugins/free_mail.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

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

                        Avoid too many return statements within this function.
                        Open

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

                          Avoid too many return statements within this function.
                          Open

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

                            Avoid too many return statements within this function.
                            Open

                                            return str(result)
                            Severity: Major
                            Found in oa/plugins/free_mail.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

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

                                Avoid too many return statements within this function.
                                Open

                                                return str(result)
                                Severity: Major
                                Found in oa/plugins/free_mail.py - About 30 mins to fix

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

                                      def check_start(self, msg):
                                          """Verify that the domains are valid and separate wildcard
                                          domains from the rest."""
                                          domain_re = Regex(r'^[a-z0-9.*?-]+$')
                                          freemail_domains = self.get_global('freemail_domains')
                                  Severity: Minor
                                  Found in oa/plugins/free_mail.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

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

                                                  if check_re.search(email):
                                                      self.ctxt.log.debug(
                                                          "FreeMail::Plugin check_freemail_body"
                                                          " HIT! %s is freemail and matches regex", email)
                                                      result = "Address from body is freemail and matches regex"
                                  Severity: Major
                                  Found in oa/plugins/free_mail.py and 1 other location - About 4 hrs to fix
                                  oa/plugins/free_mail.py on lines 217..225

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

                                  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

                                                  elif check_re and check_re.search(email):
                                                      self.ctxt.log.debug(
                                                          "FreeMail::Plugin check_freemail_from"
                                                          " HIT! %s is freemail and matches regex", email)
                                                      result = "Sender address is freemail and matches regex"
                                  Severity: Major
                                  Found in oa/plugins/free_mail.py and 1 other location - About 4 hrs to fix
                                  oa/plugins/free_mail.py on lines 314..322

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

                                  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 regex:
                                              try:
                                                  check_re = Regex(regex).compile()
                                              except re.error:
                                                  self.ctxt.log.warn("FreeMail::Plugin check_freemail_header"
                                  Severity: Major
                                  Found in oa/plugins/free_mail.py and 1 other location - About 1 hr to fix
                                  oa/plugins/free_mail.py on lines 301..309

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

                                  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 regex:
                                              try:
                                                  check_re = Regex(regex).compile()
                                              except re.error:
                                                  self.ctxt.log.warn("FreeMail::Plugin check_freemail_from"
                                  Severity: Major
                                  Found in oa/plugins/free_mail.py and 1 other location - About 1 hr to fix
                                  oa/plugins/free_mail.py on lines 248..256

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

                                  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

                                          try:
                                              from_email = get_global(
                                                  'email_re').search(msg.msg['From']).group()
                                          except (AttributeError, TypeError, KeyError):
                                              from_email = ''
                                  Severity: Major
                                  Found in oa/plugins/free_mail.py and 1 other location - About 1 hr to fix
                                  oa/plugins/free_mail.py on lines 136..140

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

                                  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

                                          try:
                                              reply_to = get_global(
                                                  'email_re').search(msg.msg['Reply-To']).group()
                                          except (AttributeError, TypeError, KeyError):
                                              reply_to = ''
                                  Severity: Major
                                  Found in oa/plugins/free_mail.py and 1 other location - About 1 hr to fix
                                  oa/plugins/free_mail.py on lines 131..135

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

                                  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 (100 > 79 characters)
                                  Open

                                      | [a-f0-9]{8}(?:\.[a-f0-9]{8}|-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}) # gmail msgids?
                                  Severity: Minor
                                  Found in oa/plugins/free_mail.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 (87 > 79 characters)
                                  Open

                                                (?=.{{0,64}}\@)                # limit userpart to 64 chars (and speed up searching?)
                                  Severity: Minor
                                  Found in oa/plugins/free_mail.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.

                                  Invalid escape sequence '.'
                                  Open

                                                  temp = domain.replace('.', '\.')
                                  Severity: Minor
                                  Found in oa/plugins/free_mail.py by pep8

                                  Invalid escape sequences are deprecated in Python 3.6.

                                  Okay: regex = r'\.png$'
                                  W605: regex = '\.png$'

                                  Line too long (107 > 79 characters)
                                  Open

                                                (?:[a-z0-9](?:[a-z0-9-]{{0,59}}[a-z0-9])?\.){{1,4}} # max 4x61 char parts (should be enough?)
                                  Severity: Minor
                                  Found in oa/plugins/free_mail.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 (90 > 79 characters)
                                  Open

                                                (?:\.[a-z0-9!#\$%&'*+\/=?^_`{{|}}~-]+)*    # no consecutive dots, no ending dot
                                  Severity: Minor
                                  Found in oa/plugins/free_mail.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.

                                  There are no issues that match your filters.

                                  Category
                                  Status