Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python correctness (i.e., lint) analyzing for Notepad++

Does anyone know of anything like pylint or pychecker for notepad++? Or perhaps how to use pylint in notepad++.

like image 352
Belmin Fernandez Avatar asked Feb 14 '11 00:02

Belmin Fernandez


3 Answers

If you install the Python Script plugin, then you can add a new script with the following lines to get pretty good results:

console.show()
console.clear()
console.run('cmd.exe /c '
            + 'C:\\Python26\\Scripts\\pylint.bat --reports=n -f parseable '
            + '"%s"' % notepad.getCurrentFilename())

The output will include hyperlinks to the lines with the errors/warnings (if the filenames don't have spaces in them...)

like image 142
Tom Avatar answered Oct 09 '22 00:10

Tom


The option "-f parseable" is deprecated in the current version of Pylint.

The current equivalent alternative is:

console.run('cmd.exe /c '
        + 'C:\\Python26\\Scripts\\pylint.bat --reports=n '
        + '--msg-template="%s" %s' 
        % ( '{path}:{line}: {msg_id}({symbol}), {obj} {msg}', notepad.getCurrentFilename()))

Note: python path can be different e.g. C:\\Python27.

Note2: double quotes in --msg-template="..." are important

like image 3
Hector Llorens Avatar answered Oct 09 '22 00:10

Hector Llorens


You could install PyLint using python -m pip install pylint and use it via Notepad++'s Run... command (F5):

cmd /c python -m pylint "$(FULL_CURRENT_PATH)" & pause

To get the output in Notepad++ and link to the code, use NppExec.

like image 1
philnext Avatar answered Oct 09 '22 02:10

philnext