-
-
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
False positive unspecified-encoding
when passing encoding as kwarg
#8719
Comments
I briefly reviewed the code involved and it seems there are two places where a fix could be applied. Either in the checker itself or in Modifying |
Ok, it seems the actual problem is being able to get the kwargs from the function call. The astroid node only contains the name of the variable used (in the example above |
In order to get the actual values we'll have to use inference. I think we need to make sure we use inference only if absolutely necessary because of the performance impact and the fact that using a dict to pass arguments to |
False positives were being generated when passing arguments as kwargs to open() calls. This has been resolved by using inference inside `get_argument_from_call`. This is an opt-in function, for inference to be used, `infer=True` must be specified when calling `get_argument_from_call`. This ensures that the rest of the codebase does not suffer a performance hit unnecessarily. Closes pylint-dev#8719
False positives were being generated when passing arguments as kwargs to open() calls. This has been resolved by using inference inside `get_argument_from_call`. This is an opt-in function, for inference to be used, `infer=True` must be specified when calling `get_argument_from_call`. This ensures that the rest of the codebase does not suffer a performance hit unnecessarily. Closes pylint-dev#8719
Ah, inference is a nice thing, learnt something new. I made #8728 which puts it to the test. Let me know if I can do anything else to be of help. |
False positives were being generated when passing arguments as kwargs to open() calls. This has been resolved by using inference inside `get_argument_from_call`. This is an opt-in function, for inference to be used, `infer=True` must be specified when calling `get_argument_from_call`. This ensures that the rest of the codebase does not suffer a performance hit unnecessarily. Closes pylint-dev#8719
False positives were being generated when passing arguments as kwargs to open() calls. This has been resolved by using inference inside `get_argument_from_call`. This is an opt-in function, for inference to be used, `infer=True` must be specified when calling `get_argument_from_call`. This ensures that the rest of the codebase does not suffer a performance hit unnecessarily. Closes pylint-dev#8719
False positives were being generated when passing arguments as kwargs to open() and other IO calls. This has been fixed by using inference whenever the argument was not found through previously existing methods (position and keyword) and kwargs are present. The confidence levels for both methods with/without inference have also been updated. Closes pylint-dev#8719
False positives were being generated when passing arguments as kwargs to open() and other IO calls. This has been fixed by using inference whenever the argument was not found through previously existing methods (position and keyword) and kwargs are present. The confidence levels for both methods with/without inference have also been updated. Closes pylint-dev#8719
False positives were being generated when passing arguments as kwargs to open() and other IO calls. This has been fixed by using inference whenever the argument was not found through previously existing methods (position and keyword) and kwargs are present. The confidence levels for both methods with/without inference have also been updated. Closes pylint-dev#8719
False positives were being generated when passing arguments as kwargs to open() and other IO calls. This has been fixed by using inference whenever the argument was not found through previously existing methods (position and keyword) and kwargs are present. The confidence levels for both methods with/without inference have also been updated. Closes pylint-dev#8719
False positives were being generated when passing arguments as kwargs to open() and other IO calls. This has been fixed by using inference whenever the argument was not found through previously existing methods (position and keyword) and kwargs are present. The confidence levels for both methods with/without inference have also been updated. Closes pylint-dev#8719
False positives were being generated when passing arguments as kwargs to open() and other IO calls. This has been fixed by using inference whenever the argument was not found through previously existing methods (position and keyword) and kwargs are present. The confidence levels for both methods with/without inference have also been updated. Closes #8719
False positives were being generated when passing arguments as kwargs to open() and other IO calls. This has been fixed by using inference whenever the argument was not found through previously existing methods (position and keyword) and kwargs are present. The confidence levels for both methods with/without inference have also been updated. Closes #8719 (cherry picked from commit 6fca823)
False positives were being generated when passing arguments as kwargs to open() and other IO calls. This has been fixed by using inference whenever the argument was not found through previously existing methods (position and keyword) and kwargs are present. The confidence levels for both methods with/without inference have also been updated. Closes #8719 (cherry picked from commit 6fca823)
Bug description
When passing an
encoding
as a kwarg toopen
, I getunspecified-encoding
thrown.Configuration
No response
Command used
Pylint output
************* Module quick_play a.py:2:5: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
Expected behavior
I think it would be cool if
pylint
wouldn't throwunspecified-encoding
in this case.Pylint version
OS / Environment
macOS Monterey v12.6
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: