amey-sam/Flask-MailGun

View on GitHub

Showing 30 of 30 total issues

Cyclomatic complexity is too high in method __init__. (10)
Open

    def __init__(self, subject='',
                 recipients=None,
                 body=None,
                 html=None,
                 alts=None,
Severity: Minor
Found in flask_mailgun/message.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 __init__ has 15 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, subject='',
Severity: Major
Found in flask_mailgun/message.py - About 1 hr to fix

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

        def attach(self,
    Severity: Minor
    Found in flask_mailgun/message.py - About 35 mins to fix

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

          def __init__(self, filename=None, content_type=None, data=None,
      Severity: Minor
      Found in flask_mailgun/attachment.py - About 35 mins to fix

        Whitespace before '('
        Open

                print ("received 2 emails")
        Severity: Minor
        Found in tests/test_receve.py by pep8

        Avoid extraneous whitespace.

        Avoid extraneous whitespace in the following situations:
        - before the open parenthesis that starts the argument list of a
          function call.
        - before the open parenthesis that starts an indexing or slicing.
        
        Okay: spam(1)
        E211: spam (1)
        
        Okay: dict['key'] = list[index]
        E211: dict ['key'] = list[index]
        E211: dict['key'] = list [index]

        Line too long (80 > 79 characters)
        Open

        url_safe_chars = string.ascii_lowercase + string.ascii_uppercase + string.digits
        Severity: Minor
        Found in tests/fixtures/email.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.assertEqual(url, 'https://api.mailgun.net/v3/example.com/messages')
        Severity: Minor
        Found in tests/test_send.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 after class or function definition, found 1
        Open

        if __name__ == '__main__':
        Severity: Minor
        Found in tests/test_api.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

        Whitespace before '('
        Open

                print ("received 100 emails")
        Severity: Minor
        Found in tests/test_receve.py by pep8

        Avoid extraneous whitespace.

        Avoid extraneous whitespace in the following situations:
        - before the open parenthesis that starts the argument list of a
          function call.
        - before the open parenthesis that starts an indexing or slicing.
        
        Okay: spam(1)
        E211: spam (1)
        
        Okay: dict['key'] = list[index]
        E211: dict ['key'] = list[index]
        E211: dict['key'] = list [index]

        At least two spaces before inline comment
        Open

        except ImportError: # for pip <= 9.0.3
        Severity: Minor
        Found in setup.py by pep8

        Separate inline comments by at least two spaces.

        An inline comment is a comment on the same line as a statement.
        Inline comments should be separated by at least two spaces from the
        statement. They should start with a # and a single space.
        
        Each line of a block comment starts with a # and a single space
        (unless it is indented text inside the comment).
        
        Okay: x = x + 1  # Increment x
        Okay: x = x + 1    # Increment x
        Okay: # Block comment
        E261: x = x + 1 # Increment x
        E262: x = x + 1  #Increment x
        E262: x = x + 1  #  Increment x
        E265: #Block comment
        E266: ### Block comment

        Trailing whitespace
        Open

                    return id_table.get(make_key(route)) 
        Severity: Minor
        Found in flask_mailgun/api.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 (83 > 79 characters)
        Open

                attachments = [att for att in files if self._is_file_allowed(att.filename)]
        Severity: Minor
        Found in flask_mailgun/core.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

            :param mail_options: A list of ESMTP options to be used in MAIL FROM command
        Severity: Minor
        Found in flask_mailgun/message.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 Processor:
        Severity: Minor
        Found in flask_mailgun/processing.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 (96 > 79 characters)
        Open

            :param alts: A dict or an iterable to go through dict() that contains multipart alternatives
        Severity: Minor
        Found in flask_mailgun/message.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 (86 > 79 characters)
        Open

                        raise MailGunException("Route deletion failed. Reason: " + ret.reason)
        Severity: Minor
        Found in flask_mailgun/api.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 after class or function definition, found 1
        Open

        if __name__ == '__main__':
        Severity: Minor
        Found in tests/__init__.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

        Blank line contains whitespace
        Open

                                         
        Severity: Minor
        Found in tests/fixtures/email.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

        At least two spaces before inline comment
        Open

        try: # for pip >= 10
        Severity: Minor
        Found in setup.py by pep8

        Separate inline comments by at least two spaces.

        An inline comment is a comment on the same line as a statement.
        Inline comments should be separated by at least two spaces from the
        statement. They should start with a # and a single space.
        
        Each line of a block comment starts with a # and a single space
        (unless it is indented text inside the comment).
        
        Okay: x = x + 1  # Increment x
        Okay: x = x + 1    # Increment x
        Okay: # Block comment
        E261: x = x + 1 # Increment x
        E262: x = x + 1  #Increment x
        E262: x = x + 1  #  Increment x
        E265: #Block comment
        E266: ### Block comment

        Line too long (109 > 79 characters)
        Open

                    raise MailGunException("Mailbox Error: credential verification failed.", "Not enough parameters")
        Severity: Minor
        Found in flask_mailgun/api.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.
        Severity
        Category
        Status
        Source
        Language