Use stevedore for dynamic check inclusion

Allow checks to be created outside of doc8
and use stevedore to load these check objects
and use them when checking.
This commit is contained in:
Joshua Harlow 2014-05-18 20:25:59 -07:00
parent 93bc2c3b9e
commit 1a6a4658b4
2 changed files with 12 additions and 1 deletions

View File

@ -34,6 +34,7 @@ import argparse
import os
from six.moves import configparser
from stevedore import extension
from doc8 import checks
from doc8 import parser as file_parser
@ -90,12 +91,21 @@ def extract_config(args):
def fetch_checks(cfg):
return [
base = [
checks.CheckTrailingWhitespace(cfg),
checks.CheckIndentationNoTab(cfg),
checks.CheckCarriageReturn(cfg),
checks.CheckMaxLineLength(cfg),
]
mgr = extension.ExtensionManager(
namespace='doc8.extension.check',
invoke_on_load=True,
invoke_args=(cfg.copy(),),
)
addons = []
for e in mgr:
addons.append(e.obj)
return base + addons
def main():

View File

@ -42,6 +42,7 @@ setup(
'argparse',
'docutils',
'six',
'stevedore',
],
entry_points={
'console_scripts': [