from
Sylvain Thénault <sylvain.thenault at logilab dot fr>
to
Benjamin Niemann <pink at odahoda dot de>
cc
Sylvain Thénault <sylvain.thenault at logilab dot fr>
subject
Re: [Python-projects] Disabling a message once
date
On Wednesday 29 June à 13:32, Benjamin Niemann wrote:2005/06/29 14:02
> On Wednesday 29 June 2005 13:05, Sylvain Thénault wrote:
> > On Tuesday 28 June à 18:30, Benjamin Niemann wrote:
> > > Looking at the code of pylint, I think another approach should be easier
> > > to implement. I propose an extended syntax for the disable-msg directive,
> > > e.g.:
> > >
> > > # pylint: disable-msg=W0704(+2)
> > >
> > > The number in brackets is either a relative line number (starting with +
> > > or -) or absolute (without +/-) - probably only the relative notations is
> > > useful. An absolute value of 0 (default, if no (NNN) is appended to the
> > > message code), implies the current behaviour - the message is disabled
> > > module wide. Otherwise the message is only disabled at the specified
> > > lines.
> > >
> > > Example:
> > >
> > > try:
> > > [code]
> > > except Exception, exc:
> > > # tell pylint that we know what we are doing...
> > > # pylint: disable-msg=W0703(-2)
> > > [code]
> > >
> > > A working patch is attached (no extensive testing so far, but it does not
> > > break the testsuite of pylint ;)
> > > It feels a bit like an ugly hack to me, because _module_msg_cats_state
> > > now contains a mix of booleans and lists...
> >
> > well, I wish to be able to do such thing too, but there is two things I
> > don't like in this way of doing this :
> > - necessary to add a relative line number (I would prefer to disable for
> > a whole block)
> This would require more knowledge of pylint's internals than I have ;)
>
> > - pylint has to apply the regexp one every line of every file (at least
> > that's what your patch is doing, I think we could reduce to every
> > *comment* line)
> Would
>
> for (tok_type, _, start, _, line) in tokens:
> if tok_type != comment:
> continue
>
> do it?
yep
> > However I'm not sure how to do this cleanly, and your patch presents
> > some nice idea, so be sure I'll consider it.
> >
> > > And another little thing: line 6 in test/fulltest.sh should be
> > > PYVERSIONS="2.2 2.3 2.4"
> > > instead of
> > > PYVERSIONS="2.2" "2.3" "2.4"
> >
> > hum strange. That works correctly for me. This is probably due to
> > different shell implementation.
> Which shell are you using?
> At least bash requires the first form - and /bin/sh is the linked to bash on
> many GNU based systems.
> I don't know what the original Bourne Shell syntax is, but I would be
> suprised, if constructs like
> CFLAGS=-g ./configure
> are not portable across sh clones...
I'm using bash. Anyway I've no objection to change this if it should be
considered as a more portable construct.
--
Sylvain Thénault LOGILAB, Paris (France).
http://www.logilab.com http://www.logilab.fr http://www.logilab.org
