# pylint-file-header
[![Pypi](https://img.shields.io/pypi/v/pylintfileheader.svg?style=flat-square)](https://pypi.python.org/pypi/pylintfileheader) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pylintfileheader.svg?style=flat-square)](https://pypi.python.org/pypi/pylintfileheader) [![PyPI - Downloads](https://img.shields.io/pypi/dm/pylintfileheader.svg?style=flat-square)](https://pypistats.org/packages/pylintfileheader) [![Stars](https://img.shields.io/github/stars/HaaLeo/pylint-file-header.svg?label=Stars&logo=github&style=flat-square)](https://github.com/HaaLeo/pylint-file-header/stargazers)
[![PyPI - License](https://img.shields.io/pypi/l/pylintfileheader.svg?style=flat-square)](https://raw.githubusercontent.com/HaaLeo/pylint-file-header/master/LICENSE.txt) [![Build Status](https://img.shields.io/travis/HaaLeo/pylint-file-header/master.svg?style=flat-square)](https://travis-ci.org/HaaLeo/pylint-file-header) [![Codecov](https://img.shields.io/codecov/c/github/HaaLeo/pylint-file-header.svg?style=flat-square)](https://codecov.io/gh/HaaLeo/pylint-file-header) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![Donate](https://img.shields.io/badge/-Donate-blue.svg?logo=paypal&style=flat-square)](https://www.paypal.me/LeoHanisch)
Pylint plugin to enforce consistent file/module header.
## Installation
You can install the package with `pip` from [pypi](https://pypi.org/project/pylintfileheader):
```
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](https://docs.python.org/3/library/re.html#regular-expression-syntax) that the file header should match.
When the `file-header` setting is omitted, pylint will pass.
### Options
* `file-header` is a regexp representing the file header that should be on top of a file.
* `file-header-path` is 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-files` turns on the mode of ignoring the empty files, like `__init__.py`. The default value is `False`.
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**:
```pylintrc
[MASTER]
load-plugins=pylintfileheader
file-header=# -----------\n#[ \w]*\n# -----------
```
* **valid_example.py**:
```python
# -----------
# lorem ipsum
# -----------
print('I am a valid example')
```
* **invalid_example.py**:
```python
# lorem ipsum
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#[ \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](https://github.com/HaaLeo/pylint-file-header/issues/new/choose).
Pull Requests are welcome!
## Support
When you like this package make sure to [star the repository](https://github.com/HaaLeo/pylint-file-header/stargazers). I am always looking for new ideas and feedback.
In addition, it is possible to [donate via paypal](https://www.paypal.me/LeoHanisch).
Raw data
{
"_id": null,
"home_page": "",
"name": "pylintfileheader",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "pylintfileheader,pylint,file,module,header",
"author": "Leo Hanisch",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/4c/14/de724962c14b48a14a2a4c68f94a5005030dbc05a9ce8606b0d976dc43c2/pylintfileheader-1.0.0.tar.gz",
"platform": null,
"description": "# pylint-file-header\n\n[![Pypi](https://img.shields.io/pypi/v/pylintfileheader.svg?style=flat-square)](https://pypi.python.org/pypi/pylintfileheader) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pylintfileheader.svg?style=flat-square)](https://pypi.python.org/pypi/pylintfileheader) [![PyPI - Downloads](https://img.shields.io/pypi/dm/pylintfileheader.svg?style=flat-square)](https://pypistats.org/packages/pylintfileheader) [![Stars](https://img.shields.io/github/stars/HaaLeo/pylint-file-header.svg?label=Stars&logo=github&style=flat-square)](https://github.com/HaaLeo/pylint-file-header/stargazers) \n[![PyPI - License](https://img.shields.io/pypi/l/pylintfileheader.svg?style=flat-square)](https://raw.githubusercontent.com/HaaLeo/pylint-file-header/master/LICENSE.txt) [![Build Status](https://img.shields.io/travis/HaaLeo/pylint-file-header/master.svg?style=flat-square)](https://travis-ci.org/HaaLeo/pylint-file-header) [![Codecov](https://img.shields.io/codecov/c/github/HaaLeo/pylint-file-header.svg?style=flat-square)](https://codecov.io/gh/HaaLeo/pylint-file-header) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) \n[![Donate](https://img.shields.io/badge/-Donate-blue.svg?logo=paypal&style=flat-square)](https://www.paypal.me/LeoHanisch)\n\nPylint plugin to enforce consistent file/module header.\n\n## Installation\n\nYou can install the package with `pip` from [pypi](https://pypi.org/project/pylintfileheader):\n\n```\npip install pylintfileheader\n```\n\n## Configuration\n\nGenerate a `.pylintrc` file by executing `pylint --generate-rcfile`.\nThen add `pylintfileheader` to the plugins to load and set the `file-header` option to the [regular expression](https://docs.python.org/3/library/re.html#regular-expression-syntax) that the file header should match. \nWhen the `file-header` setting is omitted, pylint will pass.\n\n### Options\n\n* `file-header` is a regexp representing the file header that should be on top of a file.\n* `file-header-path` is the path to the file that contains the header. This is useful in case of long, multi-line headers, such as copyrights.\n* `file-header-ignore-empty-files` turns on the mode of ignoring the empty files, like `__init__.py`. The default value is `False`.\n\nIf both options `file-header` and `file-header-path` are set, then `file-header` will be used and the `file-header-path` is ignored.\n\n## Example\n\n### Setup\n\n* **.pylintrc**: \n\n ```pylintrc\n [MASTER]\n load-plugins=pylintfileheader\n\n file-header=# -----------\\n#[ \\w]*\\n# -----------\n ```\n\n* **valid_example.py**: \n\n ```python\n # -----------\n # lorem ipsum\n # -----------\n\n print('I am a valid example')\n ```\n\n* **invalid_example.py**: \n\n ```python\n # lorem ipsum\n\n print('I am an invalid example')\n ```\n\n### Evaluation\n\n* `pylint valid_example.py` evaluates to: \n ```\n Using config file /path/to/your/.pylintrc\n\n ------------------------------------\n Your code has been rated at 10.00/10\n ```\n\n* `pylint invalid_example.py` evaluates to: \n ```\n Using config file /path/to/your/.pylintrc\n ************* Module invalid_example\n C: 1, 0: File header should match regex \"# -----------\\n#[ \\w]*\\n# -----------\" (invalid-file-header)\n\n -----------------------------------\n Your code has been rated at 8.57/10\n ```\n\n## Contribution\n\nIf you found a bug or are missing a feature do not hesitate to [file an issue](https://github.com/HaaLeo/pylint-file-header/issues/new/choose). \nPull Requests are welcome!\n\n## Support\n\nWhen you like this package make sure to [star the repository](https://github.com/HaaLeo/pylint-file-header/stargazers). I am always looking for new ideas and feedback. \nIn addition, it is possible to [donate via paypal](https://www.paypal.me/LeoHanisch).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Enables pylint to force a consistent file header.",
"version": "1.0.0",
"project_urls": {
"Changelog": "https://github.com/HaaLeo/pylint-file-header/blob/master/CHANGELOG.md#changelog",
"Funding": "https://github.com/sponsors/HaaLeo",
"Issue Tracker": "https://github.com/HaaLeo/pylint-file-header/issues",
"Source": "https://github.com/HaaLeo/pylint-file-header"
},
"split_keywords": [
"pylintfileheader",
"pylint",
"file",
"module",
"header"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8277d4fd43c70ed40269e699a1f39513ebc35a169ca017f19c12bc16be8dfdd2",
"md5": "d74e9ac0bc0df1a474cea63ad066bd52",
"sha256": "574677c838047d49bd9f6a80bfa2fa44c0614c907940416c3c1e3f499cc0a512"
},
"downloads": -1,
"filename": "pylintfileheader-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d74e9ac0bc0df1a474cea63ad066bd52",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 6823,
"upload_time": "2023-11-01T13:59:49",
"upload_time_iso_8601": "2023-11-01T13:59:49.222321Z",
"url": "https://files.pythonhosted.org/packages/82/77/d4fd43c70ed40269e699a1f39513ebc35a169ca017f19c12bc16be8dfdd2/pylintfileheader-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4c14de724962c14b48a14a2a4c68f94a5005030dbc05a9ce8606b0d976dc43c2",
"md5": "1395d50d8867f3cfb3f3796ee7c790a7",
"sha256": "680aa1f81e14c8bf5645fa2186b8a55aecd1b7c49ed5d9463ca77f53b0407d30"
},
"downloads": -1,
"filename": "pylintfileheader-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "1395d50d8867f3cfb3f3796ee7c790a7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 5373,
"upload_time": "2023-11-01T13:59:50",
"upload_time_iso_8601": "2023-11-01T13:59:50.724223Z",
"url": "https://files.pythonhosted.org/packages/4c/14/de724962c14b48a14a2a4c68f94a5005030dbc05a9ce8606b0d976dc43c2/pylintfileheader-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-01 13:59:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "HaaLeo",
"github_project": "pylint-file-header",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "pylintfileheader"
}