mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-15 00:44:44 +00:00
Add an example plugin project to source tree
This commit is contained in:
parent
a9e15afbf5
commit
5f3577fca8
4 changed files with 73 additions and 0 deletions
32
example-plugin/setup.py
Normal file
32
example-plugin/setup.py
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
name='flake8-example-plugin',
|
||||||
|
license='MIT',
|
||||||
|
version='1.0.0',
|
||||||
|
description='Example plugin to Flake8',
|
||||||
|
author='Ian Cordasco',
|
||||||
|
author_email='graffatcolmingov@gmail.com',
|
||||||
|
url='https://gitlab.com/pycqa/flake8',
|
||||||
|
package_dir={'': 'src/'},
|
||||||
|
packages=['flake8_example_plugin'],
|
||||||
|
entry_points={
|
||||||
|
'flake8.extension': [
|
||||||
|
'X1 = flake8_example_plugin:ExampleOne',
|
||||||
|
'X2 = flake8_example_plugin:ExampleTwo',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
classifiers=[
|
||||||
|
'Framework :: Flake8',
|
||||||
|
'License :: OSI Approved :: MIT License',
|
||||||
|
'Programming Language :: Python',
|
||||||
|
'Programming Language :: Python :: 2',
|
||||||
|
'Programming Language :: Python :: 2.7',
|
||||||
|
'Programming Language :: Python :: 3',
|
||||||
|
'Programming Language :: Python :: 3.4',
|
||||||
|
'Programming Language :: Python :: 3.5',
|
||||||
|
'Topic :: Software Development :: Libraries :: Python Modules',
|
||||||
|
'Topic :: Software Development :: Quality Assurance',
|
||||||
|
],
|
||||||
|
)
|
||||||
9
example-plugin/src/flake8_example_plugin/__init__.py
Normal file
9
example-plugin/src/flake8_example_plugin/__init__.py
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
"""Module for an example Flake8 plugin."""
|
||||||
|
|
||||||
|
from .on_by_default import ExampleOne
|
||||||
|
from .off_by_default import ExampleTwo
|
||||||
|
|
||||||
|
__all__ = (
|
||||||
|
'ExampleOne',
|
||||||
|
'ExampleTwo',
|
||||||
|
)
|
||||||
17
example-plugin/src/flake8_example_plugin/off_by_default.py
Normal file
17
example-plugin/src/flake8_example_plugin/off_by_default.py
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
"""Our first example plugin."""
|
||||||
|
|
||||||
|
|
||||||
|
class ExampleTwo(object):
|
||||||
|
"""Second Example Plugin."""
|
||||||
|
name = 'off-by-default-example-plugin'
|
||||||
|
version = '1.0.0'
|
||||||
|
|
||||||
|
off_by_default = True
|
||||||
|
|
||||||
|
def __init__(self, tree):
|
||||||
|
self.tree = tree
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
"""Do nothing."""
|
||||||
|
yield (1, 0, 'X200 The off-by-default plugin was enabled',
|
||||||
|
'OffByDefaultPlugin')
|
||||||
15
example-plugin/src/flake8_example_plugin/on_by_default.py
Normal file
15
example-plugin/src/flake8_example_plugin/on_by_default.py
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
"""Our first example plugin."""
|
||||||
|
|
||||||
|
|
||||||
|
class ExampleOne(object):
|
||||||
|
"""First Example Plugin."""
|
||||||
|
name = 'on-by-default-example-plugin'
|
||||||
|
version = '1.0.0'
|
||||||
|
|
||||||
|
def __init__(self, tree):
|
||||||
|
self.tree = tree
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
"""Do nothing."""
|
||||||
|
for message in []:
|
||||||
|
yield message
|
||||||
Loading…
Add table
Add a link
Reference in a new issue