lint for Python? [英] lint for Python?

查看:82
本文介绍了lint for Python?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在为Python搜索一个好的多模块lint检查器和

我还没找到一个。


Pylint只在一个单独的模块中检查错误是一项不错的工作。


这是我的一个问题。我有两个模块。


在模块一中,我有一个功能:


def foo(主机,用户ID,密码):

通过


在模块二中,我称之为函数:


foo(用户名,密码)


lint没有发现错误,在程序运行时它被称为

之前不会被捕获。我不希望凌晨3点发现错误。


我从未使用过那种没有发现错误的语言。我很惊讶Python正被许多主要的b
公司使用。你是如何发现这些类型的错误的?


我已经和Wing的技术支持人员谈过了,他们并没有意识到

多模块lint但他们正在考虑将自己的lint放入他们的IDE中。


谢谢

I''ve been searching for a good multi-module lint checker for Python and
I haven''t found one yet.

Pylint does a decent job at checking for errors only within a single module.

Here''s one of my problems. I have two modules.

In module one, I have a function:

def foo( host, userid, password ):
pass

In module two, I call that function:

foo( userid, password)

lint doesn''t find that error and it won''t be caught until it''s called
while the program is running. I don''t want that error found at 3AM.

I''ve never used a language that didn''t catch that type of error. I''m
quite surprised that Python is being used by a number of major
companies. How you catch these types of errors?

I''ve spoken to tech support at Wing and they weren''t aware of a
multi-module lint but they''re considering putting their own lint into
their IDE.

Thank you

推荐答案

2008年10月3日星期五下午2:38,Pat< Pa*@tanker.net写道:
On Fri, Oct 3, 2008 at 2:38 PM, Pat <Pa*@tanker.netwrote:

我''我一直在为Python寻找一个好的多模块lint检查器,而且我还没找到



Pylint在检查方面做得不错仅在单个模块中出现错误。


这是我的一个问题。我有两个模块。


在模块一中,我有一个功能:


def foo(主机,用户ID,密码):

通过


在模块二中,我称之为函数:


foo(用户名,密码)


lint没有发现错误,直到它被调用时才会被抓住,而程序正在运行。
我不希望凌晨3点发现错误。


我从未使用过那种没有发现错误的语言。我非常感谢很多人认为Python被许多大公司使用。您如何获得这些类型的错误?b
$ b
I''ve been searching for a good multi-module lint checker for Python and I
haven''t found one yet.

Pylint does a decent job at checking for errors only within a single module.

Here''s one of my problems. I have two modules.

In module one, I have a function:

def foo( host, userid, password ):
pass

In module two, I call that function:

foo( userid, password)

lint doesn''t find that error and it won''t be caught until it''s called while
the program is running. I don''t want that error found at 3AM.

I''ve never used a language that didn''t catch that type of error. I''m quite
surprised that Python is being used by a number of major companies. How you
catch these types of errors?



简而言之(或短语):单元测试。大量的单元测试,

可以捕获这样的愚蠢错误和更复杂的逻辑

错误。

查看''unittest''模块

[ http://docs.python .org / library / unittest.html] 以及关于该主题的许多

着作中的任何一篇,以获取更多信息。我肯定其他一些

海报会回复更全面的解释。


干杯,

克里斯
-

沿着鬣蜥的路径......
http://rebertia.com

In a word (or phrase rather): unit testing. Lots of unit testing,
which catches both silly errors like this and more complicated logic
errors.
Check out the ''unittest'' module
[http://docs.python.org/library/unittest.html] and any of the many
writings on the subject for more information. And I''m sure some other
posters will respond with more thorough explanations.

Cheers,
Chris
--
Follow the path of the Iguana...
http://rebertia.com


>

我已经与Wing和他们不知道有多个模块,但是他们正在考虑将自己的lint放入他们的IDE中。


谢谢你/>
-
http:// mail.python.org/mailman/listinfo/python-list


在消息< gc ********* *@aioe.org>,Pat写道:
In message <gc**********@aioe.org>, Pat wrote:

在模块一中,我有一个功能:


def foo(主机,用户ID,密码):

通过


在模块中le two,我称之为功能:


foo(用户名,密码)


lint没有发现错误,它赢了在程序运行时,它被称为

。我不希望凌晨3点发现错误。


我从未使用过那种没有发现错误的语言。
In module one, I have a function:

def foo( host, userid, password ):
pass

In module two, I call that function:

foo( userid, password)

lint doesn''t find that error and it won''t be caught until it''s called
while the program is running. I don''t want that error found at 3AM.

I''ve never used a language that didn''t catch that type of error.



因为在Python中,它不一定是错误的。您在
中定义的每个名称Python只是一个变量,并且可以随时更改其值:

编译器无法告诉foo不会在函数的定义和实际调用之间有一个不同的值


Because in Python, it''s not necessarily an error. Every name you define in
Python is just a variable, and can have its value changed at any time: the
compiler can''t tell that foo won''t have a different value put into it
between the definition of the function and the actual call.


2008年10月3日星期五17:38 :13:0400,Pat写道:
On Fri, 03 Oct 2008 17:38:13 -0400, Pat wrote:

Pylint只在一个

模块中检查错误做得不错。


这是我的一个问题。我有两个模块。


在模块一中,我有一个功能:


def foo(主机,用户ID,密码):

通过


在模块二中,我称之为函数:


foo(用户名,密码)


lint没有发现错误,在程序运行时它被称为

之前不会被捕获。我不希望凌晨3点发现错误。
Pylint does a decent job at checking for errors only within a single
module.

Here''s one of my problems. I have two modules.

In module one, I have a function:

def foo( host, userid, password ):
pass

In module two, I call that function:

foo( userid, password)

lint doesn''t find that error and it won''t be caught until it''s called
while the program is running. I don''t want that error found at 3AM.



然后不要进行深夜(或早上

早上)的单元测试。 ;-)


除了标准库中的`unittest`模块,你可能会看到`$。$`和`鼻子`的



Ciao,

Marc''BlackJack''Rintsch

Then don''t run the unit tests that late at night (or early in the
morning). ;-)

Besides the `unittest` module from the standard library you might look
into `py.test` and `nose`.

Ciao,
Marc ''BlackJack'' Rintsch


这篇关于lint for Python?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆