[Python-projects] pylint reports about common code to refactor

Duncan Gibson duncan at thermal.esa.int
Fri Aug 4 09:24:31 CEST 2006

I wrote:
DG> Is there any reason why similar code within a file is not reported,
DG> and why similar code within classes appears to be ignored?

Nicolas Chauvat <nicolas.chauvat at logilab.fr> replied:
> pylint.checkers.similar.py:Similar._iter_sims() choses not to compare
> a file with itself. you can try to replace [idx+1:] with [idx:] and
> see if you get what you want, but IIRC, it becomes much slower.

I tried that (and you need to remove the -1 from the line above too)
but what happens is that each file is output without its docstring
because obviously the whole file is similar to itself. Probably not
what you were expecting.

It looks like extra logic is needed to search within a single file. 

Never mind. It might have been useful, but I can live without it.


More information about the Python-Projects mailing list