Skip to content

Commit 01471ef

Browse files
committed
Added examples
1 parent 307efb3 commit 01471ef

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

Diff for: CONTRIBUTING.rst

+30-5
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,37 @@ Some pointers if you're new to Pylint plugin development:
5757
import astroid
5858
print(astroid.parse('''your script here''').repr_tree())
5959
60+
# For example:
61+
print(astroid.parse('''test = "foobar"''').repr_tree())
6062
61-
- Define ``visit_[token]`` or ``leave_[token]`` methods to process respective tokens.
63+
Module(
64+
name='',
65+
doc=None,
66+
file='<?>',
67+
path=['<?>'],
68+
package=False,
69+
pure_python=True,
70+
future_imports=set(),
71+
body=[Assign(
72+
targets=[AssignName(name='test')],
73+
value=Const(value='foobar'))])
74+
75+
- Or in a debugging session on any given AST node:
76+
77+
.. code-block:: python
78+
79+
print(node.repr_tree())
80+
81+
# For example:
82+
node = astroid.parse('''test = "foobar"''')
83+
print(node.repr_tree())
84+
85+
- Define ``visit_[token]`` or ``leave_[token]`` methods to process respective tokens, e.g. ``visit_module()``.
6286
- All available token types: http://pylint.pycqa.org/projects/astroid/en/latest/api/astroid.nodes.html.
6387
- Pylint searches for the variable ``msgs`` in a checker, make sure it is named exactly that.
64-
- Pylint lends itself nicely for test driven development: add one or more test cases (preferably both valid and invalid cases), and then implement a checker to run the test cases successfully.
88+
- Pylint lends itself nicely for test driven development: add one or more test cases (preferably both valid and invalid cases), and then implement a checker to run the test cases successfully.
6589
- Some useful resources to learn about Pylint:
66-
- `How to write Pylint plugins by Alexander Todorov - PiterPy 2018 <https://piterpy.com/system/attachments/files/000/001/519/original/how_to_write_pylint_plugins_PiterPy_2018.pdf>`_
67-
- `Pylint source code <https://github.com/PyCQA/pylint>`_
68-
- `Pylint Django plugin source code <https://github.com/PyCQA/pylint-django)>`_
90+
91+
- `How to write Pylint plugins by Alexander Todorov - PiterPy 2018 <https://piterpy.com/system/attachments/files/000/001/519/original/how_to_write_pylint_plugins_PiterPy_2018.pdf>`_
92+
- `Pylint source code <https://github.com/PyCQA/pylint>`_
93+
- `Pylint Django plugin source code <https://github.com/PyCQA/pylint-django)>`_

0 commit comments

Comments
 (0)