From skip at pobox.com Tue Jul 2 16:29:29 2013 From: skip at pobox.com (Skip Montanaro) Date: Tue, 2 Jul 2013 09:29:29 -0500 Subject: [code-quality] Pylint - missing module docstring for __init__.py Message-ID: This warning seems specious: __init__.py:1: [C0111] Missing module docstring especially since __init__.py is often empty (as it is in this case), being used only as a marker that a directory is actually a package. This is in Python 2.7. I'm doing nothing to override the docstring_min_length config parameter, so if my reading of DocStringChecker._check_docstring is correct, this message should not be emitted for any zero-length module. I can't tell where/how self.config.docstring_min_length is initialized (find+grep doesn't return many hits), so can't tell what its value is, either. (Well, not without inserting a print statement.) What am I missing here? Skip From sylvain.thenault at logilab.fr Tue Jul 2 17:16:30 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Tue, 2 Jul 2013 17:16:30 +0200 Subject: [code-quality] Pylint - missing module docstring for __init__.py In-Reply-To: References: Message-ID: <20130702151630.GG4410@logilab.fr> Hi Skip, On 02 juillet 09:29, Skip Montanaro wrote: > This warning seems specious: > > __init__.py:1: [C0111] Missing module docstring > > especially since __init__.py is often empty (as it is in this case), > being used only as a marker that a directory is actually a package. > This is in Python 2.7. I'm doing nothing to override the > docstring_min_length config parameter, so if my reading of > DocStringChecker._check_docstring is correct, this message should not > be emitted for any zero-length module. I can't tell where/how > self.config.docstring_min_length is initialized (find+grep doesn't > return many hits), so can't tell what its value is, either. (Well, > not without inserting a print statement.) > > What am I missing here? docstring_min_length is initialized from the docstring-min-length option. IIRC, this is only considered for functions / methods though, and I agree that it should be considered for modules (classes?) as well. If you don't have time to submit a patch, please consider opening an issue on bitbucket. Thanks! -- 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 florent.xicluna at gmail.com Tue Jul 2 18:19:20 2013 From: florent.xicluna at gmail.com (Florent) Date: Tue, 2 Jul 2013 18:19:20 +0200 Subject: [code-quality] [ANN] pep8 1.4.6 and PyFlakes 0.7.3 Message-ID: Hello, I'm pleased to announce the release of Pyflakes 0.7.3 and pep8 1.4.6. Changes in these versions: * http://pep8.readthedocs.org/en/1.4.6/developer.html#changes * http://bazaar.launchpad.net/~pyflakes-dev/pyflakes/master/view/106/NEWS.txt -- Florent Xicluna From skip at pobox.com Thu Jul 4 00:29:17 2013 From: skip at pobox.com (Skip Montanaro) Date: Wed, 3 Jul 2013 17:29:17 -0500 Subject: [code-quality] pylint unit tests? Message-ID: I'm struggling trying to get a clean test run in my local pylint repo. At the moment, I have one small checker function, whose call I have commented out, and have reverted all edits to the test inputs. When I run ./fulltest.sh 2.7 on my Mac, I get a lot of output, ending with this: Ran 528 test cases in 61.66s (54.36s CPU), 17 failures, 5 skipped 10 modules OK (2 failed) Is that the expected baseline unit test output from the current default branch? Reading in contribute.rst I got the impression that the unit tests should run cleanly. Thanks, Skip -------------- next part -------------- An HTML attachment was scrubbed... URL: From mbp at google.com Thu Jul 4 00:57:45 2013 From: mbp at google.com (Martin Pool) Date: Thu, 4 Jul 2013 08:57:45 +1000 Subject: [code-quality] pylint unit tests? In-Reply-To: References: Message-ID: They pass for me on Linux. It does not seem like the kind of thing that would be very platform-specific. On 4 July 2013 08:29, Skip Montanaro wrote: > I'm struggling trying to get a clean test run in my local pylint repo. At > the moment, I have one small checker function, whose call I have commented > out, and have reverted all edits to the test inputs. When I run > > ./fulltest.sh 2.7 > > on my Mac, I get a lot of output, ending with this: > > Ran 528 test cases in 61.66s (54.36s CPU), 17 failures, 5 skipped > 10 modules OK (2 failed) > > Is that the expected baseline unit test output from the current default > branch? Reading in contribute.rst I got the impression that the unit tests > should run cleanly. > > Thanks, > > Skip > > > _______________________________________________ > code-quality mailing list > code-quality at python.org > http://mail.python.org/mailman/listinfo/code-quality > > -- Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: From skip at pobox.com Thu Jul 4 03:22:42 2013 From: skip at pobox.com (Skip Montanaro) Date: Wed, 3 Jul 2013 20:22:42 -0500 Subject: [code-quality] pylint unit tests? In-Reply-To: References: Message-ID: On Wed, Jul 3, 2013 at 5:57 PM, Martin Pool wrote: > They pass for me on Linux. It does not seem like the kind of thing that > would be very platform-specific. Thanks. I tried to back out my local changes but eventually gave up, not really understanding how this stuff works in Mercurial. I wound up just deleting my cloned repo at bitbucket as well and started from scratch. Cloned locally, and got to rev 1004. I'm still getting a number of errors, which seem to fall into one of two different types. The first type is an AssertionError about 31 not being equal to 28: FAIL: test_generated_members (smoketest.RunTC) ---------------------------------------------------------------------- Traceback (most recent call last) File "/Users/skip/local/lib/python2.7/site-packages/logilab_common-0.58.0-py2.7.egg/logilab/common/testlib.py", line 644, in _proceed testfunc(*args, **kwargs) File "/Users/skip/src/pylint/test/smoketest.py", line 87, in test_generated_members self._runtest(['--generated-members=objects,DoesNotExist,delay,retry,"[a-zA-Z]+_set{1,2}""', 'pylint.lint']) File "/Users/skip/src/pylint/test/smoketest.py", line 42, in _runtest self.assertEqual(ex.code, code) File "/Users/skip/local/lib/python2.7/unittest/case.py", line 515, in assertEqual assertion_func(first, second, msg=msg) File "/Users/skip/local/lib/python2.7/unittest/case.py", line 508, in _baseAssertEqual raise self.failureException(msg) AssertionError: 31 != 28 The second is a more typical unit test failure, where the expected and actual messages aren't equal: FAIL: test_functionality (pylint.testutils.LintTC) module test of input file "func_names_imported_from_module" (LintTC) ---------------------------------------------------------------------- Traceback (most recent call last) File "/Users/skip/local/lib/python2.7/site-packages/logilab_common-0.58.0-py2.7.egg/logilab/common/testlib.py", line 644, in _proceed testfunc(*args, **kwargs) File "/Users/skip/local/lib/python2.7/site-packages/pylint-0.28.0-py2.7.egg/pylint/testutils.py", line 232, in test_functionality self._test(tocheck) File "/Users/skip/local/lib/python2.7/site-packages/pylint-0.28.0-py2.7.egg/pylint/testutils.py", line 249, in _test self.assertMultiLineEqual(got, self._get_expected()) File "/Users/skip/local/lib/python2.7/unittest/case.py", line 926, in assertMultiLineEqual self.fail(self._formatMessage(msg, standardMsg)) File "/Users/skip/local/lib/python2.7/unittest/case.py", line 412, in fail raise self.failureException(msg) AssertionError: "E: 6: No name 'common' in module 'logilab'\nE: 7: No name 'common' in module [truncated]... != "E: 6: No name 'tutu' in module 'logilab.common'\nE: 7: No name 'toto' in modu [truncated]... - E: 6: No name 'common' in module 'logilab' ? ^^^^^^ + E: 6: No name 'tutu' in module 'logilab.common' ? ^^^^ +++++++ - E: 7: No name 'common' in module 'logilab' ? ^ ^^ - + E: 7: No name 'toto' in module 'logilab.common' ? ^ ^ +++++++ - E: 10: No name 'common' in module 'logilab' - E: 13: Module 'logilab' has no 'common' member + E: 11: Module 'logilab.common.modutils' has no 'nonexistant_function' member + E: 12: Module 'logilab.common.modutils' has no 'another' member + E: 13: Module 'logilab.common.modutils' has no 'yo' member E: 17: Module 'sys' has no 'stdoout' member E: 24: No name 'compiile' in module 're' E: 24: No name 'findiiter' in module 're' F: 6: Unable to import 'logilab.common.tutu' - F: 7: Unable to import 'logilab.common' - F: 10: Unable to import 'logilab.common' F: 23: Unable to import 'rie' W: 27: Statement seems to have no effect As Martin indicated, there doesn't seem like there should be much in the way of platform-specific stuff in pylint. I tend to run Python 2.7.x built from the main Python repo: % python Python 2.7.5+ (2.7:5896f887a93a, Jul 3 2013, 20:04:47) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. Any advice cheerfully accepted... Skip From sylvain.thenault at logilab.fr Thu Jul 4 09:38:27 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Thu, 4 Jul 2013 09:38:27 +0200 Subject: [code-quality] pylint unit tests? In-Reply-To: References: Message-ID: <20130704073827.GA2427@logilab.fr> On 03 juillet 20:22, Skip Montanaro wrote: > As Martin indicated, there doesn't seem like there should be much in > the way of platform-specific stuff in pylint. I tend to run Python > 2.7.x built from the main Python repo: > > % python > Python 2.7.5+ (2.7:5896f887a93a, Jul 3 2013, 20:04:47) > [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin > Type "help", "copyright", "credits" or "license" for more information. that should not be a problem. > Any advice cheerfully accepted... * Are you sure that PYTHONPATH is set properly so that your checkout of pylint is used to run the test? The second trace you provide tends to make me think there is a problem here. * You probably need to be on the tip of checkout of astroid [1], and maybe of logilab.common [2] as well (though I think there are only python3 related fixes there) Regarding your mercurial problem, you should simply commit your changes so you may go back and forth: $ hg commit -m "my new check" $ hg up .^ # go back to parent changeset $ hg up tip # go back to changeset introducing my new check If you have the evolve extension [3] installed and activated (promise it's worth the try ;), you may modify your changeset later on, and much more # do some changes to e.g. fix the test $ hg amend # update the current changeset [1] https://bitbucket.org/logilab/astroid [2] http://hg.logilab.org/master/logilab/common [3]?http://mercurial.selenic.com/wiki/ChangesetEvolution Hope that helps -- 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 Jul 4 14:38:26 2013 From: skip at pobox.com (Skip Montanaro) Date: Thu, 4 Jul 2013 07:38:26 -0500 Subject: [code-quality] pylint unit tests? In-Reply-To: <20130704073827.GA2427@logilab.fr> References: <20130704073827.GA2427@logilab.fr> Message-ID: > * Are you sure that PYTHONPATH is set properly so that your checkout of pylint > is used to run the test? The second trace you provide tends to make me think > there is a problem here. PYTHONPATH is unset. I don't recall seeing any instructions about setting it in contribute.rst. I have been installing pylint. The fulltest.sh script runs a command called pytest though, which appears to only materialize as part of the install process: pylint% pwd /Users/skip/src/pylint pylint% find . -name 'pytest*' | wc -l 0 pylint% type pytest pytest is /Users/skip/local/bin/pytest How should PYTHONPATH be set? How would I get a pytest command in my checkout? > * You probably need to be on the tip of checkout of astroid [1], and maybe of > logilab.common [2] as well (though I think there are only python3 related fixes > there) Yes, both are fully up-to-date and installed > Regarding your mercurial problem, you should simply commit your changes so you may > go back and forth: > > $ hg commit -m "my new check" > $ hg up .^ # go back to parent changeset > $ hg up tip # go back to changeset introducing my new check > > If you have the evolve extension [3] installed and activated (promise it's worth > the try ;), you may modify your changeset later on, and much more > > # do some changes to e.g. fix the test > $ hg amend # update the current changeset Thanks, I'll try and check this stuff out in the future. I've gotten pretty comfortable with git by using it daily at work, but many of the common hg idioms remain a complete mystery to me, probably because I don't use it day-in, day-out. Skip From sylvain.thenault at logilab.fr Thu Jul 4 15:04:42 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Thu, 4 Jul 2013 15:04:42 +0200 Subject: [code-quality] pylint unit tests? In-Reply-To: References: <20130704073827.GA2427@logilab.fr> Message-ID: <20130704130442.GL2427@logilab.fr> On 04 juillet 07:38, Skip Montanaro wrote: > > * Are you sure that PYTHONPATH is set properly so that your checkout of pylint > > is used to run the test? The second trace you provide tends to make me think > > there is a problem here. > > PYTHONPATH is unset. I don't recall seeing any instructions about > setting it in contribute.rst. I have been installing pylint. The > fulltest.sh script runs a command called pytest though, which appears > to only materialize as part of the install process: > > pylint% pwd > /Users/skip/src/pylint > pylint% find . -name 'pytest*' | wc -l > 0 > pylint% type pytest > pytest is /Users/skip/local/bin/pytest pytest is provided by the logilab-common package. You may avoid it by using another test launcher or by executing python on test modules one by one. > How should PYTHONPATH be set? How would I get a pytest command in my checkout? You should ensure that when you "import pylint", pylint.__path__ point to your checkout directory (or wherever you do your own modifications). > > Regarding your mercurial problem, you should simply commit your changes so you may > > go back and forth: > > > > $ hg commit -m "my new check" > > $ hg up .^ # go back to parent changeset > > $ hg up tip # go back to changeset introducing my new check > > > > If you have the evolve extension [3] installed and activated (promise it's worth > > the try ;), you may modify your changeset later on, and much more > > > > # do some changes to e.g. fix the test > > $ hg amend # update the current changeset > > Thanks, I'll try and check this stuff out in the future. I've gotten > pretty comfortable with git by using it daily at work, but many of the > common hg idioms remain a complete mystery to me, probably because I > don't use it day-in, day-out. Much probably, both definitly use different concepts/cli. -- 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 Jul 4 15:50:34 2013 From: skip at pobox.com (Skip Montanaro) Date: Thu, 4 Jul 2013 08:50:34 -0500 Subject: [code-quality] pylint unit tests? In-Reply-To: <20130704130442.GL2427@logilab.fr> References: <20130704073827.GA2427@logilab.fr> <20130704130442.GL2427@logilab.fr> Message-ID: >> How should PYTHONPATH be set? How would I get a pytest command in my checkout? > > You should ensure that when you "import pylint", pylint.__path__ point to your > checkout directory (or wherever you do your own modifications). Thanks for the extra help. Making this work required a bit of effort. Distutils gets in the way (inserting the various packages it installed in front of whatever happens to be on PYTHONPATH), as does the default naming of the logilab-common package. For the benefit of others new to pylint development, here's what I did. 1. I have checkouts of pylint, astroid and logilab-common in ~/src. I need to create ~/src/logilab, make it a package with an empty __init__.py file, and mv logilab-common to ~/src/logilab/common. 2. Set PYTHONPATH to ~/src. 3. In the pylint/test directory, I ran this for loop: for f in *.py ; do echo $f PYTHONPATH=$(pwd)/../.. python -S $f done The -S flag suppresses distutils' machinations. When run this way, I get 100% success, modulo a few skips because of other missing packages (gtk, etc). I'll update doc/contribute.rst to reflect some of these extra steps and create a separate pull request. Skip From graffatcolmingov at gmail.com Thu Jul 4 17:42:14 2013 From: graffatcolmingov at gmail.com (Ian Cordasco) Date: Thu, 4 Jul 2013 11:42:14 -0400 Subject: [code-quality] Flake8 News Message-ID: Hey all, I would first like to apologize for my complete disappearance from everything related to this list. Between finishing my masters, moving 1000 miles away and starting a new job (before I was even able to acquire domestic internet), I haven't had time for much of anything. In spite of that poor excuse, I'm sprinting on Flake8 today (trying to fix bugs and get other things written), and I wanted community feedback on a few things. First, is there any interest in developing a pylint plugin for Flake8? If so, who's interested in working with me on it. (I doubt we will finish it today, but I'd at least like to start it.) Second, can anyone provide some guidance (or at least opinions) on issue #85 on Flake8's bug tracker[1]. I'm conflicted about using a script to manage which version of python we use and I am quite partial to the method of appending the python version to the executable's name. However, if others have strong opinions on this, I'm quite willing to listen and would love more information. Finally, if there is anyone willing to collaborate with me on issues #95 [2], #97 [3], and #99 [4], I'd heartily appreciate it. To save you a few clicks, here are some summaries of those issues: #95: Generate code quality visualizations akin to: https://github.com/jsoverson/plato #97: Maintainability index based off McCabe, Halstead and SLOC #99: Machine readable output. This can probably take full advantage of pep8 features without needing to do anything special with Flake8. Firehose may also be of interest. [1]: https://bitbucket.org/tarek/flake8/issue/85 [2]: https://bitbucket.org/tarek/flake8/issue/95 [3]: https://bitbucket.org/tarek/flake8/issue/97 [4]: https://bitbucket.org/tarek/flake8/issue/99 Thanks in advance, Ian From lionel.barret at lbdn-consulting.com Fri Jul 5 07:27:16 2013 From: lionel.barret at lbdn-consulting.com (Lionel Barret) Date: Fri, 5 Jul 2013 07:27:16 +0200 Subject: [code-quality] copy/paste detection tool Message-ID: Hi, My name is Lionel Barret, I attended Florent Xicluna?s Europython talk Tuesday and it reminded me of a clone detection tool I used in the past (on a 100k sloc codebase) I talked about it with a few people (Florent Xicluna , Joe Gordon) and they were interested. Florent told me it was the list for this kind of discussion. This tool named clonedigger (http://clonedigger.sourceforge.net/ ) detects copy/pasted code or independent writing of the same classes/functions across a big codebase. In my last job, I used to get a daily html report, a big overview of the things that have been copy/pasted/rewritten. it was really useful. Sadly, it is unmaintained, the last upload dates from 2011. Besides, it?s using old packages (like the compiler package) and likely incompatible with python3 (either for running or for analyzing). I really think this kind of tool should be part of any code-quality toolbox, like pyflakes, pep8, etc. ( The tool itself is GPL, so no blocking there. ). I just wanted to see if anybody would be interested by an updated version of the tool and who could help. From the top of my mind, the next steps would be contacting the original author, evaluate the work to do (obsolete modules used and python3 incompatibilities) and eventually refactor the code. So what do you think ? Best, L. -------------- next part -------------- An HTML attachment was scrubbed... URL: From carl.crowder at gmail.com Fri Jul 5 09:19:27 2013 From: carl.crowder at gmail.com (Carl Crowder) Date: Fri, 5 Jul 2013 09:19:27 +0200 Subject: [code-quality] Flake8 News In-Reply-To: References: Message-ID: Hi Ian, I'm interested in helping out, and #99 looks like the easiest place to get started learning the codebase. I also like the idea of a pylint plugin. Carl On 4 Jul 2013 17:42, "Ian Cordasco" wrote: > Hey all, > > I would first like to apologize for my complete disappearance from > everything related to this list. Between finishing my masters, moving > 1000 miles away and starting a new job (before I was even able to > acquire domestic internet), I haven't had time for much of anything. > In spite of that poor excuse, I'm sprinting on Flake8 today (trying to > fix bugs and get other things written), and I wanted community > feedback on a few things. > > First, is there any interest in developing a pylint plugin for Flake8? > If so, who's interested in working with me on it. (I doubt we will > finish it today, but I'd at least like to start it.) > > Second, can anyone provide some guidance (or at least opinions) on > issue #85 on Flake8's bug tracker[1]. I'm conflicted about using a > script to manage which version of python we use and I am quite partial > to the method of appending the python version to the executable's > name. However, if others have strong opinions on this, I'm quite > willing to listen and would love more information. > > Finally, if there is anyone willing to collaborate with me on issues > #95 [2], #97 [3], and #99 [4], I'd heartily appreciate it. To save you > a few clicks, here are some summaries of those issues: > > #95: Generate code quality visualizations akin to: > https://github.com/jsoverson/plato > #97: Maintainability index based off McCabe, Halstead and SLOC > #99: Machine readable output. This can probably take full advantage of > pep8 features without needing to do anything special with Flake8. > Firehose may also be of interest. > > [1]: https://bitbucket.org/tarek/flake8/issue/85 > [2]: https://bitbucket.org/tarek/flake8/issue/95 > [3]: https://bitbucket.org/tarek/flake8/issue/97 > [4]: https://bitbucket.org/tarek/flake8/issue/99 > > Thanks in advance, > Ian > _______________________________________________ > code-quality mailing list > code-quality at python.org > http://mail.python.org/mailman/listinfo/code-quality > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sylvain.thenault at logilab.fr Fri Jul 5 10:55:08 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Fri, 5 Jul 2013 10:55:08 +0200 Subject: [code-quality] copy/paste detection tool In-Reply-To: References: Message-ID: <20130705085508.GB3445@logilab.fr> Hello Lionel, On 05 juillet 07:27, Lionel Barret wrote: > My name is Lionel Barret, I attended Florent Xicluna?s Europython talk > Tuesday and it reminded me of a clone detection tool I used in the past (on > a 100k sloc codebase) > > I talked about it with a few people (Florent Xicluna , Joe Gordon) and they > were interested. Florent told me it was the list for this kind of > discussion. > > This tool named clonedigger (http://clonedigger.sourceforge.net/ ) detects > copy/pasted code or independent writing of the same classes/functions > across a big codebase. In my last job, I used to get a daily html report, a > big overview of the things that have been copy/pasted/rewritten. it was > really useful. > > Sadly, it is unmaintained, the last upload dates from 2011. Besides, it?s > using old packages (like the compiler package) and likely incompatible with > python3 (either for running or for analyzing). > > I really think this kind of tool should be part of any code-quality > toolbox, like pyflakes, pep8, etc. > > ( The tool itself is GPL, so no blocking there. ). > > I just wanted to see if anybody would be interested by an updated version > of the tool and who could help. From the top of my mind, the next steps > would be contacting the original author, evaluate the work to do (obsolete > modules used and python3 incompatibilities) and eventually refactor the > code. How does it compare to Pylint's similarity checker? Basically it will reports you copy/pasted/rewritten code implying more than a configurable number of lines, after some normalisation. -- 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 Jul 6 04:49:27 2013 From: skip at pobox.com (Skip Montanaro) Date: Fri, 5 Jul 2013 21:49:27 -0500 Subject: [code-quality] Adding new warnings? Message-ID: Is there some magic to adding new messages to pylint? I've defined my new warning in checkers/classes.py by adding a new key/value pair to the MSGS dict: MSGS = { ... 'W0234': ('instance attribute %r is not used within the class', 'defined-attribute-not-accessed', 'Used when an attribute defined by the class is not accessed \ by the class itself.'), } but when I try to disable my new warning (W0324) with something like "# pylint: disable=C0302,W0324", it complains: E: 1: Bad option value 'W0324' Is there some sort of message compilation step which gathers all the keys from the MSGS dictionaries? I looked for all the places where "W0233" appeared, and tried to mimic that, but that would seem not to have been sufficient. I can see by the tracebacks that it is getting my new code. In fact, when I am unable to disable W0234, the checker emits the unused messages I'm trying to suppress, e.g.: W:113:ClassLevelMessage: instance attribute 'attr0' is not used within the class so I know my new code is being executed. Thx, Skip From marius at gedmin.as Sun Jul 7 00:43:02 2013 From: marius at gedmin.as (Marius Gedminas) Date: Sun, 7 Jul 2013 00:43:02 +0200 Subject: [code-quality] Adding new warnings? In-Reply-To: References: Message-ID: <20130706224302.GA14944@platonas> On Fri, Jul 05, 2013 at 09:49:27PM -0500, Skip Montanaro wrote: > Is there some magic to adding new messages to pylint? I've defined my > new warning in checkers/classes.py by adding a new key/value pair to > the MSGS dict: > > MSGS = { > ... > 'W0234': ('instance attribute %r is not used within the class', > 'defined-attribute-not-accessed', > 'Used when an attribute defined by the class is not accessed \ > by the class itself.'), > > } > > but when I try to disable my new warning (W0324) with something like > "# pylint: disable=C0302,W0324", it complains: > > E: 1: Bad option value 'W0324' So is it 2-3-4, or 3-2-4? Marius Gedminas -- A: No. Q: Should I include quotations after my reply? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 190 bytes Desc: Digital signature URL: From skip at pobox.com Sun Jul 7 01:57:17 2013 From: skip at pobox.com (Skip Montanaro) Date: Sat, 6 Jul 2013 18:57:17 -0500 Subject: [code-quality] Adding new warnings? In-Reply-To: <20130706224302.GA14944@platonas> References: <20130706224302.GA14944@platonas> Message-ID: > So is it 2-3-4, or 3-2-4? : dope slap: Thanks, Skip -------------- next part -------------- An HTML attachment was scrubbed... URL: From mbp at google.com Mon Jul 8 03:30:37 2013 From: mbp at google.com (Martin Pool) Date: Mon, 8 Jul 2013 11:30:37 +1000 Subject: [code-quality] Adding new warnings? In-Reply-To: References: Message-ID: Aside from Marius's point about the typo, you also need to make sure it is added to the @check_messages decorator. -m -------------- next part -------------- An HTML attachment was scrubbed... URL: From skip at pobox.com Mon Jul 8 04:06:44 2013 From: skip at pobox.com (Skip Montanaro) Date: Sun, 7 Jul 2013 21:06:44 -0500 Subject: [code-quality] Adding new warnings? In-Reply-To: References: Message-ID: > Aside from Marius's point about the typo, you also need to make sure it is > added to the @check_messages decorator. Thanks. I would never have guessed that. Looking in checkers/classes.py, I see 22 messages defined in the MSGS dict, but only two are mentioned, in a single use of the check_messages decorator. I must be missing something. Skip From sylvain.thenault at logilab.fr Mon Jul 8 09:22:08 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Mon, 8 Jul 2013 09:22:08 +0200 Subject: [code-quality] Adding new warnings? In-Reply-To: References: Message-ID: <20130708072208.GC2787@logilab.fr> On 07 juillet 21:06, Skip Montanaro wrote: > > Aside from Marius's point about the typo, you also need to make sure it is > > added to the @check_messages decorator. > > Thanks. I would never have guessed that. Looking in > checkers/classes.py, I see 22 messages defined in the MSGS dict, but > only two are mentioned, in a single use of the check_messages > decorator. I must be missing something. Well, the pb is that when some visit methods interact with each others, it's not always that easy to properly decorate those methods: the idea of this decorator is that when some message is disabled, you don't want to call the method at all to speed up things, rather than simply not printing out the message. Wrt the classes checkers, the pb is that visit method (visit_* / leave_*) are responsible to emit messages but also to handle a shared state that is used by other methods, hence may only be disabled if almost all messages for this checker are disabled. So, if you don't mind this shared state, the best thing to do is to have your own checker class. Also notice you may have several checker with the same name, eg 'classes'. FYI, messages ids will probably disappear at some point in favor of the new symbolic names which are much more readable and easier to remember. -- 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 Jul 9 08:36:35 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Tue, 9 Jul 2013 08:36:35 +0200 Subject: [code-quality] Flake8 News In-Reply-To: References: Message-ID: <20130709063635.GA2420@logilab.fr> Hi Ian, On 04 juillet 11:42, Ian Cordasco wrote: > First, is there any interest in developing a pylint plugin for Flake8? > If so, who's interested in working with me on it. (I doubt we will > finish it today, but I'd at least like to start it.) On my side, I can't commit to find time to work on this but I would definitly like to have pylint integrated there and I'm willing to help anyone working on it. That would probably be a good opportunity to find common stuff done in pylint and flake8: I'm pretty sure both project may learn from each other on high-level stuff such as message control, ast handling, analysis execution... Pylint has been there for a while and has imo (truly objectivly, of course ;) neat features on that side. Cheers, -- 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 afayolle.ml at free.fr Wed Jul 10 13:25:13 2013 From: afayolle.ml at free.fr (afayolle) Date: Wed, 10 Jul 2013 13:25:13 +0200 Subject: [code-quality] Flake8 News In-Reply-To: <20130709063635.GA2420@logilab.fr> References: <20130709063635.GA2420@logilab.fr> Message-ID: <51DD4499.3000208@free.fr> On 09/07/2013 08:36, Sylvain Th?nault wrote: > Hi Ian, > > On 04 juillet 11:42, Ian Cordasco wrote: >> First, is there any interest in developing a pylint plugin for Flake8? >> If so, who's interested in working with me on it. (I doubt we will >> finish it today, but I'd at least like to start it.) > On my side, I can't commit to find time to work on this but I would definitly > like to have pylint integrated there and I'm willing to help anyone working on > it. That would probably be a good opportunity to find common stuff done in pylint > and flake8: I'm pretty sure both project may learn from each other on high-level > stuff such as message control, ast handling, analysis execution... Pylint has been > there for a while and has imo (truly objectivly, of course ;) neat features on > that side. > > Cheers, Be aware of the licensing issue, though : depending on the way flake8 works (subprocess or import), the GPL license of Pylint could be an issue if the flake8 authors want to stick to MIT. Alexandre From graffatcolmingov at gmail.com Tue Jul 16 05:36:45 2013 From: graffatcolmingov at gmail.com (Ian Cordasco) Date: Mon, 15 Jul 2013 23:36:45 -0400 Subject: [code-quality] StackOverflow Tags Message-ID: Hey all, I recently acquired enough reputation on StackOverflow to create new tags. I made one[1] for Flake8 since there seemed to be a few questions on there about it. If you guys need tags for your projects and have a few questions on there that could be tagged with them, let me know. Also if you have StackOverflow accounts and see questions that aren't already tagged, please tag them. It makes searching them that much easier. Thanks, Ian [1]: http://stackoverflow.com/questions/tagged/flake8 From tarek at ziade.org Wed Jul 17 12:24:46 2013 From: tarek at ziade.org (=?ISO-8859-1?Q?Tarek=20Ziad=E9?=) Date: Wed, 17 Jul 2013 12:24:46 +0200 Subject: [code-quality] Flake8 News In-Reply-To: <51DD4499.3000208@free.fr> References: <20130709063635.GA2420@logilab.fr> <51DD4499.3000208@free.fr> Message-ID: <1374056686.24279.140661256651193.2CB0AA0E@webmail.messagingengine.com> -- Tarek Ziad? | http://ziade.org On Wed, Jul 10, 2013, at 01:25 PM, afayolle wrote: > On 09/07/2013 08:36, Sylvain Th?nault wrote: > > Hi Ian, > > > > On 04 juillet 11:42, Ian Cordasco wrote: > >> First, is there any interest in developing a pylint plugin for Flake8? > >> If so, who's interested in working with me on it. (I doubt we will > >> finish it today, but I'd at least like to start it.) > > On my side, I can't commit to find time to work on this but I would definitly > > like to have pylint integrated there and I'm willing to help anyone working on > > it. That would probably be a good opportunity to find common stuff done in pylint > > and flake8: I'm pretty sure both project may learn from each other on high-level > > stuff such as message control, ast handling, analysis execution... Pylint has been > > there for a while and has imo (truly objectivly, of course ;) neat features on > > that side. > > > > Cheers, > > Be aware of the licensing issue, though : depending on the way flake8 > works (subprocess or import), the GPL license of Pylint could be an > issue if the flake8 authors want to stick to MIT. Yeah that's an issue indeed. I would like to stick with a BSD-like licence > > Alexandre > _______________________________________________ > code-quality mailing list > code-quality at python.org > http://mail.python.org/mailman/listinfo/code-quality From tarek at ziade.org Wed Jul 17 12:25:54 2013 From: tarek at ziade.org (=?ISO-8859-1?Q?Tarek=20Ziad=E9?=) Date: Wed, 17 Jul 2013 12:25:54 +0200 Subject: [code-quality] autopep8 in flake8 Message-ID: <1374056754.24820.140661256651345.601B597E@webmail.messagingengine.com> Hey folks what would you think about an option to call autopep8 as a plugin in Flake8 ? Cheers Tarek -- Tarek Ziad? | http://ziade.org From skip at pobox.com Wed Jul 17 13:55:52 2013 From: skip at pobox.com (Skip Montanaro) Date: Wed, 17 Jul 2013 06:55:52 -0500 Subject: [code-quality] More complete Bitbucket mails? Message-ID: Is there some way to get Bitbucket to give me more information in its emails? I only have decent access at the moment to email. All I get are "approved" or "declined" mails with links, no comments the submitter might have included. Thx, Skip -------------- next part -------------- An HTML attachment was scrubbed... URL: From sylvain.thenault at logilab.fr Thu Jul 18 08:19:43 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Thu, 18 Jul 2013 08:19:43 +0200 Subject: [code-quality] copy/paste detection tool In-Reply-To: References: <20130705085508.GB3445@logilab.fr> Message-ID: <20130718061943.GC2526@logilab.fr> On 17 juillet 16:59, Lionel Barret wrote: > I didn't follow pylint progress but 2 years ago clonedigger was the clear > winner. Pylint's similarity checker being fairly simple, I'm easily trusting you on this. > But you're right I need to see if having this other tool is worth pursuing. > I'll test again, in one or two weeks to see how they compare now. > It's only a single data point but it is a beginning Yep. And it may give a few ideas to get Pylint's checker on track for a minimal cost. -- 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 Thu Jul 18 08:30:57 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Thu, 18 Jul 2013 08:30:57 +0200 Subject: [code-quality] More complete Bitbucket mails? In-Reply-To: References: Message-ID: <20130718063057.GE2526@logilab.fr> On 17 juillet 06:55, Skip Montanaro wrote: > Is there some way to get Bitbucket to give me more information in its > emails? I only have decent access at the moment to email. All I get are > "approved" or "declined" mails with links, no comments the submitter might > have included. I do receive notification about comments added to Pylint's PR but that's probably because I subscribed to the project itself, using the kindof eye on the right of the big pull request button on the right-top side. This may not be an option for you though. May be you're not "watching" the pull request ? (Look on the right of the PR's description) -- 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 lionel.barret at lbdn-consulting.com Wed Jul 17 16:59:50 2013 From: lionel.barret at lbdn-consulting.com (Lionel Barret) Date: Wed, 17 Jul 2013 16:59:50 +0200 Subject: [code-quality] copy/paste detection tool In-Reply-To: <20130705085508.GB3445@logilab.fr> References: <20130705085508.GB3445@logilab.fr> Message-ID: Hi Sylvain, Sorry for the late answer, I just moved from Europython, to a week full of meetings to holidays (almost) off the grid. I didn't follow pylint progress but 2 years ago clonedigger was the clear winner. But you're right I need to see if having this other tool is worth pursuing. I'll test again, in one or two weeks to see how they compare now. It's only a single data point but it is a beginning L. On Fri, Jul 5, 2013 at 10:55 AM, Sylvain Th?nault < sylvain.thenault at logilab.fr> wrote: > Hello Lionel, > > On 05 juillet 07:27, Lionel Barret wrote: > > My name is Lionel Barret, I attended Florent Xicluna?s Europython talk > > Tuesday and it reminded me of a clone detection tool I used in the past > (on > > a 100k sloc codebase) > > > > I talked about it with a few people (Florent Xicluna , Joe Gordon) and > they > > were interested. Florent told me it was the list for this kind of > > discussion. > > > > This tool named clonedigger (http://clonedigger.sourceforge.net/ ) > detects > > copy/pasted code or independent writing of the same classes/functions > > across a big codebase. In my last job, I used to get a daily html > report, a > > big overview of the things that have been copy/pasted/rewritten. it was > > really useful. > > > > Sadly, it is unmaintained, the last upload dates from 2011. Besides, it?s > > using old packages (like the compiler package) and likely incompatible > with > > python3 (either for running or for analyzing). > > > > I really think this kind of tool should be part of any code-quality > > toolbox, like pyflakes, pep8, etc. > > > > ( The tool itself is GPL, so no blocking there. ). > > > > I just wanted to see if anybody would be interested by an updated version > > of the tool and who could help. From the top of my mind, the next steps > > would be contacting the original author, evaluate the work to do > (obsolete > > modules used and python3 incompatibilities) and eventually refactor the > > code. > > How does it compare to Pylint's similarity checker? Basically it will > reports > you copy/pasted/rewritten code implying more than a configurable number of > lines, after some normalisation. > > -- > 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 > -- Cordialement, Lionel Barret, LBdN Consulting -------------- http://www.lbdn-consulting.com --- LinkedIn Profile : http://www.linkedin.com/in/lionelbarretdenazaris Viadeo : http://fr.viadeo.com/fr/profile/lionel.barretdenazaris --- Membre de l'Arsenal Num?rique -------------- next part -------------- An HTML attachment was scrubbed... URL: