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.1 - 2019-04-01
- don`t strip before src dedent in _error_from_src
- add is_none, is_true, is_false util functions
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
Close
Hashes for flake8-plugin-utils-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6f830555436f7ed34ec8fd6c1d3f2a0cc5765ca53d25e242a14b330655b68c8 |
|
MD5 | a084831e83d40b58bcc27912b526f5c8 |
|
BLAKE2b-256 | 66b1932e19e561f0b94ff4ee1a5c6b94ae5cdaa672d82ce03b11e8e7202b41da |
Close
Hashes for flake8_plugin_utils-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a46e95fcb745b72fa7e7528f76a38045af569da1609d2fcf90c0970735dab624 |
|
MD5 | 944565e72c027542315432c6d75b83dc |
|
BLAKE2b-256 | 2a113f9cd5150bc28a49991880259119946dc2ceb0c7f5908fe5fd41571fc4da |