Skip to content

Commit 69df5b8

Browse files
committed
* Added downloads to the readme
* enabled pylintfileheader extension
1 parent eb9a81f commit 69df5b8

File tree

6 files changed

+42
-22
lines changed

6 files changed

+42
-22
lines changed

.pylintrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ jobs=1
2222

2323
# List of plugins (as comma separated values of python modules names) to load,
2424
# usually to register additional checkers.
25-
load-plugins=pylint_quotes
25+
load-plugins=pylint_quotes,pylintfileheader
26+
27+
# Option for the pylintfileheader plugin
28+
file-header=# ---------------------------------------------------------------------------------------------\n# Copyright \(c\) Leo Hanisch. All rights reserved.\n# Licensed under the MIT License. See LICENSE.txt in the project root for license information.\n# ---------------------------------------------------------------------------------------------\n
29+
2630

2731
# Pickle collected data for later comparisons.
2832
persistent=yes

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pylint-file-header
22

3-
[![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) [![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)
3+
[![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)
44
[![PyPI - License](https://img.shields.io/pypi/l/pylintfileheader.svg?style=flat-square)](https://pypi.python.org/pypi/pylintfileheader)
55
[![Build Status](https://img.shields.io/travis/HaaLeo/pylint-file-header/master.svg?style=flat-square)](https://travis-ci.org/HaaLeo/pylint-file-header) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
66
[![Donate](https://img.shields.io/badge/-Donate-blue.svg?logo=paypal&style=flat-square)](https://www.paypal.me/LeoHanisch)
@@ -31,22 +31,24 @@ When the `file-header` setting is omitted, pylint will pass.
3131
[MASTER]
3232
load-plugins=pylintfileheader
3333
34-
file-header=# -----------------------------------------------\n# Copyright (c) Leo Hanisch. All rights reserved.\n# -----------------------------------------------
34+
file-header=# -----------\n# lorem ipsum\n# -----------
3535
```
3636

3737
* **valid_example.py**:
3838

3939
```python
40-
# -----------------------------------------------
41-
# Copyright (c) Leo Hanisch. All rights reserved.
42-
# -----------------------------------------------
43-
40+
# -----------
41+
# lorem ipsum
42+
# -----------
43+
4444
print('I am a valid example')
4545
```
4646

4747
* **invalid_example.py**:
4848

4949
```python
50+
# lorem ipsum
51+
5052
print('I am an invalid example')
5153
```
5254

@@ -64,7 +66,7 @@ When the `file-header` setting is omitted, pylint will pass.
6466
```
6567
Using config file /path/to/your/.pylintrc
6668
************* Module invalid_example
67-
C: 1, 0: File header should match regex "# -----------------------------------------------\n# Copyright (c) Leo Hanisch. All rights reserved.\n# -----------------------------------------------" (invalid-file-header)
69+
C: 1, 0: File header should match regex "# -----------\n# lorem ipsum\n# -----------\ (invalid-file-header)
6870
6971
-----------------------------------
7072
Your code has been rated at 8.57/10

pylintfileheader/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# ---------------------------------------------------------------------------------------------
2+
# Copyright (c) Leo Hanisch. All rights reserved.
3+
# Licensed under the MIT License. See LICENSE.txt in the project root for license information.
4+
# ---------------------------------------------------------------------------------------------
15

26
"""pylintfileheader module"""
37

pylintfileheader/file_header_checker.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# ---------------------------------------------------------------------------------------------
2+
# Copyright (c) Leo Hanisch. All rights reserved.
3+
# Licensed under the MIT License. See LICENSE.txt in the project root for license information.
4+
# ---------------------------------------------------------------------------------------------
5+
16
import re
27
import sys
38

pylintfileheader/plugin.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
2-
"""Module which defines the required register method
3-
for Pylint plugins.
4-
"""
5-
6-
from pylintfileheader.file_header_checker import FileHeaderChecker
7-
8-
9-
def register(linter):
10-
"""Required method to auto register this checker.
11-
Args:
12-
linter: Main interface object for Pylint plugins.
13-
"""
14-
linter.register_checker(FileHeaderChecker(linter))
1+
# ---------------------------------------------------------------------------------------------
2+
# Copyright (c) Leo Hanisch. All rights reserved.
3+
# Licensed under the MIT License. See LICENSE.txt in the project root for license information.
4+
# ---------------------------------------------------------------------------------------------
5+
6+
"""Module which defines the required register method
7+
for Pylint plugins.
8+
"""
9+
10+
from pylintfileheader.file_header_checker import FileHeaderChecker
11+
12+
13+
def register(linter):
14+
"""Required method to auto register this checker.
15+
Args:
16+
linter: Main interface object for Pylint plugins.
17+
"""
18+
linter.register_checker(FileHeaderChecker(linter))

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
pylint
44
pylint-quotes
5+
pylintfileheader
56
# Requires those versions because of https://stackoverflow.com/a/26737258/6925187
67
setuptools>=38.6.0
78
twine>=1.11.0

0 commit comments

Comments
 (0)