Pylint - 区分新错误和旧错误

发布于 2024-11-26 12:27:13 字数 405 浏览 3 评论 0原文

有谁知道如何区分 Pylint 报告中的新错误(在最新 Pylint 执行期间发现的错误)和旧错误(在之前执行期间发现的错误)?

我在我的一个项目中使用 Pylint,该项目相当大。 Pylint 报告了相当多的错误(即使我在 rcfile 中禁用了很多错误)。虽然我会随着时间的推移修复这些错误,但不要引入新的错误也很重要。但是 Pylint HTML 和“可解析”报告无法区分新错误和之前发现的错误,即使我使用 persistent=yes 选项运行 Pylint。

至于现在 - 我手动比较新旧报告。不过,如果 Pylint 能够以某种方式突出显示在最近一次运行中发现但在前一次运行中未找到的错误消息,那就太好了。是否可以使用 Pylint 或现有工具或其他工具来做到这一点?因为如果没有 - 看来我最终会编写自己的比较和报告生成。

Does anybody know how to distinguish new errors (those that were found during latest Pylint execution) and old errors (those that were alredy found during previous executions) in the Pylint report?

I'm using Pylint in one of my projects, and the project is pretty big. Pylint reports pretty many errors (even though I disabled lots of them in the rcfile). While I fix these errors with time, it is also important to not introduce new ones. But Pylint HTML and "parseable" reports don't distinguish new errors from those that were identified previously, even though I run Pylint with persistent=yes option.

As for now - I compare old and new reports manually. What would be really nice though, is if Pylint could highlight somehow those error messages which were found on a latest run, but were not found on a previous one. Is it possible to do so using Pylint or existing tools or something? Becuase if not - it seems I will end up writing my own comparison and report generation.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

喜爱皱眉﹌ 2024-12-03 12:27:13

两种基本方法。修复出现的错误,这样就不会再出现旧的错误。或者,如果您无意修复某些类型的 lint 错误,请告诉 lint 停止报告它们。

如果您有很多文件,最好分别为每个文件获取 lint 报告,将 lint 报告提交到版本控制(如 svn),然后使用版本控制系统 diff 实用程序将新的 lint 错误与旧版本分开-现有的。为每个 .py 文件提供单独报告的原因是为了更轻松地读取 diff 输出。

如果您使用的是 Linux,vim -d oldfile newfile 是读取 diff 的好方法。如果您使用的是 Windows,则只需使用 Tortoise SVN 内置的 diff 功能即可。

Two basic approaches. Fix errors as they appear so that there will be no old ones. Or, if you have no intention of fixing certain types of lint errors, tell lint to stop reporting them.

If you have a lot of files it would be a good idea to get a lint report for each file separately, commit the lint reports to revision control like svn, and then use the revision control systems diff utility to separate new lint errors from older pre-existing ones. The reason for seperate reports for each .py file is to make it easier to read the diff output.

If you are on Linux, vim -d oldfile newfile is a nice way to read diff. If you are on Windows then just use the diff capability built into Tortoise SVN.

裸钻 2024-12-03 12:27:13
  • 在 dev 分支上运行 pylint,得到 x 个错误
  • 在 master 分支上运行 pylint,得到 y 错误
  • 如果 y > x,这意味着你有新的错误
  • 你可以在代码合并到master之前在CI过程中执行上述操作
  • Run pylint on dev branch, get x errors
  • Run pylint on master branch, get y errors
  • If y > x, which means you have new errors
  • You can do above things in CI process, before code is merged to master
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文