summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorbdanielby <Bruno.Daniel@blue-yonder.com>2014-08-27 22:57:27 +0200
committerbdanielby <Bruno.Daniel@blue-yonder.com>2014-08-27 22:57:27 +0200
commit131a5e074e72ac57ba6ed0e1ca0661c864b83ff4 (patch)
tree9b84a7ac063e620c96f011cb98d0785e4c5235fe /doc
parent2995e293950edc39b0466d1274affc1136c066c8 (diff)
parent0fd92f1790840130cebd8bbbc77d2811a9be3c91 (diff)
downloadpylint-131a5e074e72ac57ba6ed0e1ca0661c864b83ff4.tar.gz
Merged logilab/pylint into default
Diffstat (limited to 'doc')
-rw-r--r--doc/extensions.rst76
-rw-r--r--doc/index.rst1
2 files changed, 77 insertions, 0 deletions
diff --git a/doc/extensions.rst b/doc/extensions.rst
new file mode 100644
index 0000000..1e80097
--- /dev/null
+++ b/doc/extensions.rst
@@ -0,0 +1,76 @@
+
+Optional Pylint checkers in the extensions module
+=================================================
+
+Sphinx parameter documentation checker
+--------------------------------------
+
+If you're using Sphinx to document your code, this optional component might
+be useful for you. You can activate it by adding the line::
+
+ load-plugins=pylint.extensions.check_docs
+
+to the ``MASTER`` section of your ``.pylintrc``.
+
+This checker verifies that all function, method, and constructor parameters are
+mentioned in the Sphinx ``param`` and ``type`` parts of the docstring::
+
+ def function_foo(x, y, z):
+ '''function foo ...
+
+ :param x: bla x
+ :type x: int
+
+ :param y: bla y
+ :type y: float
+
+ :param int z: bla z
+
+ :return: sum
+ :rtype: float
+ '''
+ return x + y + z
+
+You'll be notified of **missing parameter documentation** but also of
+**naming inconsistencies** between the signature and the documentation which
+often arise when parameters are renamed automatically in the code, but not in the
+documentation.
+
+By convention, constructor parameters are documented in the class docstring.
+(``__init__`` and ``__new__`` methods are considered constructors.)::
+
+ class ClassFoo(object):
+ '''docstring foo
+
+ :param float x: bla x
+
+ :param y: bla y
+ :type y: int
+ '''
+ def __init__(self, x, y):
+ pass
+
+In some cases, having to document all parameters is a nuisance, for instance if
+many of your functions or methods just follow a **common interface**. To remove
+this burden, the checker accepts missing parameter documentation if one of the
+following phrases is found in the docstring:
+
+* For the other parameters, see
+* For the parameters, see
+
+(with arbitrary whitespace between the words). Please add a link to the
+docstring defining the interface, e.g. a superclass method, after "see"::
+
+ def callback(x, y, z):
+ '''callback ...
+
+ :param x: bla x
+ :type x: int
+
+ For the other parameters, see
+ :class:`MyFrameworkUsingAndDefiningCallback`
+ '''
+ return x + y + z
+
+Naming inconsistencies in existing ``param`` and ``type`` documentations are
+still detected.
diff --git a/doc/index.rst b/doc/index.rst
index 7b8725c..57280e5 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -13,6 +13,7 @@ https://bitbucket.org/logilab/pylint
output
message-control
features
+ extensions
options
extend
ide-integration