开发者

How do I integrate Pylint with Geany so that I can use Geany as a python IDE?

开发者 https://www.devze.com 2023-03-08 08:12 出处:网络
http://michaeljaylissner.com/blog/using-pylint-in-geany#comments This blog says to set build command as

http://michaeljaylissner.com/blog/using-pylint-in-geany#comments

This blog says to set build command as

 pylint -r no "%f" 

and set a custom error regex

(W|E|F):([0-9]+):(.*)

The commenter suggests that with command

PYTHONPATH=${PYTHONPATH}:$(dirname %d) pylint 开发者_JAVA技巧--output-format=parseable --reports=n "%f"

that it is possible to click on a line number in log and be brought there by geany. I tried this and it has not worked for me.

In my project file, I have added

[build_settings]
error_regex=^(W|E|F):([0-9]+):(.*)

After reloading the file, same result. Am I setting the error_regex correctly? Why doesnt this work?


I'm the commenter on the blog post you cite.

I'm using a Debian-based system at the moment (Linux Mint Debian, to be precise), and using Geany 0.20. What I have is a file named filetypes.python in ~/.config/geany/filedefs which contains this:

[build-menu]
FT_00_LB=pep8
FT_00_CM=pep8 --repeat --count "%f"
FT_00_WD=
FT_01_LB=PyLint (basic)
FT_01_CM=PYTHONPATH=${PYTHONPATH}:"%d" pylint --output-format=parseable --reports=n --errors-only "%f"
FT_01_WD=
FT_02_LB=PyLint (full)
FT_02_CM=PYTHONPATH=${PYTHONPATH}:"%d" pylint --output-format=parseable "%f"
FT_02_WD=
error_regex=^([^:]+?):([0-9]+):.+

Note that the key difference between my setup and the blog post is that i'm using --output-format=pareseable, and my error_regex is a little less pylint-specific, so that it will work for pep8 too.

The PYTHONPATH=${PYTHONPATH}:"%d" bit is to add the current working directory to my custom python path, and I guess, off the top of my head, it won't work like that on Windows, so if you're on Windows you'll certainly need to modify (or drop) that bit. In fact, if you're on Windows, please indicate that, as there might be a few bits that need changing.


I have written a plugin which checks your code with pep8 pylint and pyflakes the code is available on launchpad and is packaged for ubuntu in a ppa.

https://code.launchpad.net/~oly/geany-python-code-checker/trunk

https://launchpad.net/~oly/+archive/geany

maybe useful for some one, you can toggle some options on and off as well like checking of line length.

0

精彩评论

暂无评论...
验证码 换一张
取 消