Navigation Menu

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

Document error codes #7451

Merged
merged 14 commits into from Sep 18, 2019
Merged

Document error codes #7451

merged 14 commits into from Sep 18, 2019

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Sep 3, 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.

Copy link
Member

@gvanrossum gvanrossum left a comment

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.


.. code-block:: python

# Assume 'foo' is defined in 'foolib', even though mypy
Copy link
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.

docs/source/error_code_list.rst Show resolved Hide resolved
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
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?

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
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
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.

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
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
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"

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

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
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"

docs/source/error_code_list2.rst Show resolved Hide resolved
docs/source/error_code_list2.rst Show resolved Hide resolved
@JukkaL
Copy link
Collaborator Author

JukkaL commented Sep 4, 2019

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

Copy link
Member

@gvanrossum gvanrossum left a comment

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
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.

None yet

2 participants