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

Create optional error code to flag missing return type #15160

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

denisekaur
Copy link

Fixes #15127

-This adds a new error code that flags when missing a return type on an annotation.
-This commit also contains documentation and tests for the error code.
-You can test this error code by using: mypy --disallow-incomplete-defs

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2023

Diff from mypy_primer, showing the effect of this PR on open source code:

werkzeug (https://github.com/pallets/werkzeug)
- tests/test_serving.py:44: error: Function is missing a return type annotation  [no-untyped-def]
+ tests/test_serving.py:44: error: Function is missing a return type annotation  [no-incomplete-def]
- tests/test_serving.py:44: error: Function is missing a type annotation for one or more arguments  [no-untyped-def]
+ tests/test_serving.py:44: error: Function is missing a type annotation for one or more arguments  [no-incomplete-def]
- tests/test_http.py:378: error: Function is missing a type annotation for one or more arguments  [no-untyped-def]
+ tests/test_http.py:378: error: Function is missing a type annotation for one or more arguments  [no-incomplete-def]
- tests/test_formparser.py:367: error: Function is missing a return type annotation  [no-untyped-def]
+ tests/test_formparser.py:367: error: Function is missing a return type annotation  [no-incomplete-def]

rich (https://github.com/Textualize/rich)
+ rich/progress.py:241: error: Unused "type: ignore[no-untyped-def]" comment  [unused-ignore]
+ rich/progress.py:241: error: Function is missing a return type annotation  [no-incomplete-def]
+ rich/progress.py:241: note: Error code "no-incomplete-def" not covered by "type: ignore" comment

steam.py (https://github.com/Gobot1234/steam.py)
- steam/_const.py:64: error: Function is missing a return type annotation  [no-untyped-def]
+ steam/_const.py:64: error: Function is missing a return type annotation  [no-incomplete-def]
- steam/utils.py:149: error: Function is missing a type annotation for one or more arguments  [no-untyped-def]
+ steam/utils.py:149: error: Function is missing a type annotation for one or more arguments  [no-incomplete-def]
- steam/utils.py:153: error: Function is missing a type annotation for one or more arguments  [no-untyped-def]
+ steam/utils.py:153: error: Function is missing a type annotation for one or more arguments  [no-incomplete-def]
- steam/utils.py:156: error: Function is missing a type annotation for one or more arguments  [no-untyped-def]
+ steam/utils.py:156: error: Function is missing a type annotation for one or more arguments  [no-incomplete-def]
- steam/utils.py:194: error: Function is missing a type annotation for one or more arguments  [no-untyped-def]
+ steam/utils.py:194: error: Function is missing a type annotation for one or more arguments  [no-incomplete-def]
- steam/utils.py:198: error: Function is missing a type annotation for one or more arguments  [no-untyped-def]
+ steam/utils.py:198: error: Function is missing a type annotation for one or more arguments  [no-incomplete-def]
- steam/utils.py:201: error: Function is missing a type annotation for one or more arguments  [no-untyped-def]
+ steam/utils.py:201: error: Function is missing a type annotation for one or more arguments  [no-incomplete-def]

urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/util/url.py:100: error: Unused "type: ignore" comment  [unused-ignore]
+ src/urllib3/util/url.py:100: error: Function is missing a return type annotation  [no-incomplete-def]
+ src/urllib3/util/url.py:100: note: Error code "no-incomplete-def" not covered by "type: ignore" comment
+ dummyserver/server.py:153: error: Unused "type: ignore" comment  [unused-ignore]
+ dummyserver/server.py:153: error: Function is missing a type annotation for one or more arguments  [no-incomplete-def]
+ dummyserver/server.py:153: note: Error code "no-incomplete-def" not covered by "type: ignore" comment

@ahzamm
Copy link

ahzamm commented Aug 21, 2023

Hi @denisekaur, I would appreciate it if you could elaborate on the functionality or behavioral changes introduced by this pull request.

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.

Optional error code to flag missing return type when an argument has an annotation
2 participants