You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I very much like unspecified-encoding for enforcing the encoding parameter when using open, however it does not seem to work with the more modern way of writing to files through pathlib, which also has an encoding argument.
When running the following command, only the open call without encoding will be detected by pylint.
$ pylint ./test_pylint_pathlib.py --disable missing-module-docstring --disable missing-function-docstring
************* Module test_pylint_pathlib
test_pylint_pathlib.py:5:9: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
------------------------------------------------------------------
Your code has been rated at 8.33/10 (previous run: 8.33/10, +0.00)
Basically something like this as output of the code above:
$ pylint ./test_pylint_pathlib.py --disable missing-module-docstring --disable missing-function-docstring
************* Module test_pylint_pathlib
test_pylint_pathlib.py:5:9: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test_pylint_pathlib.py:10:28: W1514: Using read_text without explicitly specifying an encoding (unspecified-encoding)
------------------------------------------------------------------
Your code has been rated at 8.33/10 (previous run: 8.33/10, +0.00)
Additional context
No response
The text was updated successfully, but these errors were encountered:
The ``unspecified-encoding`` checker now also checks calls to ``pathlib.Path().read_text()``
and ``pathlib.Path().write_text()``
This closespylint-dev#4945
Current problem
I very much like
unspecified-encoding
for enforcing the encoding parameter when usingopen
, however it does not seem to work with the more modern way of writing to files throughpathlib
, which also has an encoding argument.Here is an example
When running the following command, only the
open
call without encoding will be detected by pylint.Desired solution
I want calls to
pathlib.Path.write_text()
/pathlib.Path.read_text()
to also be detected by pylint.Basically something like this as output of the code above:
Additional context
No response
The text was updated successfully, but these errors were encountered: