python - 从 TextMate 运行时 pylint 会忽略 .pylintrc

标签 python textmate pylint

当我在 TextMate 中的 python 文件上运行验证语法时,我试图让 pylint 提供 html 输出。我安装了 pycheckmate、pylint,并在 $HOME 中创建了一个 .pylintrc 文件,将输出格式设置为 html。

在 TextMate 的高级控制面板的“Shell 变量”选项卡中,我将 TM_PYCHECKER 设置为 /usr/local/share/python/pylint。如果我触发验证语法,它会使用所有默认选项运行 pylint,并给出输出。如果我将 TM_PYCHECKER 更改为 /usr/local/share/python/pylint --rcfile "$HOME/.pylintrc" 并再次验证语法,我得到:

Please install PyChecker, PyFlakes or Pylint for more extensive code checking.

如果我从命令行运行/usr/local/share/python/pylint ,不带任何参数,输出是 html,所以我知道在这种情况下它正在读取 rcfile。我错过了什么?

最佳答案

好的,我想我发现了问题:pycheckmate 将 --output-format=parseable' 设置为 pylint 的强制参数。我通过用打印出其参数的包装脚本替换/usr/local/share/python/pylint 发现了这一点:

#!/usr/bin/env python

import sys
from pylint import lint

print sys.argv[1:]
lint.Run(sys.argv[1:])

当我在 TextMate 中运行它时,我看到了这个:

['--output-format=parseable', '/Users/smithm5/test.py']
test.py:26 [C] Line too long (90/80)
…

所以我深入研究了/Applications/TextMate.app/Contents/SharedSupport/Bundles/Python.tmbundle/Support/bin/pycheckmate.py 本身。果然,它添加了这个参数,以及一大堆硬编码的 html。因此,为了解决这个问题,我删除了所有 escape() 包装器,在第 287 行设置 opts = () 以便我可以设置自己的选项,并将第 332 行更改为打印行

关于python - 从 TextMate 运行时 pylint 会忽略 .pylintrc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10836517/

相关文章:

macos - 如何格式化 date -u 以便结果包括 Mac OSX 终端 session 中的时区偏移?

python - pep8 警告 8 空格缩进

pydev - 使用 PyDev 设置 Pylint

python - FFmpeg concat demuxer 不工作 : No error, 并且没有输出

python - 迭代包含重复元素的列表

java - 用于 Java/Maven 开发的 TextMate

webstorm - 如何将不同的 IDE 与 Netsuite 一起使用

python - namedtuples 是否应该遵循 python 中的常量名称约定?

python - 你如何拆开 DataFrame 中的列?

python - 哪种编码?