Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
bmispelon committed Oct 22, 2021
1 parent 41b974d commit e8c46bd
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
21 changes: 21 additions & 0 deletions flake8_leading_blank_lines.py
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__
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1
51 changes: 51 additions & 0 deletions setup.py
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",
],
)

0 comments on commit e8c46bd

Please sign in to comment.