Replies: 1 comment 4 replies
-
Thanks for the suggestion. This isn't the first time this has been suggested, and I think it's worth considering. For basic type checking mode, we were pretty conservative when deciding which diagnostic rules to enable by default. The problem is that if we enable too many rules by default, users who are new to type checking are immediately turned off to it because they see a "sea of red" in their code, including many potential false positive errors. By including only the checks that are most likely not to generate false positives, we allow users to start slow and add more checks as they start to see value in type checking. At least that's the rationale behind the current behavior. Now that so many people are using pyright (mostly in the form of pylance), a change like this could be pretty disruptive to existing users. |
Beta Was this translation helpful? Give feedback.
-
While writing some code, I ran into an issue that I feel was easily preventable with what I would assume to be the default type checking mode of the type checker:
It took me by surprise so I wanted to open an issue about it until I searched for the previous issues and documentation and found that this is by design (ref: #1164 and https://github.com/microsoft/pyright/blob/main/docs/configuration.md#diagnostic-rule-defaults). When I was discussing this with a group of Python developers we were all caught by surprise that in the basic type checking mode this was not flagged until someone pointed out that it is enabled in strict mode.
I checked other type checkers and the default configuration for this was less surprising to me:
Since it's a commonly enabled check and it is a big noob trap, I think it'd be beneficial to change the default from
none
toerror
for the basic type checking mode.Beta Was this translation helpful? Give feedback.
All reactions