Skip to content

Commit 3992a52

Browse files
committed
* Fix build
* Adjusted README
1 parent 79f8a8d commit 3992a52

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

README.md

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

33
[![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)
4-
[![PyPI - License](https://img.shields.io/pypi/l/pylintfileheader.svg?style=flat-square)](https://pypi.python.org/pypi/pylintfileheader)
5-
[![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)
4+
[![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)
65
[![Donate](https://img.shields.io/badge/-Donate-blue.svg?logo=paypal&style=flat-square)](https://www.paypal.me/LeoHanisch)
76

87
Pylint plugin to enforce consistent file/module header.
@@ -18,7 +17,7 @@ pip install pylintfileheader
1817
## Configuration
1918

2019
Generate a `.pylintrc` file by executing `pylint --generate-rcfile`.
21-
Then add `pylintfileheader` to the plugins to load and set the `file-header` option to the [regular expression](https://docs.python.org/3.7/library/re.html#regular-expression-syntax) that the file header should match.
20+
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.
2221
When the `file-header` setting is omitted, pylint will pass.
2322

2423
## Example
@@ -31,7 +30,7 @@ When the `file-header` setting is omitted, pylint will pass.
3130
[MASTER]
3231
load-plugins=pylintfileheader
3332
34-
file-header=# -----------\n# lorem ipsum\n# -----------
33+
file-header=# -----------\n#[ \w]*\n# -----------
3534
```
3635

3736
* **valid_example.py**:
@@ -66,7 +65,7 @@ When the `file-header` setting is omitted, pylint will pass.
6665
```
6766
Using config file /path/to/your/.pylintrc
6867
************* Module invalid_example
69-
C: 1, 0: File header should match regex "# -----------\n# lorem ipsum\n# -----------\ (invalid-file-header)
68+
C: 1, 0: File header should match regex "# -----------\n#[ \w]*\n# -----------" (invalid-file-header)
7069
7170
-----------------------------------
7271
Your code has been rated at 8.57/10
@@ -78,5 +77,6 @@ If you found a bug or are missing a feature do not hesitate to [file an issue](h
7877
Pull Requests are welcome!
7978

8079
## Support
80+
8181
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.
8282
In addition, it is possible to [donate via paypal](https://www.paypal.me/LeoHanisch).

pylintfileheader/file_header_checker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class FileHeaderChecker(BaseChecker):
1919

2020
msgs = {
2121
'C5001': (
22-
'File header should match regex "%s"',
22+
'File header must match regex "%s"',
2323
'invalid-file-header',
2424
'Used when the file header does not match the '
2525
'regex configured in the `file-header` option.'
@@ -43,11 +43,11 @@ def process_module(self, node):
4343
if self.config.file_header:
4444
if sys.version_info[0] < 3:
4545
pattern = re.compile(
46-
'\A' + self.config.file_header, re.LOCALE | re.MULTILINE)
46+
r'\A' + self.config.file_header, re.LOCALE | re.MULTILINE)
4747
else:
4848
# The use of re.LOCALE is discouraged in python 3
4949
pattern = re.compile(
50-
'\A' + self.config.file_header, re.MULTILINE)
50+
r'\A' + self.config.file_header, re.MULTILINE)
5151

5252
content = None
5353
with node.stream() as stream:

pylintfileheadertest/file_header_checker_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# ---------------------------------------------------------------------------------------------
55

66
# pylint: disable=invalid-name,unused-variable
7-
from unittest.mock import MagicMock
7+
from mock import MagicMock
88
import pylint.testutils
99
from pylintfileheader.file_header_checker import FileHeaderChecker
1010

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@
4141
'License :: OSI Approved :: MIT License',
4242
'Operating System :: OS Independent',
4343
'Programming Language :: Python :: 2.7',
44+
'Programming Language :: Python :: 3.4',
4445
'Programming Language :: Python :: 3.5',
4546
'Programming Language :: Python :: 3.6',
46-
'Programming Language :: Python :: 3.7'
47+
'Programming Language :: Python :: 3.7',
48+
'Programming Language :: Python :: 3.8'
4749
]
4850
)

0 commit comments

Comments
 (0)