summaryrefslogtreecommitdiff
path: root/example-plugin
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-10-25 18:21:50 -0500
committerIan Cordasco <graffatcolmingov@gmail.com>2016-10-25 18:21:50 -0500
commit5f3577fca84f6c45110214880854bc9332f634f0 (patch)
tree713d0b450ec0ff564c8f661574c1f32f74531a6e /example-plugin
parenta9e15afbf50b3181af45a64f5736d432731eb40d (diff)
downloadflake8-5f3577fca84f6c45110214880854bc9332f634f0.tar.gz
Add an example plugin project to source tree
Diffstat (limited to 'example-plugin')
-rw-r--r--example-plugin/setup.py32
-rw-r--r--example-plugin/src/flake8_example_plugin/__init__.py9
-rw-r--r--example-plugin/src/flake8_example_plugin/off_by_default.py17
-rw-r--r--example-plugin/src/flake8_example_plugin/on_by_default.py15
4 files changed, 73 insertions, 0 deletions
diff --git a/example-plugin/setup.py b/example-plugin/setup.py
new file mode 100644
index 0000000..2da68f6
--- /dev/null
+++ b/example-plugin/setup.py
@@ -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',
+ ],
+)
diff --git a/example-plugin/src/flake8_example_plugin/__init__.py b/example-plugin/src/flake8_example_plugin/__init__.py
new file mode 100644
index 0000000..33d76f3
--- /dev/null
+++ b/example-plugin/src/flake8_example_plugin/__init__.py
@@ -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',
+)
diff --git a/example-plugin/src/flake8_example_plugin/off_by_default.py b/example-plugin/src/flake8_example_plugin/off_by_default.py
new file mode 100644
index 0000000..d768328
--- /dev/null
+++ b/example-plugin/src/flake8_example_plugin/off_by_default.py
@@ -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')
diff --git a/example-plugin/src/flake8_example_plugin/on_by_default.py b/example-plugin/src/flake8_example_plugin/on_by_default.py
new file mode 100644
index 0000000..a324297
--- /dev/null
+++ b/example-plugin/src/flake8_example_plugin/on_by_default.py
@@ -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