From 237db5aeef1abfc06638c520d5546d7c2d79de56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Verg=C3=A9?= Date: Fri, 22 Jan 2016 17:22:04 +0100 Subject: [PATCH] Doc: Document how to use the yamllint Python module --- docs/development.rst | 6 ++++++ yamllint/errors.py | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/docs/development.rst b/docs/development.rst index c6633e7..3dc86a7 100644 --- a/docs/development.rst +++ b/docs/development.rst @@ -1,5 +1,11 @@ Development =========== +yamllint provides both a script and a Python module. The latter can be used to +write your own linting tools: + +.. autoclass:: yamllint.errors.LintProblem + :members: + .. automodule:: yamllint :members: diff --git a/yamllint/errors.py b/yamllint/errors.py index 8e1f02a..fa2f21b 100644 --- a/yamllint/errors.py +++ b/yamllint/errors.py @@ -16,10 +16,15 @@ class LintProblem(object): + """Represents a linting problem found by yamllint.""" def __init__(self, line, column, desc='', rule=None): + #: Line on which the problem was found (starting at 1) self.line = line + #: Column on which the problem was found (starting at 1) self.column = column + #: Human-readable description of the problem self.desc = desc + #: Identifier of the rule that detected the problem self.rule = rule self.level = None