Title: Mypy could be clearer that an invalid type comment or annotation prevents it from scanning the rest of the project · Issue #3850 · python/mypy · GitHub
Open Graph Title: Mypy could be clearer that an invalid type comment or annotation prevents it from scanning the rest of the project · Issue #3850 · python/mypy
X Title: Mypy could be clearer that an invalid type comment or annotation prevents it from scanning the rest of the project · Issue #3850 · python/mypy
Description: TL;DR: some errors prevent mypy from further checking the project and this should be clearly stated in the log. I was trying to add mypy type-checks to a big Python project. The branch I reproduced this problem on is: https://github.com/...
Open Graph Description: TL;DR: some errors prevent mypy from further checking the project and this should be clearly stated in the log. I was trying to add mypy type-checks to a big Python project. The branch I reproduced...
X Description: TL;DR: some errors prevent mypy from further checking the project and this should be clearly stated in the log. I was trying to add mypy type-checks to a big Python project. The branch I reproduced...
Opengraph URL: https://github.com/python/mypy/issues/3850
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Mypy could be clearer that an invalid type comment or annotation prevents it from scanning the rest of the project","articleBody":"TL;DR: some errors prevent `mypy` from further checking the project and this should be clearly stated in the log.\r\n\r\nI was trying to add `mypy` type-checks to a big Python project. The branch I reproduced this problem on is: https://github.com/marmistrz/golem/blob/mypy-quirks\r\n\r\nThere's a defective function [here](https://github.com/marmistrz/golem/blob/mypy-quirks/golem/model.py#L141) which is properly linted with\r\n\r\n $ mypy --ignore-missing-imports --strict-optional golem/model.py\r\n golem/model.py:143: error: Item \"None\" of \"Optional[Node]\" has no attribute \"to_json\"\r\n\r\nBut now any of these:\r\n\r\n mypy golem --ignore-missing-imports --strict-optional\r\n mypy -m golem --ignore-missing-imports --strict-optional\r\n mypy -p golem --ignore-missing-imports --strict-optional\r\n\r\ndoesn't yield that result (the variants `golem` and `-p golem` yield other errors but not this, `-m golem` yields no results)\r\n\r\nWhat's more interesting, if I run\r\n\r\n mypy golem/network --ignore-missing-imports --strict-optional\r\n\r\nthe same error, in `golem/model.py` **is** detected! Even an `xargs` invocation failed...\r\n\r\nWhat was the problem? The second error message!\r\n\r\n```\r\ngolem/core/async.py:34: error: Name 'default_errback' already defined on line 17\r\napps/rendering/resources/imgrepr.py:181: error: invalid type comment or annotation\r\n```\r\n\r\nThe annotation was indeed incorrect:\r\n```\r\ndef load_as_PILImgRepr(file_) -> PILImgRepr():\r\n```\r\n\r\nThe second error made `mypy` abort further checking. It should be stated more clearly that this error prevents further scanning (e.g. even with capitals). This is very important when introducing incremental linting (only banning new findings) and it really puzzled me for some time that my mistake was not detected.\r\n","author":{"url":"https://github.com/marmistrz","@type":"Person","name":"marmistrz"},"datePublished":"2017-08-21T07:22:02Z","url":"https://github.com/python/mypy/issues/3850"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fba904bc-e051-7664-844b-53d9168405bb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9E04:31BF6:1209FA:1919DA:6B0063FD |
| html-safe-nonce | 056446bf81ddfc6b4442590fc3a5dd25e62967124f7fd39e44df19672c6259a8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTA0OjMxQkY2OjEyMDlGQToxOTE5REE6NkIwMDYzRkQiLCJ2aXNpdG9yX2lkIjoiMjc2OTcwNTM3MDY0ODgzMTk3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 6d706bc1a3688454ab45f39d4e26d547a80397a6cb4eea3fff57e33919449069 |
| hovercard-subject-tag | issue:251570385 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/3850/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bcdf8d901f27fd4afc918ac24adf99e341ce4a67bcb6b3818a2c3cd0523b1e5d/python/mypy/issues/3850 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bcdf8d901f27fd4afc918ac24adf99e341ce4a67bcb6b3818a2c3cd0523b1e5d/python/mypy/issues/3850 |
| og:image:alt | TL;DR: some errors prevent mypy from further checking the project and this should be clearly stated in the log. I was trying to add mypy type-checks to a big Python project. The branch I reproduced... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | marmistrz |
| hostname | github.com |
| expected-hostname | github.com |
| None | 25854482a1773a7c1ebb8be3d2bc1c6e61d82d78126be63b5044474a86d44d9e |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e4f5c239e31f1f680e6bbc419ff92d774da616ec |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width