pypi flake8-annotations 1.2.0
Release v1.2.0

latest releases: 3.1.1, 3.1.0, 3.0.1...
4 years ago

[v1.2.0]

Added

  • Add test case for checking whether flake8 invokes our plugin
  • #41 Add --suppress-none-returning configuration option to suppress TYP200 level errors for functions that either lack a return statement or only explicitly return None.
  • Add black as an explicit developer requirement (codebase already adheres to black formatting)

Changed

  • #61 Migrate from Pipenv to Poetry for developer environment setup

Additional Details:

This release adds the --suppress-none-returning configuration option, as requested by #41. If this flag is set, TYP200-level errors are suppressed for functions that meet one of the following criteria:

  • Contain no return statement, or
  • Explicit return statement(s) all return None (explicitly or implicitly).

For example:

def foo():
    """This is a test function."""
    a = 2 + 2
    if a == 4:
        return None
    else:
        return

Will not yield a TYP201 error, with the flag set:

$ flake8 test.py
test.py:1:11: TYP201 Missing return type annotation for public function
$ flake8 test.py --suppress-none-returning
<No output>

And:

def foo():
    """This is a test function."""
    a = 2 + 2
    if a == 4:
        return True
    else:
        return

Will still yield a TYP201 error, with the flag set:

$ flake8 test.py
test.py:1:11: TYP201 Missing return type annotation for public function
$ flake8 test.py --suppress-none-returning
test.py:1:11: TYP201 Missing return type annotation for public function

The default value of this configuration option is False, so this addition should be transparent to existing users.

Don't miss a new flake8-annotations release

NewReleases is sending notifications on new releases.