Leo's pylint command: a major improvement to work flow

58 views
Skip to first unread message

Edward K. Ream

unread,
Jul 30, 2014, 6:33:23 AM7/30/14
to leo-e...@googlegroups.com
When pylint is available on your machine, Leo's pylint command will execute run pylint on all @<file> nodes in the selected tree.  This command is now available from the popup menus created by the contextmenu plugin.

This command is a dynamic way of selecting files to check with pylint.  It is *much* easier to use than the old pylint -r option in pylint-leo.py.  There is no longer any need to update a list of "recent" files.  Hooray.

The command has significantly changed my work flow.  I use pylint much more often.

The details of the search process are as follows:

1. The command looks down the tree of the selected node, looking for @<file> nodes.
2. If now @<file> nodes are found, it looks up the tree, looking for @<file> nodes.
3. Coming soon: if the selected node is a clone, and no @<file> nodes have yet been found,
    it expands the search to all ancestors of all positions cloned to the selected node.

This means that you can check a file by selecting any node of the file or (when point 3 is in place) any cloned node of the file.

**Important**: running pylint-leo.py is still often very useful.  In particular, I often run python pylint-leo.py -a to check all files. Here is the recently improved docstring for pylint-leo.py:

'''
This file runs pylint on predefined lists of files.

The -r option no longer exists. Instead, use Leo's pylint command to run
pylint on all Python @<file> nodes in a given tree.

On windows, the following .bat file runs this file::
    python27 pylint-leo.py %*

On Ubuntu, the following alias runs this file::
    pylint="python27 pylint-leo.py"
'''

Edward

Matt Wilkie

unread,
Oct 6, 2014, 11:12:53 PM10/6/14
to leo-e...@googlegroups.com

On Wednesday, July 30, 2014 3:33:23 AM UTC-7, Edward K. Ream wrote:
When pylint is available on your machine, Leo's pylint command will execute run pylint on all @<file> nodes in the selected tree.  This command is now available from the popup menus created by the contextmenu plugin.

Can you give more details on what happens when using the context menu? I discovered the menu item this morning after installing pylint last night, however when I use it nothing seems to happen other then the log pane echoing "pylint: done".

-matt

Matt Wilkie

unread,
Oct 6, 2014, 11:24:27 PM10/6/14
to leo-e...@googlegroups.com
On Wednesday, July 30, 2014 3:33:23 AM UTC-7, Edward K. Ream wrote:
When pylint is available on your machine, Leo's pylint command will execute run pylint on all @<file> nodes in the selected tree.  This command is now available from the popup menus created by the contextmenu plugin.

Can you give more details on what happens when using the context menu? I discovered the menu item this morning after installing pylint last night, however when I use it nothing seems to happen other then the log pane echoing "pylint: done".

Using leo in console mode reveals it's using the wrong path:

('file not found:', u'B:\\code\\apt.py')
pylint: done

When it should be 'B:\code\maphew\apt\apt.py'. I think pylint is getting fed a path relative to the .leo file and not the @path from inside the .leo file. The name of the headline node is "@file apt.py" with @path in the parent node.

https://github.com/leo-editor/leo-editor/issues/67

-matt


 

Reply all
Reply to author
Forward
0 new messages