[IronPython] Pyflakes on IronPython

Michael Foord fuzzyman at voidspace.org.uk
Sun Dec 31 18:42:21 CET 2006


Sanghyeon Seo wrote:
> On June 22, Michael Foord wrote:
> 
> "At Resolver we are looking into tools that we can use to provide
> simple code hygiene checks. Check we're not shadowing built-in names,
> check for unneeded import statements and unused variables; that sort
> of thing.
> 
> I know of three Python modules that do this. They all fail
> unredeemably on  IronPython: (snip)
> 
> Pyflakes: Uses compiler.parse."
> 
> This is also CodePlex issue #563, titled "Support for Code Quality Tools".
> http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=563
> 
> In the release note of IPCE r5, I wrote:
> 
> "Experimental AST support."
> 
> For those who don't know, compiler.parse() returns AST, so they are
> the same thing.
> 
> I am happy to announce that FePy's AST support got out of experimental
> status, and is now mature enough to run Pyflakes without much trouble.
> Actually, I ran it over FePy libraries and fixed a couple of unused
> .NET imports!
> 

This is great.

Up until now we have been using PyLint run under CPython to do code 
analysis. Perhaps now we can switch to using PyLint or PyFlakes run 
under IronPython.


> This is done by "AST transform", which transforms AST made of
> subclasses of IronPython.Compiler.Ast.Node to AST made of subclasses
> of Python's compiler.ast.Node. Technical details will be discussed in
> the separate mail.
> 
> Here's a demo:
> 
> tinuviel at debian:~/svn/fepy$ ipy /usr/bin/pyflakes trunk/lib
> trunk/lib/_pth_support.py:116: 'sitecustomize' imported but unused
> trunk/lib/socket.py:222: 'ssl' imported but unused
> trunk/lib/socket.py:227: '_fileobject' imported but unused
> 
> (These warnings are all true, but sitecustomize import is for the side
> effect, and ssl/_fileobject is part of external API.)
> 

Can we use this without compiling Fepy ourselves ?

We'd rather use the Microsoft DLLs (just so we don't have to move 
IronPython sources into version control). Are there external files we 
could use to add the AST support to IronPython ?

I checked out the SVN repository, but it wasn't obvious from browsing 
the files so I thought I'd ask.

Michael
http://www.voidspace.org.uk/python/articles.shtml

> Enjoy!
> 




More information about the Ironpython-users mailing list