-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Document error codes #7451
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
Conversation
There was a problem hiding this 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.
docs/source/error_codes.rst
Outdated
|
||
.. code-block:: python | ||
|
||
# Assume 'foo' is defined in 'foolib', even though mypy |
There was a problem hiding this comment.
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
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 |
There was a problem hiding this comment.
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?
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. |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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
.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"that generic types have"
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). |
There was a problem hiding this comment.
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"
I addressed most comments. I left comments to the remaining ones. |
There was a problem hiding this 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!
There's a general page about what error pages and for, and I document each error code that is supported, often with code examples.
There's a general page about what error pages and for, and I document
each error code that is supported, often with code examples.