diff options
Diffstat (limited to 'doc/how_tos/plugins.rst')
-rw-r--r-- | doc/how_tos/plugins.rst | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/doc/how_tos/plugins.rst b/doc/how_tos/plugins.rst index a68bd22f8..bc2c0f14c 100644 --- a/doc/how_tos/plugins.rst +++ b/doc/how_tos/plugins.rst @@ -25,7 +25,19 @@ So a basic hello-world plugin can be implemented as: .. sourcecode:: python # Inside hello_plugin.py - def register(linter): + from typing import TYPE_CHECKING + + import astroid + + if TYPE_CHECKING: + from pylint.lint import PyLinter + + + def register(linter: "PyLinter") -> None: + """This required method auto registers the checker during initialization. + + :param linter: The linter to register the checker to. + """ print('Hello world') @@ -43,7 +55,19 @@ We can extend hello-world plugin to ignore some specific names using .. sourcecode:: python # Inside hello_plugin.py - def register(linter): + from typing import TYPE_CHECKING + + import astroid + + if TYPE_CHECKING: + from pylint.lint import PyLinter + + + def register(linter: "PyLinter") -> None: + """This required method auto registers the checker during initialization. + + :param linter: The linter to register the checker to. + """ print('Hello world') def load_configuration(linter): |