On Wednesday, May 28, 2014 8:59:15 AM UTC-5, Edward K. Ream wrote: The @test DataTraverser unit test in the new leo/test/stc_unit_tests.py > file now reports the following ambiguous class names, preceded by the > number of definitions of each name. > [Snip]
All of Leo's core classes have now been converted to pep8 style, such as MyClassName. Class names contain no underscores. The code is in "@test replace class names". It was straightforward, once a bug in the code that searches for duplicates was fixed. A modification of this code will soon become g.find_word. It is both surprisingly useful and surprisingly tricky. **Important**: the script, while extremely useful, was merely a starting point for refactoring. A number of complications arose, each of which had to be dealt with "by hand". Using unit tests and pylint to check all renames was essential. Otoh, many renames were done at a time, greatly reducing the number of needed tests. I consider "@test replace class names" to be a great success, despite obvious limitations. In particular, it demonstrates several things: 1. It's possible to do a lot of refactoring with no type analysis at all. 2. AI (that is, human intervention) is necessary to deal with strings and comments that contain renamed items. This will *always* be so: strings and comments are virtually invisible to parse-tree-oriented tools. 3. Most importantly, in the long view, is that the script decouples data structure from the parse tree. Only a single (fast) tree traversal is done. Thereafter, the script deals *only* with dictionaries created by the tree traversal. This is a subtle change in viewpoint, one that I hope will bear more fruit soon. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
