[code-quality] Make pylint faster by caching modules that passed without warnings

Noam Yorav-Raphael noamraph at gmail.com
Thu Nov 5 05:21:01 EST 2015


Hi,

Take a look at cached_pylint.py at
https://gist.github.com/noamraph/c933b32deb8304ac7ccd

It records module dependencies, and when a module passes with no warnings,
it records it together with the sha1 of the contents of each of its
dependencies, so when run again it could pass without checking it.

Dependencies are recorded by using infer and by using ImportsChecker, so if
module A imports something from module B that was actually defined in
module C, both B and C will be recorded as dependencies of A.

We have a medium sized code repository that took two minutes for each
check. Now pylint only checks the modified modules, and it takes two
seconds.

I tested it with pylint 1.4.3.

Hope this helps someone,

Noam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/code-quality/attachments/20151105/15d607f9/attachment.html>


More information about the code-quality mailing list