Enables pylint to force a consistent file header.
Project description
pylint-file-header
Pylint plugin to enforce consistent file/module header.
Installation
You can install the package with pip
from pypi:
pip install pylintfileheader
Configuration
Generate a .pylintrc
file by executing pylint --generate-rcfile
.
Then add pylintfileheader
to the plugins to load and set the file-header
option to the regular expression that the file header should match.
When the file-header
setting is omitted, pylint will pass.
Example
Setup
-
.pylintrc:
[MASTER] load-plugins=pylintfileheader file-header=# -----------------------------------------------\n# Copyright (c) Leo Hanisch. All rights reserved.\n# -----------------------------------------------
-
valid_example.py:
# ----------------------------------------------- # Copyright (c) Leo Hanisch. All rights reserved. # ----------------------------------------------- print('I am a valid example')
-
invalid_example.py:
print('I am an invalid example')
Evaluation
-
pylint valid_example.py
evaluates to:Using config file /path/to/your/.pylintrc ------------------------------------ Your code has been rated at 10.00/10
-
pylint invalid_example.py
evaluates to:Using config file /path/to/your/.pylintrc ************* Module invalid_example C: 1, 0: File header should match regex "# -----------------------------------------------\n# Copyright (c) Leo Hanisch. All rights reserved.\n# -----------------------------------------------" (invalid-file-header) ----------------------------------- Your code has been rated at 8.57/10
Contribution
If you found a bug or are missing a feature do not hesitate to file an issue.
Pull Requests are welcome!
Support
When you like this package make sure to star the repository. I am always looking for new ideas and feedback.
In addition, it is possible to donate via paypal.
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
Hashes for pylintfileheader-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 969c0dc5f1c082a8201de61bd402ea321cc11dd818745931a4fbd9491e663286 |
|
MD5 | a7b35bf3ea08ec82082688dd965ad7fe |
|
BLAKE2b-256 | ac35d1067f3d743de3fd86cf46e9fc905ccbf857249619f5e052c02b61a44222 |