Skip to main content

Enables pylint to force a consistent file header.

Project description

pylint-file-header

Pypi PyPI - Python Version PyPI - Downloads Stars
PyPI - License Build Status Codecov PRs Welcome
Donate

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#[ \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.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.
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

pylintfileheader-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pylintfileheader-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file pylintfileheader-0.1.0.tar.gz.

File metadata

  • Download URL: pylintfileheader-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.8.0

File hashes

Hashes for pylintfileheader-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1e404d21142ef1f38610b57f8bbdae3856442880212f189a8a296cff02793087
MD5 65b3b77b533b57f12768c22891c6e999
BLAKE2b-256 455b278aa57c118e71e0b458af406d709225258e0b5736dea0bce37961a1b66a

See more details on using hashes here.

File details

Details for the file pylintfileheader-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pylintfileheader-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.8.0

File hashes

Hashes for pylintfileheader-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dbcd7c504afea2a909a0bf3a5dfff1931645297de27c032296b432f5347bd7f5
MD5 5afec4ce5653705ddd9789aa296870ac
BLAKE2b-256 03783f48341006fd2651eb230cad20479ea005eeee40b5a981b076295db5da72

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page