-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Request: flake8-encodings #3278
Comments
Python 3.15! |
Should this be detected when enabling |
I would like to bump this request! Currently when you have some code such as: import pathlib
with open(pathlib.Path("path/to/file.txt")) as f:
print(f) Ruff will raise 2 issues:
If you first solve the second issue, the first issue will be gone, which led me to believe that Would the Ruff team be open to include the flake8-encodings ruleset? And do you think this could be a good first issue? If so I would be willing to pick it up (it would mean it will take a while before this will be implemented though 🙃 ) |
I noticed https://pypi.org/project/flake8-encodings/ was missing when porting a package over to Ruff. This checks for
encoding=
missing from open (andconfigparser.ConfigParser
andpathlib.Path
) calls.Here are the checks:
This is an extremely common need (it's available at runtime with
PYTHONWARNDEFAULTENCODING
(PEP 597) and is needed for Python 3.15 compatibility PEP 686), so I'm surprised no existing checks seem to cover it; wouldn't be surprised if my searching skills were just not good enough.Edit: Ahh, this might be the not-yet-implemented
unspecified-encoding / W1514
from pylint.The text was updated successfully, but these errors were encountered: