9

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.

Tim
  • 12,318
  • 7
  • 50
  • 72
  • 1
    I noticed there is a feature request for Pylint, which looks very similar to my question - http://www.logilab.org/ticket/20386. So, it looks like Pylint doesn't suppport this yet. – Tim Jul 24 '11 at 08:00

2 Answers2

4

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.

Michael Dillon
  • 31,973
  • 6
  • 70
  • 106
  • 1
    Thanks! But, in fact, I have a project with 1000+ source code files, and all this stuff was coded before I started using Pylint. And, even worse - the source code is of really bad quality (discalimer: it was not coded by me :-) ). My rcfile enables ERRORs only, and yet I have around 100+ of them. You can imagine what would be the number of errors when I enable WARNINGS... I fix these errors one by one, but it's a hard work and it takes time, while I also add new code, and I want to focus on not introducing new errors. So, that's why I still want to distinguish new errors from old ones. – Tim Jul 24 '11 at 07:54
  • As of diff tools - yes, that's how I do it now indeed :) – Tim Jul 24 '11 at 08:53
0
  • 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
lmm333
  • 163
  • 2
  • 5