Skip to content

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

Merged
merged 14 commits into from
Sep 18, 2019
12 changes: 10 additions & 2 deletions docs/source/command_line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -497,12 +497,20 @@ in error messages.
main.py:3: error: Unsupported operand types for + ("int" and "str")

``--show-column-numbers``
This flag will add column offsets to error messages,
for example, the following indicates an error in line 12, column 9
This flag will add column offsets to error messages.
For example, the following indicates an error in line 12, column 9
(note that column offsets are 0-based)::

main.py:12:9: error: Unsupported operand types for / ("int" and "str")

``--show-error-codes``
This flag will add an error code ``[<code>]`` to error messages. The error
code is shown after each error message::

prog.py:1: error: "str" has no attribute "trim" [attr-defined]

See :ref:`error-codes` for more information.

``--no-color-output``
This flag will disable color output in error messages, enabled by default.

Expand Down
8 changes: 8 additions & 0 deletions docs/source/common_issues.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ error:
The second line is now fine, since the ignore comment causes the name
``frobnicate`` to get an implicit ``Any`` type.

.. note::

You can use the form ``# type: ignore[<code>]`` to only ignore
specific errors on the line. This way you are less likely to
silence unexpected errors that are not safe to ignore, and this
will also document what the purpose of the comment is. See
:ref:`error-codes` for more information.

.. note::

The ``# type: ignore`` comment will only assign the implicit ``Any``
Expand Down
4 changes: 4 additions & 0 deletions docs/source/config_file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,16 @@ section of the command line docs.
``show_column_numbers`` (bool, default False)
Shows column numbers in error messages.

``show_error_codes`` (bool, default False)
Shows error codes in error messages. See :ref:`error-codes` for more information.

``color_output`` (bool, default True)
Shows error messages with color enabled.

``error_summary`` (bool, default True)
Shows a short summary line after error messages.


Advanced options
----------------

Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy