Skip to content

flake8 plugin which checks that modules under `__all__` are defined as strings

License

Notifications You must be signed in to change notification settings

ggupta2005/flake8-all-not-strings

Repository files navigation

flake8-all-not-strings

PyPI data-understand MIT license versions Downloads

Python Linting Run Python Unit Tests

CodeFactor

Flake8 plugin that checks that the all the elements defined in the __all__ list are strings. Sometimes the flake8 doesn't throw error from the __init__.py if the modules under __all__ are not strings.

Example below of an __init__.py file which should throw an error:-

from some_module import some_function 
__all__ = [
      some_function
]

Example below of an __init__.py file which should not throw an error:-

from some_module import some_function 
__all__ = [
      'some_function'
]

Installation

pip install flake8-all-not-strings

Flake8 codes

Code description
ANS100 '<<some_module_name>>' import under all is not a string.

Testing

In order to run unit tests under the tests/ directory you can do the following steps:-

Install editable version of flake8-all-not-strings from the top level directory

pip install -e .

Install pytest

pip install pytest

Run tests

Change to tests/ directory and run tests using pytest

cd tests/
pytest

About

flake8 plugin which checks that modules under `__all__` are defined as strings

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages