A Flake8 plugin to checking module level docstrings, future-imports, and dunders as specified in PEP 8
Low maintenance activity. Last release 10 months ago, commits in 0 of the last 26 weeks. Weaker on commit activity and release cadence.
pip install module-level-lintModule Level Lint
A Flake8 plugin to enforce code quality by checking module level docstrings, future-imports, and module level dunders as specified in PEP 8
Installation
You can install this plugin via pip:
pip install module-level-lint
Usage
After installation, you can use this plugin with the flake8 command. Here's how to run it:
flake8 [path]
To show only module level lint errors, run:
flake8 --select MLL [path]
To show only specific errors
flake8 --select MLL001,MLL002 [path]
To apply formatting
flake8 --select MLL [path] --fix
Features
Lint
Module Docstring Check: Ensure that your docstrings are always at the top of the file
- Linting Error: MLL001
Example:
import random
# Bad: Module docstring is not at the top of the file
"""This is a docstring"""
def foo():
pass
# Good: Docstring present at the top of the file
""" This is a docstring. """
def foo():
pass
Future-Imports Check: Ensure that future-imports are always at the top after module docstrings
- Linting Error: MLL002
Example:
import random
# Bad: Future-imports is not at the top of the file
from __future__ import print_function
# Good: Future-imports is at the top of the file
from __future__ import division
import random
- Linting Error: MLL003
Example:
from __future__ import print_function
# Bad: Docstring is not at the top of the file
"""This is a docstring."""
"""This is a docstring."""
# Good: Future-imports is at the top of the file after docstring
from __future__ import division