[Python-projects] pylint: Messages (dis)appear depending on order of file names
Sylvain Thénault
sylvain.thenault at logilab.fr
Wed May 2 14:13:27 CEST 2007
On Wednesday 02 May à 13:56, Sylvain Thénault wrote:
> On Friday 20 April à 20:13, Maarten ter Huurne wrote:
> >
> > Hi,
>
> Hi Maarten,
>
> > I noticed that in our automated daily checks problems were found by PyLint that
> > were not found if I run PyLint on the command line. After stepswise
> > simplifcation, I found out that it is the order of the module file names on the
> > command line that determines whether the problems are flagged or not. Here is a
> > stripped down example:
[snip]
> > As you can see in the example, the messages (true positives) are only issued if
> > "module1.py" is passed before "module2.py" on the command line.
> >
> > Is it possible that the order of module file names on the command line also
> > determines the order in which modules are checked and that for some reason
> > (bug) whether or not an imported module was already checked makes a difference
> > for the kind of messages that are issued?
>
> Huum, weird indeed. I've created a ticket (#3733) for this issue.
not so weird actually, after a deeper look at your sample code... The
problem is that attributes added externally are actually seen only when
the ast is built. With pylint, ast are built one by one (eg it iterates
on argument and for each build its ast and analyze it), and additionaly
others ast will be built when it's necessary to search something in
imported modules of the analyzed one.
In your sample, only module1 is importing module2, so if you analyze
module2 before module1, the attribute "AttRiBuTE" is added once module2
has already been analyzed.
I think pylint should first build ast for each given arguments and only
then launch analyzis, to avoid such weirdness (though potentially not
all of them, since ast for imported modules will still be processed at
analysis time).
--
Sylvain Thénault LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
Python et calcul scientifique: http://www.logilab.fr/science
More information about the Python-Projects
mailing list