【问题标题】:How do I integrate Pylint with Geany so that I can use Geany as a python IDE?如何将 Pylint 与 Geany 集成,以便可以将 Geany 用作 python IDE?
【发布时间】:2011-05-26 12:24:50
【问题描述】:

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

这个博客说设置构建命令为

 pylint -r no "%f" 

并设置自定义错误正则表达式

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

评论者建议使用命令

PYTHONPATH=${PYTHONPATH}:$(dirname %d) pylint --output-format=parseable --reports=n "%f"

可以单击日志中的行号并由 geany 带到那里。我试过了,但对我没有用。

在我的项目文件中,我已经添加了

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

重新加载文件后,结果相同。我是否正确设置了error_regex?为什么这不起作用?

【问题讨论】:

  • @simon 关于如何更新它以在 Windows XP 上的 geany 20 上工作的任何想法?正在尝试这个,但可能会偏离标准。 PYTHONPATH=${PATH=%path%;C:\Python32}: pylint --output-format=parseable --reports=n --errors-only "%f"

标签: python pylint geany


【解决方案1】:

我是你引用的博文的评论者。

我目前正在使用基于 Debian 的系统(准确地说是 Linux Mint Debian),并使用 Geany 0.20。我拥有的是~/.config/geany/filedefs 中名为filetypes.python 的文件,其中包含以下内容:

[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]+):.+

请注意,我的设置和博客文章之间的主要区别在于我使用的是 --output-format=pareseable,而我的 error_regex 的 pylint 特定性稍差一些,因此它也适用于 pep8

PYTHONPATH=${PYTHONPATH}:"%d" 位是将当前工作目录添加到我的自定义 python 路径中,我想,在我的脑海中,它不会像 Windows 那样工作,所以如果你在 Windows 上你' 肯定需要修改(或删除)该位。事实上,如果您使用的是 Windows,请指出这一点,因为可能有一些地方需要更改。

【讨论】:

  • 这对我有用。我不得不在 geany 配置中添加 filetypes.python。它不会从其他任何地方加载配置。此外,pylint 似乎不如 pychecker 有用
【解决方案2】:

我已经编写了一个插件,它使用 pep8 pylint 和 pyflakes 检查您的代码,该代码在启动板上可用,并在 ppa 中为 ubuntu 打包。

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

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

可能对某些人有用,您可以打开和关闭一些选项以及检查行长。

【讨论】:

    猜你喜欢
    • 2016-12-11
    • 1970-01-01
    • 1970-01-01
    • 2016-08-02
    • 1970-01-01
    • 1970-01-01
    • 2017-07-29
    • 2017-07-29
    • 1970-01-01
    相关资源
    最近更新 更多