--- /tmp/pylint-2.7.2-3bav7y_49/debian/pylint-doc_2.7.2-3_all.deb
+++ pylint-doc_2.7.2-3_all.deb
├── file list
│ @@ -1,3 +1,3 @@
│ -rw-r--r-- 0 0 0 4 2021-06-17 01:12:44.000000 debian-binary
│ -rw-r--r-- 0 0 0 3664 2021-06-17 01:12:44.000000 control.tar.xz
│ --rw-r--r-- 0 0 0 293888 2021-06-17 01:12:44.000000 data.tar.xz
│ +-rw-r--r-- 0 0 0 293848 2021-06-17 01:12:44.000000 data.tar.xz
├── control.tar.xz
│ ├── control.tar
│ │ ├── ./md5sums
│ │ │ ├── ./md5sums
│ │ │ │┄ Files differ
├── data.tar.xz
│ ├── data.tar
│ │ ├── file list
│ │ │ @@ -69,32 +69,32 @@
│ │ │ -rw-r--r-- 0 root (0) root (0) 90 2021-01-01 06:53:29.000000 ./usr/share/doc/pylint/html/_static/plus.png
│ │ │ -rw-r--r-- 0 root (0) root (0) 695 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/_static/py.png
│ │ │ -rw-r--r-- 0 root (0) root (0) 2971 2018-02-02 05:37:16.000000 ./usr/share/doc/pylint/html/_static/pydoctheme.css
│ │ │ -rw-r--r-- 0 root (0) root (0) 4780 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/_static/pygments.css
│ │ │ -rw-r--r-- 0 root (0) root (0) 6442 2018-02-02 05:37:16.000000 ./usr/share/doc/pylint/html/_static/sidebar.js
│ │ │ -rw-r--r-- 0 root (0) root (0) 7738 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/backlinks.html
│ │ │ drwxr-xr-x 0 root (0) root (0) 0 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/development_guide/
│ │ │ --rw-r--r-- 0 root (0) root (0) 22995 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/development_guide/contribute.html
│ │ │ +-rw-r--r-- 0 root (0) root (0) 22996 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/development_guide/contribute.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 7112 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/development_guide/index.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 28721 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/faq.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 12385 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/genindex.html
│ │ │ drwxr-xr-x 0 root (0) root (0) 0 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/how_tos/
│ │ │ --rw-r--r-- 0 root (0) root (0) 34459 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/how_tos/custom_checkers.html
│ │ │ +-rw-r--r-- 0 root (0) root (0) 34147 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/how_tos/custom_checkers.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 7644 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/how_tos/index.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 12013 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/how_tos/plugins.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 17269 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/how_tos/transform_plugins.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 10928 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/index.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 9854 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/intro.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 7268 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/objects.inv
│ │ │ -rw-r--r-- 0 root (0) root (0) 4976 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/search.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 67109 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/searchindex.js
│ │ │ -rw-r--r-- 0 root (0) root (0) 7462 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/support.html
│ │ │ drwxr-xr-x 0 root (0) root (0) 0 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/technical_reference/
│ │ │ -rw-r--r-- 0 root (0) root (0) 9327 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/technical_reference/c_extensions.html
│ │ │ --rw-r--r-- 0 root (0) root (0) 8554 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/technical_reference/checkers.html
│ │ │ +-rw-r--r-- 0 root (0) root (0) 8556 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/technical_reference/checkers.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 29919 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/technical_reference/extensions.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 151605 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/technical_reference/features.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 8082 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/technical_reference/index.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 9125 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/technical_reference/startup.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 31770 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/tutorial.html
│ │ │ drwxr-xr-x 0 root (0) root (0) 0 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/user_guide/
│ │ │ -rw-r--r-- 0 root (0) root (0) 30618 2021-06-17 01:12:44.000000 ./usr/share/doc/pylint/html/user_guide/ide-integration.html
│ │ ├── ./usr/share/doc/pylint/html/development_guide/contribute.html
│ │ │ @@ -218,15 +218,15 @@
│ │ │
│ │ │
Tips for Getting Started with Pylint Development
│ │ │
│ │ │ Read the Technical Reference. It gives a short walkthrough of the pylint
│ │ │ codebase and will help you identify where you will need to make changes
│ │ │ for what you are trying to implement.
│ │ │ astroid.extract_node()
is your friend. Most checkers are AST based,
│ │ │ -so you will likely need to interact with astroid
.
│ │ │ +so you will likely need to interact with astroid
.
│ │ │ A short example of how to use astroid.extract_node()
is given
│ │ │ here.
│ │ │ When fixing a bug for a specific check, search the code for the warning
│ │ │ message to find where the warning is raised,
│ │ │ and therefore where the logic for that code exists.
│ │ │
│ │ │
│ │ ├── ./usr/share/doc/pylint/html/how_tos/custom_checkers.html
│ │ │ @@ -82,16 +82,16 @@
│ │ │ There are three kinds of checkers:
│ │ │
│ │ │ Raw checkers, which analyse each module as a raw file stream.
│ │ │ Token checkers, which analyse a file using the list of tokens that
│ │ │ represent the source code in the file.
│ │ │ AST checkers, which work on an AST representation of the module.
│ │ │
│ │ │ -The AST representation is provided by the astroid
library.
│ │ │ -astroid
adds additional information and methods
│ │ │ +
The AST representation is provided by the astroid
library.
│ │ │ +astroid
adds additional information and methods
│ │ │ over ast
in the standard library,
│ │ │ to make tree navigation and code introspection easier.
│ │ │
│ │ │
Writing an AST Checker
│ │ │
Let's implement a checker to make sure that all return
nodes in a function
│ │ │ return a unique constant.
│ │ │ Firstly we will need to fill in some required boilerplate:
│ │ │ @@ -198,17 +198,17 @@
│ │ │
visit_<lowered class name>
or
leave_<lowered class name>
│ │ │ methods for the nodes it's interested in.
│ │ │ In this case we have implemented
visit_functiondef
and
leave_functiondef
│ │ │ to add a new list of return nodes for this function,
│ │ │ and to remove the list of return nodes when we leave the function.
│ │ │
Finally we'll implement the check.
│ │ │ We will define a visit_return
function,
│ │ │ -which is called with a astroid.node_classes.Return
node.
│ │ │ +which is called with a
astroid.node_classes.Return
node.
│ │ │
We'll need to be able to figure out what attributes a
│ │ │ -astroid.node_classes.Return
node has available.
│ │ │ +astroid.node_classes.Return
node has available.
│ │ │ We can use astroid.extract_node()
for this:
│ │ │
>>> node = astroid.extract_node("return 5")
│ │ │ >>> node
│ │ │ <Return l.1 at 0x7efe62196390>
│ │ │ >>> help(node)
│ │ │ >>> node.value
│ │ │ <Const.int l.1 at 0x7efe62196ef0>
│ │ ├── ./usr/share/doc/pylint/html/technical_reference/checkers.html
│ │ │ @@ -71,17 +71,17 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
Checkers
│ │ │
All of the default pylint checkers exist in pylint.checkers
.
│ │ │ This is where most of pylint's brains exist.
│ │ │ -Most checkers are AST based and so use astroid
.
│ │ │ +Most checkers are AST based and so use astroid
.
│ │ │ pylint.checkers.utils
provides a large number of utility methods for
│ │ │ -dealing with astroid
.
│ │ │ +dealing with
astroid
.
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │