On 13 décembre 13:18, Robert wrote: > Sylvain Thénault wrote: > >On 08 décembre 08:35, Robert wrote: > >>sometimes class members and module globals are computed > >>dynamically => lots of E0602 and so. As pylint doesn't import like > >>pychecker. > >> > >>How is it possible to tell pylint about unseen globals/members? > > > >See https://www.logilab.org/blogentry/78354 > > ( http://www.logilab.org/blogentry/78354 ) > > [--load-plugins astng_hashlib ... MANAGER.register_transformer(...)] > > looked at it. > > Well this is a little heavy for getting it done on real projects. > Indeed this issue turns out to be most hindering me from getting > through with pylint and reasonable effort on bigger projects. > (I have a zero status checker requirement in the Makefiles - > otherwise its not possible to keep a Python app stable just with > tests) > > I used class faking with pychecker by manipulating from python > executed .pycheckrc, and there was a more fine-grained suppressions > dict option. More practical, but also not optimal. > > Here I miss significantly more comfort for such > beyond-one-line-but-not-whole-error-class suppressions. I agree this is a rough start that should be improved. > First Ideas: > > * allow cheap type-tolerant suppressions / declare mere existance > (for getting projects onto track without too much frustration) > > #module xyz > #pylint:globals-exist=xx,yy > class XYZ: #pylint:members-exist=b,g > a = 1 > def f(self): > pass > > * point to full type fake mixins (which mixin-update after the > actual class/module parsing) > > #pylint:fake-mixin-module=fake_import_path_a > class XYZ: #pylint:fake-mixin=fake_import_path_b.XYZ > a = 1 > def f(self): > pass > > > Suppressions to be possible from remote via pylintrc as well (for > files which we can/shall not edit): > > members-exist={'module_path.XYZ':'b,g', 'module_path.ABC': 'b,g'} > members-exist={'module_path.DEF':'b,g'} #accumulate multiple defs? > > fake-mixin-modules={'module_path':'fake_import_path_a'} > fake-mixin-classes={'module_path.XYZ':'fake_import_path_b.XYZ'} I'm not sure I get all your example, but such feature would be great. Feel free to add a ticket for this.
> >>Is it also possible to tell pylint to really import (certain) > >>modules and respect the real beings ? > > > >You can force some imports using --init-hooks, but this is usually > >to avoid crash on certain libraries containing C-modules which break > >if not imported the right way. Beside this, it won't affect the pylint's > >way of doing things. > > (thus this cannot be used so far to improve suppressions I assume?) indeed Cheers, -- Sylvain Thénault LOGILAB, Paris (France) 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 _______________________________________________ Python-Projects mailing list [email protected] http://lists.logilab.org/mailman/listinfo/python-projects
