[code-quality] Flake8 in python script?

Ian Cordasco graffatcolmingov at gmail.com
Thu Oct 22 11:04:59 EDT 2015


On Thu, Oct 22, 2015 at 9:08 AM, Peter Bittner <peter.bittner at gmx.net> wrote:
> Maybe like this?
>
> ```
> from flake8.main import main
>
> main()
> ```

This is easily the most correct way of doing it.

Notice that it's not exactly a public API and we do not return
anything. You'll have to wrap it in

```
from flake8 import main as flake8

try:
    flake8.main()
except SystemExit:
    # Whatever handling you want
```

If you do not want flake8 to quit your script for you.


More information about the code-quality mailing list