This repository demonstrates a custom Dlint plugin. Custom plugins are useful for internal linter rules or rules that aren't generally applicable to all Python codebases, but would like to build on Dlint's functionality.
Dlint's custom plugins are built on a simple naming convention, and rely on Python modules. To make a Dlint custom plugin use the following conventions:
dlint_plugin_
.Dlint
.dlint.linters.base.BaseLinter
.
get_results
function appropriately and inherit from ast.NodeVisitor
.Both dlint_plugin_abs.py
and dlint_plugin_sys.py
correctly follow these conventions and are appropriately installed via setup.py
.
$ git clone https://github.com/duo-labs/dlint-plugin-example
$ pip install dlint-plugin-example
$ flake8 --select=DUO example.py
example.py:3:1: DUO401 use of "sys" not allowed
example.py:5:10: DUO400 use of "abs" not allowed
To ensure your custom plugins are functioning as expected you should include tests that exercise their behavior. Without appropriate testing your plugins may produce false positives or false negatives. Dlint has made the dlint.test
functionality available to aid in plugin testing efforts.
See test_dlint_plugin_abs.py
and test_dlint_plugin_sys.py
for more information.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4