|
|
|
|
| 请教: pychecker、pylint 效果都不理想 |
|
|
|
[Original]
[Print]
[Top]
|
初学python,想找个代码检查工具来差错。
网上搜了搜,发现相关详细的资料不多,但最最流行是 pylint 和 pychecker。就都装上试了试,可发现两个都不好,而且和各自的说明列举的功能不一致(不过结果倒是刚好互补 :-) )
想请教一下,是我用的不对还是它们确实就这样?另外,有没有什么建议?
谢谢。
以下是我的测试过程。我用来测试的代码应该有两个错误、警告:函数调用的个数不对、覆盖了builtin的str
$ uname -a
CYGWIN_NT-5.1 lungangfang-c1 1.5.19(0.150/4/2) 2006-01-20 13:28 i686 Cygwin
$ cat test.py
def fun(str):
print str
if __name__ == '__main__':
fun('abc', 'def')
$ pychecker --version
0.8.17
$ pychecker --no-shadowbuiltin test.py
Processing test...
Warnings...
test.py:5: Invalid arguments to (fun), got 2, expected 1
$ pylint --version
No config file found, using default configuration
pylint 0.12.2,
astng 0.16.3, common 0.21.2
Python 2.4.3 (#1, May 18 2006, 07:40:45)
[GCC 3.3.3 (cygwin special)]
$ pylint test.py | head
No config file found, using default configuration
************* Module test
C: 1: Missing docstring
C: 1:fun: Missing docstring
W: 1:fun: Redefining built-in 'str'
Report
======
4 statements analysed.
|
|
|
----
|
|
[Original]
[Print]
[Top]
|
|
|