Exemple #1
0
 def test_trailing(self):
     lines = ["a b  ", "ab"]
     check = checks.CheckTrailingWhitespace({})
     errors = []
     for line in lines:
         errors.extend(check.report_iter(line))
     self.assertEqual(1, len(errors))
     (code, msg) = errors[0]
     self.assertIn(code, check.REPORTS)
Exemple #2
0
def fetch_checks(cfg):
    base = [
        checks.CheckValidity(cfg),
        checks.CheckTrailingWhitespace(cfg),
        checks.CheckIndentationNoTab(cfg),
        checks.CheckCarriageReturn(cfg),
        checks.CheckMaxLineLength(cfg),
        checks.CheckNewlineEndOfFile(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