Package provide base classes and utils for flake8 plugin writing
Project description
flake8-plugin-utils
Package provide base classes and utils for flake8 plugin writing.
Installation
pip install flake8-plugin-utils
Example
Write simple plugin
from flake8_plugin_utils import Error, Visitor, Plugin
class MyError(Error):
code = 'X100'
message = 'my error'
class MyVisitor(Visitor):
def visit_ClassDef(self, node):
self.error_from_node(MyError, node)
class MyPlugin(Plugin):
name = 'MyPlugin'
version = '0.1.0'
visitors = [MyVisitor]
and test it with pytest
from flake8_plugin_utils import assert_error, assert_not_error
def test_code_with_error():
assert_error(MyVisitor, 'class Y: pass', MyError)
def test_code_without_error():
assert_not_error(MyVisitor, 'x = 1)
License
MIT
Change Log
0.2.0 - 2019.02.21
- add assert methods
0.1.0 - 2019.02.09
- initial
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flake8-plugin-utils-0.2.0.tar.gz.
File metadata
- Download URL: flake8-plugin-utils-0.2.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.11 CPython/2.7.15 Darwin/18.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8f07f2b2b941122f34090679bcfa0919cf89eabad2140d1d8e390b549197b51
|
|
| MD5 |
f5bb290edeea2ca3632f28f493d009d5
|
|
| BLAKE2b-256 |
6e74fe203701f4c27a0bb35ad6b7948213eb70b964c3cb697058b9bedf31b2d9
|
File details
Details for the file flake8_plugin_utils-0.2.0-py3-none-any.whl.
File metadata
- Download URL: flake8_plugin_utils-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.11 CPython/2.7.15 Darwin/18.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
432dfd1c69ad74a08f6863cb106addd51642c20b3b00bfeb9b7e8fa0680f4cf3
|
|
| MD5 |
fee9af7132ecd52ddf11e24c0e0a28f4
|
|
| BLAKE2b-256 |
aeada4af3cf726bd9360aed5a980b892ba42a5602eb59c9e921c97fc36c42fc7
|