Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docs/source/error_code_list2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,12 @@ Example:

.. _code-mutable-override:

Check that overrides of mutable attributes are safe
---------------------------------------------------
Check that overrides of mutable attributes are safe [mutable-override]
----------------------------------------------------------------------

This will enable the check for unsafe overrides of mutable attributes. For
historical reasons, and because this is a relatively common pattern in Python,
Introduced in Mypy version 1.8,
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 don't think we need to mention the version, unless perhaps if you want to go through and do it for all the other codes. The docs already prominently say the version at the top, and users should know that if they use an older version, they should consult that version's documentation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay sounds good! Yeah I had added it because I was initially using 1.7.1, and it wasn't there. However, I agree with your logic too, so will remove

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Pushed that change

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.

Thanks!

`mutable-override` will enable the check for unsafe overrides of mutable attributes.
For historical reasons, and because this is a relatively common pattern in Python,
this check is not enabled by default. The example below is unsafe, and will be
flagged when this error code is enabled:

Expand Down