3

有没有办法告诉 pylint 在看到用户定义的弃用警告时必须显示警告消息?

我试过warnings.warn,DeprecationWarning - 但pylint忽略了它们。

4

1 回答 1

2

Since warnings.warn &c are intended to happen at runtime, Pylint by default doesn't see them as anything strange. To change that I think you need to follow the (advanced and scarce) docs for writing your own checker, with which you can emit warnings on any characteristics of the sources (either the raw ones or the AST-compiled level thereof).

于 2010-09-17T15:41:22.893 回答