Skip to content

Commit c785e3e

Browse files
[doc] Add an example for 'non-ascii-file-name' (#8340)
And move links to related.rst Co-authored-by: Mark Byrne <[email protected]>
1 parent 8bf1120 commit c785e3e

File tree

11 files changed

+27
-33
lines changed

11 files changed

+27
-33
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# [non-ascii-file-name]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# [non-ascii-file-name]

doc/data/messages/n/non-ascii-file-name/details.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

doc/data/messages/n/non-ascii-file-name/good.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

doc/data/messages/n/non-ascii-file-name/good/bad.py

Whitespace-only changes.

doc/data/messages/n/non-ascii-file-name/good/not_better.py

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- `PEP 489 <https://peps.python.org/pep-0489/#export-hook-name>`_
2+
- `PEP 672 <https://peps.python.org/pep-0672/#confusing-features>`_
3+
- `Python issue 20485 <https://bugs.python.org/issue20485>`_

doc/user_guide/checkers/features.rst

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -728,13 +728,10 @@ Verbatim name of the checker is ``nonascii-checker``.
728728

729729
Nonascii-Checker checker Messages
730730
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
731-
:non-ascii-file-name (W2402): *%s name "%s" contains a non-ASCII character. PEP 3131 only allows non-ascii identifiers, not file names.*
732-
Some editors don't support non-ASCII file names properly. Even though Python
733-
supports UTF-8 files since Python 3.5 this isn't recommended for
734-
interoperability. Further reading: -
735-
https://peps.python.org/pep-0489/#export-hook-name -
736-
https://peps.python.org/pep-0672/#confusing-features -
737-
https://bugs.python.org/issue20485
731+
:non-ascii-file-name (W2402): *%s name "%s" contains a non-ASCII character.*
732+
Under python 3.5, PEP 3131 only allows non-ascii identifiers, not file
733+
names.Since Python 3.5, even though Python supports UTF-8 files, some editors
734+
or tools don't.
738735
:non-ascii-name (C2401): *%s name "%s" contains a non-ASCII character, consider renaming it.*
739736
Used when the name contains at least one non-ASCII unicode character. See
740737
https://peps.python.org/pep-0672/#confusing-features for a background why
@@ -1363,8 +1360,8 @@ Variables checker Messages
13631360
:unused-variable (W0612): *Unused variable %r*
13641361
Used when a variable is defined but not used.
13651362
:global-variable-not-assigned (W0602): *Using global for %r but no assignment is done*
1366-
When a variable defined in the global scope is modified in an inner scope, the
1367-
'global' keyword is required in the inner scope only if there is an
1363+
When a variable defined in the global scope is modified in an inner scope,
1364+
the 'global' keyword is required in the inner scope only if there is an
13681365
assignment operation done in the inner scope.
13691366
:undefined-loop-variable (W0631): *Using possibly undefined loop variable %r*
13701367
Used when a loop variable (i.e. defined by a for loop or a list comprehension

doc/user_guide/configuration/all-options.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,6 @@ Standard Checkers
174174
**Default:** ``(3, 10)``
175175

176176

177-
--source-roots
178-
""""""""""""""
179-
*Add paths to the list of the source roots. The source root is an absolute path or a path relative to the current working directory used to determine a package namespace for modules located under the source root.*
180-
181-
**Default:** ``()``
182-
183-
184177
--recursive
185178
"""""""""""
186179
*Discover python modules and packages in the file system subtree.*
@@ -202,6 +195,13 @@ Standard Checkers
202195
**Default:** ``True``
203196

204197

198+
--source-roots
199+
""""""""""""""
200+
*Add paths to the list of the source roots. Supports globbing patterns. The source root is an absolute path or a path relative to the current working directory used to determine a package namespace for modules located under the source root.*
201+
202+
**Default:** ``()``
203+
204+
205205
--suggestion-mode
206206
"""""""""""""""""
207207
*When enabled, pylint would attempt to guess common misconfiguration and emit user-friendly hints instead of false-positive error messages.*
@@ -279,6 +279,8 @@ Standard Checkers
279279
280280
score = true
281281
282+
source-roots = []
283+
282284
suggestion-mode = true
283285
284286
unsafe-load-any-extension = false
@@ -1000,7 +1002,7 @@ Standard Checkers
10001002

10011003
--preferred-modules
10021004
"""""""""""""""""""
1003-
*Couples of modules and preferred modules, separated by a comma. Submodules may also be specified using '.' syntax (for ex. 'os.path').*
1005+
*Couples of modules and preferred modules, separated by a comma.*
10041006

10051007
**Default:** ``()``
10061008

pylint/checkers/non_ascii_names.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,14 @@ class NonAsciiNameChecker(base_checker.BaseChecker):
4343
),
4444
# First %s will always be "file"
4545
"W2402": (
46-
(
47-
'%s name "%s" contains a non-ASCII character. PEP 3131 only allows '
48-
"non-ascii identifiers, not file names."
49-
),
46+
'%s name "%s" contains a non-ASCII character.',
5047
"non-ascii-file-name",
5148
(
5249
# Some = PyCharm at the time of writing didn't display the non_ascii_name_loł
53-
# files and had big troubles with git.
54-
# Probably only a bug shows the problem quite good.
55-
# That's also why this is a warning and not only a convention!
56-
"Some editors don't support non-ASCII file names properly. "
57-
"Even though Python supports UTF-8 files since Python 3.5 this isn't "
58-
"recommended for interoperability. Further reading:\n"
59-
"- https://peps.python.org/pep-0489/#export-hook-name\n"
60-
"- https://peps.python.org/pep-0672/#confusing-features\n"
61-
"- https://bugs.python.org/issue20485"
50+
# files. That's also why this is a warning and not only a convention!
51+
"Under python 3.5, PEP 3131 allows non-ascii identifiers, but not non-ascii file names."
52+
"Since Python 3.5, even though Python supports UTF-8 files, some editors or tools "
53+
"don't."
6254
),
6355
),
6456
# First %s will always be "module"

0 commit comments

Comments
 (0)