8000 Re-add documentation for formatting mypy --help text (#19063) · python/mypy@18a6695 · GitHub
[go: up one dir, main page]

Skip to content

Commit 18a6695

Browse files
Re-add documentation for formatting mypy --help text (#19063)
Fixes #15555 This re-adds some rather-innocuous documentation to main about how to write command line flag descriptions, which were on a wiki page that was subsequently destroyed (rendering the link in the comment dead).
1 parent fe8ca3b commit 18a6695

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

mypy/main.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,27 @@ def add_invertible_flag(
535535
# their `dest` prefixed with `special-opts:`, which will cause them to be
536536
# parsed into the separate special_opts namespace object.
537537

538-
# Note: we have a style guide for formatting the mypy --help text. See
539-
# https://github.com/python/mypy/wiki/Documentation-Conventions
538+
# Our style guide for formatting the output of running `mypy --help`:
539+
# Flags:
540+
# 1. The flag help text should start with a capital letter but never end with a period.
541+
# 2. Keep the flag help text brief -- ideally just a single sentence.
542+
# 3. All flags must be a part of a group, unless the flag is deprecated or suppressed.
543+
# 4. Avoid adding new flags to the "miscellaneous" groups -- instead add them to an
544+
# existing group or, if applicable, create a new group. Feel free to move existing
545+
# flags to a new group: just be sure to also update the documentation to match.
546+
#
547+
# Groups:
548+
# 1. The group title and description should start with a capital letter.
549+
# 2. The first sentence of a group description should be written in the bare infinitive.
550+
# Tip: try substituting the group title and description into the following sentence:
551+
# > {group_title}: these flags will {group_description}
552+
# Feel free to add subsequent sentences that add additional details.
553+
# 3. If you cannot think of a meaningful description for a new group, omit it entirely.
554+
# (E.g. see the "miscellaneous" sections).
555+
# 4. The group description should end with a period (unless the last line is a link). If you
556+
# do end the group description with a link, omit the 'http://' prefix. (Some links are too
557+
# long and will break up into multiple lines if we include that prefix, so for consistency
558+
# we omit the prefix on all links.)
540559

541560
general_group = parser.add_argument_group(title="Optional arguments")
542561
general_group.add_argument(

0 commit comments

Comments
 (0)
0