-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
needs-decisionAwaiting a decision from a maintainerAwaiting a decision from a maintainerpluginImplementing a known but unsupported pluginImplementing a known but unsupported plugin
Description
I noticed https://pypi.org/project/flake8-encodings/ was missing when porting a package over to Ruff. This checks for encoding= missing from open (and configparser.ConfigParser and pathlib.Path) calls.
Here are the checks:
ENC001 = "ENC001 no encoding specified for 'open'."
ENC002 = "ENC002 'encoding=None' used for 'open'."
ENC003 = "ENC003 no encoding specified for 'open' with unknown mode."
ENC004 = "ENC004 'encoding=None' used for 'open' with unknown mode."
ENC011 = "ENC011 no encoding specified for 'configparser.ConfigParser.read'."
ENC012 = "ENC012 'encoding=None' used for 'configparser.ConfigParser.read'."
ENC021 = "ENC021 no encoding specified for 'pathlib.Path.open'."
ENC022 = "ENC022 'encoding=None' used for 'pathlib.Path.open'."
ENC023 = "ENC023 no encoding specified for 'pathlib.Path.read_text'."
ENC024 = "ENC024 'encoding=None' used for 'pathlib.Path.read_text'."
ENC025 = "ENC025 no encoding specified for 'pathlib.Path.write_text'."
ENC026 = "ENC026 'encoding=None' used for 'pathlib.Path.write_text'."
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
needs-decisionAwaiting a decision from a maintainerAwaiting a decision from a maintainerpluginImplementing a known but unsupported pluginImplementing a known but unsupported plugin