Skip to content
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

Work on documentation for non-ascii-file-name #8324

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions doc/user_guide/checkers/features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -728,13 +728,6 @@ Verbatim name of the checker is ``nonascii-checker``.

Nonascii-Checker checker Messages
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:non-ascii-file-name (W2402): *%s name "%s" contains a non-ASCII character. PEP 3131 only allows non-ascii identifiers, not file names.*
Some editors don't support non-ASCII file names properly. Even though Python
supports UTF-8 files since Python 3.5 this isn't recommended for
interoperability. Further reading: -
https://peps.python.org/pep-0489/#export-hook-name -
https://peps.python.org/pep-0672/#confusing-features -
https://bugs.python.org/issue20485
:non-ascii-name (C2401): *%s name "%s" contains a non-ASCII character, consider renaming it.*
Used when the name contains at least one non-ASCII unicode character. See
https://peps.python.org/pep-0672/#confusing-features for a background why
Expand Down
1 change: 0 additions & 1 deletion doc/user_guide/messages/messages_overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ All messages in the warning category:
warning/named-expr-without-context
warning/nan-comparison
warning/nested-min-max
warning/non-ascii-file-name
warning/non-parent-init-called
warning/non-str-assignment-to-dunder-name
warning/overlapping-except
Expand Down
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/8324.non_ascii_file_name
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Remove 'non-ascii-file-name' as it has not been an issue since Python 3.5

Closes #8324
26 changes: 2 additions & 24 deletions pylint/checkers/non_ascii_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,6 @@ class NonAsciiNameChecker(base_checker.BaseChecker):
NON_ASCII_HELP,
{"old_names": [("C0144", "old-non-ascii-name")]},
),
# First %s will always be "file"
"W2402": (
(
'%s name "%s" contains a non-ASCII character. PEP 3131 only allows '
"non-ascii identifiers, not file names."
),
"non-ascii-file-name",
(
# Some = PyCharm at the time of writing didn't display the non_ascii_name_loł
# files and had big troubles with git.
# Probably only a bug shows the problem quite good.
# That's also why this is a warning and not only a convention!
"Some editors don't support non-ASCII file names properly. "
"Even though Python supports UTF-8 files since Python 3.5 this isn't "
"recommended for interoperability. Further reading:\n"
"- https://peps.python.org/pep-0489/#export-hook-name\n"
"- https://peps.python.org/pep-0672/#confusing-features\n"
"- https://bugs.python.org/issue20485"
ollie-iterators marked this conversation as resolved.
Show resolved Hide resolved
),
),
# First %s will always be "module"
"C2403": (
'%s name "%s" contains a non-ASCII character, use an ASCII-only alias for import.',
Expand All @@ -85,14 +65,12 @@ def _check_name(self, node_type: str, name: str | None, node: nodes.NodeNG) -> N
msg = "non-ascii-name"

# Some node types have customized messages
if node_type == "file":
msg = "non-ascii-file-name"
elif node_type == "module":
if node_type == "module":
msg = "non-ascii-module-import"

self.add_message(msg, node=node, args=args, confidence=interfaces.HIGH)

@utils.only_required_for_messages("non-ascii-name", "non-ascii-file-name")
@utils.only_required_for_messages("non-ascii-name")
def visit_module(self, node: nodes.Module) -> None:
self._check_name("file", node.name.split(".")[-1], node)

Expand Down
3 changes: 3 additions & 0 deletions pylint/message/_deleted_message_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ class DeletedMessage(NamedTuple):
"https://github.com/PyCQA/pylint/pull/6421": [
DeletedMessage("W0111", "assign-to-new-keyword"),
],
"https://github.com/PyCQA/pylint/pull/8324": [
DeletedMessage("W2402", "non-ascii-file-name"),
],
}
MOVED_TO_EXTENSIONS = {
"https://pylint.readthedocs.io/en/latest/whatsnew/2/2.14/summary.html#removed-checkers": [
Expand Down
1 change: 0 additions & 1 deletion tests/functional/n/non_ascii_name/non_ascii_name_loł.py

This file was deleted.

1 change: 0 additions & 1 deletion tests/functional/n/non_ascii_name/non_ascii_name_loł.txt

This file was deleted.