-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ignored-modules should turn no-name-in-module-off #223
Comments
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore): Don't emit 'no-name-in-module' for ignored modules. Closes issue #223. |
Original comment by Buck Evan (BitBucket: bukzor, GitHub: @bukzor?): I'm fairly sure this has regressed. Test case:
Expected: no errors. Actual result:
|
Original comment by Buck Evan (BitBucket: bukzor, GitHub: @bukzor?): See also: pypa/pip#2048 (comment) |
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore): Maybe a pylintrc problem? I get the following:
Note that |
Original comment by Buck Evan (BitBucket: bukzor, GitHub: @bukzor?): Yes I was in a virtualenv. They replace the distutils namespace with some black-magic code that can't be statically analysed. Regardless, there should be a way to configure pylintrc to avoid lint errors using six.moves. I see that you didn't copy my example verbatim, since I have the prints there. I also strongly suspect you don't have six installed. |
Original comment by Buck Evan (BitBucket: bukzor, GitHub: @bukzor?): For modules that do black magic to add module objects to themselves at runtime (six.moves, distutils under virtualenv), no-name-in-module is equivalent to import-error. I'm fairly certain that the same argument applies as in the original post, when the import error is for a submodule of an ignored-module. |
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore): No, I don't have six installed. You can still disable import-errors using |
Original comment by Buck Evan (BitBucket: bukzor, GitHub: @bukzor?): @claudiupopa Are you available on freenode? |
Original comment by Buck Evan (BitBucket: bukzor, GitHub: @bukzor?): Disabling all import errors for the entire project isn't an agreeable workaround. Do you agree on the above assertion that import-error and no-name-in-module is equivalent for these dynamic namespaces? |
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore): Fair enough. I wasn't talking about disabling all the imports, only the ones where Pylint has troubles detecting them. My only concern is that |
Original comment by Buck Evan (BitBucket: bukzor, GitHub: @bukzor?): @claudiupopa For the sake of clarity, you are agreeing that we should expand the contract of ignored_modules to include import-errors of sub-packages? I can probably work this up this weekend. |
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore): Yes, sorry if I'm unclear. |
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore): Fix issue #223 (ignored_modules should apply to import errors too). The fix will ignore import errors caused by attempting to import any name which is or is a subpackage of a module listed in ignored_modules. |
Original comment by Ivan Smirnov (BitBucket: aldanor, GitHub: @aldanor?): @PCManticore Is setting I was getting this kind of errors:
Then I've put six and py in ignored-modules: ignored-modules=py,py.path,six,six.moves Which seemed to get rid of
Is this intended behaviour or a bug? (astroid 1.3.6, pylint 1.4.4) |
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore): Yes, ignore-modules can be used to get rid of import-error. The problem is that the fix wasn't officially released into a new pylint version, so pylint 1.4.4 still doesn't have it. It's in the repo, I'm planning to finish Python 3.5 support and some other fixes in the next two weeks and then I'll do a new 1.5 release. |
This seems to still be an issue in 1.5.6. Am I missing something? |
It works for me. Please give us a reproduction. On Sat, Jun 25, 2016, 18:18 Glenn Matthews [email protected] wrote:
|
User error on my part (duplicate ignored-modules key in .pylintrc). Looks like this kind of user error will be caught in future by Pylint due to moving to use the newer configparser module (#828) which rejects duplicates by default. Sorry for the noise! |
1.6.0 seems to have broken the use of
This is the only relevant issue I could find from the release notes; is no-name-in-module now superseded by ignored-modules? |
I cannot reproduce this, it works fine for me, can you provide more details, please? |
If you can provide the astroid version, the snippet of code for which this reproduces and how you called pylint, that would be helpful. |
|
Also happens in our travis build here https://travis-ci.org/mediachain/mediachain-client/builds/143118789 |
I figured out the problem and I will issue a release shortly. |
@PCManticore thanks so much for the quick response! |
@parkan can you check with pylint 1.6.1? It should work not as expected. |
Regression fixed 👍 |
seems to have popped back up as of 1.7.2
|
Using 1.7.4 still seeing this problem. |
Was seeing this error in from six.moves.urllib.parse import urlencode the fix was:
|
`six.moves` is a dynamically-created namespace that doesn't actually exist and therefore `pylint` can't statically analyze it. By default, `pylint` is smart enough to realize that and ignore the import errors. However, because we vendor it, the location changes to `kafka.vendor.six.moves` so `pylint` doesn't realize it should be ignored. So this explicitly ignores it. `pylint` documentation of this feature: http://pylint.pycqa.org/en/1.9/technical_reference/features.html?highlight=ignored-modules#id34 More background: * pylint-dev/pylint#1640 * pylint-dev/pylint#223
`six.moves` is a dynamically-created namespace that doesn't actually exist and therefore `pylint` can't statically analyze it. By default, `pylint` is smart enough to realize that and ignore the import errors. However, because we vendor it, the location changes to `kafka.vendor.six.moves` so `pylint` doesn't realize it should be ignored. So this explicitly ignores it. `pylint` documentation of this feature: http://pylint.pycqa.org/en/1.9/technical_reference/features.html?highlight=ignored-modules#id34 More background: * pylint-dev/pylint#1640 * pylint-dev/pylint#223
Originally reported by: Antony Lee (BitBucket: anntzer, GitHub: @anntzer?)
I believe no-name-in-module is basically the same as no-member (for modules), except that the former triggers at "from ... import" statements. Modules in the "ignore-modules" list should thus be ignored for no-name-in-module too.
The text was updated successfully, but these errors were encountered: