From njn2118 at columbia.edu Fri Mar 6 18:21:08 2015 From: njn2118 at columbia.edu (Nik Nyby) Date: Fri, 06 Mar 2015 12:21:08 -0500 Subject: [code-quality] flake8 should check for unused multiple assignments Message-ID: <54F9E204.4060508@columbia.edu> Hi, flake8 2.3.0 warns me when a variable is never actually used, e.g.: a = 1 It doesn't seem to check for unused multiple assigments, e.g.: obj, created = RefutationResponse.objects.update_or_create(...) -- Nik Nyby Programmer Columbia Center for New Media Teaching and Learning nnyby at columbia.edu | (212) 854-7076 From graffatcolmingov at gmail.com Fri Mar 6 21:28:34 2015 From: graffatcolmingov at gmail.com (Ian Cordasco) Date: Fri, 6 Mar 2015 14:28:34 -0600 Subject: [code-quality] flake8 should check for unused multiple assignments In-Reply-To: <54F9E204.4060508@columbia.edu> References: <54F9E204.4060508@columbia.edu> Message-ID: On Fri, Mar 6, 2015 at 11:21 AM, Nik Nyby wrote: > Hi, > flake8 2.3.0 warns me when a variable is never actually used, e.g.: > a = 1 > > It doesn't seem to check for unused multiple assigments, e.g.: > obj, created = RefutationResponse.objects.update_or_create(...) > > -- > Nik Nyby > Programmer > Columbia Center for New Media Teaching and Learning > nnyby at columbia.edu | (212) 854-7076 I don't see the same thing Nik. With the following file saved as foo.py: def foo(): a = 1 def bar(): b, c = 2, 3 I get these results: $ flake8 foo.py foo.py:2:5: F841 local variable 'a' is assigned to but never used a = 1 ^ foo.py:6:5: F841 local variable 'b' is assigned to but never used b, c = 2, 3 ^ foo.py:6:8: F841 local variable 'c' is assigned to but never used b, c = 2, 3 ^ $ flake8 --version 2.3.0 (pep8: 1.6.2, pyflakes: 0.8.1, mccabe: 0.3) CPython 2.7.9 on Darwin If instead `a = 1` is a global definition, flake8 (actually pyflakes) chooses not to report it as it could be a constant defined to be exported as part of that module's API. Cheers, Ian From michael.forbes+python at gmail.com Sun Mar 8 05:23:04 2015 From: michael.forbes+python at gmail.com (Michael McNeil Forbes) Date: Sat, 7 Mar 2015 20:23:04 -0800 Subject: [code-quality] No output when running from nosetests and jobs != 1 Message-ID: Dear Flake8ers, I am trying to run flake8 programmatically in a Test class as follows: import flake8.main import nose.tools as nt class TestCodeFormat(object): def setUp(self): self.files = find_py_files(os.path.dirname(mmfutils.__file__)) def test_flake8_conformance(self): # Pass in the files here so that config setup.cfg file gets found style_guide = flake8.main.get_style_guide(paths=self.files) result = style_guide.check_files() nt.eq_(result.total_errors, 0, "Found {0} code style errors (and warnings)." .format(result.total_errors)) The problem I am having is that there is no output when jobs > 1. This is probably something to do with stdout flushing and multiprocessing when running under nosetests. Is there any solution that will allow parallel processing with displayed output. (I could change the error message to use result.messages or something, but don't see an easy way of properly formatting output with filenames and lines numbers etc.) Thanks, Michael. P.S. 1) Please let me know if I should file an issue. I thought this might be resolved by #21 but even using the latest sources does not help. 2) flake8 and python setup.py flake8 both work fine, so another solution would be if I can somehow trigger this from "python setup.py nosetests" or "python setup.py test" but it seems to be something of a challenge to customize setup.py commands. 3) Setting nose's nocapture=1 also works, but the errors then are not deferred until the end of the tests and so can get lost. From michael.forbes+python at gmail.com Sun Mar 8 06:16:18 2015 From: michael.forbes+python at gmail.com (Michael McNeil Forbes) Date: Sat, 7 Mar 2015 21:16:18 -0800 Subject: [code-quality] Locally increase max-complexity? Message-ID: Following the NIST recommendation: "For each module, either limit cyclomatic complexity to [the agreed-upon limit] or provide a written explanation of why the limit was exceeded." Is there a way of providing a "written explanation" for functions with one of # pragma: max-complexity 15 # flake8: max-complexity 15 etc.? Michael. From graffatcolmingov at gmail.com Sun Mar 8 15:01:09 2015 From: graffatcolmingov at gmail.com (Ian Cordasco) Date: Sun, 8 Mar 2015 09:01:09 -0500 Subject: [code-quality] Locally increase max-complexity? In-Reply-To: References: Message-ID: On Sat, Mar 7, 2015 at 11:16 PM, Michael McNeil Forbes wrote: > Following the NIST recommendation: > > "For each module, either limit cyclomatic complexity to [the agreed-upon limit] or provide a written explanation of why the limit was exceeded." > > Is there a way of providing a "written explanation" for functions with one of > > # pragma: max-complexity 15 > # flake8: max-complexity 15 > > etc.? > > Michael. > _______________________________________________ > code-quality mailing list > code-quality at python.org > https://mail.python.org/mailman/listinfo/code-quality No there isn't. From graffatcolmingov at gmail.com Sun Mar 8 15:37:09 2015 From: graffatcolmingov at gmail.com (Ian Cordasco) Date: Sun, 8 Mar 2015 09:37:09 -0500 Subject: [code-quality] No output when running from nosetests and jobs != 1 In-Reply-To: References: Message-ID: On Sat, Mar 7, 2015 at 10:23 PM, Michael McNeil Forbes wrote: > Dear Flake8ers, > > I am trying to run flake8 programmatically in a Test class as follows: > > import flake8.main > import nose.tools as nt > > class TestCodeFormat(object): > def setUp(self): > self.files = find_py_files(os.path.dirname(mmfutils.__file__)) > > def test_flake8_conformance(self): > # Pass in the files here so that config setup.cfg file gets found > style_guide = flake8.main.get_style_guide(paths=self.files) > result = style_guide.check_files() > nt.eq_(result.total_errors, 0, > "Found {0} code style errors (and warnings)." > .format(result.total_errors)) > The code looks vaguely correct. I don't remember the behaviour of using get_style_guide without providing a list of default config files though (I doubt it affects this though). > The problem I am having is that there is no output when jobs > 1. This is probably something to do with stdout flushing and multiprocessing when running under nosetests. > > Is there any solution that will allow parallel processing with displayed output. (I could change the error message to use result.messages or something, but don't see an easy way of properly formatting output with filenames and lines numbers etc.) nose may not support this usecase. > Thanks, > Michael. > > P.S. > > 1) Please let me know if I should file an issue. I thought this might be resolved by #21 but even using the latest sources does not help. > > 2) flake8 and python setup.py flake8 both work fine, so another solution would be if I can somehow trigger this from "python setup.py nosetests" or "python setup.py test" but it seems to be something of a challenge to customize setup.py commands. > > 3) Setting nose's nocapture=1 also works, but the errors then are not deferred until the end of the tests and so can get lost. So if you do `python setup.py tests -s` then the errors will all be printed, correct? I suspect this is something to do with how flake8 defers printing and how nosetests expects to receive data on stdout. I'm not sure flake8 wants to support nose like this. From pcmanticore at gmail.com Wed Mar 11 14:14:03 2015 From: pcmanticore at gmail.com (Claudiu Popa) Date: Wed, 11 Mar 2015 15:14:03 +0200 Subject: [code-quality] [ANN] Pylint 1.4.2 / Astroid 1.3.5 released Message-ID: Hello, I'm happy to announce the release of Pylint 1.4.2 and astroid 1.3.5. The following changes were included in these releases: For pylint: * Don't require a docstring for empty modules. Closes issue #261. * Fix a false positive with `too-few-format-args` string warning, emitted when the string format contained a normal positional argument ('{0}'), mixed with a positional argument which did an attribute access ('{0.__class__}'). Closes issue #463. * Take in account all the methods from the ancestors when checking for too-few-public-methods. Closes issue #471. * Catch enchant errors and emit 'invalid-characters-in-docstring' when checking for spelling errors. Closes issue #469. * Use all the inferred statements for the super-init-not-called check. Closes issue #389. * Add a new warning, 'unichr-builtin', emitted by the Python 3 porting checker, when the unichr builtin is found. Closes issue #472. * Add a new warning, 'intern-builtin', emitted by the Python 3 porting checker, when the intern builtin is found. Closes issue #473. * Add support for editable installations. * The HTML output accepts the `--msg-template` option. Patch by Dan Goldsmith. * Add 'map-builtin-not-iterating' (replacing 'implicit-map-evaluation'), 'zip-builtin-not-iterating', 'range-builtin-not-iterating', and 'filter-builtin-not-iterating' which are emitted by `--py3k` when the appropriate built-in is not used in an iterating context (semantics taken from 2to3). * Add a new warning, 'unidiomatic-typecheck', emitted when an explicit typecheck uses type() instead of isinstance(). For example, `type(x) == Y` instead of `isinstance(x, Y)`. Patch by Chris Rebert. Closes issue #299. * Add support for combining the Python 3 checker mode with the --jobs flag (--py3k and --jobs). Closes issue #467. * Add a new warning for the Python 3 porting checker, 'using-cmp-argument', emitted when the `cmp` argument for the `list.sort` or `sorted builtin` is encountered. * Make the --py3k flag commutative with the -E flag. Also, this patch fixes the leaks of error messages from the Python 3 checker when the errors mode was activated. Closes issue #437. For astroid: * Add the ability to optimize small ast subtrees, with the first use in the optimization of multiple BinOp nodes. This removes recursivity in the rebuilder when dealing with a lot of small strings joined by the addition operator. Closes issue #59. * Obtain the methods for the nose brain tip through an unittest.TestCase instance. Closes Pylint issue #457. * Fix a crash which occurred when a class was the ancestor of itself. Closes issue #78. * Improve the scope_lookup method for Classes regarding qualified objects, with an attribute name exactly as one provided in the class itself. For example, a class containing an attribute 'first', which was also an import and which had, as a base, a qualified name or a Gettattr node, in the form 'module.first', then Pylint would have inferred the `first` name as the function from the Class, not the import. Closes Pylint issue #466. * Implement the assigned_stmts operation for Starred nodes, which was omitted when support for Python 3 was added in astroid. Closes issue #36. If you find any bugs, don't hesitate to open a new issue on our issue tracker. Enjoy! From danihgit at gmail.com Thu Mar 12 21:51:50 2015 From: danihgit at gmail.com (Dani Hodovic) Date: Thu, 12 Mar 2015 21:51:50 +0100 Subject: [code-quality] Pylint and sys path Message-ID: I have a very large project with deeply nested hierarchies. To find the root directory I use a source root walker and append the root directory to sys.path. This way, I can easily import things in the project relative to the root directory. The problem is that pylint doesn't detect this, even though I have a method which appends the path imported in the files where the path is used. So all my imports are marked as F0401 : Unable to import. Is there any way to avoid this error message by getting pylint to understand sys.path? The __init__.py that is imported in files that need imports relative to the root directory: import os import sys def find_repo_rootdir(): def __check_parent(topdir): for _, _, files in os.walk(topdir): if '.THIS_IS_ROOT' in files: return topdir else: next_ = topdir.rsplit("/", 1) if len(next_) == 2: return __check_parent(next_[0]) else: return None return __check_parent(os.path.abspath(os.path.dirname(__file__))) repo_root = find_repo_rootdir() if repo_root is not None and repo_root not in sys.path: sys.path.append(repo_root) -------------- next part -------------- An HTML attachment was scrubbed... URL: From graffatcolmingov at gmail.com Thu Mar 12 22:00:48 2015 From: graffatcolmingov at gmail.com (Ian Cordasco) Date: Thu, 12 Mar 2015 16:00:48 -0500 Subject: [code-quality] Pylint and sys path In-Reply-To: References: Message-ID: On Thu, Mar 12, 2015 at 3:51 PM, Dani Hodovic wrote: > I have a very large project with deeply nested hierarchies. To find the > root directory I use a source root walker and append the root directory to > sys.path. This way, I can easily import things in the project relative to > the root directory. > The problem is that pylint doesn't detect this, even though I have a > method which appends the path imported in the files where the path is used. > So all my imports are marked as F0401 > : Unable to import. > > Is there any way to avoid this error message by getting pylint to > understand sys.path? > > The __init__.py that is imported in files that need imports relative to > the root directory: > > import os > import sys > > > def find_repo_rootdir(): > def __check_parent(topdir): > for _, _, files in os.walk(topdir): > if '.THIS_IS_ROOT' in files: > return topdir > else: > next_ = topdir.rsplit("/", 1) > if len(next_) == 2: > return __check_parent(next_[0]) > else: > return None > return __check_parent(os.path.abspath(os.path.dirname(__file__))) > > repo_root = find_repo_rootdir() > if repo_root is not None and repo_root not in sys.path: > sys.path.append(repo_root) > > > _______________________________________________ > code-quality mailing list > code-quality at python.org > https://mail.python.org/mailman/listinfo/code-quality > > Hi Dani, Please subscribe to the list so the rest of your posts will not need to be moderated. Thanks, Ian -------------- next part -------------- An HTML attachment was scrubbed... URL: From me at the-compiler.org Thu Mar 12 22:08:04 2015 From: me at the-compiler.org (Florian Bruhin) Date: Thu, 12 Mar 2015 22:08:04 +0100 Subject: [code-quality] Pylint and sys path In-Reply-To: References: Message-ID: <20150312210804.GP11094@tonks> * Dani Hodovic [2015-03-12 21:51:50 +0100]: > I have a very large project with deeply nested hierarchies. To find the > root directory I use a source root walker and append the root directory to > sys.path. This way, I can easily import things in the project relative to > the root directory. I don't know how to teach pylint to understand this - but if I understood correctly, shouldn't python packages to that anyways? e.g. if you have a tree like this: myproject/ __init__.py utils/ __init__.py foo.py bar.py modules/ __init__.py eggs.py bacon.py spam.py And start your project correctly via `python -m myproject`, you should be able to do something like `from myproject.utils.foo import fish` in e.g. myproject/modules/eggs.py just fine. If that is what you're attempting, I recommend reading http://bit.ly/pypackages. If not and I misunderstood something, sorry! :) Florian -- http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP) GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc I love long mails! | http://email.is-not-s.ms/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From ned at nedbatchelder.com Thu Mar 12 22:13:30 2015 From: ned at nedbatchelder.com (Ned Batchelder) Date: Thu, 12 Mar 2015 17:13:30 -0400 Subject: [code-quality] Pylint and sys path In-Reply-To: References: Message-ID: <5502017A.2060305@nedbatchelder.com> On 3/12/15 4:51 PM, Dani Hodovic wrote: > I have a very large project with deeply nested hierarchies. To find > the root directory I use a source root walker and append the root > directory to sys.path. This way, I can easily import things in the > project relative to the root directory. > The problem is that pylint doesn't detect this, even though I have a > method which appends the path imported in the files where the path is > used. So all my imports are marked as F0401 > : Unable to import. If you want to import everything relative to the root directory, why not set PYTHONPATH to point to the root directory, without sys.path manipulations? Then pylint will run the same way, and will find all of your imports. --Ned. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ianlee1521 at gmail.com Wed Mar 18 06:17:27 2015 From: ianlee1521 at gmail.com (Ian Lee) Date: Tue, 17 Mar 2015 22:17:27 -0700 Subject: [code-quality] pep8 / flake8 config files. Message-ID: Hi All -- I just pushed a commit [1] to the pep8 repo that contains what I hope is a fix for the issues with pep8 / flake8 config files that arose from the way that pep8 #368 was handled, e.g. [2] (I think, I'm getting 500 errors when I try to few issues on the flake8 repo, but I'm hoping that is transient). This led to flake8 2.4.0 pinning to pep8 < 1.6 in it's latest release [3]. I'm hoping that folks can test out there configurations and ways of running flake8 / pep8 with various configuration files (user and project specific configs) and please report any issues to me. Thanks in advance! [1] https://github.com/jcrocholl/pep8/commit/435d1cbf995a659a82d1d4b42d25e3459556ef21 [2] https://gitlab.com/pycqa/flake8/issues/35 [3] https://pypi.python.org/pypi/flake8/2.4.0 ~ Ian Lee -------------- next part -------------- An HTML attachment was scrubbed... URL: From graffatcolmingov at gmail.com Wed Mar 18 06:32:31 2015 From: graffatcolmingov at gmail.com (Ian Cordasco) Date: Wed, 18 Mar 2015 00:32:31 -0500 Subject: [code-quality] pep8 / flake8 config files. In-Reply-To: References: Message-ID: On Wed, Mar 18, 2015 at 12:17 AM, Ian Lee wrote: > Hi All -- > > I just pushed a commit [1] to the pep8 repo that contains what I hope is a > fix for the issues with pep8 / flake8 config files that arose from the way > that pep8 #368 was handled, e.g. [2] (I think, I'm getting 500 errors when > I try to few issues on the flake8 repo, but I'm hoping that is transient). > > This led to flake8 2.4.0 pinning to pep8 < 1.6 in it's latest release [3]. > > I'm hoping that folks can test out there configurations and ways of > running flake8 / pep8 with various configuration files (user and project > specific configs) and please report any issues to me. > > Thanks in advance! > > [1] > https://github.com/jcrocholl/pep8/commit/435d1cbf995a659a82d1d4b42d25e3459556ef21 > [2] https://gitlab.com/pycqa/flake8/issues/35 > [3] https://pypi.python.org/pypi/flake8/2.4.0 > > ~ Ian Lee > > _______________________________________________ > code-quality mailing list > code-quality at python.org > https://mail.python.org/mailman/listinfo/code-quality > > Hey Ian, Thanks for working on this. Looking at https://github.com/jcrocholl/pep8/compare/1.5.7...435d1cbf995a659a82d1d4b42d25e3459556ef21 it's not identical to 1.5.7. By default options.config_file was previously None. So the USER_CONFIG wasn't checked/loaded first ( https://github.com/jcrocholl/pep8/compare/1.5.7...435d1cbf995a659a82d1d4b42d25e3459556ef21#diff-429d64b260de27fe3688921a1592b3f6R1987). Am I missing logic where options.config was changed to default to USER_CONFIG? (I know the binding was previously called user_conf, but I'm not entirely convinced this is doing the same thing in effect.) Cheers, Ian -------------- next part -------------- An HTML attachment was scrubbed... URL: From ianlee1521 at gmail.com Wed Mar 18 06:50:16 2015 From: ianlee1521 at gmail.com (Ian Lee) Date: Tue, 17 Mar 2015 22:50:16 -0700 Subject: [code-quality] pep8 / flake8 config files. In-Reply-To: References: Message-ID: Yes, it wasn't an exact reversion of just that change (though perhaps that would be a better way to go about it). The logic that you're looking for (if I'm reading this right) is that last bit of the diff you posted ( https://github.com/jcrocholl/pep8/compare/1.5.7...435d1cbf995a659a82d1d4b42d25e3459556ef21#diff-429d64b260de27fe3688921a1592b3f6R1987) from lines (numbered off master) 2041 - 2101. Namely, the former assignment of ``pep8style = StyleGuide(parse_argv=True, config_file=True)`` used to take the config_file=True argument and then ``process_options(...)`` would use that to set the config_file to DEFAULT_CONFIG (now named USER_CONFIG in master). Does that clear up the piece that you were missing? ~ Ian Lee On Tue, Mar 17, 2015 at 10:32 PM, Ian Cordasco wrote: > > > On Wed, Mar 18, 2015 at 12:17 AM, Ian Lee wrote: > >> Hi All -- >> >> I just pushed a commit [1] to the pep8 repo that contains what I hope is >> a fix for the issues with pep8 / flake8 config files that arose from the >> way that pep8 #368 was handled, e.g. [2] (I think, I'm getting 500 errors >> when I try to few issues on the flake8 repo, but I'm hoping that is >> transient). >> >> This led to flake8 2.4.0 pinning to pep8 < 1.6 in it's latest release [3]. >> >> I'm hoping that folks can test out there configurations and ways of >> running flake8 / pep8 with various configuration files (user and project >> specific configs) and please report any issues to me. >> >> Thanks in advance! >> >> [1] >> https://github.com/jcrocholl/pep8/commit/435d1cbf995a659a82d1d4b42d25e3459556ef21 >> [2] https://gitlab.com/pycqa/flake8/issues/35 >> [3] https://pypi.python.org/pypi/flake8/2.4.0 >> >> ~ Ian Lee >> >> _______________________________________________ >> code-quality mailing list >> code-quality at python.org >> https://mail.python.org/mailman/listinfo/code-quality >> >> > Hey Ian, > > Thanks for working on this. Looking at > https://github.com/jcrocholl/pep8/compare/1.5.7...435d1cbf995a659a82d1d4b42d25e3459556ef21 > it's not identical to 1.5.7. By default options.config_file was previously > None. So the USER_CONFIG wasn't checked/loaded first ( > https://github.com/jcrocholl/pep8/compare/1.5.7...435d1cbf995a659a82d1d4b42d25e3459556ef21#diff-429d64b260de27fe3688921a1592b3f6R1987). > Am I missing logic where options.config was changed to default to > USER_CONFIG? (I know the binding was previously called user_conf, but I'm > not entirely convinced this is doing the same thing in effect.) > > Cheers, > Ian > -------------- next part -------------- An HTML attachment was scrubbed... URL: From graffatcolmingov at gmail.com Wed Mar 18 07:00:11 2015 From: graffatcolmingov at gmail.com (Ian Cordasco) Date: Wed, 18 Mar 2015 01:00:11 -0500 Subject: [code-quality] pep8 / flake8 config files. In-Reply-To: References: Message-ID: On Wed, Mar 18, 2015 at 12:50 AM, Ian Lee wrote: > Yes, it wasn't an exact reversion of just that change (though perhaps that > would be a better way to go about it). > > The logic that you're looking for (if I'm reading this right) is that last > bit of the diff you posted ( > https://github.com/jcrocholl/pep8/compare/1.5.7...435d1cbf995a659a82d1d4b42d25e3459556ef21#diff-429d64b260de27fe3688921a1592b3f6R1987) > from lines (numbered off master) 2041 - 2101. Namely, the former assignment > of ``pep8style = StyleGuide(parse_argv=True, config_file=True)`` used to > take the config_file=True argument and then ``process_options(...)`` would > use that to set the config_file to DEFAULT_CONFIG (now named USER_CONFIG in > master). > > Does that clear up the piece that you were missing? > > > ~ Ian Lee > > On Tue, Mar 17, 2015 at 10:32 PM, Ian Cordasco > wrote: > >> >> >> On Wed, Mar 18, 2015 at 12:17 AM, Ian Lee wrote: >> >>> Hi All -- >>> >>> I just pushed a commit [1] to the pep8 repo that contains what I hope is >>> a fix for the issues with pep8 / flake8 config files that arose from the >>> way that pep8 #368 was handled, e.g. [2] (I think, I'm getting 500 errors >>> when I try to few issues on the flake8 repo, but I'm hoping that is >>> transient). >>> >>> This led to flake8 2.4.0 pinning to pep8 < 1.6 in it's latest release >>> [3]. >>> >>> I'm hoping that folks can test out there configurations and ways of >>> running flake8 / pep8 with various configuration files (user and project >>> specific configs) and please report any issues to me. >>> >>> Thanks in advance! >>> >>> [1] >>> https://github.com/jcrocholl/pep8/commit/435d1cbf995a659a82d1d4b42d25e3459556ef21 >>> [2] https://gitlab.com/pycqa/flake8/issues/35 >>> [3] https://pypi.python.org/pypi/flake8/2.4.0 >>> >>> ~ Ian Lee >>> >>> _______________________________________________ >>> code-quality mailing list >>> code-quality at python.org >>> https://mail.python.org/mailman/listinfo/code-quality >>> >>> >> Hey Ian, >> >> Thanks for working on this. Looking at >> https://github.com/jcrocholl/pep8/compare/1.5.7...435d1cbf995a659a82d1d4b42d25e3459556ef21 >> it's not identical to 1.5.7. By default options.config_file was previously >> None. So the USER_CONFIG wasn't checked/loaded first ( >> https://github.com/jcrocholl/pep8/compare/1.5.7...435d1cbf995a659a82d1d4b42d25e3459556ef21#diff-429d64b260de27fe3688921a1592b3f6R1987). >> Am I missing logic where options.config was changed to default to >> USER_CONFIG? (I know the binding was previously called user_conf, but I'm >> not entirely convinced this is doing the same thing in effect.) >> >> Cheers, >> Ian >> > > So it looks like the SyleGuide's API has changed in a fairly significant way then, no? Users aren't expected to pass `config_file=True` now? This means the next release of flake8 will either need to specify a higher minimum version or conditionally handle how it creates the StyleGuide based on the version of pep8. It's late here and I'm tired though, so I could be wrong, but it seems like this is somewhat backwards incompatible. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ianlee1521 at gmail.com Wed Mar 18 07:11:03 2015 From: ianlee1521 at gmail.com (Ian Lee) Date: Tue, 17 Mar 2015 23:11:03 -0700 Subject: [code-quality] pep8 / flake8 config files. In-Reply-To: References: Message-ID: Not that early here either, so I could also be confusing myself, but I don't think this is an issue. flake8 uses the flake8.engine.get_style_guide() function [1] which takes in ``config_file=DEFAULT_CONFIG`` in just about every place it's called (e.g. [2]) which in pep8 gets passed explicitly to ``process_options()``[3] with the value that is set in ``pep8.StyleGuide.__init__()`` [4] [1] https://gitlab.com/pycqa/flake8/blob/master/flake8/engine.py#L107 [2] https://gitlab.com/pycqa/flake8/blob/master/flake8/main.py#L24 [3] https://github.com/jcrocholl/pep8/blob/master/pep8.py#L1787-L1788 [4] https://github.com/jcrocholl/pep8/blob/master/pep8.py#L1782 ~ Ian Lee On Tue, Mar 17, 2015 at 11:00 PM, Ian Cordasco wrote: > > > On Wed, Mar 18, 2015 at 12:50 AM, Ian Lee wrote: > >> Yes, it wasn't an exact reversion of just that change (though perhaps >> that would be a better way to go about it). >> >> The logic that you're looking for (if I'm reading this right) is that >> last bit of the diff you posted ( >> https://github.com/jcrocholl/pep8/compare/1.5.7...435d1cbf995a659a82d1d4b42d25e3459556ef21#diff-429d64b260de27fe3688921a1592b3f6R1987) >> from lines (numbered off master) 2041 - 2101. Namely, the former assignment >> of ``pep8style = StyleGuide(parse_argv=True, config_file=True)`` used to >> take the config_file=True argument and then ``process_options(...)`` would >> use that to set the config_file to DEFAULT_CONFIG (now named USER_CONFIG in >> master). >> >> Does that clear up the piece that you were missing? >> >> >> ~ Ian Lee >> >> On Tue, Mar 17, 2015 at 10:32 PM, Ian Cordasco < >> graffatcolmingov at gmail.com> wrote: >> >>> >>> >>> On Wed, Mar 18, 2015 at 12:17 AM, Ian Lee wrote: >>> >>>> Hi All -- >>>> >>>> I just pushed a commit [1] to the pep8 repo that contains what I hope >>>> is a fix for the issues with pep8 / flake8 config files that arose from the >>>> way that pep8 #368 was handled, e.g. [2] (I think, I'm getting 500 errors >>>> when I try to few issues on the flake8 repo, but I'm hoping that is >>>> transient). >>>> >>>> This led to flake8 2.4.0 pinning to pep8 < 1.6 in it's latest release >>>> [3]. >>>> >>>> I'm hoping that folks can test out there configurations and ways of >>>> running flake8 / pep8 with various configuration files (user and project >>>> specific configs) and please report any issues to me. >>>> >>>> Thanks in advance! >>>> >>>> [1] >>>> https://github.com/jcrocholl/pep8/commit/435d1cbf995a659a82d1d4b42d25e3459556ef21 >>>> [2] https://gitlab.com/pycqa/flake8/issues/35 >>>> [3] https://pypi.python.org/pypi/flake8/2.4.0 >>>> >>>> ~ Ian Lee >>>> >>>> _______________________________________________ >>>> code-quality mailing list >>>> code-quality at python.org >>>> https://mail.python.org/mailman/listinfo/code-quality >>>> >>>> >>> Hey Ian, >>> >>> Thanks for working on this. Looking at >>> https://github.com/jcrocholl/pep8/compare/1.5.7...435d1cbf995a659a82d1d4b42d25e3459556ef21 >>> it's not identical to 1.5.7. By default options.config_file was previously >>> None. So the USER_CONFIG wasn't checked/loaded first ( >>> https://github.com/jcrocholl/pep8/compare/1.5.7...435d1cbf995a659a82d1d4b42d25e3459556ef21#diff-429d64b260de27fe3688921a1592b3f6R1987). >>> Am I missing logic where options.config was changed to default to >>> USER_CONFIG? (I know the binding was previously called user_conf, but I'm >>> not entirely convinced this is doing the same thing in effect.) >>> >>> Cheers, >>> Ian >>> >> >> > So it looks like the SyleGuide's API has changed in a fairly significant > way then, no? Users aren't expected to pass `config_file=True` now? This > means the next release of flake8 will either need to specify a higher > minimum version or conditionally handle how it creates the StyleGuide based > on the version of pep8. It's late here and I'm tired though, so I could be > wrong, but it seems like this is somewhat backwards incompatible. > -------------- next part -------------- An HTML attachment was scrubbed... URL: