Skip to content

Commit

Permalink
[doc] Add an example for 'non-ascii-file-name'
Browse files Browse the repository at this point in the history
And move links to related.rst
  • Loading branch information
Pierre-Sassoulas committed Feb 25, 2023
1 parent 8bf1120 commit 7d3c34c
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 16 deletions.
1 change: 1 addition & 0 deletions doc/data/messages/n/non-ascii-file-name/bad/bàd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# [non-ascii-file-name]
1 change: 1 addition & 0 deletions doc/data/messages/n/non-ascii-file-name/bad/not_bétter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# [non-ascii-file-name]
1 change: 0 additions & 1 deletion doc/data/messages/n/non-ascii-file-name/details.rst

This file was deleted.

1 change: 0 additions & 1 deletion doc/data/messages/n/non-ascii-file-name/good.py

This file was deleted.

Empty file.
Empty file.
3 changes: 3 additions & 0 deletions doc/data/messages/n/non-ascii-file-name/related.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- `PEP 489 <https://peps.python.org/pep-0489/#export-hook-name>`_
- `PEP 672 <https://peps.python.org/pep-0672/#confusing-features>`_
- `Python issue 20485 <https://bugs.python.org/issue20485>`_
19 changes: 6 additions & 13 deletions pylint/checkers/non_ascii_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,15 @@ class NonAsciiNameChecker(base_checker.BaseChecker):
),
# 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."
),
'%s name "%s" contains a non-ASCII character.',
"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"
# 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!
"Under python 3.5, PEP 3131 only allows non-ascii identifiers, not file names."
"Since Python 3.5, even though Python supports UTF-8 files, some editors or tools "
"don't. "
),
),
# First %s will always be "module"
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/n/non_ascii_name/non_ascii_name_loł.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
non-ascii-file-name:1:0:None:None::"File name ""non_ascii_name_loł"" contains a non-ASCII character. PEP 3131 only allows non-ascii identifiers, not file names.":HIGH
non-ascii-file-name:1:0:None:None::"File name ""non_ascii_name_loł"" contains a non-ASCII character.":HIGH

0 comments on commit 7d3c34c

Please sign in to comment.