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.
Options
file-headeris a regexp representing the file header that should be on top of a file.file-header-pathis the path to the file that contains the header. This is useful in case of long, multi-line headers, such as copyrights.file-header-ignore-empty-filesturns on the mode of ignoring the empty files, like__init__.py. The default value isFalse.
If both options file-header and file-header-path are set, then file-header will be used and the file-header-path is ignored.
Example
Setup
-
.pylintrc:
[MASTER] load-plugins=pylintfileheader file-header=# -----------\n#[ \w]*\n# -----------
-
valid_example.py:
# ----------- # lorem ipsum # ----------- print('I am a valid example')
-
invalid_example.py:
# lorem ipsum print('I am an invalid example')
Evaluation
-
pylint valid_example.pyevaluates to:Using config file /path/to/your/.pylintrc ------------------------------------ Your code has been rated at 10.00/10 -
pylint invalid_example.pyevaluates to:Using config file /path/to/your/.pylintrc ************* Module invalid_example C: 1, 0: File header should match regex "# -----------\n#[ \w]*\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.
Metadata
Release files for pylintfileheader 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pylintfileheader-1.1.0.tar.gz | 5.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pylintfileheader-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.4 kB
Release files / pylintfileheader-1.1.0.tar.gz
| Download URL | pylintfileheader-1.1.0.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74f2ddc0a7dcf7bd0290a26b8922a260a1de2331cecf0a08075ff7e059461f14
|
|
BLAKE2b-256 checksum How to use checksums |
aa128a597fb273aa899d62d0a5d536e2969c134ca44a7372e183b0f27a4537e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.13
|
Release files / pylintfileheader-1.1.0-py3-none-any.whl
| Download URL | pylintfileheader-1.1.0-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
58de42f475550bc2ef542e2490ff679f330ff705eb4e904993589917d12b0d88
|
|
BLAKE2b-256 checksum How to use checksums |
538055f629016c2b26736cfec3b8cf59575ff652efc51d6de8eccf5fd8d3bc17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.13
|
Security for pylintfileheader 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.