-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import token | ||
|
||
__version__ = '1.0.1' | ||
|
||
|
||
def plugin(tree, file_tokens): | ||
try: | ||
first = file_tokens[0] | ||
except IndexError: | ||
return | ||
if first.type == token.NL: | ||
yield ( | ||
first.start[0], | ||
first.start[1], | ||
'LBL001: Blank line at start of file', | ||
None | ||
) | ||
|
||
|
||
plugin.name = 'flake8-leading-blank-lines' | ||
plugin.version = __version__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[bdist_wheel] | ||
universal = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import setuptools | ||
|
||
|
||
def get_version(): | ||
with open('flake8_leading_blank_lines.py') as f: | ||
lines = [line.strip() for line in f if line.startswith('__version__')] | ||
|
||
for line in lines: | ||
_, versionstr = line.split('=', 1) | ||
return versionstr.strip(' "\'') | ||
|
||
raise Exception("__version__ not found in flake8_leading_blank_lines.py") | ||
|
||
|
||
with open("README.md", "r", encoding="utf-8") as fh: | ||
long_description = fh.read() | ||
|
||
|
||
setuptools.setup( | ||
name="flake8-leading-blank-lines", | ||
license="MIT", | ||
version=get_version(), | ||
description="A flake8 plugin to detect blank lines at the start of a file", | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
author="Baptiste Mispelon", | ||
author_email="[email protected]", | ||
url="https://github.com/bmispelon/flake8-leading-blank-lines", | ||
project_urls={ | ||
"Bug Tracker": "https://github.com/bmispelon/flake8-leading-blank-lines/issues", | ||
}, | ||
py_modules=["flake8_leading_blank_lines"], | ||
install_requires=[ | ||
"flake8 > 3.0.0", | ||
], | ||
entry_points={ | ||
'flake8.extension': [ | ||
'LBL001 = flake8_leading_blank_lines:plugin', | ||
], | ||
}, | ||
classifiers=[ | ||
"Framework :: Flake8", | ||
"Environment :: Console", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Topic :: Software Development :: Libraries :: Python Modules", | ||
"Topic :: Software Development :: Quality Assurance", | ||
], | ||
) |