Skip to content

Ignore specific warnings on specific lines #14630

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

Closed
Alex031544 opened this issue Feb 7, 2023 · 2 comments
Closed

Ignore specific warnings on specific lines #14630

Alex031544 opened this issue Feb 7, 2023 · 2 comments
Labels

Comments

@Alex031544
Copy link

Feature

Similar to this issue it would be nice to be able to accept deviations from the MyPy checks for special cases. Sometimes there are reasons to solve something this way rather than following the common rule.

Nevertheless, it is important to provide information to code reviewers to help them to understand:

  • which warning (e.g. by using the identifiers of MyPy) is suppressed
  • optional comment
  • it must be easy to find the exceptions/approvals

Pitch

  • adding a line hint:

    class MyTinyClass:  # R0903 : ignore
    
  • adding a line hint with a comment:

    class MyTinyClass:  # R0903 : ignore - No further public methods are required here (Alex)
    
  • adding a line hint with several keys:

    class MyTinyClass:  # R0903,R0915 : ignore
    
@JelleZijlstra
Copy link
Member

You can use type ignores with error codes, is that not enough?

https://mypy.readthedocs.io/en/stable/error_codes.html#silencing-errors-based-on-error-codes

@Alex031544
Copy link
Author

Yes - thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants