[code-quality] pylint: disable for too-many-lines must go on first line of module?

Sylvain Thénault sylvain.thenault at logilab.fr
Mon Jan 6 12:07:54 CET 2014


On 22 décembre 21:22, Patrick Jakubowski wrote:
> Hi all,

Hi Patrick,
 
> I'm upgrading from pylint 0.27.0 to 1.0.0 in my company's code base and I've run into a bit of an issue. For several of our modules, we use 'pylint: disable=C0302', to disable the too-many-lines error for the module. In pylint 0.26 this worked just fine as long as we put the line somewhere at the top of the module before any imports, like so:
> 
> #! /usr/bin/env python
> # pylint: disable=C0302
> <rest of code>
> 
> However, after upgrading to 1.0.0 it seems that the disable comment for C0302 HAS to go on the first line. This gets awkward because one has to mix it with the shebang line, like so:
> 
> #! /usr/bin/env python # pylint: disable=C0302
> <rest of code>
> 
> I have a feeling that this will be difficult and awkward for other developers in our code base to figure out. It's also very strange because module-wide suppression of other errors (e.g. W0223) continue to work even if they are not on the very first line. Is this a bug or is there some other way to accomplish a module-wide suppression of C0302 without mixing it with the shebang?

this sounds like a regression to me. Did you open an issue on the Bitbucket's
tracker ? (https://bitbucket.org/logilab/pylint/issues)

-- 
Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (05.62.17.16.42)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org


More information about the code-quality mailing list