No project description provided
Project description
Module 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 MLL001,MLL002,MLL003 [path]
Features
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
Module-Level Dunders: Ensure that module level dunders are always at the top after future-imports or docstrings
- Linting Error: MLL003
Example:
import random
# Bad: Module level dunder after imports
__all__ = ["foo"]
def foo():
pass
# Bad: Module level dunder before docstring
__all__ = ["foo"]
"""This is a docstring"""
def foo():
pass
def foo():
pass
# Bad: Module level dunder after code
__all__ = ["foo"]
# Good: Module level dunder at the top of the file
__all__ = ["foo"]
def foo():
pass
Configuration
This plugin doesn't require any specific configuration, but you can include its error codes in your Flake8 configuration file to disable or enable specific checks:
[flake8]
extend-ignore = MLL001, MLL002, MLL003
Contributing
Contributions, issues, and feature requests are welcome! Please feel free to submit a pull request or open an issue.
License
This plugin is licensed under the MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file module_level_lint-0.1.0.tar.gz
.
File metadata
- Download URL: module_level_lint-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.16 Linux/6.2.0-34-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e9a80419e5849b5634522c2491da9aa380eae056ab84af24107e1907eb015ea |
|
MD5 | 10e3c6d7dc62786a1c816bda1ccc4e5b |
|
BLAKE2b-256 | 996e9881d88e17b64acf9396afc8cacc89c1774a3979c36768f9bf6120530b1f |
File details
Details for the file module_level_lint-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: module_level_lint-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.16 Linux/6.2.0-34-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b67f40f8e9f8e53b63c1bc9951e50d51ed9369868513ebb2cec8da93b646cfc |
|
MD5 | 3bd4bf026cedc618f720410c06d7bc7a |
|
BLAKE2b-256 | 90be6b1d0c1030781e06991380bebf3d9ec9453ff82b0746d1a53865f4881a69 |