-
Notifications
You must be signed in to change notification settings - Fork 117
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
pylint-django calls ast_from_module_name without catching AstroidImportError #399
Comments
We managed to fix this via config: with the following
|
@jacobtylerwalls Is this related to our latest changes to that cache? |
I don't know yet. I'm planning to take a look this week. |
Not related to the cache. (I should do a little refactor to avoid the KeyError from a cache miss showing up in the tracebacks like this.) EDIT: done, see pylint-dev/astroid#2205 It's just that safe_infer() doesn't catch AstroidImportError. (Or, that pylint-django doesn't catch it in their transform.) |
pylint-django should catch and deal with AstroidImportError when calling ast_from_module_name. Should we also guard against it safe_infer()? I think it's better to guard against errors you reasonably expect, so probably not. |
Refs pylint-dev/pylint#8716
@jacobtylerwalls Hi there, I'm the one behind pylint-django, I'll look into this. Do you know what specifically changed in your |
Sorry, I'm not the reporter! But from this:
it seems like the change in the rc file made projects.models discoverable somehow. |
Yes sorry, I picked the wrong autocomplete after typing @jonholdsworth Do you know what specifically changed in your .pylintrc which made the problem go away? |
My apologies, I should have posted the diff in the first place. Hope this helps! Changes were: [MASTER]
load-plugins=pylint_django
ignore=features, migrations
+ django-settings-module=config.settings
[REPORTS]
output-format=colorized
[FORMAT]
max-line-length=120
[MESSAGES CONTROL]
disable=
RP0101,
+ RP0204,
RP0401,
RP0402,
RP0701,
RP0801,
+ W0707,
+ C0209,
+ R0022,
+ R1735,
+ W0640,
+ R1721,
+ W0236,
+ W0719,
+ C0415,
+ R1729,
+ R1732,
+ W0236,
+ R1724,
+ R1720,
+ W1514,
+ R1720,
attribute-defined-outside-init,
fixme,
invalid-name,
locally-disabled,
- locally-enabled,
missing-docstring,
- no-self-use,
- redefined-variable-type,
similarities,
too-few-public-methods,
too-many-ancestors,
too-many-lines,
no-member,
arguments-differ,
- bad-continuation,
unused-argument,
too-many-arguments,
too-many-instance-attributes,
line-too-long,
unnecessary-pass,
cyclic-import,
[TYPECHECK]
generated-members=_meta,object,objects.request,kwargs,[a-z]+_set,DoesNotExist
[DESIGN]
max-parents=13
|
Bug description
Possibly related to: pylint-dev/pylint#8554
Pylint consistently crashes across all versions including latest, on one particular file, throwing 'AstroidError' mentioning 'inference_tip.py' and '_inference_tip_cached'.
Configuration
No response
Command used
Pylint output
I'm finding out if I'm allowed to post the actual code.
The error is:
Expected behavior
Pylint would just warn about code findings and not crash.
Pylint version
pylint 2.17.4 (got same result in 2.17.5 which I now don't seem to be able to install)
astroid 2.15.5
Python 3.10.11 (main, May 23 2023, 13:58:30) [GCC 10.2.1 20210110]
OS / Environment
Docker
Debian GNU/Linux 11
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: