通过 pylint 处理用户提出的弃用警告
有没有办法告诉 pylint 当它看到用户定义的弃用警告时必须显示警告消息?
我尝试过 warnings.warn、DeprecationWarning - 但 pylint 会忽略它们。
Is there a way to tell pylint that it must show warning message when it see user-defined deprecation warning?
I've tried warnings.warn, DeprecationWarning - but pylint ignores them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于
warnings.warn
&c 旨在在运行时发生,Pylint 默认情况下不会将它们视为任何奇怪的事情。要改变这一点,我认为您需要遵循 编写您自己的检查器,使用它您可以针对源的任何特征(无论是原始源还是 AST 编译级别)发出警告。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).