Skip to content

Document error codes - #7451

Merged
JukkaL merged 14 commits into
masterfrom
errcode-more-docs
Sep 18, 2019
Merged

JukkaL merged 14 commits into
masterfrom
errcode-more-docs

Conversation

@JukkaL

@JukkaL JukkaL commented Sep 3, 2019

Copy link
Copy Markdown
Collaborator

There's a general page about what error pages and for, and I document
each error code that is supported, often with code examples.

@gvanrossum gvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a huge improvement! Because it's a lot of text I have a fair number of nits.

Note that I'm not sure if the lists would look better as a single list -- maybe this is actually the best way to organize them.

Comment thread docs/source/error_codes.rst Outdated

.. code-block:: python

# Assume 'foo' is defined in 'foolib', even though mypy

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd drop "Assume" and remove the blank line between the comment and the import statememt.

Comment thread docs/source/error_code_list.rst Resolved
Comment thread docs/source/error_code_list.rst Outdated
Mypy checks that an attribute is defined in the target class or module
when using the dot operator. This applies to both getting and setting
an attribute. Attribute assignments in the class body or through the
``self`` argument in a method define new attributes, and they don't

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to re-read this three times before I found the verb in the first clause ("define"). Maybe reword so the verb comes earlier?

Comment thread docs/source/error_code_list.rst Outdated
an attribute. Attribute assignments in the class body or through the
``self`` argument in a method define new attributes, and they don't
generate ``attr-defined`` errors. Mypy doesn't allow defining
attributes outside a class definition.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What even would it mean to define an attribute outside a class? OTOH you mention module attributes, which are defined outside class. :-) Maybe drop this sentence?

----------------------

Error codes are not displayed by default. Use ``--show-error-codes``
to display error codes. Error codes are shown inside square brackets:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flag also ought to be listed in command_line.html#configuring-error-messages and in the corresponding section in config_file.html.

Comment thread docs/source/error_code_list.rst Outdated
Mypy performs numerous other, less commonly failing checks that don't
have specific error codes. These use the ``misc`` error code. Other
than being used for multiple unrelated errors, the ``misc`` error code
is not special in other ways. For example, you can ignore all errors

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop "in other ways".

------------------------------------------

If you use ``--disallow-any-generics``, mypy requires that each generic
type has values for each type argument. For example, the types ``List`` or

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"that generic types have"

Comment thread docs/source/error_code_list2.rst Outdated
------------------------------------------------------------

If you use ``--disallow-untyped-defs``, mypy requires that each function
has an annotation (either a Python 3 annotation or a type comment).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"that all functions have annotations"

Comment thread docs/source/error_code_list2.rst Resolved
Comment thread docs/source/error_code_list2.rst Resolved
@JukkaL

JukkaL commented Sep 4, 2019

Copy link
Copy Markdown
Collaborator Author

I addressed most comments. I left comments to the remaining ones.

@gvanrossum gvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed on all counts. Ship it!

@gvanrossum

Copy link
Copy Markdown
Member

@JukkaL Were you planning to add this to the release? (#7461)

@JukkaL JukkaL mentioned this pull request Sep 13, 2019
@JukkaL
JukkaL merged commit 0c2ec6a into master Sep 18, 2019
@gvanrossum
gvanrossum deleted the errcode-more-docs branch September 20, 2019 05:25
JukkaL added a commit that referenced this pull request Sep 24, 2019
There's a general page about what error pages and for, and I document
each error code that is supported, often with code examples.
@JukkaL JukkaL mentioned this pull request Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants