On Thu, Jun 07, 2012 at 11:13:14PM +0800, Shu Ming wrote:
On 2012-6-7 21:26, Adam Litke wrote:
On Thu, Jun 07, 2012 at 12:03:30PM +0800, Zhou Zheng Sheng wrote:
Hi,
Since there is no coverage report on tests in vdsm, if a PEP 8 patch passes the tests, we still not sure if there is no mistake in it. Viewing the diff reports on all the changes consumes a lot of time, and some small but fatal mistakes(like misspelling variable name) can easily be ignored by human eyes.
So I have a try on the compiler module of Python. I write a tool named 'pydiff'. pydiff parses two Python scripts into Abstract Syntax Trees. These data structures can reflect the logic of the code, and pydiff performs a recursive compare on the trees. Then pydiff reports differences and the corresponding line numbers. In this way, pydiff ignores code style changes, and reports only logical changes of the code.
I think this tool can save us a lot of time. After a PEP 8 patch passes vdsm tests and pydiff, I will get some confidence on the patch and it probably does not break anything in vdsm.
This is a very nice tool. Thanks for sharing it. I would like to see all authors of PEP8 patches use this to check their patches for semantic correctness. This should greatly improve our ability to complete the PEP8 cleanup quickly.
Yes, I agree with you. Also, we should merge this tool into vdsm as a helper for PEP8 clean work.
Thanks, Zhou Zheng! I hope this expedites the pep8 conversion process.
As the tool is not vdsm-specific, I'd rather see it in pypi.python.org than in vdsm.
Regrads, Dan.