From davidanderson2374 at outlook.com Wed Jun 5 13:34:44 2013 From: davidanderson2374 at outlook.com (David Anderson) Date: Wed, 5 Jun 2013 16:04:44 +0430 Subject: Jaíba - Lista dos aprovados concurso Message-ID: <137044822175fb01796467ab754833f9cc72a463a6@outlook.com> Ja?ba AMANDA FARIAS TELES, LEONARDO LICARIAO DE MELLO MENEZES, FRANCISCO AGEU DE SOUSA NOBREGA, PAMELA NOBREGA MENEZES, JO?O CARLOS MOREIRA DE CARVALHO, CLYCIA MONTEIRO FERREIRA, MARIA DE LOURDES FERREIRA BRITO, IZALANA PEREIRA NEPOMUCENO. SARA MARIA BEZERRA DOS SANTOS, ERALDO FREITA DA SILVA, MAYKSON CALISTA DE MELO, JOZENILDA BATISTA GOMES, WELIDA WENDY ARAUJO DA SILVA. Pires do Rio. Quiterian?polis ANA ANGELICA PEREIRA ALVES, LETICIA BAIRLE, FRANCISCO ANDERSON VALE DO NASCIMENTO, PAULO DE SIQUEIRA SILVA, JO?O CARLOS MOREIRA DE CARVALHO, DAMIANA PEREIRA DE OLIVERIA, MARIA DO SOCORRO DE ALBURQUERQUE ARRUDA BARBOSA, JAIME CUSTODIO DA SILVA FILHO. SEBASTIANA M?RCIA GOMES DE MELO, ?RICA FRANCISCA BATISTA DE MELO, MAYRES RAQUEL DA SILVA PINHEIRO, JUCIMARA VICENTE DOS SANTOS, WEULLER TEIXEIRA DE MAGALHAES. Coxim. Central de Minas ANA KARINE PAULINO DA SILVA, LUAN VICTOR VASCONCELOS NOBERTO, FRANCISCO MARKAN NOBRE DE SOUZA FILHO, PEDRO SIQUEIRA FONTENELE, JO?O CARLOS MOREIRA DE CARVALHO, DANIEL MOREIRA ALVES DA SILVA, MARIA JOELMA BEZERRA DA SILVA, JESSICA DE PONTES GOMES. SINELANDIA MARIA DA SILVA, BRENA CARLA DE MELO CAMELO, LUCINEIDE MARIA DA SILVA, HAROLDO PEIXOTO DA JUSTA JUNIOR, RENATA ROCHA DE NEGREIROS. Coxim. From horneds at gmail.com Thu Jun 6 14:47:16 2013 From: horneds at gmail.com (horneds at gmail.com) Date: Thu, 6 Jun 2013 20:47:16 +0800 Subject: [code-quality] Pylint with threading Message-ID: Hello guys, I came from http://docs.pylint.org/contribute.html#mailing-lists Im the author of some code-quality libraries such as https://github.com/klen/pylama. I use that in my VIM plugin https://github.com/klen/python-mode. Pylama is simular to flake8, but have some additional features and works also with pylint. Today I would like to make code checking with pylama is more asynchronously. I haven't any problems with pyflake, pep8, pep257 and mccabe but cannot make pylint works. When I run pylint with a few threads I get errors like this: https://gist.github.com/klen/5721176. When one thread try to run pylint a more from one time I got this error. I think the problem in ASTNG MANAGER and I try to clean that cache. I tried to clear the cache in several ways https://gist.github.com/klen/5721225 but not have success. Can anybody help me? PS: Sorry for my English, its far from well I now. Kirill Klenov web developer ______________________________________________________________________ horneds at gmail.com | http://klen.github.io mobile: +7 906 7723620 -------------- next part -------------- An HTML attachment was scrubbed... URL: From skip at pobox.com Thu Jun 6 22:49:01 2013 From: skip at pobox.com (Skip Montanaro) Date: Thu, 6 Jun 2013 15:49:01 -0500 Subject: [code-quality] Two attribute usage checkers I'd like to see Message-ID: These features may already be possible with some tools. If so, pointers appreciated. When a class evolves over a long period of time, it's quite possible for methods or data attributes to fall into disuse. While I realize that attributes which don't start with an underscore are implicitly part of the class's API, most attributes are used internally. I'd like to be able to have my checker(s) warn me if I define an attribute but don't use it within the class: class Foo: def __init__(self): self.x = 0 def y(self): pass .... If I never refer to self.x or self.y within the class's methods it would be nice to be alerted. It might catch misspellings (think_long_amd_meaningful_attribute_names) or catch what is effectively dead code. Obviously, this checker should be something you can turn on and off selectively. There are plenty of cases where attributes aren't used within the class implementation but are used by its clients. This is not a hard-and-fast rule. Here's the other problem I'd like to catch: class X(object): ... def get_foo(self): return self._foo foo = property(get_foo) The problem here is that I have violated this Zen of Python dictum: There should be one-- and preferably only one --obvious way to do it. I will admit that I sometimes go back and forth on property objects. On the one hand, as a Python programmer, I like them. I didn't always feel that way though, and some of the people I have worked with over the years have been more C++-centric, and tended to spell their setters and getters without leading underscores. Skip From mbp at google.com Fri Jun 7 01:18:34 2013 From: mbp at google.com (Martin Pool) Date: Fri, 7 Jun 2013 09:18:34 +1000 Subject: [code-quality] Two attribute usage checkers I'd like to see In-Reply-To: References: Message-ID: On 7 June 2013 06:49, Skip Montanaro wrote: > If I never refer to self.x or self.y within the class's methods it > would be nice to be alerted. > +1, and that seems feasible to add to pylint. > > Here's the other problem I'd like to catch: > class X(object): > ... > def get_foo(self): > return self._foo > foo = property(get_foo) > The problem here is that I have violated this Zen of Python dictum: > There should be one-- and preferably only one --obvious way to do it. I will admit that I sometimes go back and forth on property objects. But there is no obvious one way to do this in Python. Depending on your project's standards you could say any of - don't use trivial getters/setters or properties, just have a public field (consenting adults) - don't use properties, use an explicit method call (because calls that may take time or have side effects should not look like a simple attribute read) - don't assign property objects to an attribute, use @property - the property getter implementation shouldn't be public - a property getter implementation that only reads a variable should be an inlined lambda - ... should be an operator.attrgetter (I realize your example of just getting a field value may be unrealistically simplified, but even if the getter was doing a lot of work several of those options are available.) -- Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: From skip at pobox.com Fri Jun 7 01:32:48 2013 From: skip at pobox.com (Skip Montanaro) Date: Thu, 6 Jun 2013 18:32:48 -0500 Subject: [code-quality] Two attribute usage checkers I'd like to see In-Reply-To: References: Message-ID: >> Here's the other problem I'd like to catch: >> class X(object): >> ... >> def get_foo(self): >> return self._foo >> foo = property(get_foo) >> The problem here is that I have violated this Zen of Python dictum: >> There should be one-- and preferably only one --obvious way to do it. >> >> I will admit that I sometimes go back and forth on property objects. > > > But there is no obvious one way to do this in Python. Correct, but I would just like to be alerted that perhaps I should consider narrowing my API. Some of the code base I work on was around before Python 2.2 was available. Over time, people have started to add property-based setters and getters. In many circumstances, we should probably pick one way to do it, in this case self.foo vs self.get_foo(). I'm just looking for the message to remind me to consider the API duplication. I'm not suggesting pylint or other tools should recommend one or the other. Skip From mbp at google.com Fri Jun 7 01:35:25 2013 From: mbp at google.com (Martin Pool) Date: Fri, 7 Jun 2013 09:35:25 +1000 Subject: [code-quality] Two attribute usage checkers I'd like to see In-Reply-To: References: Message-ID: On 7 June 2013 09:32, Skip Montanaro wrote: > > Correct, but I would just like to be alerted that perhaps I should > consider narrowing my API. Some of the code base I work on was around > before Python 2.2 was available. Over time, people have started to > add property-based setters and getters. In many circumstances, we > should probably pick one way to do it, in this case self.foo vs > self.get_foo(). I'm just looking for the message to remind me to > consider the API duplication. I'm not suggesting pylint or other > tools should recommend one or the other. That makes sense. You could do something similar when people are migrating methods but the old one's hanging around. -- Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel at trvx.org Fri Jun 7 02:22:46 2013 From: daniel at trvx.org (Daniel Hofmann) Date: Fri, 7 Jun 2013 02:22:46 +0200 Subject: [code-quality] Possible false positives in Pyflakes Message-ID: <20130607002246.GA12167@trvx.org> I tried reaching someone from Pyflakes in the IRC channel on freenode and was kindly redirected to this mailinglist, so please tell me if this is not the appropriate place for my questions. I discovered Pyflakes a few weeks ago and I'm using it in a project. But it seems that I'm not able to get rid of a few errors it reports. I'm by no means a Python professional, so this may be a mistake on my side. The following three error messages do not make sense for me: > dslrpicontrol/models.py:26: invalid syntax > flash(u'Auto-detection request failed', 'danger') > ^ > dslrpicontrol/errorhandlers.py:15: invalid syntax > return render_error(404, u'Page not found') > ^ > dslrpicontrol/__init__.py:28: 'dslrpicontrol' imported but unused If you want to see the specific position, I hilighted the exact lines here: > https://github.com/daniel-j-h/dslr-pi-control/blob/master/dslrpicontrol/models.py#L26 > https://github.com/daniel-j-h/dslr-pi-control/blob/master/dslrpicontrol/errorhandlers.py#L15 > https://github.com/daniel-j-h/dslr-pi-control/blob/master/dslrpicontrol/__init__.py#L28 The first two 'invalid syntax' error reports do not make sense to me. Why is the syntax invalid? The Python interpreter does The Right Thing. More about the flash() function here: > http://flask.pocoo.org/docs/patterns/flashing/#flashing-with-categories > http://flask.pocoo.org/docs/api/#message-flashing The last 'imported but unused' error report probably comes from the circular imports? This idiom was actually recommended by the Flask docs. Is this also a false positive? I'm glad for any hints. Cheers, Daniel From florent.xicluna at gmail.com Fri Jun 7 08:21:20 2013 From: florent.xicluna at gmail.com (Florent) Date: Fri, 7 Jun 2013 08:21:20 +0200 Subject: [code-quality] Possible false positives in Pyflakes In-Reply-To: <20130607002246.GA12167@trvx.org> References: <20130607002246.GA12167@trvx.org> Message-ID: Hello Daniel, you see the syntax issue because you installed Pyflakes for Python 3.1 or 3.2, and you are checking code which is syntactically wrong for these versions of Python (The u"" prefix is only supported with Python 2.x or Python >= 3.3). Because Pyflakes is based on the AST module from the standard library, it is dependent on the version of Python. See also: https://bugs.launchpad.net/pyflakes/+bug/1169552 The last case, about unused import, could be seen as a false positive. Usually you can get rid of the warning if you declare these __init__ imports in the special __all__ variable. http://docs.python.org/2/tutorial/modules.html#importing-from-a-package The related issue, with details https://bugs.launchpad.net/pyflakes/+bug/1178905 Best regards, -- Florent Xicluna 2013/6/7 Daniel Hofmann : > I tried reaching someone from Pyflakes in the IRC channel on > freenode and was kindly redirected to this mailinglist, so please > tell me if this is not the appropriate place for my questions. > > > I discovered Pyflakes a few weeks ago and I'm using it in a project. > But it seems that I'm not able to get rid of a few errors it reports. > > I'm by no means a Python professional, so this may be a mistake on my side. > > The following three error messages do not make sense for me: > >> dslrpicontrol/models.py:26: invalid syntax >> flash(u'Auto-detection request failed', 'danger') >> ^ >> dslrpicontrol/errorhandlers.py:15: invalid syntax >> return render_error(404, u'Page not found') >> ^ >> dslrpicontrol/__init__.py:28: 'dslrpicontrol' imported but unused > > If you want to see the specific position, I hilighted the exact lines here: > >> https://github.com/daniel-j-h/dslr-pi-control/blob/master/dslrpicontrol/models.py#L26 >> https://github.com/daniel-j-h/dslr-pi-control/blob/master/dslrpicontrol/errorhandlers.py#L15 >> https://github.com/daniel-j-h/dslr-pi-control/blob/master/dslrpicontrol/__init__.py#L28 > > The first two 'invalid syntax' error reports do not make sense to me. > Why is the syntax invalid? The Python interpreter does The Right Thing. > > More about the flash() function here: >> http://flask.pocoo.org/docs/patterns/flashing/#flashing-with-categories >> http://flask.pocoo.org/docs/api/#message-flashing > > The last 'imported but unused' error report probably comes from the circular imports? > This idiom was actually recommended by the Flask docs. Is this also a false positive? > > I'm glad for any hints. > > Cheers, > Daniel > _______________________________________________ > code-quality mailing list > code-quality at python.org > http://mail.python.org/mailman/listinfo/code-quality From marius at gedmin.as Fri Jun 7 08:50:00 2013 From: marius at gedmin.as (Marius Gedminas) Date: Fri, 7 Jun 2013 09:50:00 +0300 Subject: [code-quality] Possible false positives in Pyflakes In-Reply-To: <20130607002246.GA12167@trvx.org> References: <20130607002246.GA12167@trvx.org> Message-ID: <20130607065000.GA1944@platonas> On Fri, Jun 07, 2013 at 02:22:46AM +0200, Daniel Hofmann wrote: > I tried reaching someone from Pyflakes in the IRC channel on > freenode and was kindly redirected to this mailinglist, so please > tell me if this is not the appropriate place for my questions. > > I discovered Pyflakes a few weeks ago and I'm using it in a project. > But it seems that I'm not able to get rid of a few errors it reports. > > I'm by no means a Python professional, so this may be a mistake on my side. > > The following three error messages do not make sense for me: > > > dslrpicontrol/models.py:26: invalid syntax > > flash(u'Auto-detection request failed', 'danger') > > ^ > > dslrpicontrol/errorhandlers.py:15: invalid syntax > > return render_error(404, u'Page not found') > > ^ This looks like you're using Python 3.2 to run Pyflakes on a source tree that was written for Python 2.x. u'unicode string literals' are invalid syntax on Python 3.0 through 3.2. Perhaps the error would be a bit clearer if the caret pointed to the beginning of the string literal, instead of the end. > > dslrpicontrol/__init__.py:28: 'dslrpicontrol' imported but unused Well, it is unused. You're merely importing it for the side effects (which is, generally speaking, a Bad Idea). In my pyflakes fork (which I intend to upstream Some Day Real Soon Now) I made pyflakes ignore unused imports if there's a comment on the line, with the intent that the comment explain why this unused import is here. E.g. import dslrpicontrol.loggers # for the side effects It doesn't look immediately upstreamable: http://bazaar.launchpad.net/~mgedmin/pyflakes/pyflakes-mg/revision/26 since it depends on my earlier changes that added command-line warning filtering: http://bazaar.launchpad.net/~mgedmin/pyflakes/pyflakes-mg/revision/22 http://bazaar.launchpad.net/~mgedmin/pyflakes/pyflakes-mg/revision/25 Marius Gedminas -- Users will less and less tolerate the risk of being attacked from anywhere in the universe. -- David Clark about network security, 1992 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 190 bytes Desc: Digital signature URL: From daniel at trvx.org Fri Jun 7 12:12:52 2013 From: daniel at trvx.org (Daniel Hofmann) Date: Fri, 7 Jun 2013 12:12:52 +0200 Subject: [code-quality] Possible false positives in Pyflakes In-Reply-To: References: <20130607002246.GA12167@trvx.org> Message-ID: <20130607101252.GA2392@trvx.org> Thanks for your quick and detailed description! On 08:21 Fri 07 Jun , Florent wrote: > you see the syntax issue because you installed Pyflakes for Python 3.1 > or 3.2, and you are checking code which is syntactically wrong for > these versions of Python (The u"" prefix is only supported with Python > 2.x or Python >= 3.3). Oh, that's true, my system's Pyflakes is installed for Python 3. But I'm wondering a bit, because my virtualenv is Pythpn 2 only. And even after activating it, it seems that it is calling the global Pyflakes: > (env)$ pyflakes dslrpicontrol > (unicode literal errors here) Although my PATH got the virtualenv's bin directory at first position: > (env)$ echo $PATH > /home/daniel/dslr-pi-control/env/bin:/usr/local/sbin:/usr/local/bin:.... So it seems I have to call it like > (env)$ ./env/bin/pyflakes dslrpicontrol To get the right one? Isn't it virtualenv's task to use the one from the environment? > The last case, about unused import, could be seen as a false positive. > Usually you can get rid of the warning if you declare these __init__ > imports in the special __all__ variable. Will do! Thanks! From florent.xicluna at gmail.com Fri Jun 7 12:56:13 2013 From: florent.xicluna at gmail.com (Florent) Date: Fri, 7 Jun 2013 12:56:13 +0200 Subject: [code-quality] Possible false positives in Pyflakes In-Reply-To: <20130607101252.GA2392@trvx.org> References: <20130607002246.GA12167@trvx.org> <20130607101252.GA2392@trvx.org> Message-ID: 2013/6/7 Daniel Hofmann : > > Oh, that's true, my system's Pyflakes is installed for Python 3. > But I'm wondering a bit, because my virtualenv is Pythpn 2 only. > And even after activating it, it seems that it is calling the global > Pyflakes: >> (env)$ pyflakes dslrpicontrol You can check which version is used... sometimes the internal Bash "hash" table keeps a reference to the global pyflakes. (venv)$ hash (venv)$ which pyflakes If pyflakes is in the "hash" table, it should be linked to the same path. If there's a stale entry in the table, you could take one of these actions: * upgrade virtualenv (the hash table is cleared since version 1.1) * force clear the table: `hash -r` * or force run with the right version `python -m pyflakes dslrpicontrol` -- Florent Xicluna From daniel at trvx.org Fri Jun 7 13:26:18 2013 From: daniel at trvx.org (Daniel Hofmann) Date: Fri, 7 Jun 2013 13:26:18 +0200 Subject: [code-quality] Possible false positives in Pyflakes In-Reply-To: References: <20130607002246.GA12167@trvx.org> <20130607101252.GA2392@trvx.org> Message-ID: <20130607112618.GA1419@trvx.org> You're right, there was an old entry in the hash table. Thanks, I did not know about this. From sylvain.thenault at logilab.fr Tue Jun 11 14:49:30 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Tue, 11 Jun 2013 14:49:30 +0200 Subject: [code-quality] Pylint with threading In-Reply-To: References: Message-ID: <20130611124930.GL5561@logilab.fr> On 06 juin 20:47, horneds at gmail.com wrote: > Hello guys, Hi, > Im the author of some code-quality libraries such as https://github.com/klen/pylama. I use that in my VIM plugin > https://github.com/klen/python-mode. Pylama is simular to flake8, but have some additional features and works also with pylint. > > Today I would like to make code checking with pylama is more asynchronously. I haven't any problems with pyflake, pep8, pep257 and mccabe but cannot make pylint works. When I run pylint with a few threads I get errors like this: https://gist.github.com/klen/5721176. When one thread try to run pylint a more from one time I got this error. > > I think the problem in ASTNG MANAGER and I try to clean that cache. > > I tried to clear the cache in several ways https://gist.github.com/klen/5721225 but not have success. > > Can anybody help me? nor pylint nor astng have been written with multi-threading in mind so I'm not surprised such pb arises. You're right that the one you're issuing are much probably due to the astng's MANAGER singleton. Though IMO it'll be hard if possible to remove that singleton/borg and your attempt to solve the pb are not in the good direction. We should rather ensure that the manager and other underlying code is thread safe. Quickly digging in the code shown me the unsafety you're encountering: the rebuilder is set as a class attribute on the builder, hence shared among thread. See attached patch for an attempt to fix this. There may be other pb on the way, and the best thing to do is to open an issue for that on bitbucket so we can continue this discussion there. On the pylint side, I assume you have a pylint instance per thread? -- 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 From sylvain.thenault at logilab.fr Tue Jun 11 15:29:05 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Tue, 11 Jun 2013 15:29:05 +0200 Subject: [code-quality] Pylint with threading In-Reply-To: <20130611124930.GL5561@logilab.fr> References: <20130611124930.GL5561@logilab.fr> Message-ID: <20130611132905.GN5561@logilab.fr> the patch... -- 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: astng-threading.patch Type: text/x-diff Size: 1309 bytes Desc: not available URL: From sylvain.thenault at logilab.fr Wed Jun 19 09:37:06 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Wed, 19 Jun 2013 09:37:06 +0200 Subject: [code-quality] Two attribute usage checkers I'd like to see In-Reply-To: References: Message-ID: <20130619073706.GA2790@logilab.fr> On 07 juin 09:18, Martin Pool wrote: > On 7 June 2013 06:49, Skip Montanaro wrote: > > > If I never refer to self.x or self.y within the class's methods it > > would be nice to be alerted. > > > > +1, and that seems feasible to add to pylint. Hey guys, today is your last chance to contribute this to the pylint 10th anniversary sprint ;) And to get it in forthcoming 1.0... Monday and tuesday reports: https://www.logilab.org/blogentry/146924 https://www.logilab.org/blogentry/147339 -- 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 From ned at nedbatchelder.com Wed Jun 19 12:59:19 2013 From: ned at nedbatchelder.com (Ned Batchelder) Date: Wed, 19 Jun 2013 06:59:19 -0400 Subject: [code-quality] Two attribute usage checkers I'd like to see In-Reply-To: <20130619073706.GA2790@logilab.fr> References: <20130619073706.GA2790@logilab.fr> Message-ID: <51C18F07.4080505@nedbatchelder.com> I don't think I can make an actual patch, but can I suggest a very simple change? This message: Invalid name "f" for type variable (should match [a-z_][a-z0-9_]{2,30}$) would be simpler and clearer without the word "type". I always read it first as "f is not a valid name for a type". Can we shorten it to: Invalid name "f" for variable (should match [a-z_][a-z0-9_]{2,30}$) --Ned. On 6/19/2013 3:37 AM, Sylvain Th?nault wrote: > On 07 juin 09:18, Martin Pool wrote: >> On 7 June 2013 06:49, Skip Montanaro wrote: >> >>> If I never refer to self.x or self.y within the class's methods it >>> would be nice to be alerted. >>> >> +1, and that seems feasible to add to pylint. > Hey guys, today is your last chance to contribute this to the pylint 10th anniversary sprint ;) > And to get it in forthcoming 1.0... > > Monday and tuesday reports: > https://www.logilab.org/blogentry/146924 > https://www.logilab.org/blogentry/147339 > From sylvain.thenault at logilab.fr Wed Jun 19 14:53:28 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Wed, 19 Jun 2013 14:53:28 +0200 Subject: [code-quality] Two attribute usage checkers I'd like to see In-Reply-To: <51C18F07.4080505@nedbatchelder.com> References: <20130619073706.GA2790@logilab.fr> <51C18F07.4080505@nedbatchelder.com> Message-ID: <20130619125328.GA12285@logilab.fr> On 19 juin 06:59, Ned Batchelder wrote: > I don't think I can make an actual patch, but can I suggest a very > simple change? This message: > > Invalid name "f" for type variable (should match > [a-z_][a-z0-9_]{2,30}$) > > would be simpler and clearer without the word "type". I always read > it first as "f is not a valid name for a type". Can we shorten it > to: > > Invalid name "f" for variable (should match [a-z_][a-z0-9_]{2,30}$) Good suggestion, I've just changed so you'll get in case of the above example: Invalid variable name "f" So it's even shorter (we decided to drop the regexp pattern as well since it's not easily readable and may be a long string). -- 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 From skip at pobox.com Wed Jun 19 17:41:28 2013 From: skip at pobox.com (Skip Montanaro) Date: Wed, 19 Jun 2013 10:41:28 -0500 Subject: [code-quality] Two attribute usage checkers I'd like to see In-Reply-To: <20130619073706.GA2790@logilab.fr> References: <20130619073706.GA2790@logilab.fr> Message-ID: On Wed, Jun 19, 2013 at 2:37 AM, Sylvain Th?nault wrote: > On 07 juin 09:18, Martin Pool wrote: >> On 7 June 2013 06:49, Skip Montanaro wrote: >> >> > If I never refer to self.x or self.y within the class's methods it >> > would be nice to be alerted. >> > >> >> +1, and that seems feasible to add to pylint. > > Hey guys, today is your last chance to contribute this to the pylint 10th anniversary sprint ;) > And to get it in forthcoming 1.0... > > Monday and tuesday reports: > https://www.logilab.org/blogentry/146924 > https://www.logilab.org/blogentry/147339 > > -- > 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 I don't have a bunch of spare time, but can you point me in the general direction of where such a check would be made? I believe pylint already has a "set but not used" message for local variables. This check could, I think, be patterned after that code. Sorry, I wasn't aware you were sprinting. Skip From mbp at google.com Wed Jun 19 23:30:07 2013 From: mbp at google.com (Martin Pool) Date: Thu, 20 Jun 2013 07:30:07 +1000 Subject: [code-quality] Two attribute usage checkers I'd like to see In-Reply-To: <20130619073706.GA2790@logilab.fr> References: <20130619073706.GA2790@logilab.fr> Message-ID: On 19 June 2013 17:37, Sylvain Th?nault wrote: > > Hey guys, today is your last chance to contribute this to the pylint 10th > anniversary sprint ;) > And to get it in forthcoming 1.0... > > Monday and tuesday reports: > https://www.logilab.org/blogentry/146924 > https://www.logilab.org/blogentry/147339 I think I missed it, but thanks for the updates. I'm especially pleased to hear Torsten pushing out some checkers from Google's pylint. -- Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: From sylvain.thenault at logilab.fr Thu Jun 20 10:33:18 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Thu, 20 Jun 2013 10:33:18 +0200 Subject: [code-quality] Two attribute usage checkers I'd like to see In-Reply-To: References: <20130619073706.GA2790@logilab.fr> Message-ID: <20130620083318.GC2591@logilab.fr> On 19 juin 10:41, Skip Montanaro wrote: > On Wed, Jun 19, 2013 at 2:37 AM, Sylvain Th?nault > wrote: > > On 07 juin 09:18, Martin Pool wrote: > >> On 7 June 2013 06:49, Skip Montanaro wrote: > >> > >> > If I never refer to self.x or self.y within the class's methods it > >> > would be nice to be alerted. > >> > > >> > >> +1, and that seems feasible to add to pylint. > > > > Hey guys, today is your last chance to contribute this to the pylint 10th anniversary sprint ;) > > And to get it in forthcoming 1.0... > > > > Monday and tuesday reports: > > https://www.logilab.org/blogentry/146924 > > https://www.logilab.org/blogentry/147339 > > > > -- > > 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 > > I don't have a bunch of spare time, but can you point me in the > general direction of where such a check would be made? I believe > pylint already has a "set but not used" message for local variables. > This check could, I think, be patterned after that code. There is an unused-variable message in the variables checker (pylint/checkers/variables.py). This is probably worth reading indeed, though in this particular case in should rather go in the classes checker (pylint/checkers/classes.py). > Sorry, I wasn't aware you were sprinting. no problem. I will do a whole sprint report later today. -- 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 From skip at pobox.com Thu Jun 20 20:44:04 2013 From: skip at pobox.com (Skip Montanaro) Date: Thu, 20 Jun 2013 13:44:04 -0500 Subject: [code-quality] Two attribute usage checkers I'd like to see In-Reply-To: <20130620083318.GC2591@logilab.fr> References: <20130619073706.GA2790@logilab.fr> <20130620083318.GC2591@logilab.fr> Message-ID: > There is an unused-variable message in the variables checker > (pylint/checkers/variables.py). > This is probably worth reading indeed, though in this particular case in > should rather > go in the classes checker (pylint/checkers/classes.py). Thanks for the pointer. I think I have a notion of how to go about this, however, I lacked up-to-date source. I cloned logilab-common, pylint and astroid. Installed in ~/.local, then tried pylint with PYTHONPATH set, but no command line args. No luck: % PYTHONPATH=/home/skipm/.local/lib/python2.7/site-packages pylint Traceback (most recent call last): File "/home/skipm/.local/bin/pylint", line 6, in from pkg_resources import load_entry_point File "/home/skipm/.local/lib/python2.7/site-packages/pkg_resources.py", line 2805, in working_set.require(__requires__) File "/home/skipm/.local/lib/python2.7/site-packages/pkg_resources.py", line 696, in require needed = self.resolve(parse_requirements(requirements)) File "/home/skipm/.local/lib/python2.7/site-packages/pkg_resources.py", line 594, in resolve raise DistributionNotFound(req) pkg_resources.DistributionNotFound: logilab-astroid>=0.24.3 udesktop267% PYTHONPATH=/home/skipm/.local/lib/python2.7/site-packages python Python 2.7.2 (default, Oct 17 2012, 03:11:33) [GCC 4.4.6 [TWW]] on sunos5 Type "help", "copyright", "credits" or "license" for more information. >>> import astroid >>> astroid.__file__ '/home/skipm/.local/lib/python2.7/site-packages/astroid-0.24.3-py2.7.egg/astroid/__init__.pyc' >>> I know this isn't a distutils mailing list and that you all are sprinting, so you're busy thinking about other stuff, however... Any idea how I can get past this basic hurdle so I can actually do some work with pylint? (Is there some non-pkg_resources way to install these things?) Thx, Skip From skip at pobox.com Thu Jun 20 21:55:21 2013 From: skip at pobox.com (Skip Montanaro) Date: Thu, 20 Jun 2013 14:55:21 -0500 Subject: [code-quality] Two attribute usage checkers I'd like to see In-Reply-To: References: <20130619073706.GA2790@logilab.fr> <20130620083318.GC2591@logilab.fr> Message-ID: > I cloned logilab-common, pylint and astroid. Installed in ~/.local, > then tried pylint with PYTHONPATH set, but no command line args. No > luck: > ... > pkg_resources.DistributionNotFound: logilab-astroid>=0.24.3 I believe I have this figured out. Pylint appears to be requiring a package named logilab-astroid, while the astroid package is installed as simply "astroid". I manually edited the installed EGG-INFO/requires.txt to refer to "astroid". I have no idea how this is generated, but I at least have a workaround until the problem can be fixed or someone can explain what I was doing wrong. Skip From sylvain.thenault at logilab.fr Fri Jun 21 08:13:28 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Fri, 21 Jun 2013 08:13:28 +0200 Subject: [code-quality] Two attribute usage checkers I'd like to see In-Reply-To: References: <20130619073706.GA2790@logilab.fr> <20130620083318.GC2591@logilab.fr> Message-ID: <20130621061328.GA2464@logilab.fr> On 20 juin 14:55, Skip Montanaro wrote: > > I cloned logilab-common, pylint and astroid. Installed in ~/.local, > > then tried pylint with PYTHONPATH set, but no command line args. No > > luck: > > > ... > > pkg_resources.DistributionNotFound: logilab-astroid>=0.24.3 > > I believe I have this figured out. Pylint appears to be requiring a > package named logilab-astroid, while the astroid package is installed > as simply "astroid". I manually edited the installed > EGG-INFO/requires.txt to refer to "astroid". I have no idea how this > is generated, but I at least have a workaround until the problem can > be fixed or someone can explain what I was doing wrong. This is a bug in pylint's packaging, I've just pushed a fix. -- 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 From skip at pobox.com Sat Jun 22 03:44:48 2013 From: skip at pobox.com (Skip Montanaro) Date: Fri, 21 Jun 2013 20:44:48 -0500 Subject: [code-quality] Unsure how to change tests when adding new checker Message-ID: I'm working on a new class checker which complains about attributes which are defined but not used within the class. This check triggers all sorts of warnings throughout the test suite. What do I do? Lots of expected output will have to be changed. Thx, Skip From sylvain.thenault at logilab.fr Mon Jun 24 09:55:52 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Mon, 24 Jun 2013 09:55:52 +0200 Subject: [code-quality] Unsure how to change tests when adding new checker In-Reply-To: References: Message-ID: <20130624075552.GA3111@logilab.fr> Hi Skip, On 21 juin 20:44, Skip Montanaro wrote: > I'm working on a new class checker which complains about attributes > which are defined but not used within the class. This check triggers > all sorts of warnings throughout the test suite. What do I do? Lots > of expected output will have to be changed. ths simplest is probably to add this message name to the 'pylint:disable' pragma on top of files where it's unexpectedly triggered. -- 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